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 _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 = () => {
|
|
@@ -21,7 +13,7 @@ class Records extends _react.Component {
|
|
|
21
13
|
chart
|
|
22
14
|
} = this.props;
|
|
23
15
|
const displayColumns = this.calcuteDisplayColumns(this.props.shownColumns);
|
|
24
|
-
const container = document.querySelector(
|
|
16
|
+
const container = document.querySelector(`#sea-chart-cavans-container-${chart.id}`);
|
|
25
17
|
let resultTotalwidth = displayColumns.reduce((cur, nextItem) => {
|
|
26
18
|
return cur + nextItem.width;
|
|
27
19
|
}, 0);
|
|
@@ -52,15 +44,15 @@ class Records extends _react.Component {
|
|
|
52
44
|
const {
|
|
53
45
|
chart
|
|
54
46
|
} = this.props;
|
|
55
|
-
const columnsWidthDataStr = localStorage.getItem(
|
|
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 => {
|
|
@@ -95,14 +87,14 @@ class Records extends _react.Component {
|
|
|
95
87
|
};
|
|
96
88
|
});
|
|
97
89
|
// clear old data if there are new columns and not matched with the old data
|
|
98
|
-
localStorage.setItem(
|
|
90
|
+
localStorage.setItem(`statistic_${chart.id}_columns_width`, JSON.stringify(newColumnsWidthData));
|
|
99
91
|
return columns;
|
|
100
92
|
};
|
|
101
93
|
this.resizeColumnWidth = (column, width) => {
|
|
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
|
});
|
|
@@ -120,7 +112,7 @@ class Records extends _react.Component {
|
|
|
120
112
|
const {
|
|
121
113
|
chart
|
|
122
114
|
} = this.props;
|
|
123
|
-
localStorage.setItem(
|
|
115
|
+
localStorage.setItem(`statistic_${chart.id}_columns_width`, JSON.stringify(columnsWidthData));
|
|
124
116
|
};
|
|
125
117
|
this.setVerticalScrollbarTop = scrollTop => {
|
|
126
118
|
if (this.verticalScrollbar) {
|
|
@@ -162,25 +154,25 @@ class Records extends _react.Component {
|
|
|
162
154
|
const totalWidth = displayColumns.reduce((cur, nextItem) => {
|
|
163
155
|
return cur + nextItem.width;
|
|
164
156
|
}, 0);
|
|
165
|
-
return /*#__PURE__*/
|
|
157
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
166
158
|
className: "table-element-container",
|
|
167
159
|
ref: ref => this.resultContainerRef = ref
|
|
168
|
-
}, /*#__PURE__*/
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
169
161
|
id: "sea-chart-table-element-result-container",
|
|
170
162
|
className: "table-element-result-container",
|
|
171
163
|
ref: ref => this.resultRef = ref
|
|
172
|
-
}, /*#__PURE__*/
|
|
164
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
173
165
|
id: "sea-chart-table-element-result-content",
|
|
174
166
|
className: "table-element-result-content",
|
|
175
167
|
style: {
|
|
176
168
|
width: totalWidth
|
|
177
169
|
}
|
|
178
|
-
}, /*#__PURE__*/
|
|
170
|
+
}, /*#__PURE__*/React.createElement(RecordsHeader, {
|
|
179
171
|
columns: headerDisplayColumns,
|
|
180
172
|
resizeColumnWidth: this.resizeColumnWidth,
|
|
181
173
|
resizeColumnWidthEnd: this.resizeColumnWidthEnd,
|
|
182
174
|
globalTheme: this.props.globalTheme
|
|
183
|
-
}), /*#__PURE__*/
|
|
175
|
+
}), /*#__PURE__*/React.createElement(RecordsBody, {
|
|
184
176
|
ref: ref => this.recordsBody = ref,
|
|
185
177
|
records: records,
|
|
186
178
|
columns: displayColumns,
|
|
@@ -189,11 +181,11 @@ class Records extends _react.Component {
|
|
|
189
181
|
setVerticalScrollbarTop: this.setVerticalScrollbarTop,
|
|
190
182
|
globalTheme: this.props.globalTheme,
|
|
191
183
|
setHorizontalScroll: this.setHorizontalScroll
|
|
192
|
-
}))), /*#__PURE__*/
|
|
184
|
+
}))), /*#__PURE__*/React.createElement(VerticalScrollbar, {
|
|
193
185
|
contentHeight: 33 * records.length,
|
|
194
186
|
ref: ref => this.verticalScrollbar = ref,
|
|
195
187
|
onScrollbarScroll: this.onVerticalScrollbarScroll
|
|
196
188
|
})));
|
|
197
189
|
}
|
|
198
190
|
}
|
|
199
|
-
|
|
191
|
+
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
|
-
return isValidUrl(url) ? url :
|
|
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,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 { debounce } from 'lodash-es';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { EMPTY_NAME } from '../../constants';
|
|
7
|
+
import { BaseUtils, isFunction } from '../../utils';
|
|
8
|
+
import intl from '../../intl';
|
|
9
|
+
import ToolTip from '../../components/tooltip';
|
|
10
|
+
import ChartComponent from './chart-component';
|
|
11
|
+
class Treemap extends ChartComponent {
|
|
20
12
|
constructor(props) {
|
|
21
13
|
super(props);
|
|
22
14
|
this.handleResize = () => {
|
|
@@ -40,10 +32,10 @@ class Treemap extends _chartComponent.default {
|
|
|
40
32
|
let {
|
|
41
33
|
result: data
|
|
42
34
|
} = this.props;
|
|
43
|
-
data =
|
|
35
|
+
data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
|
|
44
36
|
if (!Array.isArray(data)) return;
|
|
45
37
|
this.draw(data);
|
|
46
|
-
|
|
38
|
+
isFunction(customRender) && customRender(this.chart);
|
|
47
39
|
};
|
|
48
40
|
this.showTooltip = (event, _ref) => {
|
|
49
41
|
let {
|
|
@@ -64,8 +56,8 @@ class Treemap extends _chartComponent.default {
|
|
|
64
56
|
title: data.name,
|
|
65
57
|
items: [{
|
|
66
58
|
color: '',
|
|
67
|
-
name:
|
|
68
|
-
value:
|
|
59
|
+
name: intl.get('Amount'),
|
|
60
|
+
value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
|
|
69
61
|
}]
|
|
70
62
|
};
|
|
71
63
|
this.setState({
|
|
@@ -101,10 +93,10 @@ class Treemap extends _chartComponent.default {
|
|
|
101
93
|
tables,
|
|
102
94
|
chartColorTheme
|
|
103
95
|
} = this.props;
|
|
104
|
-
const colorsTheme =
|
|
96
|
+
const colorsTheme = BaseUtils.getCurrentTheme(chartColorTheme);
|
|
105
97
|
const {
|
|
106
98
|
data: newData
|
|
107
|
-
} =
|
|
99
|
+
} = BaseUtils.formatPieChartData(data, chart, tables, colorsTheme);
|
|
108
100
|
if (!Array.isArray(newData)) return;
|
|
109
101
|
const {
|
|
110
102
|
width: chartWidth,
|
|
@@ -113,8 +105,8 @@ class Treemap extends _chartComponent.default {
|
|
|
113
105
|
} = this.chartBoundingClientRect;
|
|
114
106
|
const fullData = this.getFullData(newData);
|
|
115
107
|
const root = d3.treemap().size([chartWidth - insertPadding * 2, chartHeight - insertPadding * 2]).padding(1)(d3.hierarchy(fullData).sum(d => d.value)).sort((a, b) => a.value - b.value);
|
|
116
|
-
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper').attr('transform',
|
|
117
|
-
contentWrapper.selectAll().data(root.leaves()).join('g').attr('transform', d =>
|
|
108
|
+
const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper').attr('transform', `translate(${insertPadding},${insertPadding})`);
|
|
109
|
+
contentWrapper.selectAll().data(root.leaves()).join('g').attr('transform', d => `translate(${d.x0},${d.y0})`).append('rect').attr('opacity', 1).attr('fill', d => {
|
|
118
110
|
const {
|
|
119
111
|
data
|
|
120
112
|
} = d;
|
|
@@ -150,9 +142,9 @@ class Treemap extends _chartComponent.default {
|
|
|
150
142
|
name: 'root',
|
|
151
143
|
children: data.map(item => {
|
|
152
144
|
let name = item.name;
|
|
153
|
-
item.name = name || name === 0 ? name :
|
|
145
|
+
item.name = name || name === 0 ? name : intl.get(EMPTY_NAME);
|
|
154
146
|
if (name === '_Others') {
|
|
155
|
-
item.name =
|
|
147
|
+
item.name = intl.get('Others');
|
|
156
148
|
}
|
|
157
149
|
return item;
|
|
158
150
|
})
|
|
@@ -168,12 +160,12 @@ class Treemap extends _chartComponent.default {
|
|
|
168
160
|
componentDidMount() {
|
|
169
161
|
this.createChart();
|
|
170
162
|
this.drawChart();
|
|
171
|
-
this.debouncedHandleResize =
|
|
163
|
+
this.debouncedHandleResize = debounce(this.handleResize, 300);
|
|
172
164
|
window.addEventListener('resize', this.debouncedHandleResize);
|
|
173
165
|
}
|
|
174
166
|
componentDidUpdate(prevProps) {
|
|
175
167
|
super.componentDidUpdate(prevProps);
|
|
176
|
-
if (
|
|
168
|
+
if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
|
|
177
169
|
this.destroyChart();
|
|
178
170
|
this.createChart();
|
|
179
171
|
this.drawChart();
|
|
@@ -191,13 +183,13 @@ class Treemap extends _chartComponent.default {
|
|
|
191
183
|
tooltipData,
|
|
192
184
|
toolTipPosition
|
|
193
185
|
} = this.state;
|
|
194
|
-
return /*#__PURE__*/
|
|
186
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
195
187
|
ref: ref => this.container = ref,
|
|
196
|
-
className: (
|
|
188
|
+
className: classNames('sea-chart-container', {
|
|
197
189
|
'show-x-axis-label': this.isShowXAxisLabel(chart),
|
|
198
190
|
'show-y-axis-label': this.isShowYAxisLabel(chart)
|
|
199
191
|
})
|
|
200
|
-
}, /*#__PURE__*/
|
|
192
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
201
193
|
tooltipData: tooltipData,
|
|
202
194
|
toolTipPosition: toolTipPosition,
|
|
203
195
|
chart: this.chart
|
|
@@ -205,16 +197,16 @@ class Treemap extends _chartComponent.default {
|
|
|
205
197
|
}
|
|
206
198
|
}
|
|
207
199
|
Treemap.propTypes = {
|
|
208
|
-
canvasStyle:
|
|
209
|
-
chart:
|
|
210
|
-
groupbyColumn:
|
|
211
|
-
columnGroupbyColumn:
|
|
212
|
-
summaryColumn:
|
|
213
|
-
result:
|
|
214
|
-
tables:
|
|
215
|
-
globalTheme:
|
|
216
|
-
chartColorTheme:
|
|
217
|
-
toggleRecords:
|
|
218
|
-
customRender:
|
|
200
|
+
canvasStyle: PropTypes.object,
|
|
201
|
+
chart: PropTypes.object,
|
|
202
|
+
groupbyColumn: PropTypes.object,
|
|
203
|
+
columnGroupbyColumn: PropTypes.object,
|
|
204
|
+
summaryColumn: PropTypes.object,
|
|
205
|
+
result: PropTypes.array,
|
|
206
|
+
tables: PropTypes.array,
|
|
207
|
+
globalTheme: PropTypes.string,
|
|
208
|
+
chartColorTheme: PropTypes.string,
|
|
209
|
+
toggleRecords: PropTypes.func,
|
|
210
|
+
customRender: PropTypes.func
|
|
219
211
|
};
|
|
220
|
-
|
|
212
|
+
export default Treemap;
|