sea-chart 2.0.37 → 2.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +20 -69
- package/dist/assets/css/sea-chart-d3-tooltip.css +0 -1
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
- package/dist/components/cell-factory/SingleSelectOption.js +11 -18
- package/dist/components/cell-factory/cell-editor-factory.js +5 -12
- package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
- package/dist/components/cell-factory/link-content.js +30 -38
- package/dist/components/chart-color-selector/color-selector.js +11 -18
- package/dist/components/collaborator/index.js +7 -14
- package/dist/components/color-picker/index.js +12 -19
- package/dist/components/color-popover/color-rules/color-rule.js +26 -34
- package/dist/components/color-popover/color-rules/index.js +7 -15
- package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
- package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
- package/dist/components/color-popover/color-rules/rule-filters/number-input.js +9 -17
- package/dist/components/color-popover/color-rules-popover.js +31 -37
- package/dist/components/color-popover/color-selector-popover.js +12 -20
- package/dist/components/color-setting/color-group-selector.js +13 -21
- package/dist/components/common-add-tool/index.js +8 -15
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +13 -20
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +18 -26
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +41 -48
- package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
- package/dist/components/drill-down-settings/index.js +11 -18
- package/dist/components/dtable-popover/index.js +13 -20
- package/dist/components/dtable-search-input/index.js +13 -21
- package/dist/components/font-settings/index.js +14 -22
- package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
- package/dist/components/goal-line-setting/index.js +12 -19
- package/dist/components/highlighter/highlighter.js +7 -14
- package/dist/components/icon/index.js +12 -23
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +11 -24
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +13 -16
- package/dist/components/popover/hide-column-popover/hide-column-popover.css +5 -1
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +28 -38
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +58 -69
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +17 -24
- package/dist/components/row-card/row-card-header.js +15 -22
- package/dist/components/row-card/row-card-item.js +35 -43
- package/dist/components/row-card/row-card.js +17 -25
- package/dist/components/statistic-record-dialog/index.js +61 -68
- package/dist/components/tooltip/index.js +39 -28
- package/dist/components/types-dialog/index.js +62 -70
- package/dist/components/types-dialog/use-force-update.js +4 -10
- package/dist/constants/color-rules.js +8 -14
- package/dist/constants/common-constants.js +8 -14
- package/dist/constants/error.js +2 -8
- package/dist/constants/geolocation.js +9 -15
- package/dist/constants/index.js +142 -271
- package/dist/constants/key-codes.js +0 -2
- package/dist/constants/model.js +3 -9
- package/dist/constants/regions.js +3 -8
- package/dist/constants/style.js +6 -12
- package/dist/constants/table.js +1 -7
- package/dist/constants/type-image.js +33 -39
- package/dist/constants/type.js +3 -9
- package/dist/context.js +13 -20
- package/dist/editor/index.js +13 -16
- package/dist/index.js +13 -104
- package/dist/intl.js +10 -17
- package/dist/locale/index.js +16 -23
- package/dist/locale/lang/de.js +2 -7
- package/dist/locale/lang/en.js +2 -7
- package/dist/locale/lang/es.js +2 -7
- package/dist/locale/lang/fr.js +2 -7
- package/dist/locale/lang/pt.js +2 -7
- package/dist/locale/lang/ru.js +2 -7
- package/dist/locale/lang/zh_CN.js +2 -7
- package/dist/model/area-group.js +12 -19
- package/dist/model/area.js +12 -19
- package/dist/model/bar-custom.js +11 -18
- package/dist/model/bar-group.js +12 -19
- package/dist/model/bar-stack.js +10 -17
- package/dist/model/bar.js +11 -18
- package/dist/model/base-model.js +4 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +15 -22
- package/dist/model/compare-bar.js +14 -21
- package/dist/model/completeness-group.js +11 -18
- package/dist/model/completeness.js +10 -17
- package/dist/model/dashboard.js +7 -14
- package/dist/model/funnel.js +14 -21
- package/dist/model/generic-model.js +135 -143
- package/dist/model/heat-map.js +9 -16
- package/dist/model/horizontal-bar.js +11 -18
- package/dist/model/horizontal-group-bar.js +10 -17
- package/dist/model/index.js +69 -93
- package/dist/model/line-group.js +13 -20
- package/dist/model/line.js +12 -19
- package/dist/model/map-bubble.js +14 -17
- package/dist/model/map.js +12 -19
- package/dist/model/mirror.js +13 -20
- package/dist/model/pie.js +12 -19
- package/dist/model/ring.js +12 -19
- package/dist/model/scatter.js +10 -17
- package/dist/model/stacked-horizontal-bar.js +11 -18
- package/dist/model/table-element.js +5 -12
- package/dist/model/table.js +7 -14
- package/dist/model/tree-map.js +7 -14
- package/dist/model/trend.js +11 -18
- package/dist/model/user.js +1 -7
- package/dist/model/world-map-bubble.js +12 -19
- package/dist/model/world-map.js +12 -19
- package/dist/services/map-json.js +14 -17
- package/dist/settings/advance-bar-settings/data-settings.js +36 -44
- package/dist/settings/advance-bar-settings/index.js +3 -20
- package/dist/settings/advance-bar-settings/style-settings.js +66 -73
- package/dist/settings/bar-settings/data-settings.js +39 -47
- package/dist/settings/bar-settings/index.js +3 -20
- package/dist/settings/bar-settings/style-settings.js +51 -59
- package/dist/settings/basic-number-card/data-settings.js +50 -57
- package/dist/settings/basic-number-card/index.js +3 -20
- package/dist/settings/basic-number-card/style-settings.js +19 -27
- package/dist/settings/combination-settings/data-settings.js +55 -64
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +67 -75
- package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
- package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
- package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
- package/dist/settings/completeness-settings/index.js +3 -20
- package/dist/settings/completeness-settings/style-settings.js +19 -26
- package/dist/settings/dashboard-settings/data-settings.js +44 -51
- package/dist/settings/dashboard-settings/index.js +2 -13
- package/dist/settings/data-settings.js +72 -79
- package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
- package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
- package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
- package/dist/settings/funnel-settings/components/funnel-layer-setting.js +22 -30
- package/dist/settings/funnel-settings/data-settings.js +23 -31
- package/dist/settings/funnel-settings/index.js +3 -20
- package/dist/settings/funnel-settings/style-settings.js +11 -19
- package/dist/settings/heat-map-settings/data-settings.js +18 -26
- package/dist/settings/heat-map-settings/index.js +3 -20
- package/dist/settings/heat-map-settings/style-settings.js +18 -26
- package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
- package/dist/settings/horizontal-bar-settings/index.js +3 -20
- package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
- package/dist/settings/index.js +57 -70
- package/dist/settings/map-settings/components/location-field-selector.js +10 -17
- package/dist/settings/map-settings/components/map-level-selector.js +11 -18
- package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
- package/dist/settings/map-settings/index.js +3 -20
- package/dist/settings/map-settings/map-data-settings.js +23 -30
- package/dist/settings/map-settings/map-style-settings.js +27 -35
- package/dist/settings/mirror-settings/data-settings.js +26 -34
- package/dist/settings/mirror-settings/index.js +2 -13
- package/dist/settings/pie-settings/data-settings.js +33 -41
- package/dist/settings/pie-settings/index.js +3 -20
- package/dist/settings/pie-settings/style-settings.js +47 -55
- package/dist/settings/scatter/data-settings.js +27 -34
- package/dist/settings/scatter/index.js +3 -12
- package/dist/settings/stacks-settings/index.js +19 -27
- package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
- package/dist/settings/style-settings.js +65 -73
- package/dist/settings/table-element-settings/components/data-filter.js +49 -58
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.css +1 -31
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +113 -120
- package/dist/settings/table-settings/index.js +2 -13
- package/dist/settings/time-comparison-settings/data-settings.js +43 -51
- package/dist/settings/time-comparison-settings/index.js +3 -20
- package/dist/settings/time-comparison-settings/style-settings.js +44 -52
- package/dist/settings/trend-settings/data-settings.js +24 -32
- package/dist/settings/trend-settings/index.js +3 -20
- package/dist/settings/trend-settings/style-setting.js +19 -27
- package/dist/settings/widgets/basic-summary/index.js +59 -66
- package/dist/settings/widgets/chart-type/index.js +18 -26
- package/dist/settings/widgets/color-settings/index.js +72 -80
- package/dist/settings/widgets/common-data-settings.js +27 -34
- package/dist/settings/widgets/data-filter/index.js +59 -59
- package/dist/settings/widgets/data-sort.js +16 -24
- package/dist/settings/widgets/date-summary-item.js +26 -34
- package/dist/settings/widgets/display-values-settings/index.js +14 -22
- package/dist/settings/widgets/divider/index.js +8 -16
- package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
- package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
- package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
- package/dist/settings/widgets/font-settings/index.js +4 -27
- package/dist/settings/widgets/group-by.js +52 -59
- package/dist/settings/widgets/min-max-setting.js +10 -18
- package/dist/settings/widgets/mininum-slice-percent.js +10 -18
- package/dist/settings/widgets/numeric-summary-item.js +25 -33
- package/dist/settings/widgets/select-line-type/index.js +10 -17
- package/dist/settings/widgets/select-table/index.js +9 -16
- package/dist/settings/widgets/select-view/index.js +20 -28
- package/dist/settings/widgets/stack.js +14 -22
- package/dist/settings/widgets/summary-method-setting.js +17 -25
- package/dist/settings/widgets/summary-settings.js +75 -82
- package/dist/settings/widgets/switch/index.js +9 -16
- package/dist/settings/widgets/text-horizontal-settings.js +15 -23
- package/dist/settings/widgets/time-picker.js +29 -37
- package/dist/settings/widgets/title-settings/index.js +29 -37
- package/dist/settings/widgets/title-settings/title-text.js +5 -12
- package/dist/settings/widgets/x-axios.js +0 -1
- package/dist/settings/widgets/y-axis-group-settings.js +65 -72
- package/dist/utils/cell-format-utils.js +25 -33
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +467 -367
- package/dist/utils/chart-utils/index.js +29 -40
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +78 -85
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -21
- package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
- package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +21 -28
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
- package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +28 -26
- package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
- package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +94 -97
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -25
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +50 -36
- package/dist/utils/chart-utils/sql-statistics-utils.js +385 -388
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +19 -31
- package/dist/utils/collaborator.js +6 -15
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +88 -102
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +7 -11
- package/dist/utils/date-translate.js +12 -20
- package/dist/utils/digital-sign-utils.js +7 -14
- package/dist/utils/event-bus.js +1 -7
- package/dist/utils/hotkey.js +5 -11
- package/dist/utils/index.js +73 -219
- package/dist/utils/key-generator.js +2 -9
- package/dist/utils/map.js +22 -31
- package/dist/utils/object-utils.js +2 -8
- package/dist/utils/options-utils.js +10 -18
- package/dist/utils/row-record-utils.js +251 -183
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +106 -112
- package/dist/utils/sql/column-2-sql-column.js +162 -172
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +50 -45
- package/dist/view/index.css +2 -8
- package/dist/view/index.js +102 -103
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +57 -57
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +56 -48
- package/dist/view/wrapper/bar-custom-stack.js +73 -55
- package/dist/view/wrapper/bar-group.js +94 -73
- package/dist/view/wrapper/bar-stack.js +49 -57
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +50 -34
- package/dist/view/wrapper/chart-component.js +164 -569
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +140 -93
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +104 -59
- package/dist/view/wrapper/funnel.js +40 -43
- package/dist/view/wrapper/heat-map.js +62 -70
- package/dist/view/wrapper/horizontal-bar-group.js +70 -58
- package/dist/view/wrapper/horizontal-bar-stack.js +48 -56
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +49 -52
- package/dist/view/wrapper/line.js +42 -50
- package/dist/view/wrapper/map-bubble.js +40 -48
- package/dist/view/wrapper/map-world-bubble.js +40 -47
- package/dist/view/wrapper/map-world.js +42 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +45 -53
- package/dist/view/wrapper/ring.js +50 -58
- package/dist/view/wrapper/scatter.js +50 -56
- package/dist/view/wrapper/table/index.js +14 -22
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +53 -61
- package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
- package/dist/view/wrapper/table/two-dimension-table.js +85 -92
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +90 -99
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
- package/dist/view/wrapper/table-element/components/record.js +13 -20
- package/dist/view/wrapper/table-element/components/records-body.js +9 -17
- package/dist/view/wrapper/table-element/components/records-header/index.js +7 -16
- package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
- package/dist/view/wrapper/table-element/components/records.js +25 -33
- package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +8 -13
- package/dist/view/wrapper/table-element/components/utils.js +6 -16
- package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
- package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
- package/dist/view/wrapper/table-element/index.js +30 -43
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +80 -65
- package/package.json +15 -12
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _dtableUtils = require("dtable-utils");
|
|
12
|
-
var _utils = require("../../../utils");
|
|
13
|
-
var _intl = _interopRequireDefault(require("../../../intl"));
|
|
14
|
-
var _constants = require("../../../constants");
|
|
15
|
-
var _pivotTableDisplayName = _interopRequireDefault(require("./pivot-table-display-name"));
|
|
16
|
-
class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { isNumber } from 'dtable-utils';
|
|
4
|
+
import { BaseUtils, formatRowTotal } from '../../../utils';
|
|
5
|
+
import intl from '../../../intl';
|
|
6
|
+
import { CHART_THEME_COLOR } from '../../../constants';
|
|
7
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
8
|
+
class OneDimensionTableWithNumericColumns extends PureComponent {
|
|
17
9
|
constructor(_props) {
|
|
18
10
|
super(_props);
|
|
19
11
|
this.init = props => {
|
|
@@ -32,7 +24,7 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
32
24
|
}
|
|
33
25
|
};
|
|
34
26
|
this.getRowTotal = (rowTotal, value) => {
|
|
35
|
-
if (value &&
|
|
27
|
+
if (value && isNumber(value)) {
|
|
36
28
|
return rowTotal + value;
|
|
37
29
|
}
|
|
38
30
|
return rowTotal;
|
|
@@ -63,9 +55,9 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
63
55
|
cellIdx: selectedCellIdx
|
|
64
56
|
} = selectedCell || {};
|
|
65
57
|
const isSelectedTotalHeaderBottom = selectRowIdx === 0 && selectedCellIdx === (pivot_columns === null || pivot_columns === void 0 ? void 0 : pivot_columns.length);
|
|
66
|
-
return /*#__PURE__*/
|
|
58
|
+
return /*#__PURE__*/React.createElement("thead", {
|
|
67
59
|
className: "seatable-table-header-sm"
|
|
68
|
-
}, /*#__PURE__*/
|
|
60
|
+
}, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
69
61
|
className: "pivot-table-header"
|
|
70
62
|
}, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
71
63
|
const {
|
|
@@ -73,17 +65,17 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
73
65
|
} = item;
|
|
74
66
|
const column = chartTableColumns.find(column => column.key === key);
|
|
75
67
|
const isSelectedHeaderBottom = selectRowIdx === 0 && selectedCellIdx === index;
|
|
76
|
-
return /*#__PURE__*/
|
|
77
|
-
className: (
|
|
68
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
69
|
+
className: classnames('pivot-table-header', {
|
|
78
70
|
'selected-pivot-cell-top': isSelectedHeaderBottom
|
|
79
71
|
}),
|
|
80
|
-
key:
|
|
81
|
-
}, /*#__PURE__*/
|
|
82
|
-
}), display_total && /*#__PURE__*/
|
|
83
|
-
className: (
|
|
72
|
+
key: `pivot-column-${index}`
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", null, column.name));
|
|
74
|
+
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
75
|
+
className: classnames('pivot-table-header', {
|
|
84
76
|
'selected-pivot-cell-top': isSelectedTotalHeaderBottom
|
|
85
77
|
})
|
|
86
|
-
}, /*#__PURE__*/
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get('Total')))));
|
|
87
79
|
};
|
|
88
80
|
this.toggleRecords = (cell, selectedCell) => {
|
|
89
81
|
if (window.isMobile) return;
|
|
@@ -135,7 +127,7 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
135
127
|
const isSelectRowTotalCellRight = selectRowIdx === pivotRowsLen && selectedCellIdx === 0;
|
|
136
128
|
let lastRowTotal = 0;
|
|
137
129
|
let lastRows = [];
|
|
138
|
-
return /*#__PURE__*/
|
|
130
|
+
return /*#__PURE__*/React.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
|
|
139
131
|
const {
|
|
140
132
|
name,
|
|
141
133
|
total,
|
|
@@ -150,13 +142,13 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
150
142
|
if (!Array.isArray(pivot_columns)) {
|
|
151
143
|
pivotColumnCells[rowIdx] = rowItem.rows || [];
|
|
152
144
|
}
|
|
153
|
-
return /*#__PURE__*/
|
|
145
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
154
146
|
key: 'table-row' + rowIdx
|
|
155
|
-
}, /*#__PURE__*/
|
|
156
|
-
className: (
|
|
147
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
148
|
+
className: classnames('pivot-row-name', {
|
|
157
149
|
'selected-pivot-cell-left': isSelectedRowNameRight
|
|
158
150
|
})
|
|
159
|
-
}, /*#__PURE__*/
|
|
151
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
160
152
|
value: name,
|
|
161
153
|
column: groupbyColumn,
|
|
162
154
|
rowData: rowItem,
|
|
@@ -170,8 +162,8 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
170
162
|
} = columnMap;
|
|
171
163
|
const column = chartTableColumns.find(item => item.key === key);
|
|
172
164
|
rowTotal = this.getRowTotal(rowTotal, total[key]);
|
|
173
|
-
const displayValue =
|
|
174
|
-
const isValidDisplayValue =
|
|
165
|
+
const displayValue = BaseUtils.getSummaryValueDisplayString(column, total[key], this.summaryColumnsMethodMap[key]);
|
|
166
|
+
const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
|
|
175
167
|
if (Array.isArray(rows) && rows.length > 0) {
|
|
176
168
|
if (pivotColumnCells[cellIdx]) {
|
|
177
169
|
pivotColumnCells[cellIdx].push(...rows);
|
|
@@ -179,71 +171,71 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
179
171
|
pivotColumnCells[cellIdx] = [...rows];
|
|
180
172
|
}
|
|
181
173
|
}
|
|
182
|
-
return /*#__PURE__*/
|
|
183
|
-
className: (
|
|
174
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
175
|
+
className: classnames('pivot-cell', {
|
|
184
176
|
'pivot-empty-cell': !isValidDisplayValue,
|
|
185
177
|
'selected-pivot-cell': isSelectedCell,
|
|
186
178
|
'selected-pivot-cell-top': isSelectedCellTop,
|
|
187
179
|
'selected-pivot-cell-left': isSelectedCellLeft
|
|
188
180
|
}),
|
|
189
|
-
key:
|
|
181
|
+
key: `table-cell-${cellIdx}`
|
|
190
182
|
// onClick={() => this.toggleRecords({ rows, name: rowItem?.name, total: total[key] }, { rowIdx, cellIdx })}
|
|
191
183
|
,
|
|
192
184
|
title: isValidDisplayValue ? displayValue : ''
|
|
193
|
-
}, isValidDisplayValue ? displayValue : /*#__PURE__*/
|
|
194
|
-
className: (
|
|
185
|
+
}, isValidDisplayValue ? displayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
186
|
+
className: classnames({
|
|
195
187
|
'selected-pivot-cell-border': isSelectedCell
|
|
196
188
|
})
|
|
197
189
|
}));
|
|
198
|
-
}), display_total && /*#__PURE__*/
|
|
199
|
-
className: (
|
|
190
|
+
}), display_total && /*#__PURE__*/React.createElement("td", {
|
|
191
|
+
className: classnames('pivot-cell', {
|
|
200
192
|
'selected-pivot-cell': isSelectedTotalCell,
|
|
201
193
|
'selected-pivot-cell-top': isSelectedTotalCellTop,
|
|
202
194
|
'selected-pivot-cell-left': isSelectedTotalCellLeft
|
|
203
195
|
})
|
|
204
196
|
// onClick={() => this.toggleRecords({ rows, name: rowItem?.name, total: rowTotal }, { rowIdx })}
|
|
205
197
|
,
|
|
206
|
-
title: rowTotal ?
|
|
207
|
-
}, rowTotal ?
|
|
208
|
-
className: (
|
|
198
|
+
title: rowTotal ? formatRowTotal(rowTotal) : 0
|
|
199
|
+
}, rowTotal ? formatRowTotal(rowTotal) : /*#__PURE__*/React.createElement("i", null, "0"), /*#__PURE__*/React.createElement("span", {
|
|
200
|
+
className: classnames({
|
|
209
201
|
'selected-pivot-cell-border': isSelectedTotalCell
|
|
210
202
|
})
|
|
211
203
|
})));
|
|
212
|
-
}), display_total && /*#__PURE__*/
|
|
213
|
-
className: (
|
|
204
|
+
}), display_total && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
205
|
+
className: classnames('pivot-column-total', {
|
|
214
206
|
'selected-pivot-cell-left': isSelectRowTotalCellRight
|
|
215
207
|
})
|
|
216
|
-
}, /*#__PURE__*/
|
|
208
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get('Total'))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
|
|
217
209
|
const pivotColumnTotal = pivot_columns_total[c.key];
|
|
218
210
|
const column = chartTableColumns.find(column => column.key === c.key);
|
|
219
|
-
const totalDisplayValue =
|
|
220
|
-
const isValidTotalDisplayValue =
|
|
211
|
+
const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(column, pivotColumnTotal, this.summaryColumnsMethodMap[c.key]);
|
|
212
|
+
const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
|
|
221
213
|
const isSelectRowTotalCell = selectRowIdx === pivot_rows.length && selectedCellIdx === index;
|
|
222
214
|
const isSelectRowTotalCellLeft = selectRowIdx === pivot_rows.length && selectedCellIdx - 1 === index;
|
|
223
215
|
lastRowTotal = this.getRowTotal(lastRowTotal, pivotColumnTotal);
|
|
224
|
-
return /*#__PURE__*/
|
|
225
|
-
className: (
|
|
216
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
217
|
+
className: classnames('pivot-cell', {
|
|
226
218
|
'pivot-empty-cell': !isValidTotalDisplayValue,
|
|
227
219
|
'selected-pivot-cell': isSelectRowTotalCell,
|
|
228
220
|
'selected-pivot-cell-left': isSelectRowTotalCellLeft
|
|
229
221
|
}),
|
|
230
|
-
key:
|
|
222
|
+
key: `total-cell-${index}`
|
|
231
223
|
// onClick={() => this.toggleRecords({ rows: pivotColumnCell, total: pivot_columns_total[c.key] }, { rowIdx: pivot_rows.length, cellIdx: index })}
|
|
232
224
|
,
|
|
233
225
|
title: totalDisplayValue
|
|
234
|
-
}, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/
|
|
235
|
-
className: (
|
|
226
|
+
}, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
227
|
+
className: classnames({
|
|
236
228
|
'selected-pivot-cell-border': isSelectRowTotalCell
|
|
237
229
|
})
|
|
238
230
|
}));
|
|
239
|
-
}), /*#__PURE__*/
|
|
240
|
-
className: (
|
|
241
|
-
'pivot-empty-cell': !
|
|
231
|
+
}), /*#__PURE__*/React.createElement("td", {
|
|
232
|
+
className: classnames('pivot-cell', {
|
|
233
|
+
'pivot-empty-cell': !BaseUtils.isValidValue(lastRowTotal, display_empty)
|
|
242
234
|
})
|
|
243
235
|
// onClick={() => this.toggleRecords({ rows: lastRows, total: lastRowTotal }, { rowIdx: pivot_rows.length, cellIdx: pivot_columns?.length })}
|
|
244
236
|
,
|
|
245
|
-
title:
|
|
246
|
-
},
|
|
237
|
+
title: formatRowTotal(lastRowTotal)
|
|
238
|
+
}, BaseUtils.isValidValue(lastRowTotal, display_empty) ? formatRowTotal(lastRowTotal) : /*#__PURE__*/React.createElement("i", null))));
|
|
247
239
|
};
|
|
248
240
|
this.init(_props);
|
|
249
241
|
}
|
|
@@ -253,12 +245,12 @@ class OneDimensionTableWithNumericColumns extends _react.PureComponent {
|
|
|
253
245
|
globalTheme
|
|
254
246
|
} = this.props;
|
|
255
247
|
if (!groupbyColumn) return '';
|
|
256
|
-
return /*#__PURE__*/
|
|
248
|
+
return /*#__PURE__*/React.createElement("table", {
|
|
257
249
|
className: "sea-chart-pivot-table",
|
|
258
250
|
style: {
|
|
259
|
-
color:
|
|
251
|
+
color: CHART_THEME_COLOR[globalTheme].pivotTextColor
|
|
260
252
|
}
|
|
261
253
|
}, this.renderHeader(), this.renderRows());
|
|
262
254
|
}
|
|
263
255
|
}
|
|
264
|
-
|
|
256
|
+
export default OneDimensionTableWithNumericColumns;
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
13
|
-
var _utils = require("../../../utils");
|
|
14
|
-
var _components = require("../../../components");
|
|
15
|
-
var _intl = _interopRequireDefault(require("../../../intl"));
|
|
16
|
-
var _context = _interopRequireDefault(require("../../../context"));
|
|
17
|
-
var _constants = require("../../../constants");
|
|
18
|
-
class PivotTableDisplayName extends _react.default.Component {
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import shallowEqual from 'shallowequal';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_RESULT_TYPE, getOption, getCollaborator, getNumberDisplayString, isNumber, isValidEmail, getCollaboratorsName } from 'dtable-utils';
|
|
5
|
+
import { getKnownCollaboratorByEmail, getColumnOptions, getDateColumnFormat, generateDefaultUser, getClientLinkDisplayString } from '../../../utils';
|
|
6
|
+
import { Collaborator } from '../../../components';
|
|
7
|
+
import intl from '../../../intl';
|
|
8
|
+
import context from '../../../context';
|
|
9
|
+
import { CHART_THEME_COLOR } from '../../../constants';
|
|
10
|
+
class PivotTableDisplayName extends React.Component {
|
|
19
11
|
constructor(props) {
|
|
20
12
|
super(props);
|
|
21
13
|
this.getType = column => {
|
|
22
14
|
let type = column.type;
|
|
23
|
-
if (type ===
|
|
15
|
+
if (type === CellType.LINK_FORMULA) {
|
|
24
16
|
var _column$data;
|
|
25
17
|
type = column === null || column === void 0 ? void 0 : (_column$data = column.data) === null || _column$data === void 0 ? void 0 : _column$data.array_type;
|
|
26
18
|
}
|
|
27
19
|
return type;
|
|
28
20
|
};
|
|
29
21
|
this.updateCreator = (email, rowData) => {
|
|
30
|
-
if (!
|
|
22
|
+
if (!isValidEmail(email)) {
|
|
31
23
|
const {
|
|
32
24
|
original_name
|
|
33
25
|
} = rowData;
|
|
34
26
|
email = original_name;
|
|
35
27
|
}
|
|
36
|
-
let creator =
|
|
28
|
+
let creator = getKnownCollaboratorByEmail(email);
|
|
37
29
|
if (creator) {
|
|
38
30
|
this.setState({
|
|
39
31
|
creator
|
|
@@ -52,14 +44,14 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
52
44
|
email: email,
|
|
53
45
|
name: email
|
|
54
46
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
creator = emailUserMap && emailUserMap[email] ||
|
|
47
|
+
context.updateCollaboratorsCache(email, valueTemplate);
|
|
48
|
+
context.queryUsers([email], emailUserMap => {
|
|
49
|
+
creator = emailUserMap && emailUserMap[email] || generateDefaultUser(email);
|
|
58
50
|
const loadedCreator = {
|
|
59
51
|
...creator,
|
|
60
52
|
loaded: true
|
|
61
53
|
};
|
|
62
|
-
|
|
54
|
+
context.updateCollaboratorsCache(email, loadedCreator);
|
|
63
55
|
this.setState({
|
|
64
56
|
creator
|
|
65
57
|
});
|
|
@@ -76,9 +68,9 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
76
68
|
email: email,
|
|
77
69
|
name: email
|
|
78
70
|
};
|
|
79
|
-
|
|
71
|
+
context.updateCollaboratorsCache(email, template);
|
|
80
72
|
});
|
|
81
|
-
|
|
73
|
+
context.queryUsers(emails, cb);
|
|
82
74
|
};
|
|
83
75
|
this.renderSelectOption = option => {
|
|
84
76
|
if (!option) return null;
|
|
@@ -87,7 +79,7 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
87
79
|
color,
|
|
88
80
|
textColor
|
|
89
81
|
} = option;
|
|
90
|
-
return /*#__PURE__*/
|
|
82
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
83
|
style: {
|
|
92
84
|
color: textColor,
|
|
93
85
|
backgroundColor: color
|
|
@@ -103,17 +95,17 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
103
95
|
avatar_url,
|
|
104
96
|
name
|
|
105
97
|
} = collaborator;
|
|
106
|
-
return /*#__PURE__*/
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
107
99
|
className: "collaborators-formatter"
|
|
108
|
-
}, /*#__PURE__*/
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
101
|
className: "collaborator"
|
|
110
|
-
}, /*#__PURE__*/
|
|
102
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
111
103
|
className: "collaborator-avatar-container"
|
|
112
|
-
}, /*#__PURE__*/
|
|
104
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
113
105
|
src: avatar_url,
|
|
114
106
|
alt: '',
|
|
115
107
|
className: "collaborator-avatar"
|
|
116
|
-
})), /*#__PURE__*/
|
|
108
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
117
109
|
className: "collaborator-name",
|
|
118
110
|
title: name,
|
|
119
111
|
"aria-label": name
|
|
@@ -125,31 +117,31 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
125
117
|
data
|
|
126
118
|
} = column;
|
|
127
119
|
type = this.getType(column);
|
|
128
|
-
const collaborators =
|
|
120
|
+
const collaborators = context.getCollaboratorsFromCache();
|
|
129
121
|
let displayName;
|
|
130
122
|
switch (type) {
|
|
131
|
-
case
|
|
123
|
+
case CellType.SINGLE_SELECT:
|
|
132
124
|
{
|
|
133
125
|
let options;
|
|
134
126
|
// column type is LINK_FORMULA, but we need to use single selector formatter here
|
|
135
|
-
if (column.type ===
|
|
127
|
+
if (column.type === CellType.LINK_FORMULA) {
|
|
136
128
|
options = column.data.array_data.options;
|
|
137
129
|
} else {
|
|
138
|
-
options =
|
|
130
|
+
options = getColumnOptions(column);
|
|
139
131
|
}
|
|
140
132
|
|
|
141
133
|
// if this is a link-formula column and linked to a single select column, in this case the value is an array
|
|
142
134
|
if (Array.isArray(value)) {
|
|
143
135
|
value = value[0];
|
|
144
136
|
}
|
|
145
|
-
let option =
|
|
137
|
+
let option = getOption(options, value) || {};
|
|
146
138
|
if (Object.keys(option).length === 0) {
|
|
147
139
|
option = options.find(item => item.name === value) || {};
|
|
148
140
|
}
|
|
149
|
-
displayName = /*#__PURE__*/
|
|
141
|
+
displayName = /*#__PURE__*/React.createElement(React.Fragment, null, this.renderSelectOption(option));
|
|
150
142
|
break;
|
|
151
143
|
}
|
|
152
|
-
case
|
|
144
|
+
case CellType.MULTIPLE_SELECT:
|
|
153
145
|
{
|
|
154
146
|
const {
|
|
155
147
|
rowData
|
|
@@ -161,25 +153,25 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
161
153
|
} = rowData;
|
|
162
154
|
const newValue = original_name || name || original_key;
|
|
163
155
|
let options, validValue;
|
|
164
|
-
if (column.type ===
|
|
156
|
+
if (column.type === CellType.LINK_FORMULA) {
|
|
165
157
|
options = column.data.array_data.options;
|
|
166
158
|
validValue = Array.isArray(newValue) && newValue.length !== 0 ? newValue : [newValue];
|
|
167
159
|
} else {
|
|
168
|
-
options =
|
|
160
|
+
options = getColumnOptions(column);
|
|
169
161
|
validValue = Array.isArray(newValue) && newValue.length !== 0 ? newValue : [newValue];
|
|
170
162
|
}
|
|
171
|
-
displayName = /*#__PURE__*/
|
|
163
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
172
164
|
className: "pivot-table-display-name-row"
|
|
173
165
|
}, validValue.map(item => {
|
|
174
|
-
const option =
|
|
166
|
+
const option = getOption(options, item);
|
|
175
167
|
if (!item) return null;
|
|
176
|
-
return /*#__PURE__*/
|
|
168
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
177
169
|
key: item
|
|
178
170
|
}, this.renderSelectOption(option));
|
|
179
171
|
}));
|
|
180
172
|
break;
|
|
181
173
|
}
|
|
182
|
-
case
|
|
174
|
+
case CellType.COLLABORATOR:
|
|
183
175
|
{
|
|
184
176
|
const {
|
|
185
177
|
rowData
|
|
@@ -205,12 +197,12 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
205
197
|
|
|
206
198
|
// value is empty
|
|
207
199
|
if (validValue[0] === null || validValue[0] === undefined) {
|
|
208
|
-
return /*#__PURE__*/
|
|
200
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
209
201
|
title: String(value),
|
|
210
202
|
"aria-label": String(value)
|
|
211
|
-
}, "(",
|
|
203
|
+
}, "(", intl.get('Empty'), ")");
|
|
212
204
|
}
|
|
213
|
-
const unknowEmails = validValue.filter(email => !
|
|
205
|
+
const unknowEmails = validValue.filter(email => !getCollaborator(collaborators, email));
|
|
214
206
|
|
|
215
207
|
// if need to query unknowEmails
|
|
216
208
|
if (unknowEmails.length > 0) {
|
|
@@ -222,7 +214,7 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
222
214
|
...user,
|
|
223
215
|
loaded: true
|
|
224
216
|
};
|
|
225
|
-
|
|
217
|
+
context.updateCollaboratorsCache(email, loadedUser);
|
|
226
218
|
if (window.app.collaboratorsCache) {
|
|
227
219
|
// update global collaborators cache
|
|
228
220
|
// when statistics plugin reloaded, collaboratorsCache will be passed here, so we just need to fetch them once in statistics plugin
|
|
@@ -231,58 +223,58 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
231
223
|
});
|
|
232
224
|
});
|
|
233
225
|
}
|
|
234
|
-
displayName = /*#__PURE__*/
|
|
226
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
235
227
|
className: "pivot-table-display-name-row"
|
|
236
228
|
}, validValue.map(item => {
|
|
237
|
-
let collaborator =
|
|
229
|
+
let collaborator = getCollaborator(collaborators, item);
|
|
238
230
|
if (!collaborator) {
|
|
239
|
-
collaborator =
|
|
231
|
+
collaborator = generateDefaultUser(item);
|
|
240
232
|
}
|
|
241
|
-
return /*#__PURE__*/
|
|
233
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
242
234
|
key: item
|
|
243
235
|
}, this.renderCollaborator(collaborator));
|
|
244
236
|
}));
|
|
245
237
|
break;
|
|
246
238
|
}
|
|
247
|
-
case
|
|
248
|
-
case
|
|
239
|
+
case CellType.CREATOR:
|
|
240
|
+
case CellType.LAST_MODIFIER:
|
|
249
241
|
{
|
|
250
242
|
let {
|
|
251
243
|
creator
|
|
252
244
|
} = this.state;
|
|
253
|
-
displayName = /*#__PURE__*/
|
|
245
|
+
displayName = /*#__PURE__*/React.createElement(Collaborator, {
|
|
254
246
|
collaborator: creator
|
|
255
247
|
});
|
|
256
248
|
break;
|
|
257
249
|
}
|
|
258
|
-
case
|
|
250
|
+
case CellType.NUMBER:
|
|
259
251
|
{
|
|
260
252
|
let valueNumber = parseFloat(value);
|
|
261
|
-
let displayValue =
|
|
262
|
-
displayName = /*#__PURE__*/
|
|
253
|
+
let displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
|
|
254
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
263
255
|
title: displayValue,
|
|
264
256
|
"aria-label": displayValue
|
|
265
257
|
}, displayValue);
|
|
266
258
|
break;
|
|
267
259
|
}
|
|
268
|
-
case
|
|
260
|
+
case CellType.DATE:
|
|
269
261
|
{
|
|
270
262
|
let displayValue = value + '';
|
|
271
263
|
if (displayValue && displayValue.split('-').length === 3) {
|
|
272
|
-
let format =
|
|
264
|
+
let format = getDateColumnFormat(column);
|
|
273
265
|
let spaceIndex = format.indexOf(' ');
|
|
274
266
|
if (spaceIndex > -1) {
|
|
275
267
|
format = format.slice(0, spaceIndex);
|
|
276
268
|
}
|
|
277
|
-
displayValue = (
|
|
269
|
+
displayValue = dayjs(displayValue).format(format);
|
|
278
270
|
}
|
|
279
|
-
displayName = /*#__PURE__*/
|
|
271
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
280
272
|
title: displayValue,
|
|
281
273
|
"aria-label": displayValue
|
|
282
274
|
}, displayValue);
|
|
283
275
|
break;
|
|
284
276
|
}
|
|
285
|
-
case
|
|
277
|
+
case CellType.LINK:
|
|
286
278
|
{
|
|
287
279
|
let newValue;
|
|
288
280
|
if (!Array.isArray(value)) {
|
|
@@ -296,14 +288,14 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
296
288
|
} = data || {};
|
|
297
289
|
|
|
298
290
|
// link displays single select, need to render option with color
|
|
299
|
-
if ([
|
|
291
|
+
if ([CellType.SINGLE_SELECT].includes(array_type)) {
|
|
300
292
|
let options = array_data.options;
|
|
301
|
-
displayName = /*#__PURE__*/
|
|
293
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
302
294
|
className: "pivot-table-display-name-row"
|
|
303
295
|
}, newValue.map(item => {
|
|
304
296
|
const option = options.find(option => option.name === item);
|
|
305
297
|
if (!item) return null;
|
|
306
|
-
return /*#__PURE__*/
|
|
298
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
307
299
|
key: item
|
|
308
300
|
}, this.renderSelectOption(option));
|
|
309
301
|
}));
|
|
@@ -312,10 +304,10 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
312
304
|
|
|
313
305
|
// link displays collaborator, need to render collaborator name
|
|
314
306
|
// but link column doesn't seem to be capable of displaying collaborator
|
|
315
|
-
if (
|
|
307
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
316
308
|
const collaboratorList = Array.isArray(value) ? value : [value];
|
|
317
|
-
const displayValue =
|
|
318
|
-
displayName = /*#__PURE__*/
|
|
309
|
+
const displayValue = getCollaboratorsName(collaborators, collaboratorList);
|
|
310
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
319
311
|
title: displayValue,
|
|
320
312
|
"aria-label": displayValue
|
|
321
313
|
}, displayValue) || null;
|
|
@@ -323,33 +315,33 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
323
315
|
}
|
|
324
316
|
|
|
325
317
|
// normal case, link displays text
|
|
326
|
-
displayName = /*#__PURE__*/
|
|
318
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
327
319
|
title: String(value),
|
|
328
320
|
"aria-label": String(value)
|
|
329
321
|
}, newValue.join(', '));
|
|
330
322
|
break;
|
|
331
323
|
}
|
|
332
|
-
case
|
|
333
|
-
case
|
|
324
|
+
case CellType.FORMULA:
|
|
325
|
+
case CellType.LINK_FORMULA:
|
|
334
326
|
{
|
|
335
327
|
let displayValue = value;
|
|
336
328
|
let {
|
|
337
329
|
result_type,
|
|
338
330
|
array_type
|
|
339
331
|
} = data || {};
|
|
340
|
-
if (result_type ===
|
|
332
|
+
if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
|
|
341
333
|
let valueNumber = parseFloat(value);
|
|
342
|
-
displayValue =
|
|
343
|
-
} else if (result_type ===
|
|
344
|
-
if (
|
|
334
|
+
displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
|
|
335
|
+
} else if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
336
|
+
if (COLLABORATOR_COLUMN_TYPES.includes(array_type) && Array.isArray(value)) {
|
|
345
337
|
displayValue = value.map(email => {
|
|
346
|
-
let user = array_type ===
|
|
338
|
+
let user = array_type === CellType.COLLABORATOR ? getCollaborator(collaborators, email) : getKnownCollaboratorByEmail(email);
|
|
347
339
|
return (user || {}).name;
|
|
348
340
|
});
|
|
349
341
|
displayValue = displayValue.join(' ');
|
|
350
342
|
}
|
|
351
343
|
}
|
|
352
|
-
displayName = /*#__PURE__*/
|
|
344
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
353
345
|
title: displayValue,
|
|
354
346
|
"aria-label": displayValue
|
|
355
347
|
}, displayValue);
|
|
@@ -357,7 +349,7 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
357
349
|
}
|
|
358
350
|
default:
|
|
359
351
|
{
|
|
360
|
-
displayName = /*#__PURE__*/
|
|
352
|
+
displayName = /*#__PURE__*/React.createElement("div", {
|
|
361
353
|
title: String(value),
|
|
362
354
|
"aria-label": String(value)
|
|
363
355
|
}, value);
|
|
@@ -368,7 +360,7 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
368
360
|
};
|
|
369
361
|
this.state = {
|
|
370
362
|
creator: {},
|
|
371
|
-
context
|
|
363
|
+
context
|
|
372
364
|
};
|
|
373
365
|
}
|
|
374
366
|
componentDidMount() {
|
|
@@ -378,7 +370,7 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
378
370
|
rowData
|
|
379
371
|
} = this.props;
|
|
380
372
|
const type = this.getType(column);
|
|
381
|
-
if (type !==
|
|
373
|
+
if (type !== CellType.CREATOR && type !== CellType.LAST_MODIFIER) return;
|
|
382
374
|
this.updateCreator(value, rowData);
|
|
383
375
|
}
|
|
384
376
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -388,8 +380,8 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
388
380
|
rowData
|
|
389
381
|
} = nextProps;
|
|
390
382
|
const type = this.getType(column);
|
|
391
|
-
if (type !==
|
|
392
|
-
if (value !== this.props.value || (
|
|
383
|
+
if (type !== CellType.CREATOR && type !== CellType.LAST_MODIFIER) return;
|
|
384
|
+
if (value !== this.props.value || shallowEqual(nextProps.column, this.props.column)) {
|
|
393
385
|
this.updateCreator(value, rowData);
|
|
394
386
|
}
|
|
395
387
|
}
|
|
@@ -399,14 +391,14 @@ class PivotTableDisplayName extends _react.default.Component {
|
|
|
399
391
|
column,
|
|
400
392
|
globalTheme
|
|
401
393
|
} = this.props;
|
|
402
|
-
const AlwaysDisplayLightThemeTypes = [
|
|
394
|
+
const AlwaysDisplayLightThemeTypes = [CellType.CREATOR, CellType.LAST_MODIFIER, CellType.SINGLE_SELECT, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR];
|
|
403
395
|
const isAlwaysLightTheme = AlwaysDisplayLightThemeTypes.includes(column.type);
|
|
404
|
-
let displayName = value ? this.getDisplayName(value, column) : /*#__PURE__*/
|
|
405
|
-
return /*#__PURE__*/
|
|
396
|
+
let displayName = value ? this.getDisplayName(value, column) : /*#__PURE__*/React.createElement("div", null, `(${intl.get('Empty')})`);
|
|
397
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
406
398
|
style: {
|
|
407
|
-
color: isAlwaysLightTheme ?
|
|
399
|
+
color: isAlwaysLightTheme ? CHART_THEME_COLOR['light'].pivotTextColor : CHART_THEME_COLOR[globalTheme].pivotTextColor
|
|
408
400
|
}
|
|
409
401
|
}, displayName));
|
|
410
402
|
}
|
|
411
403
|
}
|
|
412
|
-
|
|
404
|
+
export default PivotTableDisplayName;
|