dtable-statistic 4.0.2-test-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/es/api/dtable-db-api.js +43 -0
- package/es/assets/css/color-picker.css +53 -0
- package/es/assets/css/color-rules-popover.css +144 -0
- package/es/assets/css/color-theme-dialog.css +40 -0
- package/es/assets/css/dashboard.css +562 -0
- package/es/assets/css/dialog.css +415 -0
- package/es/assets/css/mobile-dashboard.module.css +91 -0
- package/es/assets/css/slider.css +77 -0
- package/es/assets/css/statistic-chart.module.css +11 -0
- package/es/assets/css/statistic-custom-title.module.css +3 -0
- package/es/assets/css/statistic-custom.module.css +4 -0
- package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
- package/es/assets/css/statistic-time-picker.module.css +21 -0
- package/es/assets/css/theme.css +61 -0
- package/es/assets/images/icon.png +0 -0
- package/es/calculator/base-calculator.js +111 -0
- package/es/calculator/basic-chart-calculator.js +571 -0
- package/es/calculator/combination-calculator.js +296 -0
- package/es/calculator/compare-bar-calculator.js +291 -0
- package/es/calculator/completeness-calculator.js +307 -0
- package/es/calculator/copy-value.js +47 -0
- package/es/calculator/dashboard-calculator.js +146 -0
- package/es/calculator/heat-map-calculator.js +225 -0
- package/es/calculator/horizontal-bar-calculator.js +100 -0
- package/es/calculator/index.js +88 -0
- package/es/calculator/map-calculator.js +169 -0
- package/es/calculator/mirror-calculator.js +217 -0
- package/es/calculator/number-card-calculator.js +135 -0
- package/es/calculator/pivot-table-calculator.js +810 -0
- package/es/calculator/scatter-calculator.js +150 -0
- package/es/calculator/thread-manager.js +70 -0
- package/es/calculator/trend-calculator.js +204 -0
- package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
- package/es/calculator/workers/calculator.worker.js +22 -0
- package/es/calculator/workers/card-calculator-worker.js +28 -0
- package/es/calculator/workers/combination-calculator-worker.js +257 -0
- package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
- package/es/calculator/workers/completeness-calculator-worker.js +153 -0
- package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
- package/es/calculator/workers/mirror-calculator-worker.js +132 -0
- package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
- package/es/calculator/workers/scatter-calculator-worker.js +67 -0
- package/es/calculator/workers/trend-calculator-worker.js +93 -0
- package/es/calculator/world-map-calculator.js +193 -0
- package/es/components/common-add-tool.js +19 -0
- package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
- package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
- package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
- package/es/components/dialog/color-theme-dialog.js +71 -0
- package/es/components/dialog/enlarged-chart-dialog.js +73 -0
- package/es/components/dialog/new-table-dialog.js +113 -0
- package/es/components/dialog/new-view-dialog.js +87 -0
- package/es/components/dialog/rename-view-dialog.js +87 -0
- package/es/components/dialog/statistic-record-dialog/index.css +114 -0
- package/es/components/dialog/statistic-record-dialog/index.js +174 -0
- package/es/components/dialog/table-select-dialog.js +93 -0
- package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
- package/es/components/dtable-popover.js +109 -0
- package/es/components/dtable-search-input.js +137 -0
- package/es/components/dtable-select.js +104 -0
- package/es/components/index.js +11 -0
- package/es/components/loading.js +8 -0
- package/es/components/modal-portal.js +36 -0
- package/es/components/popover/color-rules/color-rule.js +179 -0
- package/es/components/popover/color-rules/index.js +87 -0
- package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
- package/es/components/popover/color-rules/rule-filters/index.css +214 -0
- package/es/components/popover/color-rules/rule-filters/index.js +97 -0
- package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
- package/es/components/popover/color-rules-popover.js +213 -0
- package/es/components/popover/color-selector-popover.js +85 -0
- package/es/components/seatable-radio/index.css +51 -0
- package/es/components/seatable-radio/index.js +28 -0
- package/es/components/select/index.js +2 -0
- package/es/components/select/option-group.css +104 -0
- package/es/components/select/option-group.js +225 -0
- package/es/components/select/option.js +51 -0
- package/es/components/select/select.css +211 -0
- package/es/components/select/select.js +157 -0
- package/es/components/toast/alert.js +130 -0
- package/es/components/toast/index.js +3 -0
- package/es/components/toast/toast.js +164 -0
- package/es/components/toast/toastManager.js +150 -0
- package/es/components/toast/toaster.js +64 -0
- package/es/constants/color-rules.js +8 -0
- package/es/constants/dtable-select-style.js +61 -0
- package/es/constants/event-types.js +1 -0
- package/es/constants/index.js +501 -0
- package/es/constants/key-codes.js +102 -0
- package/es/constants/zIndexes.js +1 -0
- package/es/custom-g2.js +614 -0
- package/es/dashboard.js +408 -0
- package/es/desktop-dashboard.js +299 -0
- package/es/index.js +33 -0
- package/es/locale/index.js +17 -0
- package/es/locale/lang/de.js +237 -0
- package/es/locale/lang/en.js +237 -0
- package/es/locale/lang/fr.js +237 -0
- package/es/locale/lang/zh_CN.js +237 -0
- package/es/mobile-dashboard.js +103 -0
- package/es/model/collaborators.js +11 -0
- package/es/model/stat-item.js +340 -0
- package/es/model/statistic-dashboard.js +8 -0
- package/es/service/chart-service.js +192 -0
- package/es/service/dashboard-service.js +415 -0
- package/es/stat-editor/chart-name-editor.js +75 -0
- package/es/stat-editor/index.js +74 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
- package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
- package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
- package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
- package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
- package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
- package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
- package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
- package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
- package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
- package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
- package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
- package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
- package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
- package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
- package/es/stat-list/chart-preview.js +139 -0
- package/es/stat-list/index.js +275 -0
- package/es/stat-view/area-chart.js +521 -0
- package/es/stat-view/bar-chart.js +568 -0
- package/es/stat-view/base-chart.js +44 -0
- package/es/stat-view/basic-number-card.js +255 -0
- package/es/stat-view/combination-chart.js +558 -0
- package/es/stat-view/compare-chart.js +485 -0
- package/es/stat-view/completeness-chart.js +389 -0
- package/es/stat-view/custom-bar.js +433 -0
- package/es/stat-view/dashboard-chart.js +317 -0
- package/es/stat-view/heat-map.js +501 -0
- package/es/stat-view/horizontal-bar-chart.js +569 -0
- package/es/stat-view/index.js +183 -0
- package/es/stat-view/line-chart.js +505 -0
- package/es/stat-view/map.js +428 -0
- package/es/stat-view/mirror.js +285 -0
- package/es/stat-view/pie-chart.js +326 -0
- package/es/stat-view/pivot-table/index.js +206 -0
- package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
- package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
- package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
- package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
- package/es/stat-view/ring-chart.js +416 -0
- package/es/stat-view/scatter-chart.js +367 -0
- package/es/stat-view/treemap-chart.js +318 -0
- package/es/stat-view/trend-chart.js +299 -0
- package/es/stat-view/world-map.js +443 -0
- package/es/tabs/index.js +252 -0
- package/es/tabs/statistic-tabs.module.css +154 -0
- package/es/tabs/tab.js +167 -0
- package/es/utils/basic-chart-utils.js +24 -0
- package/es/utils/cell-format.js +110 -0
- package/es/utils/cell-value.js +27 -0
- package/es/utils/collaborator.js +31 -0
- package/es/utils/color-utils.js +112 -0
- package/es/utils/column-utils.js +18 -0
- package/es/utils/column.js +13 -0
- package/es/utils/common-utils.js +303 -0
- package/es/utils/date-format.js +65 -0
- package/es/utils/export-table-utils.js +632 -0
- package/es/utils/index.js +26 -0
- package/es/utils/object.js +26 -0
- package/es/utils/row-utils.js +115 -0
- package/es/utils/search.js +67 -0
- package/es/utils/sql-utils.js +293 -0
- package/es/utils/stat-utils.js +353 -0
- package/es/utils/trend-utils.js +136 -0
- package/index.js +1 -0
- package/package.json +188 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import intl from 'react-intl-universal';
|
|
3
|
+
import { DTableSelect } from '../../../components';
|
|
4
|
+
function ColumnSettings(props) {
|
|
5
|
+
var columnsOptions = props.columnsOptions,
|
|
6
|
+
selectedColumnOption = props.selectedColumnOption,
|
|
7
|
+
onChangeSelectedColumn = props.onChangeSelectedColumn;
|
|
8
|
+
return /*#__PURE__*/React.createElement(DTableSelect, {
|
|
9
|
+
value: selectedColumnOption,
|
|
10
|
+
options: columnsOptions,
|
|
11
|
+
placeholder: intl.get('Select_a_column'),
|
|
12
|
+
onChange: onChangeSelectedColumn
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export default ColumnSettings;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Input } from 'reactstrap';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
import styles from '../../../assets/css/statistic-custom-title.module.css';
|
|
9
|
+
var CustomTitleSetting = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(CustomTitleSetting, _React$Component);
|
|
11
|
+
var _super = _createSuper(CustomTitleSetting);
|
|
12
|
+
function CustomTitleSetting(props) {
|
|
13
|
+
var _this;
|
|
14
|
+
_classCallCheck(this, CustomTitleSetting);
|
|
15
|
+
_this = _super.call(this, props);
|
|
16
|
+
_this.onKeyDown = function (event) {
|
|
17
|
+
if (event.keyCode === 13) {
|
|
18
|
+
_this.onBlur();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
_this.onBlur = function () {
|
|
22
|
+
var titleName = _this.props.titleName;
|
|
23
|
+
var newName = _this.state.titleName;
|
|
24
|
+
if (newName === titleName) return;
|
|
25
|
+
var setting = {
|
|
26
|
+
'title_name': newName
|
|
27
|
+
};
|
|
28
|
+
_this.props.updateTitleName(setting);
|
|
29
|
+
};
|
|
30
|
+
_this.onChange = function (event) {
|
|
31
|
+
var value = event.target.value;
|
|
32
|
+
var titleName = _this.state.titleName;
|
|
33
|
+
if (value === titleName) return;
|
|
34
|
+
_this.setState({
|
|
35
|
+
titleName: value
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
_this.state = {
|
|
39
|
+
titleName: props.titleName || ''
|
|
40
|
+
};
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
_createClass(CustomTitleSetting, [{
|
|
44
|
+
key: "render",
|
|
45
|
+
value: function render() {
|
|
46
|
+
var titleName = this.state.titleName;
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: styles['custom-title']
|
|
49
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Custom_title')), /*#__PURE__*/React.createElement(Input, {
|
|
50
|
+
autoComplete: "off",
|
|
51
|
+
value: titleName,
|
|
52
|
+
onChange: this.onChange,
|
|
53
|
+
onKeyDown: this.onKeyDown,
|
|
54
|
+
onBlur: this.onBlur
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}]);
|
|
58
|
+
return CustomTitleSetting;
|
|
59
|
+
}(React.Component);
|
|
60
|
+
export default CustomTitleSetting;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import intl from 'react-intl-universal';
|
|
7
|
+
import { SeaTableRadio } from '../../../components';
|
|
8
|
+
import { DATA_SORT_TYPE, DATA_SORT_TYPES, DATA_SORT_TYPE_LABEL } from '../../../constants';
|
|
9
|
+
var DataSort = /*#__PURE__*/function (_Component) {
|
|
10
|
+
_inherits(DataSort, _Component);
|
|
11
|
+
var _super = _createSuper(DataSort);
|
|
12
|
+
function DataSort(props) {
|
|
13
|
+
var _this;
|
|
14
|
+
_classCallCheck(this, DataSort);
|
|
15
|
+
_this = _super.call(this, props);
|
|
16
|
+
_this.onChangeSortType = function (type) {
|
|
17
|
+
var statItem = _this.props.statItem;
|
|
18
|
+
var sort_type = statItem.sort_type;
|
|
19
|
+
if (type === sort_type) return;
|
|
20
|
+
_this.setState({
|
|
21
|
+
sortType: type
|
|
22
|
+
}, function () {
|
|
23
|
+
_this.props.updateStatItem(Object.assign({}, statItem, {
|
|
24
|
+
sort_type: type === DATA_SORT_TYPE.NOT_SORTED ? '' : type
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var _statItem = props.statItem;
|
|
29
|
+
var _sort_type = _statItem.sort_type;
|
|
30
|
+
_this.state = {
|
|
31
|
+
sortType: _sort_type || DATA_SORT_TYPE.NOT_SORTED
|
|
32
|
+
};
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
_createClass(DataSort, [{
|
|
36
|
+
key: "render",
|
|
37
|
+
value: function render() {
|
|
38
|
+
var _this2 = this;
|
|
39
|
+
var sortType = this.state.sortType;
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "statistic-chart-parameter-item"
|
|
42
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Data_sorting')), DATA_SORT_TYPES.map(function (item, index) {
|
|
43
|
+
var isChecked = sortType === item;
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
key: 'chart-group-item-' + index,
|
|
46
|
+
className: 'chart-group-item'
|
|
47
|
+
}, /*#__PURE__*/React.createElement(SeaTableRadio, {
|
|
48
|
+
isChecked: isChecked,
|
|
49
|
+
onCheckedChange: _this2.onChangeSortType.bind(_this2, item),
|
|
50
|
+
label: intl.get(DATA_SORT_TYPE_LABEL[item])
|
|
51
|
+
}));
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}]);
|
|
55
|
+
return DataSort;
|
|
56
|
+
}(Component);
|
|
57
|
+
export default DataSort;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
var IndToggleSetting = /*#__PURE__*/function (_Component) {
|
|
7
|
+
_inherits(IndToggleSetting, _Component);
|
|
8
|
+
var _super = _createSuper(IndToggleSetting);
|
|
9
|
+
function IndToggleSetting() {
|
|
10
|
+
_classCallCheck(this, IndToggleSetting);
|
|
11
|
+
return _super.apply(this, arguments);
|
|
12
|
+
}
|
|
13
|
+
_createClass(IndToggleSetting, [{
|
|
14
|
+
key: "render",
|
|
15
|
+
value: function render() {
|
|
16
|
+
var _this$props = this.props,
|
|
17
|
+
handleToggleChange = _this$props.handleToggleChange,
|
|
18
|
+
isChecked = _this$props.isChecked,
|
|
19
|
+
label = _this$props.label;
|
|
20
|
+
var value = isChecked || false;
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: "statistic-toggle-parameter individual-toggle-parameter d-block"
|
|
23
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
24
|
+
className: "custom-switch d-flex justify-content-between align-items-start"
|
|
25
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
26
|
+
type: "checkbox",
|
|
27
|
+
className: "custom-switch-input",
|
|
28
|
+
checked: value,
|
|
29
|
+
value: value,
|
|
30
|
+
onChange: handleToggleChange,
|
|
31
|
+
name: "custom-switch-checkbox"
|
|
32
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
33
|
+
className: "custom-switch-description m-0"
|
|
34
|
+
}, label), /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
className: "custom-switch-indicator ml-2"
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
}]);
|
|
39
|
+
return IndToggleSetting;
|
|
40
|
+
}(Component);
|
|
41
|
+
export default IndToggleSetting;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import { Form, FormGroup, Label, Input } from 'reactstrap';
|
|
7
|
+
import intl from 'react-intl-universal';
|
|
8
|
+
var MinMaxSetting = /*#__PURE__*/function (_Component) {
|
|
9
|
+
_inherits(MinMaxSetting, _Component);
|
|
10
|
+
var _super = _createSuper(MinMaxSetting);
|
|
11
|
+
function MinMaxSetting(props) {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, MinMaxSetting);
|
|
14
|
+
_this = _super.call(this, props);
|
|
15
|
+
_this.onMinChange = function (e) {
|
|
16
|
+
var min = e.target.value;
|
|
17
|
+
_this.setState({
|
|
18
|
+
min: min
|
|
19
|
+
});
|
|
20
|
+
_this.props.onMinChange(min);
|
|
21
|
+
};
|
|
22
|
+
_this.onMaxChange = function (e) {
|
|
23
|
+
var max = e.target.value;
|
|
24
|
+
_this.setState({
|
|
25
|
+
max: max
|
|
26
|
+
});
|
|
27
|
+
_this.props.onMaxChange(max);
|
|
28
|
+
};
|
|
29
|
+
_this.state = {
|
|
30
|
+
min: props.min || props.min === 0 ? props.min : '',
|
|
31
|
+
max: props.max || props.max === 0 ? props.max : ''
|
|
32
|
+
};
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
_createClass(MinMaxSetting, [{
|
|
36
|
+
key: "render",
|
|
37
|
+
value: function render() {
|
|
38
|
+
var _this$state = this.state,
|
|
39
|
+
min = _this$state.min,
|
|
40
|
+
max = _this$state.max;
|
|
41
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
42
|
+
className: "mt-2"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(FormGroup, {
|
|
44
|
+
className: "mb-2"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
46
|
+
for: "min"
|
|
47
|
+
}, intl.get('Min')), /*#__PURE__*/React.createElement(Input, {
|
|
48
|
+
id: "min",
|
|
49
|
+
type: "number",
|
|
50
|
+
value: min,
|
|
51
|
+
onChange: this.onMinChange
|
|
52
|
+
})), /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, {
|
|
53
|
+
for: "max"
|
|
54
|
+
}, intl.get('Max')), /*#__PURE__*/React.createElement(Input, {
|
|
55
|
+
id: "max",
|
|
56
|
+
type: "number",
|
|
57
|
+
value: max,
|
|
58
|
+
onChange: this.onMaxChange
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
61
|
+
}]);
|
|
62
|
+
return MinMaxSetting;
|
|
63
|
+
}(Component);
|
|
64
|
+
export default MinMaxSetting;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
import intl from 'react-intl-universal';
|
|
7
|
+
import { DTableSelect } from '../../../components';
|
|
8
|
+
import { TIME_COLUMN_LIST, STAT_TYPE } from '../../../constants';
|
|
9
|
+
import style from '../../../assets/css/statistic-numeric-column-item.module.css';
|
|
10
|
+
var NumericSummaryItem = /*#__PURE__*/function (_Component) {
|
|
11
|
+
_inherits(NumericSummaryItem, _Component);
|
|
12
|
+
var _super = _createSuper(NumericSummaryItem);
|
|
13
|
+
function NumericSummaryItem(_props) {
|
|
14
|
+
var _this;
|
|
15
|
+
_classCallCheck(this, NumericSummaryItem);
|
|
16
|
+
_this = _super.call(this, _props);
|
|
17
|
+
_this.getSelectedColumnOption = function (props) {
|
|
18
|
+
var numericColumnItem = props.numericColumnItem;
|
|
19
|
+
var column_key = numericColumnItem.column_key,
|
|
20
|
+
key = numericColumnItem.key;
|
|
21
|
+
return _this.props.numericColumnsOptions.find(function (item) {
|
|
22
|
+
return item.value.key === column_key || item.value.key === key;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
_this.getSummaryMethodOptions = function (props) {
|
|
26
|
+
var summaryMethodOptions = props.summaryMethodOptions;
|
|
27
|
+
var selectedColumnOption = _this.getSelectedColumnOption(props);
|
|
28
|
+
if (selectedColumnOption && TIME_COLUMN_LIST.includes(selectedColumnOption.value.type)) {
|
|
29
|
+
return summaryMethodOptions.filter(function (option) {
|
|
30
|
+
return option.value !== 'Mean' && option.value !== 'Sum';
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return summaryMethodOptions;
|
|
34
|
+
};
|
|
35
|
+
_this.getSelectedSummaryMethodOption = function () {
|
|
36
|
+
var numericColumnItem = _this.props.numericColumnItem;
|
|
37
|
+
var summary_method = numericColumnItem.summary_method,
|
|
38
|
+
method = numericColumnItem.method;
|
|
39
|
+
return _this.summaryMethodOptions.find(function (item) {
|
|
40
|
+
return item.value === summary_method || item.value === method;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
_this.onToggleExpand = function () {
|
|
44
|
+
_this.setState({
|
|
45
|
+
isExpand: !_this.state.isExpand
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
_this.onDeleteNumericColumnItem = function (index) {
|
|
49
|
+
_this.props.onDeleteNumericColumnItem(index);
|
|
50
|
+
};
|
|
51
|
+
_this.state = {
|
|
52
|
+
isExpand: true
|
|
53
|
+
};
|
|
54
|
+
_this.summaryMethodOptions = _this.getSummaryMethodOptions(_props);
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
_createClass(NumericSummaryItem, [{
|
|
58
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
59
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
60
|
+
var numericColumnItem = nextProps.numericColumnItem;
|
|
61
|
+
if (numericColumnItem !== this.props.numericColumnItem) {
|
|
62
|
+
this.summaryMethodOptions = this.getSummaryMethodOptions(nextProps);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "render",
|
|
67
|
+
value: function render() {
|
|
68
|
+
var _this2 = this;
|
|
69
|
+
var _this$props = this.props,
|
|
70
|
+
index = _this$props.index,
|
|
71
|
+
onChangeColumnOption = _this$props.onChangeColumnOption,
|
|
72
|
+
onChangeSummaryMethod = _this$props.onChangeSummaryMethod,
|
|
73
|
+
numericColumnsOptions = _this$props.numericColumnsOptions,
|
|
74
|
+
statItem = _this$props.statItem;
|
|
75
|
+
var selectedColumnOption = this.getSelectedColumnOption(this.props);
|
|
76
|
+
var selectedSummaryMethodOption = this.getSelectedSummaryMethodOption();
|
|
77
|
+
var isExpand = this.state.isExpand;
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
style: {
|
|
80
|
+
paddingBottom: isExpand ? '14px' : '7px'
|
|
81
|
+
},
|
|
82
|
+
className: "".concat(style['container'], " statistic-chart-parameter-item")
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: style['item-title']
|
|
85
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
86
|
+
className: "title-item title-left"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
88
|
+
onClick: this.onToggleExpand,
|
|
89
|
+
className: "".concat(style['icon'], " dtable-font ").concat(isExpand ? 'dtable-icon-drop-down' : 'dtable-icon-right-slide')
|
|
90
|
+
}), /*#__PURE__*/React.createElement("label", null, (statItem.type === STAT_TYPE.PIVOT_TABLE ? intl.get('Summary_column') : intl.get('Numeric_column')) + (1 + index))), /*#__PURE__*/React.createElement("span", {
|
|
91
|
+
className: "title-item title-right"
|
|
92
|
+
}, index !== 0 && /*#__PURE__*/React.createElement("i", {
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
return _this2.onDeleteNumericColumnItem(index);
|
|
95
|
+
},
|
|
96
|
+
className: "".concat(style['close-icon'], " dtable-font dtable-icon-fork-number")
|
|
97
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: isExpand ? style['expanded-numeric-summary-content'] : style['collapsed-numeric-summary-content']
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: "".concat(style['select-item'], " numeric-column")
|
|
101
|
+
}, /*#__PURE__*/React.createElement(DTableSelect, {
|
|
102
|
+
className: 'number-column-selector',
|
|
103
|
+
value: selectedColumnOption,
|
|
104
|
+
placeholder: intl.get('Select_a_column'),
|
|
105
|
+
onChange: onChangeColumnOption.bind(this, index),
|
|
106
|
+
options: numericColumnsOptions
|
|
107
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "".concat(style['select-item'], " ").concat(style['summary-method'])
|
|
109
|
+
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
110
|
+
value: selectedSummaryMethodOption,
|
|
111
|
+
onChange: onChangeSummaryMethod.bind(this, index),
|
|
112
|
+
options: this.summaryMethodOptions
|
|
113
|
+
}))));
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
return NumericSummaryItem;
|
|
117
|
+
}(Component);
|
|
118
|
+
export default NumericSummaryItem;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Component } from 'react';
|
|
6
|
+
var ToggleSetting = /*#__PURE__*/function (_Component) {
|
|
7
|
+
_inherits(ToggleSetting, _Component);
|
|
8
|
+
var _super = _createSuper(ToggleSetting);
|
|
9
|
+
function ToggleSetting() {
|
|
10
|
+
_classCallCheck(this, ToggleSetting);
|
|
11
|
+
return _super.apply(this, arguments);
|
|
12
|
+
}
|
|
13
|
+
_createClass(ToggleSetting, [{
|
|
14
|
+
key: "render",
|
|
15
|
+
value: function render() {
|
|
16
|
+
var _this$props = this.props,
|
|
17
|
+
handleToggleChange = _this$props.handleToggleChange,
|
|
18
|
+
isChecked = _this$props.isChecked,
|
|
19
|
+
label = _this$props.label;
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "statistic-toggle-parameter"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
23
|
+
className: "custom-switch"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
25
|
+
type: "checkbox",
|
|
26
|
+
className: "custom-switch-input",
|
|
27
|
+
checked: isChecked,
|
|
28
|
+
onChange: handleToggleChange,
|
|
29
|
+
name: "custom-switch-checkbox"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
31
|
+
className: "custom-switch-indicator"
|
|
32
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
33
|
+
className: "custom-switch-description text-truncate"
|
|
34
|
+
}, label)));
|
|
35
|
+
}
|
|
36
|
+
}]);
|
|
37
|
+
return ToggleSetting;
|
|
38
|
+
}(Component);
|
|
39
|
+
export default ToggleSetting;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React, { Component } from 'react';
|
|
7
|
+
import ReactDOM from 'react-dom';
|
|
8
|
+
import html2canvas from 'html2canvas';
|
|
9
|
+
import StatView from '../stat-view';
|
|
10
|
+
import StatisticDropdownMenu from '../components/dropdown-menu/statistic-dropdown-menu';
|
|
11
|
+
import { STAT_TYPE } from '../constants';
|
|
12
|
+
var ChartPreview = /*#__PURE__*/function (_Component) {
|
|
13
|
+
_inherits(ChartPreview, _Component);
|
|
14
|
+
var _super = _createSuper(ChartPreview);
|
|
15
|
+
function ChartPreview() {
|
|
16
|
+
var _this;
|
|
17
|
+
_classCallCheck(this, ChartPreview);
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
+
args[_key] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
+
_this.onToggleShowEnlarged = function (event) {
|
|
23
|
+
if (event) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
_this.props.enlargeChart();
|
|
28
|
+
};
|
|
29
|
+
_this.onExportChart = function (statItem) {
|
|
30
|
+
var exportContainerID = 'exported-chart-container';
|
|
31
|
+
var exportContainer = document.createElement('div');
|
|
32
|
+
exportContainer.setAttribute('id', exportContainerID);
|
|
33
|
+
|
|
34
|
+
// for charts rendered with `<canvas>`
|
|
35
|
+
var id = statItem._id;
|
|
36
|
+
var originalElement = document.querySelector("#stat-item-".concat(id, " .statistic-chart-container > div"));
|
|
37
|
+
if (originalElement) {
|
|
38
|
+
var containerWidth = originalElement.scrollWidth + 15 * 2;
|
|
39
|
+
var containerHeight = originalElement.scrollHeight + 15 * 2;
|
|
40
|
+
exportContainer.setAttribute('style', "width: ".concat(containerWidth, "px; height: ").concat(containerHeight, "px;"));
|
|
41
|
+
}
|
|
42
|
+
document.body.appendChild(exportContainer);
|
|
43
|
+
ReactDOM.render(_this.renderChart(statItem), exportContainer);
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
var ele = document.querySelector("#".concat(exportContainerID, " .statistic-chart-container"));
|
|
46
|
+
if (!ele) return;
|
|
47
|
+
html2canvas(ele, {
|
|
48
|
+
windowWidth: ele.scrollWidth,
|
|
49
|
+
windowHeight: ele.scrollHeight
|
|
50
|
+
}).then(function (canvas) {
|
|
51
|
+
var eleA = document.createElement('a');
|
|
52
|
+
eleA.href = canvas.toDataURL('image/png');
|
|
53
|
+
eleA.download = "".concat(statItem.name || 'image', ".png");
|
|
54
|
+
eleA.click();
|
|
55
|
+
document.body.removeChild(exportContainer);
|
|
56
|
+
});
|
|
57
|
+
}, 1000);
|
|
58
|
+
};
|
|
59
|
+
_this.onNewTableDialogToggle = function () {
|
|
60
|
+
var statisticalResult = _this.chartView && _this.chartView.getStatData();
|
|
61
|
+
statisticalResult && _this.props.showNewTableDialog({
|
|
62
|
+
statisticalResult: statisticalResult
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
_this.onUpdateTableDialogToggle = function () {
|
|
66
|
+
var statisticalResult = _this.chartView && _this.chartView.getStatData();
|
|
67
|
+
statisticalResult && _this.props.showSelectTableDialog({
|
|
68
|
+
statisticalResult: statisticalResult
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
_this.renderChart = function (statItem) {
|
|
72
|
+
var _this$props = _this.props,
|
|
73
|
+
refresh = _this$props.refresh,
|
|
74
|
+
chartCalculator = _this$props.chartCalculator,
|
|
75
|
+
theme = _this$props.theme,
|
|
76
|
+
colorThemeName = _this$props.colorThemeName,
|
|
77
|
+
eventBus = _this$props.eventBus;
|
|
78
|
+
return /*#__PURE__*/React.createElement(StatView, {
|
|
79
|
+
ref: function ref(_ref) {
|
|
80
|
+
return _this.chartView = _ref;
|
|
81
|
+
},
|
|
82
|
+
isPreview: true,
|
|
83
|
+
refresh: refresh,
|
|
84
|
+
isEnlarge: false,
|
|
85
|
+
theme: theme,
|
|
86
|
+
colorThemeName: colorThemeName,
|
|
87
|
+
statItem: _objectSpread({}, statItem),
|
|
88
|
+
chartCalculator: chartCalculator,
|
|
89
|
+
eventBus: eventBus,
|
|
90
|
+
getTableById: _this.props.getTableById,
|
|
91
|
+
toggleStatisticRecordsDialog: _this.props.toggleStatisticRecordsDialog
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
return _this;
|
|
95
|
+
}
|
|
96
|
+
_createClass(ChartPreview, [{
|
|
97
|
+
key: "render",
|
|
98
|
+
value: function render() {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
var _this$props2 = this.props,
|
|
101
|
+
isTableReadOnly = _this$props2.isTableReadOnly,
|
|
102
|
+
statItem = _this$props2.statItem;
|
|
103
|
+
var statId = statItem._id,
|
|
104
|
+
statName = statItem.name,
|
|
105
|
+
type = statItem.type;
|
|
106
|
+
var showStatName = !(type === STAT_TYPE.BASIC_NUMBER_CARD || type === STAT_TYPE.DASHBOARD);
|
|
107
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "statistic-chart-preview-header"
|
|
109
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
110
|
+
className: "statistic-chart-preview-name"
|
|
111
|
+
}, showStatName ? statName : ''), /*#__PURE__*/React.createElement("span", {
|
|
112
|
+
className: "statistic-chart-preview-operations"
|
|
113
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: "statistic-chart-preview-microscope",
|
|
115
|
+
onClick: this.onToggleShowEnlarged
|
|
116
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
117
|
+
className: "dtable-font dtable-icon-open"
|
|
118
|
+
})), /*#__PURE__*/React.createElement(StatisticDropdownMenu, {
|
|
119
|
+
isTableReadOnly: isTableReadOnly,
|
|
120
|
+
chartType: type,
|
|
121
|
+
onExportChart: function onExportChart() {
|
|
122
|
+
return _this2.onExportChart(statItem);
|
|
123
|
+
},
|
|
124
|
+
deleteStatItem: this.props.deleteChart.bind(this, statId),
|
|
125
|
+
editStatItem: this.props.onToggleEditChart.bind(this, statId),
|
|
126
|
+
copyStatItem: this.props.copyChart.bind(this, statId),
|
|
127
|
+
onNewTableDialogToggle: this.onNewTableDialogToggle,
|
|
128
|
+
onUpdateTableDialogToggle: this.onUpdateTableDialogToggle
|
|
129
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
id: "stat-item-".concat(statItem._id),
|
|
131
|
+
className: "statistic-chart-preview-container"
|
|
132
|
+
}, this.renderChart(statItem)), /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
className: "statistic-chart-preview-container-resize"
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
}]);
|
|
137
|
+
return ChartPreview;
|
|
138
|
+
}(Component);
|
|
139
|
+
export default ChartPreview;
|