sea-chart 2.0.36 → 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 +8 -15
- 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 +30 -38
- 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 +40 -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 +5 -12
- package/dist/components/index.js +7 -48
- package/dist/components/loading/index.js +6 -13
- package/dist/components/number-input/index.js +4 -11
- package/dist/components/pixel-editor/index.js +15 -23
- package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
- package/dist/components/popover/hide-column-popover/hide-column-popover.js +26 -34
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +55 -65
- 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 +56 -64
- package/dist/components/tooltip/index.js +14 -21
- 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 +8 -15
- 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 +1 -7
- package/dist/locale/lang/en.js +1 -7
- package/dist/locale/lang/es.js +1 -7
- package/dist/locale/lang/fr.js +1 -7
- package/dist/locale/lang/pt.js +1 -7
- package/dist/locale/lang/ru.js +1 -7
- package/dist/locale/lang/zh_CN.js +1 -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 +12 -19
- 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 +11 -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 +63 -71
- 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 +49 -57
- package/dist/settings/basic-number-card/data-settings.js +49 -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 -63
- package/dist/settings/combination-settings/index.js +3 -20
- package/dist/settings/combination-settings/style-settings.js +65 -73
- 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 +43 -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 +20 -28
- 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 +52 -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 +30 -38
- package/dist/settings/table-element-settings/data-settings.js +21 -29
- package/dist/settings/table-element-settings/index.js +2 -13
- package/dist/settings/table-settings/data-settings.js +112 -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 +42 -50
- 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 +55 -63
- 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 +21 -29
- package/dist/settings/widgets/data-filter/index.js +35 -43
- 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 +51 -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 +74 -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 +64 -72
- package/dist/utils/cell-format-utils.js +17 -27
- package/dist/utils/cell-value-utils.js +4 -11
- package/dist/utils/chart-utils/base-utils.js +324 -332
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +77 -84
- package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
- 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 +16 -23
- 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 +90 -96
- package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
- package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
- package/dist/utils/chart-utils/sql-statistics-utils.js +229 -237
- 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 +77 -104
- package/dist/utils/common-utils.js +28 -53
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- 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 +54 -221
- 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 +166 -178
- 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 +158 -168
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.js +90 -96
- package/dist/view/title/index.js +16 -24
- package/dist/view/wrapper/area-group.js +45 -53
- package/dist/view/wrapper/area.js +43 -51
- package/dist/view/wrapper/bar-compare.js +38 -46
- package/dist/view/wrapper/bar-custom-stack.js +39 -47
- package/dist/view/wrapper/bar-group.js +45 -53
- package/dist/view/wrapper/bar-stack.js +48 -56
- package/dist/view/wrapper/bar.js +40 -48
- package/dist/view/wrapper/basic-number-card.js +26 -34
- package/dist/view/wrapper/chart-component.js +123 -131
- package/dist/view/wrapper/combination.js +55 -63
- package/dist/view/wrapper/completeness-group.js +40 -48
- package/dist/view/wrapper/completeness.js +36 -44
- package/dist/view/wrapper/dashboard.js +39 -44
- 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 +52 -60
- package/dist/view/wrapper/horizontal-bar-stack.js +47 -55
- package/dist/view/wrapper/horizontal-bar.js +41 -49
- package/dist/view/wrapper/index.js +107 -115
- package/dist/view/wrapper/line-group.js +43 -51
- 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 +39 -47
- package/dist/view/wrapper/map-world.js +41 -49
- package/dist/view/wrapper/map.js +42 -50
- package/dist/view/wrapper/mirror.js +41 -49
- package/dist/view/wrapper/pie.js +44 -52
- package/dist/view/wrapper/ring.js +49 -57
- package/dist/view/wrapper/scatter.js +42 -50
- 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 -93
- 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 -15
- 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 +5 -12
- 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 +18 -26
- package/dist/view/wrapper/treemap.js +38 -46
- package/dist/view/wrapper/trend.js +58 -66
- package/package.json +5 -5
|
@@ -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 TwoDimensionTable extends _react.PureComponent {
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { CellType, isNumber } from 'dtable-utils';
|
|
4
|
+
import { BaseUtils, formatRowTotal } from '../../../utils';
|
|
5
|
+
import intl from '../../../intl';
|
|
6
|
+
import { CHART_SUMMARY_TYPE, CHART_THEME_COLOR } from '../../../constants';
|
|
7
|
+
import PivotTableDisplayName from './pivot-table-display-name';
|
|
8
|
+
class TwoDimensionTable extends PureComponent {
|
|
17
9
|
constructor() {
|
|
18
10
|
super(...arguments);
|
|
19
11
|
this.getCells = row => {
|
|
@@ -66,10 +58,10 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
66
58
|
cellIdx: selectedCellIdx
|
|
67
59
|
} = selectedCell || {};
|
|
68
60
|
const isSelectedTotalCellBottom = selectRowIdx === 0 && selectedCellIdx === (Array.isArray(pivot_columns) ? pivot_columns.length : 0);
|
|
69
|
-
const isCollaborator = columnGroupbyColumn.type ===
|
|
70
|
-
return /*#__PURE__*/
|
|
61
|
+
const isCollaborator = columnGroupbyColumn.type === CellType.COLLABORATOR;
|
|
62
|
+
return /*#__PURE__*/React.createElement("thead", {
|
|
71
63
|
className: "seatable-table-header-sm"
|
|
72
|
-
}, /*#__PURE__*/
|
|
64
|
+
}, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
73
65
|
className: "pivot-table-header"
|
|
74
66
|
}, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
75
67
|
let {
|
|
@@ -79,40 +71,40 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
79
71
|
original_key = [original_key];
|
|
80
72
|
}
|
|
81
73
|
let isSelectedHeaderBottom = selectRowIdx === 0 && selectedCellIdx === index;
|
|
82
|
-
return /*#__PURE__*/
|
|
83
|
-
className: (
|
|
74
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
75
|
+
className: classnames('pivot-table-header', {
|
|
84
76
|
'selected-pivot-cell-top': isSelectedHeaderBottom
|
|
85
77
|
}),
|
|
86
|
-
key:
|
|
87
|
-
}, /*#__PURE__*/
|
|
78
|
+
key: `pivot-column-${index}`
|
|
79
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
88
80
|
value: original_key,
|
|
89
81
|
column: columnGroupbyColumn || {},
|
|
90
82
|
rowData: item,
|
|
91
83
|
globalTheme: globalTheme
|
|
92
84
|
}));
|
|
93
|
-
}), display_total && /*#__PURE__*/
|
|
94
|
-
className: (
|
|
85
|
+
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
86
|
+
className: classnames('pivot-table-header', {
|
|
95
87
|
'selected-pivot-cell-top': isSelectedTotalCellBottom
|
|
96
88
|
})
|
|
97
|
-
}, /*#__PURE__*/
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get('Total')))), isSingleNumericColumn === 'false' && summary_columns && summary_columns.length && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
98
90
|
className: "pivot-table-header"
|
|
99
91
|
}), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
|
|
100
|
-
return /*#__PURE__*/
|
|
101
|
-
key:
|
|
92
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
93
|
+
key: `pivot-column-${index}`,
|
|
102
94
|
className: "pivot-table-header summary-columns-header"
|
|
103
|
-
}, /*#__PURE__*/
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
104
96
|
className: "pivot-table-header-summary-columns-container"
|
|
105
97
|
}, summary_columns.map((column, idx) => {
|
|
106
|
-
return /*#__PURE__*/
|
|
107
|
-
className: (
|
|
108
|
-
key:
|
|
109
|
-
}, /*#__PURE__*/
|
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: classnames('pivot-table-header'),
|
|
100
|
+
key: `pivot-summary-column-${idx}`
|
|
101
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
110
102
|
value: column.name,
|
|
111
103
|
column: column || {},
|
|
112
104
|
globalTheme: globalTheme
|
|
113
105
|
}));
|
|
114
106
|
})));
|
|
115
|
-
}), display_total && /*#__PURE__*/
|
|
107
|
+
}), display_total && /*#__PURE__*/React.createElement("th", {
|
|
116
108
|
className: "pivot-table-header"
|
|
117
109
|
})));
|
|
118
110
|
};
|
|
@@ -141,23 +133,23 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
141
133
|
this.renderEmpty = (summaryColumns, cellIdx) => {
|
|
142
134
|
if (summaryColumns && (summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.length) !== 0) {
|
|
143
135
|
return summaryColumns.map(item => {
|
|
144
|
-
return /*#__PURE__*/
|
|
145
|
-
key:
|
|
146
|
-
className: (
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
key: `table-cell-${item === null || item === void 0 ? void 0 : item.key}`,
|
|
138
|
+
className: classnames('pivot-cell', {
|
|
147
139
|
'pivot-empty-cell': true
|
|
148
140
|
})
|
|
149
|
-
}, /*#__PURE__*/
|
|
141
|
+
}, /*#__PURE__*/React.createElement("i", null));
|
|
150
142
|
});
|
|
151
143
|
}
|
|
152
|
-
return /*#__PURE__*/
|
|
153
|
-
key:
|
|
154
|
-
className: (
|
|
144
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
key: `table-cell-${cellIdx}`,
|
|
146
|
+
className: classnames('pivot-cell', {
|
|
155
147
|
'pivot-empty-cell': true
|
|
156
148
|
})
|
|
157
|
-
}, /*#__PURE__*/
|
|
149
|
+
}, /*#__PURE__*/React.createElement("i", null));
|
|
158
150
|
};
|
|
159
151
|
this.getRowTotal = (rowTotal, value) => {
|
|
160
|
-
if (value &&
|
|
152
|
+
if (value && isNumber(value)) {
|
|
161
153
|
return rowTotal + value;
|
|
162
154
|
}
|
|
163
155
|
return rowTotal;
|
|
@@ -192,12 +184,12 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
192
184
|
let pivotColumnCells = [];
|
|
193
185
|
const isSelectRowTotalCellRight = selectRowIdx === pivotRowsLen && selectedCellIdx === 0;
|
|
194
186
|
const isSelectTotal = selectRowIdx === pivotRowsLen && selectedCellIdx === (Array.isArray(pivot_columns) ? pivot_columns.length : 0);
|
|
195
|
-
const tableTotalDisplayValue =
|
|
196
|
-
const isValidTableTotalDisplayValue =
|
|
197
|
-
const isCount = summary_type ===
|
|
187
|
+
const tableTotalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivot_table_total, summaryMethod);
|
|
188
|
+
const isValidTableTotalDisplayValue = BaseUtils.isValidValue(tableTotalDisplayValue, display_empty);
|
|
189
|
+
const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
|
|
198
190
|
this.isCount = isCount;
|
|
199
|
-
const isCollaborator = groupbyColumn.type ===
|
|
200
|
-
return /*#__PURE__*/
|
|
191
|
+
const isCollaborator = groupbyColumn.type === CellType.COLLABORATOR;
|
|
192
|
+
return /*#__PURE__*/React.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
|
|
201
193
|
let {
|
|
202
194
|
name,
|
|
203
195
|
total
|
|
@@ -215,13 +207,13 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
215
207
|
pivotColumnCells[rowIdx] = rowItem.rows || [];
|
|
216
208
|
}
|
|
217
209
|
let rowTotal = 0;
|
|
218
|
-
return /*#__PURE__*/
|
|
210
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
219
211
|
key: 'table-row' + rowIdx
|
|
220
|
-
}, /*#__PURE__*/
|
|
221
|
-
className: (
|
|
212
|
+
}, /*#__PURE__*/React.createElement("td", {
|
|
213
|
+
className: classnames('pivot-row-name', {
|
|
222
214
|
'selected-pivot-cell-left': isSelectedRowNameRight
|
|
223
215
|
})
|
|
224
|
-
}, /*#__PURE__*/
|
|
216
|
+
}, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
|
|
225
217
|
value: name,
|
|
226
218
|
column: groupbyColumn,
|
|
227
219
|
rowData: rowItem,
|
|
@@ -235,7 +227,7 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
235
227
|
} = c;
|
|
236
228
|
if (isCount) {
|
|
237
229
|
const displayValue = total;
|
|
238
|
-
const isValidDisplayValue =
|
|
230
|
+
const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
|
|
239
231
|
rowTotal = this.getRowTotal(rowTotal, displayValue);
|
|
240
232
|
if (c && Array.isArray(c.rows) && c.rows.length > 0) {
|
|
241
233
|
pivotRowCells.push(...c.rows);
|
|
@@ -245,14 +237,14 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
245
237
|
pivotColumnCells[cellIdx] = [...c.rows];
|
|
246
238
|
}
|
|
247
239
|
}
|
|
248
|
-
return /*#__PURE__*/
|
|
249
|
-
className: (
|
|
240
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
241
|
+
className: classnames('pivot-cell', {
|
|
250
242
|
'pivot-empty-cell': !isValidDisplayValue,
|
|
251
243
|
'selected-pivot-cell': isSelectedCell,
|
|
252
244
|
'selected-pivot-cell-top': isSelectedCellTop,
|
|
253
245
|
'selected-pivot-cell-left': isSelectedCellLeft
|
|
254
246
|
}),
|
|
255
|
-
key:
|
|
247
|
+
key: `table-cell-${cellIdx}`,
|
|
256
248
|
onClick: () => this.toggleRecords({
|
|
257
249
|
...c,
|
|
258
250
|
name: rowItem === null || rowItem === void 0 ? void 0 : rowItem.name
|
|
@@ -261,39 +253,39 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
261
253
|
cellIdx
|
|
262
254
|
}),
|
|
263
255
|
title: displayValue
|
|
264
|
-
}, isValidDisplayValue ? displayValue : /*#__PURE__*/
|
|
265
|
-
className: (
|
|
256
|
+
}, isValidDisplayValue ? displayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
257
|
+
className: classnames({
|
|
266
258
|
'selected-pivot-cell-border': isSelectedCell
|
|
267
259
|
})
|
|
268
260
|
}));
|
|
269
261
|
}
|
|
270
|
-
return /*#__PURE__*/
|
|
271
|
-
className: (
|
|
272
|
-
key:
|
|
273
|
-
}, /*#__PURE__*/
|
|
274
|
-
className: (
|
|
262
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
263
|
+
className: classnames('pivot-cell'),
|
|
264
|
+
key: `table-cell-${cellIdx}`
|
|
265
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
266
|
+
className: classnames('pivot-cells-container')
|
|
275
267
|
}, total && total.map && total.map((summaryCell, idx) => {
|
|
276
268
|
const summaryCellColumnKey = summaryCell[2];
|
|
277
269
|
const summaryCellColumn = summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.find(item => item.key === summaryCellColumnKey);
|
|
278
|
-
const displayValue =
|
|
279
|
-
const isValidDisplayValue =
|
|
270
|
+
const displayValue = BaseUtils.getSummaryValueDisplayString(summaryCellColumn, summaryCell[1], summaryMethod);
|
|
271
|
+
const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
|
|
280
272
|
rowTotal = this.getRowTotal(rowTotal, summaryCell[1]);
|
|
281
|
-
return /*#__PURE__*/
|
|
282
|
-
key:
|
|
283
|
-
className: (
|
|
273
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
274
|
+
key: `table-cell-${cellIdx}-${idx}`,
|
|
275
|
+
className: classnames('pivot-cell', {
|
|
284
276
|
'pivot-empty-cell': !isValidDisplayValue,
|
|
285
277
|
'selected-pivot-cell': isSelectedCell,
|
|
286
278
|
'selected-pivot-cell-top': isSelectedCellTop,
|
|
287
279
|
'selected-pivot-cell-left': isSelectedCellLeft
|
|
288
280
|
})
|
|
289
|
-
}, isValidDisplayValue ? displayValue : /*#__PURE__*/
|
|
290
|
-
className: (
|
|
281
|
+
}, isValidDisplayValue ? displayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
282
|
+
className: classnames({
|
|
291
283
|
'selected-pivot-cell-border': isSelectedCell
|
|
292
284
|
})
|
|
293
285
|
}));
|
|
294
286
|
}), !total && !(typeof total === 'number') && this.renderEmpty(summaryColumns, cellIdx)));
|
|
295
|
-
}), display_total && /*#__PURE__*/
|
|
296
|
-
className: (
|
|
287
|
+
}), display_total && /*#__PURE__*/React.createElement("td", {
|
|
288
|
+
className: classnames('pivot-cell', {
|
|
297
289
|
'selected-pivot-cell': isSelectedTotalCell,
|
|
298
290
|
'selected-pivot-cell-top': isSelectedTotalCellTop,
|
|
299
291
|
'selected-pivot-cell-left': isSelectedTotalCellLeft
|
|
@@ -307,29 +299,29 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
307
299
|
cellIdx: cells.length
|
|
308
300
|
}),
|
|
309
301
|
title: rowTotal
|
|
310
|
-
},
|
|
311
|
-
className: (
|
|
302
|
+
}, BaseUtils.isValidValue(rowTotal, display_empty) ? BaseUtils.getSummaryValueDisplayString(summaryColumn, rowTotal, summaryMethod) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
303
|
+
className: classnames({
|
|
312
304
|
'selected-pivot-cell-border': isSelectedTotalCell
|
|
313
305
|
})
|
|
314
306
|
})));
|
|
315
|
-
}), display_total && /*#__PURE__*/
|
|
316
|
-
className: (
|
|
307
|
+
}), display_total && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
|
|
308
|
+
className: classnames('pivot-column-total', {
|
|
317
309
|
'selected-pivot-cell-left': isSelectRowTotalCellRight
|
|
318
310
|
})
|
|
319
|
-
}, /*#__PURE__*/
|
|
311
|
+
}, /*#__PURE__*/React.createElement("div", null, intl.get('Total'))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
|
|
320
312
|
const pivotColumnCell = pivotColumnCells[index];
|
|
321
313
|
const isSelectRowTotalCell = selectRowIdx === pivot_rows.length && selectedCellIdx === index;
|
|
322
314
|
const isSelectRowTotalCellLeft = selectRowIdx === pivot_rows.length && selectedCellIdx - 1 === index;
|
|
323
315
|
const pivotColumnTotal = pivot_columns_total[c.key];
|
|
324
|
-
const totalDisplayValue =
|
|
325
|
-
const isValidTotalDisplayValue =
|
|
326
|
-
return /*#__PURE__*/
|
|
327
|
-
className: (
|
|
316
|
+
const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summaryMethod);
|
|
317
|
+
const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
|
|
318
|
+
return /*#__PURE__*/React.createElement("td", {
|
|
319
|
+
className: classnames('pivot-cell', {
|
|
328
320
|
'pivot-empty-cell': !isValidTotalDisplayValue,
|
|
329
321
|
'selected-pivot-cell': isSelectRowTotalCell,
|
|
330
322
|
'selected-pivot-cell-left': isSelectRowTotalCellLeft
|
|
331
323
|
}),
|
|
332
|
-
key:
|
|
324
|
+
key: `total-cell-${index}`,
|
|
333
325
|
onClick: () => this.toggleRecords({
|
|
334
326
|
rows: pivotColumnCell,
|
|
335
327
|
total: pivot_columns_total[c.key]
|
|
@@ -338,13 +330,13 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
338
330
|
cellIdx: index
|
|
339
331
|
}),
|
|
340
332
|
title: totalDisplayValue
|
|
341
|
-
}, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/
|
|
342
|
-
className: (
|
|
333
|
+
}, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
334
|
+
className: classnames({
|
|
343
335
|
'selected-pivot-cell-border': isSelectRowTotalCell
|
|
344
336
|
})
|
|
345
337
|
}));
|
|
346
|
-
}), /*#__PURE__*/
|
|
347
|
-
className: (
|
|
338
|
+
}), /*#__PURE__*/React.createElement("td", {
|
|
339
|
+
className: classnames('pivot-cell pivot-table-total', {
|
|
348
340
|
'pivot-empty-cell': !isValidTableTotalDisplayValue,
|
|
349
341
|
'selected-pivot-cell': isSelectTotal
|
|
350
342
|
}),
|
|
@@ -352,8 +344,8 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
352
344
|
rowIdx: pivot_rows.length,
|
|
353
345
|
cellIdx: Array.isArray(pivot_columns) ? pivot_columns.length : 0
|
|
354
346
|
})
|
|
355
|
-
}, isValidTableTotalDisplayValue ? tableTotalDisplayValue : /*#__PURE__*/
|
|
356
|
-
className: (
|
|
347
|
+
}, isValidTableTotalDisplayValue ? tableTotalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
|
|
348
|
+
className: classnames({
|
|
357
349
|
'selected-pivot-cell-border': isSelectTotal
|
|
358
350
|
})
|
|
359
351
|
}))));
|
|
@@ -366,16 +358,16 @@ class TwoDimensionTable extends _react.PureComponent {
|
|
|
366
358
|
globalTheme
|
|
367
359
|
} = this.props;
|
|
368
360
|
if (!groupbyColumn) return '';
|
|
369
|
-
return /*#__PURE__*/
|
|
361
|
+
return /*#__PURE__*/React.createElement("table", {
|
|
370
362
|
className: "sea-chart-pivot-table",
|
|
371
363
|
style: {
|
|
372
|
-
color:
|
|
364
|
+
color: CHART_THEME_COLOR[globalTheme].pivotTextColor
|
|
373
365
|
}
|
|
374
|
-
}, /*#__PURE__*/
|
|
366
|
+
}, /*#__PURE__*/React.createElement("caption", {
|
|
375
367
|
className: "column-title"
|
|
376
|
-
}, columnGroupbyColumn.name), /*#__PURE__*/
|
|
368
|
+
}, columnGroupbyColumn.name), /*#__PURE__*/React.createElement("caption", {
|
|
377
369
|
className: "row-title"
|
|
378
370
|
}, groupbyColumn.name), this.renderHeader(), this.renderRows());
|
|
379
371
|
}
|
|
380
372
|
}
|
|
381
|
-
|
|
373
|
+
export default TwoDimensionTable;
|
|
@@ -1,47 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.getTwoDimensionArrayValue = exports.getFormulaArrayValue = exports.getCellRecordWidth = exports.convertValueToDtableLongTextValue = exports.DATASET_NOT_SUPPORT_COLUMN_TYPES = void 0;
|
|
7
|
-
exports.isArrayFormalColumn = isArrayFormalColumn;
|
|
8
|
-
exports.isValidCellValue = void 0;
|
|
9
|
-
var _dtableUtils = require("dtable-utils");
|
|
10
|
-
var _seafileEditor = require("@seafile/seafile-editor");
|
|
11
|
-
const DATASET_NOT_SUPPORT_COLUMN_TYPES = exports.DATASET_NOT_SUPPORT_COLUMN_TYPES = [_dtableUtils.CellType.BUTTON];
|
|
12
|
-
const getCellRecordWidth = function (column) {
|
|
1
|
+
import { CellType } from 'dtable-utils';
|
|
2
|
+
import { getPreviewContent } from '@seafile/seafile-editor';
|
|
3
|
+
export const DATASET_NOT_SUPPORT_COLUMN_TYPES = [CellType.BUTTON];
|
|
4
|
+
export const getCellRecordWidth = function (column) {
|
|
13
5
|
let isSample = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14
6
|
let {
|
|
15
7
|
type,
|
|
16
8
|
data
|
|
17
9
|
} = column;
|
|
18
10
|
switch (type) {
|
|
19
|
-
case
|
|
11
|
+
case CellType.DATE:
|
|
20
12
|
{
|
|
21
13
|
let isShowHourAndMinute = data && data.format && data.format.indexOf('HH:mm') > -1;
|
|
22
14
|
return isShowHourAndMinute ? 160 : 110;
|
|
23
15
|
}
|
|
24
|
-
case
|
|
25
|
-
case
|
|
26
|
-
case
|
|
27
|
-
case
|
|
16
|
+
case CellType.LONG_TEXT:
|
|
17
|
+
case CellType.AUTO_NUMBER:
|
|
18
|
+
case CellType.URL:
|
|
19
|
+
case CellType.EMAIL:
|
|
28
20
|
{
|
|
29
21
|
return 200;
|
|
30
22
|
}
|
|
31
|
-
case
|
|
23
|
+
case CellType.CHECKBOX:
|
|
32
24
|
{
|
|
33
25
|
return 80;
|
|
34
26
|
}
|
|
35
|
-
case
|
|
27
|
+
case CellType.NUMBER:
|
|
36
28
|
{
|
|
37
29
|
return 120;
|
|
38
30
|
}
|
|
39
|
-
case
|
|
40
|
-
case
|
|
31
|
+
case CellType.CTIME:
|
|
32
|
+
case CellType.MTIME:
|
|
41
33
|
{
|
|
42
34
|
return 170;
|
|
43
35
|
}
|
|
44
|
-
case
|
|
36
|
+
case CellType.RATE:
|
|
45
37
|
{
|
|
46
38
|
const {
|
|
47
39
|
rate_max_number
|
|
@@ -49,8 +41,8 @@ const getCellRecordWidth = function (column) {
|
|
|
49
41
|
const rateMaxNumber = rate_max_number || 5;
|
|
50
42
|
return 16 * rateMaxNumber + 20;
|
|
51
43
|
}
|
|
52
|
-
case
|
|
53
|
-
case
|
|
44
|
+
case CellType.IMAGE:
|
|
45
|
+
case CellType.FILE:
|
|
54
46
|
{
|
|
55
47
|
return isSample ? 60 : 160;
|
|
56
48
|
}
|
|
@@ -60,8 +52,7 @@ const getCellRecordWidth = function (column) {
|
|
|
60
52
|
}
|
|
61
53
|
}
|
|
62
54
|
};
|
|
63
|
-
|
|
64
|
-
const getFormulaArrayValue = function (value) {
|
|
55
|
+
export const getFormulaArrayValue = function (value) {
|
|
65
56
|
let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
66
57
|
if (!Array.isArray(value)) return [];
|
|
67
58
|
if (!isFlat) return getTwoDimensionArrayValue(value);
|
|
@@ -86,19 +77,17 @@ const getFormulaArrayValue = function (value) {
|
|
|
86
77
|
});
|
|
87
78
|
}).flat().filter(item => isValidCellValue(item));
|
|
88
79
|
};
|
|
89
|
-
|
|
90
|
-
const convertValueToDtableLongTextValue = value => {
|
|
80
|
+
export const convertValueToDtableLongTextValue = value => {
|
|
91
81
|
const valueType = Object.prototype.toString.call(value);
|
|
92
82
|
if (value && valueType === '[object String]') {
|
|
93
|
-
return
|
|
83
|
+
return getPreviewContent(value);
|
|
94
84
|
}
|
|
95
85
|
if (valueType === '[object Object]') {
|
|
96
86
|
return value;
|
|
97
87
|
}
|
|
98
88
|
return '';
|
|
99
89
|
};
|
|
100
|
-
|
|
101
|
-
const isValidCellValue = value => {
|
|
90
|
+
export const isValidCellValue = value => {
|
|
102
91
|
if (value === undefined) return false;
|
|
103
92
|
if (value === null) return false;
|
|
104
93
|
if (value === '') return false;
|
|
@@ -106,8 +95,7 @@ const isValidCellValue = value => {
|
|
|
106
95
|
if (JSON.stringify(value) === '[]') return false;
|
|
107
96
|
return true;
|
|
108
97
|
};
|
|
109
|
-
|
|
110
|
-
const getTwoDimensionArrayValue = value => {
|
|
98
|
+
export const getTwoDimensionArrayValue = value => {
|
|
111
99
|
if (!Array.isArray(value)) return [];
|
|
112
100
|
return value.map(item => {
|
|
113
101
|
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
@@ -130,7 +118,6 @@ const getTwoDimensionArrayValue = value => {
|
|
|
130
118
|
});
|
|
131
119
|
});
|
|
132
120
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return [_dtableUtils.CellType.IMAGE, _dtableUtils.CellType.FILE, _dtableUtils.CellType.MULTIPLE_SELECT, _dtableUtils.CellType.COLLABORATOR].includes(columnType);
|
|
121
|
+
export function isArrayFormalColumn(columnType) {
|
|
122
|
+
return [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR].includes(columnType);
|
|
136
123
|
}
|