sea-chart 2.0.43 → 2.0.44
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 +4 -11
- package/dist/components/cell-factory/FormatterConfig.js +55 -62
- package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
- 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 +27 -35
- 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 +11 -18
- package/dist/components/color-popover/color-rules/color-rule.js +25 -33
- package/dist/components/color-popover/color-rules/index.js +6 -14
- 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 +10 -18
- package/dist/components/color-popover/color-rules-popover.js +26 -34
- package/dist/components/color-popover/color-selector-popover.js +10 -18
- package/dist/components/color-setting/color-group-selector.js +12 -20
- package/dist/components/common-add-tool/index.js +6 -13
- package/dist/components/data-process-setter/data-setting-header.js +7 -14
- package/dist/components/data-process-setter/hide-column-setter.js +12 -19
- package/dist/components/data-process-setter/index.js +4 -27
- package/dist/components/data-process-setter/sort-setter.js +16 -24
- package/dist/components/draggable/Draggable.js +7 -13
- package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
- 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 +4 -11
- 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 +25 -33
- package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
- package/dist/components/popover/sort-popover/sort-popover.js +54 -64
- package/dist/components/resize-handle/ResizeHandle.js +6 -13
- package/dist/components/row-card/row-card-header-cell.js +15 -22
- package/dist/components/row-card/row-card-header.js +14 -21
- package/dist/components/row-card/row-card-item.js +33 -41
- package/dist/components/row-card/row-card.js +15 -23
- package/dist/components/statistic-record-dialog/index.js +56 -64
- package/dist/components/tooltip/index.js +21 -21
- package/dist/components/types-dialog/index.js +56 -64
- 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 +149 -273
- 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 +20 -24
- 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 +8 -11
- package/dist/model/basic-number-card.js +13 -20
- package/dist/model/chart.js +7 -13
- package/dist/model/combination.js +19 -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 +15 -18
- package/dist/model/horizontal-group-bar.js +14 -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 +15 -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 +7 -13
- 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 +83 -74
- 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 +69 -60
- 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 +18 -26
- 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 +94 -77
- 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 +26 -34
- 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 +64 -72
- 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 +111 -119
- 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 +62 -53
- 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 +17 -25
- package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
- 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 +24 -32
- 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 +23 -31
- 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 +72 -80
- package/dist/settings/widgets/switch/index.js +8 -15
- 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 +63 -71
- package/dist/utils/cell-format-utils.js +18 -28
- package/dist/utils/cell-value-utils.js +5 -12
- package/dist/utils/chart-utils/base-utils.js +362 -334
- package/dist/utils/chart-utils/index.js +28 -41
- package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
- 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 +19 -26
- package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
- 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 +21 -28
- package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
- 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 +284 -246
- package/dist/utils/chart.js +9 -17
- package/dist/utils/collaborator-manager.js +3 -9
- package/dist/utils/collaborator-utils.js +18 -30
- package/dist/utils/collaborator.js +4 -13
- package/dist/utils/color-utils.js +18 -29
- package/dist/utils/column-utils.js +65 -92
- package/dist/utils/common-utils.js +27 -52
- package/dist/utils/concurrency-manager.js +1 -7
- package/dist/utils/contexts.js +5 -12
- package/dist/utils/date-translate.js +11 -19
- 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 +1 -7
- package/dist/utils/options-utils.js +8 -16
- package/dist/utils/row-record-utils.js +182 -178
- package/dist/utils/row-utils.js +27 -38
- package/dist/utils/search.js +24 -32
- package/dist/utils/sql/chart-data-sql.js +49 -55
- package/dist/utils/sql/column-2-sql-column.js +146 -154
- package/dist/utils/sql/index.js +3 -27
- package/dist/utils/trend-utils.js +39 -47
- package/dist/view/index.css +0 -17
- package/dist/view/index.js +89 -95
- package/dist/view/title/index.js +15 -23
- package/dist/view/wrapper/area-group.js +53 -72
- package/dist/view/wrapper/area.js +51 -72
- package/dist/view/wrapper/bar-compare.js +43 -56
- package/dist/view/wrapper/bar-custom-stack.js +50 -120
- package/dist/view/wrapper/bar-group.js +51 -94
- package/dist/view/wrapper/bar-stack.js +54 -90
- package/dist/view/wrapper/bar.js +45 -66
- package/dist/view/wrapper/basic-number-card.js +25 -26
- package/dist/view/wrapper/chart-component.js +539 -162
- package/dist/view/wrapper/combination.js +63 -83
- package/dist/view/wrapper/completeness-group.js +42 -96
- package/dist/view/wrapper/completeness.js +42 -96
- package/dist/view/wrapper/dashboard.js +33 -47
- package/dist/view/wrapper/funnel.js +36 -56
- package/dist/view/wrapper/heat-map.js +126 -104
- package/dist/view/wrapper/horizontal-bar-group.js +57 -76
- package/dist/view/wrapper/horizontal-bar-stack.js +56 -109
- package/dist/view/wrapper/horizontal-bar.js +45 -68
- package/dist/view/wrapper/index.js +110 -115
- package/dist/view/wrapper/line-group.js +48 -66
- package/dist/view/wrapper/line.js +47 -67
- package/dist/view/wrapper/map-bubble.js +46 -59
- package/dist/view/wrapper/map-world-bubble.js +45 -58
- package/dist/view/wrapper/map-world.js +47 -60
- package/dist/view/wrapper/map.js +48 -60
- package/dist/view/wrapper/mirror.js +40 -61
- package/dist/view/wrapper/pie.js +48 -59
- package/dist/view/wrapper/ring.js +52 -63
- package/dist/view/wrapper/scatter.js +49 -67
- package/dist/view/wrapper/table/index.js +13 -21
- 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 +50 -58
- package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
- package/dist/view/wrapper/table/two-dimension-table.js +76 -84
- package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
- package/dist/view/wrapper/table-element/components/formatter.js +96 -105
- package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
- package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
- package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
- package/dist/view/wrapper/table-element/components/record.js +10 -17
- package/dist/view/wrapper/table-element/components/records-body.js +17 -19
- 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 +23 -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 +5 -15
- 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 +39 -57
- package/dist/view/wrapper/trend.js +41 -48
- package/package.json +1 -1
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _dtableUtils = require("dtable-utils");
|
|
11
|
-
var _rowUtils = require("../../../../utils/row-utils");
|
|
12
|
-
var _recordsHeader = _interopRequireDefault(require("./records-header"));
|
|
13
|
-
var _recordsBody = _interopRequireDefault(require("./records-body"));
|
|
14
|
-
var _datasetUtils = require("./dataset-utils");
|
|
15
|
-
var _verticalScrollbar = _interopRequireDefault(require("./vertical-scrollbar"));
|
|
16
|
-
class Records extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { CellType } from 'dtable-utils';
|
|
3
|
+
import { resizeColumn } from '../../../../utils/row-utils';
|
|
4
|
+
import RecordsHeader from './records-header';
|
|
5
|
+
import RecordsBody from './records-body';
|
|
6
|
+
import { DATASET_NOT_SUPPORT_COLUMN_TYPES, getCellRecordWidth } from './dataset-utils';
|
|
7
|
+
import VerticalScrollbar from './vertical-scrollbar';
|
|
8
|
+
class Records extends Component {
|
|
17
9
|
constructor(props) {
|
|
18
10
|
super(props);
|
|
19
11
|
this.resizeColumnWidthToFitContainer = () => {
|
|
@@ -54,13 +46,13 @@ class Records extends _react.Component {
|
|
|
54
46
|
} = this.props;
|
|
55
47
|
const columnsWidthDataStr = localStorage.getItem(`statistic_${chart.id}_columns_width`);
|
|
56
48
|
const columnsWidthData = columnsWidthDataStr ? JSON.parse(columnsWidthDataStr) : [];
|
|
57
|
-
const columns = shownColumns.filter(column => !
|
|
49
|
+
const columns = shownColumns.filter(column => !DATASET_NOT_SUPPORT_COLUMN_TYPES.includes(column.type)).map(column => {
|
|
58
50
|
const {
|
|
59
51
|
type
|
|
60
52
|
} = column;
|
|
61
53
|
const columnWidthData = columnsWidthData.find(item => item.key === column.key);
|
|
62
54
|
const previousWidth = typeof (columnWidthData === null || columnWidthData === void 0 ? void 0 : columnWidthData.width) === 'number' && columnWidthData.width;
|
|
63
|
-
if (type ===
|
|
55
|
+
if (type === CellType.LINK) {
|
|
64
56
|
const {
|
|
65
57
|
data
|
|
66
58
|
} = column;
|
|
@@ -71,12 +63,12 @@ class Records extends _react.Component {
|
|
|
71
63
|
} = data;
|
|
72
64
|
const display_column = {
|
|
73
65
|
key: display_column_key || '0000',
|
|
74
|
-
type: array_type ||
|
|
66
|
+
type: array_type || CellType.TEXT,
|
|
75
67
|
data: array_data || null
|
|
76
68
|
};
|
|
77
69
|
return {
|
|
78
70
|
...column,
|
|
79
|
-
width: previousWidth ||
|
|
71
|
+
width: previousWidth || getCellRecordWidth(column),
|
|
80
72
|
data: {
|
|
81
73
|
...data,
|
|
82
74
|
display_column
|
|
@@ -85,7 +77,7 @@ class Records extends _react.Component {
|
|
|
85
77
|
}
|
|
86
78
|
return {
|
|
87
79
|
...column,
|
|
88
|
-
width: previousWidth ||
|
|
80
|
+
width: previousWidth || getCellRecordWidth(column)
|
|
89
81
|
};
|
|
90
82
|
});
|
|
91
83
|
const newColumnsWidthData = columns.map(column => {
|
|
@@ -102,7 +94,7 @@ class Records extends _react.Component {
|
|
|
102
94
|
const {
|
|
103
95
|
displayColumns
|
|
104
96
|
} = this.state;
|
|
105
|
-
const newDisplayColumns =
|
|
97
|
+
const newDisplayColumns = resizeColumn(column.key, Math.max(width, 50), displayColumns);
|
|
106
98
|
this.setState({
|
|
107
99
|
headerDisplayColumns: newDisplayColumns
|
|
108
100
|
});
|
|
@@ -134,13 +126,11 @@ class Records extends _react.Component {
|
|
|
134
126
|
this.resultRef.scrollLeft += deltaX;
|
|
135
127
|
};
|
|
136
128
|
this.state = {
|
|
137
|
-
scrollLeft: 0
|
|
138
|
-
};
|
|
139
|
-
this.resultContainerRef = null;
|
|
140
|
-
this.state = {
|
|
129
|
+
scrollLeft: 0,
|
|
141
130
|
displayColumns: [],
|
|
142
131
|
headerDisplayColumns: []
|
|
143
132
|
};
|
|
133
|
+
this.resultContainerRef = null;
|
|
144
134
|
}
|
|
145
135
|
componentDidUpdate(prevProps) {
|
|
146
136
|
if (prevProps.shownColumns !== this.props.shownColumns) {
|
|
@@ -162,25 +152,25 @@ class Records extends _react.Component {
|
|
|
162
152
|
const totalWidth = displayColumns.reduce((cur, nextItem) => {
|
|
163
153
|
return cur + nextItem.width;
|
|
164
154
|
}, 0);
|
|
165
|
-
return /*#__PURE__*/
|
|
155
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
166
156
|
className: "table-element-container",
|
|
167
157
|
ref: ref => this.resultContainerRef = ref
|
|
168
|
-
}, /*#__PURE__*/
|
|
158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
169
159
|
id: "sea-chart-table-element-result-container",
|
|
170
160
|
className: "table-element-result-container",
|
|
171
161
|
ref: ref => this.resultRef = ref
|
|
172
|
-
}, /*#__PURE__*/
|
|
162
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
173
163
|
id: "sea-chart-table-element-result-content",
|
|
174
164
|
className: "table-element-result-content",
|
|
175
165
|
style: {
|
|
176
166
|
width: totalWidth
|
|
177
167
|
}
|
|
178
|
-
}, /*#__PURE__*/
|
|
168
|
+
}, /*#__PURE__*/React.createElement(RecordsHeader, {
|
|
179
169
|
columns: headerDisplayColumns,
|
|
180
170
|
resizeColumnWidth: this.resizeColumnWidth,
|
|
181
171
|
resizeColumnWidthEnd: this.resizeColumnWidthEnd,
|
|
182
172
|
globalTheme: this.props.globalTheme
|
|
183
|
-
}), /*#__PURE__*/
|
|
173
|
+
}), /*#__PURE__*/React.createElement(RecordsBody, {
|
|
184
174
|
ref: ref => this.recordsBody = ref,
|
|
185
175
|
records: records,
|
|
186
176
|
columns: displayColumns,
|
|
@@ -189,11 +179,11 @@ class Records extends _react.Component {
|
|
|
189
179
|
setVerticalScrollbarTop: this.setVerticalScrollbarTop,
|
|
190
180
|
globalTheme: this.props.globalTheme,
|
|
191
181
|
setHorizontalScroll: this.setHorizontalScroll
|
|
192
|
-
}))), /*#__PURE__*/
|
|
182
|
+
}))), /*#__PURE__*/React.createElement(VerticalScrollbar, {
|
|
193
183
|
contentHeight: 33 * records.length,
|
|
194
184
|
ref: ref => this.verticalScrollbar = ref,
|
|
195
185
|
onScrollbarScroll: this.onVerticalScrollbarScroll
|
|
196
186
|
})));
|
|
197
187
|
}
|
|
198
188
|
}
|
|
199
|
-
|
|
189
|
+
export default Records;
|
package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
require("./index.css");
|
|
10
|
-
class ResizeColumnHandle extends _react.Component {
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
class ResizeColumnHandle extends Component {
|
|
11
4
|
constructor() {
|
|
12
5
|
super(...arguments);
|
|
13
6
|
this.cleanUp = () => {
|
|
@@ -45,7 +38,7 @@ class ResizeColumnHandle extends _react.Component {
|
|
|
45
38
|
this.cleanUp();
|
|
46
39
|
}
|
|
47
40
|
render() {
|
|
48
|
-
return /*#__PURE__*/
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
42
|
className: "sea-chart-record-HeaderCell__draggable",
|
|
50
43
|
onClick: e => e.stopPropagation(),
|
|
51
44
|
onDrag: this.props.onDrag,
|
|
@@ -54,4 +47,4 @@ class ResizeColumnHandle extends _react.Component {
|
|
|
54
47
|
});
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
|
-
|
|
50
|
+
export default ResizeColumnHandle;
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.openUrlLink = exports.isValidUrl = exports.getValidUrl = exports.getTrimmedString = void 0;
|
|
7
|
-
const getTrimmedString = value => {
|
|
1
|
+
export const getTrimmedString = value => {
|
|
8
2
|
return typeof value === 'string' ? value.trim() : '';
|
|
9
3
|
};
|
|
10
|
-
|
|
11
|
-
const isValidUrl = url => {
|
|
4
|
+
export const isValidUrl = url => {
|
|
12
5
|
const reg = /^(([-a-zA-Z0-9+.]+):\/\/)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/;
|
|
13
6
|
return reg.test(url);
|
|
14
7
|
};
|
|
15
|
-
|
|
16
|
-
const getValidUrl = value => {
|
|
8
|
+
export const getValidUrl = value => {
|
|
17
9
|
const url = getTrimmedString(value);
|
|
18
10
|
return isValidUrl(url) ? url : `http://${url}`;
|
|
19
11
|
};
|
|
20
|
-
|
|
21
|
-
const openUrlLink = url => {
|
|
12
|
+
export const openUrlLink = url => {
|
|
22
13
|
let a = document.createElement('a');
|
|
23
14
|
document.body.appendChild(a);
|
|
24
15
|
a.href = url;
|
|
@@ -26,5 +17,4 @@ const openUrlLink = url => {
|
|
|
26
17
|
a.rel = 'noopener noreferrer';
|
|
27
18
|
a.click();
|
|
28
19
|
document.body.removeChild(a);
|
|
29
|
-
};
|
|
30
|
-
exports.openUrlLink = openUrlLink;
|
|
20
|
+
};
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCellDisplayValue = void 0;
|
|
7
|
-
var _dtableUtils = require("dtable-utils");
|
|
8
|
-
const getCellDisplayValue = (record, column, collaborators) => {
|
|
1
|
+
import { getCellValueDisplayString } from 'dtable-utils';
|
|
2
|
+
export const getCellDisplayValue = (record, column, collaborators) => {
|
|
9
3
|
const {
|
|
10
4
|
type,
|
|
11
5
|
data,
|
|
12
6
|
key
|
|
13
7
|
} = column;
|
|
14
|
-
return
|
|
8
|
+
return getCellValueDisplayString(record, type, key, {
|
|
15
9
|
data,
|
|
16
10
|
collaborators,
|
|
17
11
|
geolocationHyphen: ' '
|
|
18
12
|
});
|
|
19
|
-
};
|
|
20
|
-
exports.getCellDisplayValue = getCellDisplayValue;
|
|
13
|
+
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
require("./index.css");
|
|
10
|
-
class VerticalScrollbar extends _react.default.Component {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
class VerticalScrollbar extends React.Component {
|
|
11
4
|
constructor() {
|
|
12
5
|
super(...arguments);
|
|
13
6
|
this.isSelfScroll = true;
|
|
@@ -28,11 +21,11 @@ class VerticalScrollbar extends _react.default.Component {
|
|
|
28
21
|
const {
|
|
29
22
|
contentHeight
|
|
30
23
|
} = this.props;
|
|
31
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
32
25
|
className: "vertical-scrollbar",
|
|
33
26
|
ref: ref => this.container = ref,
|
|
34
27
|
onScroll: this.onScroll
|
|
35
|
-
}, /*#__PURE__*/
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
36
29
|
className: "vertical-scrollbar-inner",
|
|
37
30
|
style: {
|
|
38
31
|
height: contentHeight
|
|
@@ -40,4 +33,4 @@ class VerticalScrollbar extends _react.default.Component {
|
|
|
40
33
|
}));
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
|
-
|
|
36
|
+
export default VerticalScrollbar;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _dtableUtils = require("dtable-utils");
|
|
10
|
-
var _lodashEs = require("lodash-es");
|
|
11
|
-
var _context = _interopRequireDefault(require("../../../context"));
|
|
12
|
-
var _records = _interopRequireDefault(require("./components/records"));
|
|
13
|
-
require("./css/index.css");
|
|
14
|
-
class TableElement extends _react.default.Component {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getTableById } from 'dtable-utils';
|
|
3
|
+
import { isEqual } from 'lodash-es';
|
|
4
|
+
import context from '../../../context';
|
|
5
|
+
import Records from './components/records';
|
|
6
|
+
import './css/index.css';
|
|
7
|
+
export default class TableElement extends React.Component {
|
|
15
8
|
constructor(props) {
|
|
16
9
|
super(props);
|
|
17
10
|
this.getInitState = (config, tables) => {
|
|
@@ -19,7 +12,7 @@ class TableElement extends _react.default.Component {
|
|
|
19
12
|
table_id,
|
|
20
13
|
shown_column_keys
|
|
21
14
|
} = config;
|
|
22
|
-
const selectedTable =
|
|
15
|
+
const selectedTable = getTableById(tables, table_id);
|
|
23
16
|
// if shown_column_keys was not set, use all columns
|
|
24
17
|
if (!shown_column_keys) shown_column_keys = selectedTable.columns.map(column => column.key);
|
|
25
18
|
const shownColumns = selectedTable.columns.filter(column => shown_column_keys.includes(column.key));
|
|
@@ -29,7 +22,7 @@ class TableElement extends _react.default.Component {
|
|
|
29
22
|
};
|
|
30
23
|
};
|
|
31
24
|
this.queryUsers = emails => {
|
|
32
|
-
const currentEmails =
|
|
25
|
+
const currentEmails = context.getCollaboratorsFromCache().map(user => user.email);
|
|
33
26
|
let queryEmails = emails.filter(email => {
|
|
34
27
|
return !currentEmails.includes(email);
|
|
35
28
|
});
|
|
@@ -40,18 +33,18 @@ class TableElement extends _react.default.Component {
|
|
|
40
33
|
}
|
|
41
34
|
this.isQuerying = true;
|
|
42
35
|
setTimeout(() => {
|
|
43
|
-
|
|
36
|
+
context.queryUsers(queryEmails, this.updateRelatedUser);
|
|
44
37
|
}, 500);
|
|
45
38
|
};
|
|
46
39
|
this.updateRelatedUser = emailUserMap => {
|
|
47
40
|
this.isQuerying = false;
|
|
48
|
-
const currentEmails =
|
|
41
|
+
const currentEmails = context.getCollaboratorsFromCache().map(user => user.email);
|
|
49
42
|
for (let email in emailUserMap) {
|
|
50
43
|
if (!currentEmails.includes(email)) {
|
|
51
|
-
|
|
44
|
+
context.updateCollaboratorsCache(email, emailUserMap[email]);
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
|
-
const newUsers =
|
|
47
|
+
const newUsers = context.getCollaboratorsFromCache();
|
|
55
48
|
this.relatedUserEmailMap = {};
|
|
56
49
|
newUsers.forEach(u => {
|
|
57
50
|
this.relatedUserEmailMap[u.email] = true;
|
|
@@ -68,7 +61,7 @@ class TableElement extends _react.default.Component {
|
|
|
68
61
|
config: _config
|
|
69
62
|
} = chart;
|
|
70
63
|
const initState = this.getInitState(_config, _tables);
|
|
71
|
-
initState.relatedUserList =
|
|
64
|
+
initState.relatedUserList = context.getCollaboratorsFromCache();
|
|
72
65
|
this.state = initState;
|
|
73
66
|
this.relatedUserEmailMap = {};
|
|
74
67
|
initState.relatedUserList.forEach(u => {
|
|
@@ -91,7 +84,7 @@ class TableElement extends _react.default.Component {
|
|
|
91
84
|
const {
|
|
92
85
|
config: oldConfig
|
|
93
86
|
} = oldChart;
|
|
94
|
-
if (!
|
|
87
|
+
if (!isEqual(config, oldConfig)) {
|
|
95
88
|
const state = this.getInitState(config, nextProps.tables, result);
|
|
96
89
|
this.setState(state);
|
|
97
90
|
}
|
|
@@ -108,10 +101,10 @@ class TableElement extends _react.default.Component {
|
|
|
108
101
|
selectedTable
|
|
109
102
|
} = this.state;
|
|
110
103
|
const records = Array.isArray(result) ? result : [];
|
|
111
|
-
return /*#__PURE__*/
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
112
105
|
className: "table-element-result",
|
|
113
106
|
ref: ref => this.wrapperRef = ref
|
|
114
|
-
}, /*#__PURE__*/
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Records, {
|
|
115
108
|
chart: chart,
|
|
116
109
|
selectedTable: selectedTable,
|
|
117
110
|
shownColumns: shownColumns,
|
|
@@ -121,5 +114,4 @@ class TableElement extends _react.default.Component {
|
|
|
121
114
|
globalTheme: globalTheme
|
|
122
115
|
}));
|
|
123
116
|
}
|
|
124
|
-
}
|
|
125
|
-
exports.default = TableElement;
|
|
117
|
+
}
|
|
@@ -1,29 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _lodashEs = require("lodash-es");
|
|
12
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
13
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
-
var _constants = require("../../constants");
|
|
15
|
-
var _utils = require("../../utils");
|
|
16
|
-
var _intl = _interopRequireDefault(require("../../intl"));
|
|
17
|
-
var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
|
|
18
|
-
var _chartComponent = _interopRequireDefault(require("./chart-component"));
|
|
19
|
-
class Treemap extends _chartComponent.default {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
import { isEmpty } from 'dtable-utils';
|
|
5
|
+
import { EMPTY_NAME } from '../../constants';
|
|
6
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
7
|
+
import intl from '../../intl';
|
|
8
|
+
import ToolTip from '../../components/tooltip';
|
|
9
|
+
import ChartComponent from './chart-component';
|
|
10
|
+
class Treemap extends ChartComponent {
|
|
20
11
|
constructor(props) {
|
|
21
12
|
super(props);
|
|
22
|
-
this.handleResize = () => {
|
|
23
|
-
this.destroyChart();
|
|
24
|
-
this.createChart();
|
|
25
|
-
this.drawChart();
|
|
26
|
-
};
|
|
27
13
|
this.createChart = () => {
|
|
28
14
|
const {
|
|
29
15
|
chart
|
|
@@ -40,10 +26,10 @@ class Treemap extends _chartComponent.default {
|
|
|
40
26
|
let {
|
|
41
27
|
result: data
|
|
42
28
|
} = this.props;
|
|
43
|
-
data =
|
|
29
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
44
30
|
if (!Array.isArray(data)) return;
|
|
45
31
|
this.draw(data);
|
|
46
|
-
|
|
32
|
+
isFunction(customRender) && customRender(this.chart);
|
|
47
33
|
};
|
|
48
34
|
this.showTooltip = (event, _ref) => {
|
|
49
35
|
let {
|
|
@@ -64,8 +50,8 @@ class Treemap extends _chartComponent.default {
|
|
|
64
50
|
title: data.name,
|
|
65
51
|
items: [{
|
|
66
52
|
color: '',
|
|
67
|
-
name:
|
|
68
|
-
value:
|
|
53
|
+
name: intl.get('Amount'),
|
|
54
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
|
|
69
55
|
}]
|
|
70
56
|
};
|
|
71
57
|
this.setState({
|
|
@@ -101,10 +87,10 @@ class Treemap extends _chartComponent.default {
|
|
|
101
87
|
tables,
|
|
102
88
|
chartColorTheme
|
|
103
89
|
} = this.props;
|
|
104
|
-
const colorsTheme =
|
|
90
|
+
const colorsTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
105
91
|
const {
|
|
106
92
|
data: newData
|
|
107
|
-
} =
|
|
93
|
+
} = BaseUtils.formatPieChartData(data, chart, tables, colorsTheme);
|
|
108
94
|
if (!Array.isArray(newData)) return;
|
|
109
95
|
const {
|
|
110
96
|
width: chartWidth,
|
|
@@ -143,6 +129,9 @@ class Treemap extends _chartComponent.default {
|
|
|
143
129
|
this.moveTooltip(event);
|
|
144
130
|
}).on('mouseleave', event => {
|
|
145
131
|
this.hiddenTooltip(event);
|
|
132
|
+
}).call(g => {
|
|
133
|
+
this.animateFadeIn(g);
|
|
134
|
+
this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
|
|
146
135
|
});
|
|
147
136
|
};
|
|
148
137
|
this.getFullData = data => {
|
|
@@ -150,9 +139,9 @@ class Treemap extends _chartComponent.default {
|
|
|
150
139
|
name: 'root',
|
|
151
140
|
children: data.map(item => {
|
|
152
141
|
let name = item.name;
|
|
153
|
-
item.name = name
|
|
142
|
+
item.name = isEmpty(name) ? intl.get(EMPTY_NAME) : name;
|
|
154
143
|
if (name === '_Others') {
|
|
155
|
-
item.name =
|
|
144
|
+
item.name = intl.get('Others');
|
|
156
145
|
}
|
|
157
146
|
return item;
|
|
158
147
|
})
|
|
@@ -168,12 +157,11 @@ class Treemap extends _chartComponent.default {
|
|
|
168
157
|
componentDidMount() {
|
|
169
158
|
this.createChart();
|
|
170
159
|
this.drawChart();
|
|
171
|
-
|
|
172
|
-
window.addEventListener('resize', this.debouncedHandleResize);
|
|
160
|
+
super.componentDidMount();
|
|
173
161
|
}
|
|
174
162
|
componentDidUpdate(prevProps) {
|
|
175
163
|
super.componentDidUpdate(prevProps);
|
|
176
|
-
if (
|
|
164
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
177
165
|
this.destroyChart();
|
|
178
166
|
this.createChart();
|
|
179
167
|
this.drawChart();
|
|
@@ -181,23 +169,17 @@ class Treemap extends _chartComponent.default {
|
|
|
181
169
|
}
|
|
182
170
|
componentWillUnmount() {
|
|
183
171
|
this.destroyChart();
|
|
184
|
-
|
|
172
|
+
super.componentWillUnmount();
|
|
185
173
|
}
|
|
186
174
|
render() {
|
|
187
|
-
const {
|
|
188
|
-
chart
|
|
189
|
-
} = this.props;
|
|
190
175
|
const {
|
|
191
176
|
tooltipData,
|
|
192
177
|
toolTipPosition
|
|
193
178
|
} = this.state;
|
|
194
|
-
return /*#__PURE__*/
|
|
179
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
195
180
|
ref: ref => this.container = ref,
|
|
196
|
-
className:
|
|
197
|
-
|
|
198
|
-
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
199
|
-
})
|
|
200
|
-
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
181
|
+
className: "sea-chart-container"
|
|
182
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
201
183
|
tooltipData: tooltipData,
|
|
202
184
|
toolTipPosition: toolTipPosition,
|
|
203
185
|
chart: this.chart
|
|
@@ -205,16 +187,16 @@ class Treemap extends _chartComponent.default {
|
|
|
205
187
|
}
|
|
206
188
|
}
|
|
207
189
|
Treemap.propTypes = {
|
|
208
|
-
canvasStyle:
|
|
209
|
-
chart:
|
|
210
|
-
groupbyColumn:
|
|
211
|
-
columnGroupbyColumn:
|
|
212
|
-
summaryColumn:
|
|
213
|
-
result:
|
|
214
|
-
tables:
|
|
215
|
-
globalTheme:
|
|
216
|
-
chartColorTheme:
|
|
217
|
-
toggleRecords:
|
|
218
|
-
customRender:
|
|
190
|
+
canvasStyle: PropTypes.object,
|
|
191
|
+
chart: PropTypes.object,
|
|
192
|
+
groupbyColumn: PropTypes.object,
|
|
193
|
+
columnGroupbyColumn: PropTypes.object,
|
|
194
|
+
summaryColumn: PropTypes.object,
|
|
195
|
+
result: PropTypes.array,
|
|
196
|
+
tables: PropTypes.array,
|
|
197
|
+
globalTheme: PropTypes.string,
|
|
198
|
+
chartColorTheme: PropTypes.string,
|
|
199
|
+
toggleRecords: PropTypes.func,
|
|
200
|
+
customRender: PropTypes.func
|
|
219
201
|
};
|
|
220
|
-
|
|
202
|
+
export default Treemap;
|