sea-chart 0.0.1 → 0.0.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 +117 -1
- package/dist/api/index.js +101 -0
- package/{lib → dist}/components/collaborator/index.js +8 -6
- package/{lib → dist}/components/icon/index.css +1 -1
- package/{lib → dist}/components/icon/index.js +7 -5
- package/dist/components/index.js +8 -0
- package/{lib → dist}/components/loading/index.js +4 -2
- package/dist/components/number-input/index.js +31 -0
- package/{lib → dist}/components/pixel-editor/index.css +4 -4
- package/{lib → dist}/components/pixel-editor/index.js +11 -15
- package/{lib → dist}/components/select-group/index.css +10 -10
- package/dist/components/select-group/index.js +52 -0
- package/dist/components/types-dialog/index.css +97 -0
- package/dist/components/types-dialog/index.js +117 -0
- package/{lib → dist}/constants/geolocation.js +3 -3
- package/dist/constants/index.js +184 -0
- package/{lib → dist}/constants/model.js +25 -5
- package/dist/constants/style.js +15 -0
- package/dist/constants/type-image.js +59 -0
- package/dist/constants/type.js +124 -0
- package/dist/context.js +83 -0
- package/dist/editor/index.js +41 -0
- package/dist/index.js +9 -0
- package/dist/intl.js +37 -0
- package/dist/locale/index.js +18 -0
- package/{lib → dist}/locale/lang/de.js +1 -1
- package/{lib → dist}/locale/lang/en.js +1 -1
- package/{lib → dist}/locale/lang/es.js +1 -1
- package/{lib → dist}/locale/lang/fr.js +1 -1
- package/{lib → dist}/locale/lang/pt.js +1 -1
- package/{lib → dist}/locale/lang/ru.js +1 -1
- package/{lib → dist}/locale/lang/zh_CN.js +1 -1
- package/dist/model/area-group.js +41 -0
- package/dist/model/area.js +32 -0
- package/dist/model/bar-group.js +44 -0
- package/dist/model/bar-stack.js +41 -0
- package/dist/model/bar.js +38 -0
- package/dist/model/base-model.js +9 -0
- package/dist/model/basic-number-card.js +22 -0
- package/dist/model/chart.js +23 -0
- package/dist/model/combination.js +38 -0
- package/dist/model/compare-bar.js +39 -0
- package/dist/model/completeness-group.js +24 -0
- package/dist/model/completeness.js +18 -0
- package/dist/model/dashboard.js +16 -0
- package/dist/model/generic-model.js +224 -0
- package/dist/model/heat-map.js +23 -0
- package/dist/model/horizontal-bar.js +38 -0
- package/dist/model/horizontal-group-bar.js +43 -0
- package/dist/model/index.js +63 -0
- package/dist/model/line-group.js +44 -0
- package/dist/model/line.js +38 -0
- package/dist/model/map-bubble.js +27 -0
- package/dist/model/map.js +27 -0
- package/dist/model/mirror.js +26 -0
- package/dist/model/pie.js +26 -0
- package/dist/model/ring.js +26 -0
- package/dist/model/scatter.js +19 -0
- package/dist/model/stacked-horizontal-bar.js +32 -0
- package/dist/model/table.js +23 -0
- package/dist/model/tree-map.js +20 -0
- package/dist/model/trend.js +24 -0
- package/dist/model/user.js +15 -0
- package/dist/model/world-map-bubble.js +26 -0
- package/dist/model/world-map.js +26 -0
- package/{lib/components → dist}/settings/advance-bar-settings/data-settings.js +68 -45
- package/dist/settings/advance-bar-settings/style-settings.js +161 -0
- package/{lib/components → dist}/settings/bar-settings/data-settings.js +76 -51
- package/dist/settings/bar-settings/style-settings.js +179 -0
- package/dist/settings/basic-number-card/data-settings.js +126 -0
- package/dist/settings/basic-number-card/style-settings.js +42 -0
- package/dist/settings/combination-settings/data-settings.js +279 -0
- package/dist/settings/combination-settings/style-settings.js +174 -0
- package/dist/settings/dashboard-settings/data-settings.js +179 -0
- package/{lib/components → dist}/settings/data-settings.js +28 -22
- package/dist/settings/horizontal-bar-settings/data-settings.js +55 -0
- package/dist/settings/horizontal-bar-settings/style-settings.js +46 -0
- package/dist/settings/index.css +85 -0
- package/dist/settings/index.js +76 -0
- package/{lib/components → dist}/settings/pie-settings/data-settings.js +67 -44
- package/{lib/components → dist}/settings/pie-settings/style-settings.js +67 -49
- package/dist/settings/style-settings.js +118 -0
- package/{lib/components → dist}/settings/table-settings/data-settings.js +269 -208
- package/{lib/components → dist}/settings/time-comparison-settings/data-settings.js +82 -67
- package/dist/settings/time-comparison-settings/style-settings.js +213 -0
- package/dist/settings/widgets/basic-summary/index.css +12 -0
- package/dist/settings/widgets/basic-summary/index.js +176 -0
- package/{lib/components/settings/widgets/statistic-type → dist/settings/widgets/chart-type}/index.css +5 -5
- package/dist/settings/widgets/chart-type/index.js +59 -0
- package/{lib/components → dist}/settings/widgets/common-data-settings.js +24 -18
- package/dist/settings/widgets/data-filter/index.css +17 -0
- package/{lib/components → dist}/settings/widgets/data-filter/index.js +51 -37
- package/dist/settings/widgets/data-sort.js +44 -0
- package/dist/settings/widgets/date-summary-item.js +111 -0
- package/dist/settings/widgets/display-values-settings/index.css +13 -0
- package/{lib/components → dist}/settings/widgets/display-values-settings/index.js +19 -14
- package/{lib/components → dist}/settings/widgets/divider/index.css +1 -1
- package/dist/settings/widgets/divider/index.js +12 -0
- package/{lib/components → dist}/settings/widgets/font-settings/font-size-settings.js +14 -12
- package/{lib/components → dist}/settings/widgets/font-settings/font-weight-settings.js +14 -16
- package/dist/settings/widgets/group-by.js +160 -0
- package/{lib/components → dist}/settings/widgets/label-color.js +10 -10
- package/dist/settings/widgets/min-max-setting.js +52 -0
- package/dist/settings/widgets/mininum-slice-percent.js +63 -0
- package/dist/settings/widgets/numeric-summary-item.js +90 -0
- package/dist/settings/widgets/select-table/index.js +38 -0
- package/dist/settings/widgets/stack.js +50 -0
- package/dist/settings/widgets/summary-method-setting.js +66 -0
- package/dist/settings/widgets/summary-settings.js +411 -0
- package/dist/settings/widgets/switch/index.css +37 -0
- package/{lib/components → dist}/settings/widgets/switch/index.js +11 -8
- package/{lib/components → dist}/settings/widgets/text-horizontal-settings.js +12 -10
- package/dist/settings/widgets/time-picker.js +174 -0
- package/{lib/components → dist}/settings/widgets/title-settings/index.js +15 -13
- package/dist/settings/widgets/title-settings/title-text.js +25 -0
- package/dist/settings/widgets/x-axios.js +0 -0
- package/dist/settings/widgets/y-axis-group-settings.js +438 -0
- package/dist/utils/cell-format-utils.js +42 -0
- package/dist/utils/chart-data-sql.js +606 -0
- package/dist/utils/chart-utils.js +1803 -0
- package/dist/utils/chart.js +6 -0
- package/dist/utils/collaborator-manager.js +24 -0
- package/dist/utils/collaborator-utils.js +40 -0
- package/dist/utils/column-2-sql-column.js +551 -0
- package/dist/utils/column-utils.js +208 -0
- package/{lib → dist}/utils/custom-g2.js +11 -11
- package/{lib → dist}/utils/date-translate.js +11 -11
- package/dist/utils/index.js +48 -0
- package/dist/utils/key-generator.js +13 -0
- package/dist/utils/object-utils.js +45 -0
- package/{lib → dist}/utils/options-utils.js +17 -18
- package/dist/view/index.css +53 -0
- package/dist/view/index.js +169 -0
- package/{lib/layout → dist/view}/title/index.css +1 -1
- package/dist/view/title/index.js +46 -0
- package/dist/view/wrapper/area.js +150 -0
- package/dist/view/wrapper/bar-group.js +148 -0
- package/dist/view/wrapper/bar.js +138 -0
- package/dist/view/wrapper/basic-number-card.js +127 -0
- package/dist/view/wrapper/chart-component.js +261 -0
- package/dist/view/wrapper/combination.js +399 -0
- package/dist/view/wrapper/dashboard.js +164 -0
- package/dist/view/wrapper/horizontal-bar-group.js +149 -0
- package/dist/view/wrapper/horizontal-bar.js +140 -0
- package/dist/view/wrapper/horizontal-component.js +78 -0
- package/{lib/components/formatter → dist/view/wrapper}/index.js +90 -71
- package/dist/view/wrapper/line-group.js +145 -0
- package/dist/view/wrapper/line.js +157 -0
- package/dist/view/wrapper/pie.js +185 -0
- package/dist/view/wrapper/ring.js +264 -0
- package/{lib/components/formatter → dist/view/wrapper}/table/index.css +18 -18
- package/dist/view/wrapper/table/index.js +31 -0
- package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +144 -0
- package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +198 -0
- package/dist/view/wrapper/table/pivot-table-display-name.js +248 -0
- package/dist/view/wrapper/table/two-dimension-table.js +249 -0
- package/dist/view/wrapper/treemap.js +186 -0
- package/package.json +91 -100
- package/lib/components/formatter/area.js +0 -162
- package/lib/components/formatter/bar-group.js +0 -160
- package/lib/components/formatter/bar.js +0 -150
- package/lib/components/formatter/basic-number-card.js +0 -138
- package/lib/components/formatter/chart-component.js +0 -266
- package/lib/components/formatter/combination.js +0 -407
- package/lib/components/formatter/dashboard.js +0 -182
- package/lib/components/formatter/horizontal-bar-group.js +0 -161
- package/lib/components/formatter/horizontal-bar.js +0 -152
- package/lib/components/formatter/horizontal-component.js +0 -91
- package/lib/components/formatter/line-group.js +0 -157
- package/lib/components/formatter/line.js +0 -170
- package/lib/components/formatter/pie.js +0 -201
- package/lib/components/formatter/ring.js +0 -277
- package/lib/components/formatter/table/index.js +0 -42
- package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +0 -145
- package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +0 -193
- package/lib/components/formatter/table/pivot-table-display-name.js +0 -249
- package/lib/components/formatter/table/two-dimension-table.js +0 -241
- package/lib/components/formatter/treemap.js +0 -213
- package/lib/components/index.js +0 -5
- package/lib/components/number-input/index.js +0 -31
- package/lib/components/select-group/index.js +0 -63
- package/lib/components/settings/advance-bar-settings/style-settings.js +0 -149
- package/lib/components/settings/bar-settings/style-settings.js +0 -163
- package/lib/components/settings/basic-number-card/data-settings.js +0 -121
- package/lib/components/settings/basic-number-card/style-settings.js +0 -42
- package/lib/components/settings/combination-settings/data-settings.js +0 -256
- package/lib/components/settings/combination-settings/style-settings.js +0 -183
- package/lib/components/settings/dashboard-settings/data-settings.js +0 -167
- package/lib/components/settings/horizontal-bar-settings/data-settings.js +0 -45
- package/lib/components/settings/horizontal-bar-settings/style-settings.js +0 -38
- package/lib/components/settings/index.css +0 -73
- package/lib/components/settings/index.js +0 -74
- package/lib/components/settings/style-settings.js +0 -100
- package/lib/components/settings/time-comparison-settings/style-settings.js +0 -191
- package/lib/components/settings/widgets/basic-summary/index.css +0 -12
- package/lib/components/settings/widgets/basic-summary/index.js +0 -173
- package/lib/components/settings/widgets/data-filter/index.css +0 -17
- package/lib/components/settings/widgets/data-sort.js +0 -38
- package/lib/components/settings/widgets/date-summary-item.js +0 -126
- package/lib/components/settings/widgets/display-values-settings/index.css +0 -13
- package/lib/components/settings/widgets/divider/index.js +0 -10
- package/lib/components/settings/widgets/group-by.js +0 -168
- package/lib/components/settings/widgets/min-max-setting.js +0 -64
- package/lib/components/settings/widgets/mininum-slice-percent.js +0 -72
- package/lib/components/settings/widgets/numeric-summary-item.js +0 -109
- package/lib/components/settings/widgets/select-table/index.js +0 -49
- package/lib/components/settings/widgets/stack.js +0 -58
- package/lib/components/settings/widgets/statistic-type/index.js +0 -54
- package/lib/components/settings/widgets/summary-method-setting.js +0 -80
- package/lib/components/settings/widgets/summary-settings.js +0 -394
- package/lib/components/settings/widgets/switch/index.css +0 -37
- package/lib/components/settings/widgets/time-picker.js +0 -182
- package/lib/components/settings/widgets/title-settings/title-text.js +0 -31
- package/lib/components/settings/widgets/y-axis-group-settings.js +0 -399
- package/lib/components/types-dialog/index.css +0 -97
- package/lib/components/types-dialog/index.js +0 -127
- package/lib/constants/index.js +0 -164
- package/lib/constants/style.js +0 -13
- package/lib/constants/type-image.js +0 -32
- package/lib/constants/type.js +0 -97
- package/lib/context.js +0 -49
- package/lib/index.js +0 -6
- package/lib/intl.js +0 -37
- package/lib/layout/index.js +0 -4
- package/lib/layout/statistic/index.css +0 -53
- package/lib/layout/statistic/index.js +0 -190
- package/lib/layout/title/index.js +0 -41
- package/lib/locale/index.js +0 -11
- package/lib/model/area-group.js +0 -51
- package/lib/model/area.js +0 -42
- package/lib/model/bar-group.js +0 -54
- package/lib/model/bar-stack.js +0 -51
- package/lib/model/bar.js +0 -48
- package/lib/model/base-model.js +0 -11
- package/lib/model/basic-number-card.js +0 -32
- package/lib/model/combination.js +0 -48
- package/lib/model/compare-bar.js +0 -49
- package/lib/model/completeness-group.js +0 -34
- package/lib/model/completeness.js +0 -28
- package/lib/model/dashboard.js +0 -26
- package/lib/model/generic-model.js +0 -235
- package/lib/model/heat-map.js +0 -33
- package/lib/model/horizontal-bar.js +0 -48
- package/lib/model/horizontal-group-bar.js +0 -53
- package/lib/model/index.js +0 -36
- package/lib/model/line-group.js +0 -54
- package/lib/model/line.js +0 -48
- package/lib/model/map-bubble.js +0 -37
- package/lib/model/map.js +0 -37
- package/lib/model/mirror.js +0 -36
- package/lib/model/pie.js +0 -36
- package/lib/model/ring.js +0 -36
- package/lib/model/scatter.js +0 -29
- package/lib/model/stacked-horizontal-bar.js +0 -42
- package/lib/model/statistic.js +0 -22
- package/lib/model/table.js +0 -33
- package/lib/model/tree-map.js +0 -30
- package/lib/model/trend.js +0 -34
- package/lib/model/user.js +0 -22
- package/lib/model/world-map-bubble.js +0 -36
- package/lib/model/world-map.js +0 -36
- package/lib/utils/cell-format-utils.js +0 -41
- package/lib/utils/chart.js +0 -6
- package/lib/utils/collaborator-utils.js +0 -40
- package/lib/utils/column-utils.js +0 -247
- package/lib/utils/data-filter/filter-item-utils.js +0 -80
- package/lib/utils/data-filter/filters-utils.js +0 -406
- package/lib/utils/data-filter/index.js +0 -3
- package/lib/utils/index.js +0 -50
- package/lib/utils/key-generator.js +0 -13
- package/lib/utils/object-utils.js +0 -61
- package/lib/utils/statistic-column-2-sql-column-utils.js +0 -499
- package/lib/utils/statistic-utils.js +0 -1685
- /package/{lib → dist}/assets/icons/area-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/bar-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/card.svg +0 -0
- /package/{lib → dist}/assets/icons/combination-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/dtable-logo.svg +0 -0
- /package/{lib → dist}/assets/icons/facet-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/gauge.svg +0 -0
- /package/{lib → dist}/assets/icons/heat-map.svg +0 -0
- /package/{lib → dist}/assets/icons/histogram.svg +0 -0
- /package/{lib → dist}/assets/icons/line-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/map.svg +0 -0
- /package/{lib → dist}/assets/icons/pie-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/rectangular-tree-diagram.svg +0 -0
- /package/{lib → dist}/assets/icons/scatter-chart.svg +0 -0
- /package/{lib → dist}/assets/icons/type-change.svg +0 -0
- /package/{lib → dist}/assets/img/area-chart.png +0 -0
- /package/{lib → dist}/assets/img/area-group-chart.png +0 -0
- /package/{lib → dist}/assets/img/bar-group.png +0 -0
- /package/{lib → dist}/assets/img/bar-stack.png +0 -0
- /package/{lib → dist}/assets/img/bar.png +0 -0
- /package/{lib → dist}/assets/img/combination-chart.png +0 -0
- /package/{lib → dist}/assets/img/compared-chart.png +0 -0
- /package/{lib → dist}/assets/img/completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/custom-bar.png +0 -0
- /package/{lib → dist}/assets/img/dashboard-chart.png +0 -0
- /package/{lib → dist}/assets/img/group-completeness-chart.png +0 -0
- /package/{lib → dist}/assets/img/group_line.png +0 -0
- /package/{lib → dist}/assets/img/heat-map.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/horizontal-group-bar.png +0 -0
- /package/{lib → dist}/assets/img/line.png +0 -0
- /package/{lib → dist}/assets/img/map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/map.png +0 -0
- /package/{lib → dist}/assets/img/mirror.png +0 -0
- /package/{lib → dist}/assets/img/number-card.png +0 -0
- /package/{lib → dist}/assets/img/pie.png +0 -0
- /package/{lib → dist}/assets/img/pivot-table.png +0 -0
- /package/{lib → dist}/assets/img/ring.png +0 -0
- /package/{lib → dist}/assets/img/scatter.png +0 -0
- /package/{lib → dist}/assets/img/stacked-horizontal-bar.png +0 -0
- /package/{lib → dist}/assets/img/treemap.png +0 -0
- /package/{lib → dist}/assets/img/trend-chart.png +0 -0
- /package/{lib → dist}/assets/img/world-map-bubble.png +0 -0
- /package/{lib → dist}/assets/img/world-map.png +0 -0
- /package/{lib → dist}/components/loading/index.css +0 -0
- /package/{lib/components/settings/widgets/select-table → dist/editor}/index.css +0 -0
- /package/{lib/components → dist}/settings/advance-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/basic-number-card/index.js +0 -0
- /package/{lib/components → dist}/settings/combination-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/dashboard-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/horizontal-bar-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/pie-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/table-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/time-comparison-settings/index.js +0 -0
- /package/{lib/components → dist}/settings/widgets/font-settings/index.js +0 -0
- /package/{lib/components/settings/widgets/x-axios.js → dist/settings/widgets/select-table/index.css} +0 -0
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
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, Fragment } from 'react';
|
|
7
|
-
import { COLUMNS_ICON_CONFIG, getTableById } from 'dtable-utils';
|
|
8
|
-
import { FormGroup, Label } from 'reactstrap';
|
|
9
|
-
import DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
10
|
-
import NumericSummaryItem from './numeric-summary-item';
|
|
11
|
-
import { StatisticsUtils } from '../../../utils';
|
|
12
|
-
import { STATISTIC_SUMMARY_SHOW, STATISTIC_SUMMARY_CALCULATION_METHOD, STATISTIC_SUMMARY_TYPE, STATISTIC_Y_GROUP_TYPE, STATISTIC_TYPE, STATISTIC_SUPPORT_COLUMNS, STATISTIC_DATE_SUMMARY_CALCULATION_METHOD } from '../../../constants';
|
|
13
|
-
import intl from '../../../intl';
|
|
14
|
-
var SummarySettings = /*#__PURE__*/function (_Component) {
|
|
15
|
-
_inherits(SummarySettings, _Component);
|
|
16
|
-
var _super = _createSuper(SummarySettings);
|
|
17
|
-
function SummarySettings(_props) {
|
|
18
|
-
var _this;
|
|
19
|
-
_classCallCheck(this, SummarySettings);
|
|
20
|
-
_this = _super.call(this, _props);
|
|
21
|
-
_this.initTable = function (props) {
|
|
22
|
-
var config = props.config,
|
|
23
|
-
tables = props.tables;
|
|
24
|
-
var table_id = config.table_id;
|
|
25
|
-
_this.selectedTable = getTableById(tables, table_id);
|
|
26
|
-
};
|
|
27
|
-
_this.initColumns = function () {
|
|
28
|
-
if (!_this.selectedTable) {
|
|
29
|
-
_this.numericColumns = [];
|
|
30
|
-
_this.numericColumnsOptions = [];
|
|
31
|
-
_this.columnGroupbyColumnsOptions = [];
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
var columns = Array.isArray(_this.selectedTable.columns) ? _this.selectedTable.columns : [];
|
|
35
|
-
_this.columns = _this.getAvailableColumns(columns);
|
|
36
|
-
_this.columnGroupbyColumnsOptions = _this.getColumnOptions(_this.columns);
|
|
37
|
-
_this.numericColumns = _this.columns.filter(function (column) {
|
|
38
|
-
return StatisticsUtils.isNumericSummaryColumn(column);
|
|
39
|
-
});
|
|
40
|
-
_this.numericColumnsOptions = _this.getColumnOptions(_this.numericColumns);
|
|
41
|
-
};
|
|
42
|
-
_this.getAvailableColumns = function (columns) {
|
|
43
|
-
if (!columns || !Array.isArray(columns)) return [];
|
|
44
|
-
return columns.filter(function (column) {
|
|
45
|
-
return STATISTIC_SUPPORT_COLUMNS.includes(column.type);
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
_this.getColumnOptions = function (columns) {
|
|
49
|
-
var options = columns.map(function (column) {
|
|
50
|
-
return {
|
|
51
|
-
value: column,
|
|
52
|
-
label: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
53
|
-
className: "header-icon"
|
|
54
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
55
|
-
className: COLUMNS_ICON_CONFIG[column.type]
|
|
56
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
57
|
-
className: 'select-module select-module-name ml-0'
|
|
58
|
-
}, column.name))
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
return [{
|
|
62
|
-
value: {
|
|
63
|
-
key: 'Groupby_null'
|
|
64
|
-
},
|
|
65
|
-
label: /*#__PURE__*/React.createElement("span", {
|
|
66
|
-
className: 'select-module select-module-name null-option-name ml-0'
|
|
67
|
-
}, intl.get('Select_a_column')),
|
|
68
|
-
style: {
|
|
69
|
-
color: 'rgba(0, 0, 0, .25)'
|
|
70
|
-
}
|
|
71
|
-
}].concat(_toConsumableArray(options));
|
|
72
|
-
};
|
|
73
|
-
_this.getSummaryTypeOptions = function () {
|
|
74
|
-
var summaryTypes = [{
|
|
75
|
-
value: STATISTIC_Y_GROUP_TYPE.COUNT,
|
|
76
|
-
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
77
|
-
className: "select-module select-module-name ml-0"
|
|
78
|
-
}, intl.get(STATISTIC_SUMMARY_SHOW['count'])), /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className: "summary-type-explanation"
|
|
80
|
-
}, intl.get('Count_the_number_of_records_in_each_group')))
|
|
81
|
-
}, {
|
|
82
|
-
value: STATISTIC_Y_GROUP_TYPE.SINGLE_NUMERIC_COLUMN,
|
|
83
|
-
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
84
|
-
className: "select-module select-module-name ml-0"
|
|
85
|
-
}, intl.get(STATISTIC_SUMMARY_SHOW['advanced'])), /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: "summary-type-explanation"
|
|
87
|
-
}, intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_a_field')))
|
|
88
|
-
}];
|
|
89
|
-
|
|
90
|
-
// multiple_numeric_column
|
|
91
|
-
if (_this.props.useMultipleSummaryColumns) {
|
|
92
|
-
summaryTypes.push({
|
|
93
|
-
value: STATISTIC_Y_GROUP_TYPE.MULTIPLE_NUMERIC_COLUMN,
|
|
94
|
-
label: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: "select-module select-module-name ml-0"
|
|
96
|
-
}, intl.get('Summarize_multiple_fields')), /*#__PURE__*/React.createElement("div", {
|
|
97
|
-
className: "summary-type-explanation"
|
|
98
|
-
}, intl.get('Compute_the_sum_maximum_or_minimum_value_of_records_in_each_group_by_multiple_fields')))
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return summaryTypes;
|
|
102
|
-
};
|
|
103
|
-
_this.getSummaryExplanation = function () {
|
|
104
|
-
var config = _this.props.config;
|
|
105
|
-
var chartType = config.type;
|
|
106
|
-
var variable = '';
|
|
107
|
-
if (chartType === STATISTIC_TYPE.MAP) {
|
|
108
|
-
variable = '位置字段';
|
|
109
|
-
}
|
|
110
|
-
if (chartType === STATISTIC_TYPE.WORLD_MAP) {
|
|
111
|
-
variable = intl.get('Location_field');
|
|
112
|
-
}
|
|
113
|
-
if (chartType === STATISTIC_TYPE.HEAT_MAP) {
|
|
114
|
-
variable = intl.get('Time_field');
|
|
115
|
-
}
|
|
116
|
-
if (chartType === STATISTIC_TYPE.MIRROR) {
|
|
117
|
-
variable = intl.get('Statistic_field');
|
|
118
|
-
}
|
|
119
|
-
if (chartType === STATISTIC_TYPE.COMBINATION) {
|
|
120
|
-
variable = intl.get('X-axis');
|
|
121
|
-
}
|
|
122
|
-
if (chartType === STATISTIC_TYPE.TREND) {
|
|
123
|
-
return {
|
|
124
|
-
count: intl.get('Calculate_the_number_of_records_in_two_time_periods'),
|
|
125
|
-
advanced: intl.get('Use_a_field_to_calculate_the_sum_maximum_or_minimum_value_of_records_in_two_time_periods')
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
count: intl.get('Count_by_var', {
|
|
130
|
-
var: variable
|
|
131
|
-
}),
|
|
132
|
-
advanced: intl.get('Compute_sum_max_min_by_var', {
|
|
133
|
-
var: variable
|
|
134
|
-
})
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
_this.getSummaryMethodsOptions = function () {
|
|
138
|
-
return STATISTIC_SUMMARY_CALCULATION_METHOD.map(function (method) {
|
|
139
|
-
return {
|
|
140
|
-
label: /*#__PURE__*/React.createElement("span", {
|
|
141
|
-
className: "select-option-name"
|
|
142
|
-
}, intl.get(STATISTIC_SUMMARY_SHOW[method])),
|
|
143
|
-
value: method
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
_this.getSelectedMethodOption = function (method, summaryMethodsOptions) {
|
|
148
|
-
return summaryMethodsOptions.find(function (m) {
|
|
149
|
-
return m.value === method;
|
|
150
|
-
}) || summaryMethodsOptions[0];
|
|
151
|
-
};
|
|
152
|
-
_this.renderSummaryTypes = function () {
|
|
153
|
-
var label = _this.props.label;
|
|
154
|
-
var selectedSummaryType = _this.getSelectedSummaryType();
|
|
155
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
156
|
-
className: "seastatistic-parameter-item"
|
|
157
|
-
}, /*#__PURE__*/React.createElement(Label, null, label), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
158
|
-
classNamePrefix: "chart-summary-types",
|
|
159
|
-
value: selectedSummaryType,
|
|
160
|
-
onChange: _this.onChangeSummaryType,
|
|
161
|
-
options: _this.summaryTypeOptions
|
|
162
|
-
}));
|
|
163
|
-
};
|
|
164
|
-
_this.getSelectedSummaryType = function () {
|
|
165
|
-
var _this$props = _this.props,
|
|
166
|
-
_this$props$summaryTy = _this$props.summaryType,
|
|
167
|
-
summaryType = _this$props$summaryTy === void 0 ? STATISTIC_SUMMARY_TYPE.COUNT : _this$props$summaryTy,
|
|
168
|
-
config = _this$props.config,
|
|
169
|
-
useMultipleSummaryColumns = _this$props.useMultipleSummaryColumns;
|
|
170
|
-
if (summaryType === STATISTIC_SUMMARY_TYPE.COUNT) {
|
|
171
|
-
return _this.summaryTypeOptions[0];
|
|
172
|
-
}
|
|
173
|
-
if (config.type === STATISTIC_TYPE.COMBINATION && config.y_axis_left_group_by_multiple_numeric_column && useMultipleSummaryColumns) {
|
|
174
|
-
return _this.summaryTypeOptions[2];
|
|
175
|
-
}
|
|
176
|
-
return _this.summaryTypeOptions[1];
|
|
177
|
-
};
|
|
178
|
-
_this.onChangeSummaryType = function (option) {
|
|
179
|
-
var type = option.value;
|
|
180
|
-
var summaryType = _this.props.summaryType;
|
|
181
|
-
if (type === summaryType) return;
|
|
182
|
-
_this.props.onChangeSummaryType(type);
|
|
183
|
-
};
|
|
184
|
-
_this.onSelectSummaryColumn = function (option) {
|
|
185
|
-
_this.props.onSelectSummaryColumn(option.value.key);
|
|
186
|
-
};
|
|
187
|
-
_this.renderNumericColumn = function () {
|
|
188
|
-
var summaryColumn = _this.props.summaryColumn;
|
|
189
|
-
var selectedColumnOption = _this.numericColumnsOptions.find(function (o) {
|
|
190
|
-
return o.value.key === summaryColumn;
|
|
191
|
-
});
|
|
192
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
193
|
-
className: "seastatistic-parameter-item"
|
|
194
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Numeric_field')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
195
|
-
value: selectedColumnOption,
|
|
196
|
-
onChange: _this.onSelectSummaryColumn,
|
|
197
|
-
options: _this.numericColumnsOptions,
|
|
198
|
-
placeholder: intl.get('Select_a_column'),
|
|
199
|
-
noOptionsMessage: function noOptionsMessage() {
|
|
200
|
-
return /*#__PURE__*/React.createElement("span", null, intl.get('No_options'));
|
|
201
|
-
}
|
|
202
|
-
}));
|
|
203
|
-
};
|
|
204
|
-
_this.renderSummaryMethod = function () {
|
|
205
|
-
var selectedMethodOption = _this.getSelectedMethodOption(_this.props.summaryMethod, _this.summaryMethodsOptions);
|
|
206
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
207
|
-
className: "seastatistic-parameter-item"
|
|
208
|
-
}, /*#__PURE__*/React.createElement("label", null, intl.get('Summary_method')), /*#__PURE__*/React.createElement(DTableSelect, {
|
|
209
|
-
value: selectedMethodOption,
|
|
210
|
-
onChange: _this.onSelectSummaryMethod,
|
|
211
|
-
options: _this.summaryMethodsOptions
|
|
212
|
-
}));
|
|
213
|
-
};
|
|
214
|
-
_this.onSelectSummaryMethod = function (option) {
|
|
215
|
-
_this.props.onSelectSummaryMethod(option.value);
|
|
216
|
-
};
|
|
217
|
-
_this.renderNumericSummaryItem = function () {
|
|
218
|
-
var _this$props2 = _this.props,
|
|
219
|
-
config = _this$props2.config,
|
|
220
|
-
statistic = _this$props2.statistic;
|
|
221
|
-
var type = config.type;
|
|
222
|
-
var column_key, summary_method;
|
|
223
|
-
if (type === STATISTIC_TYPE.COMBINATION) {
|
|
224
|
-
column_key = config.y_axis_left_summary_column;
|
|
225
|
-
summary_method = config.y_axis_left_summary_method;
|
|
226
|
-
}
|
|
227
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
228
|
-
statistic: statistic,
|
|
229
|
-
key: "number-column-".concat(0),
|
|
230
|
-
numericColumnOptions: _this.numericColumnsOptions,
|
|
231
|
-
onColumnOptionChange: _this.onChangeNumericSummaryColumn,
|
|
232
|
-
onSummaryMethodChange: _this.onChangeNumericSummaryMethod,
|
|
233
|
-
index: 0,
|
|
234
|
-
value: {
|
|
235
|
-
column_key: column_key,
|
|
236
|
-
summary_method: summary_method
|
|
237
|
-
}
|
|
238
|
-
}), _this.renderGroupbyNumericColumns(), Array.isArray(_this.numericColumnsOptions) && _this.numericColumnsOptions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
239
|
-
className: "statistics-add-number-columns d-flex align-items-center",
|
|
240
|
-
onClick: _this.onAddNumericColumn
|
|
241
|
-
}, /*#__PURE__*/React.createElement("i", {
|
|
242
|
-
className: "dtable-font dtable-icon-add-table mr-2"
|
|
243
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
244
|
-
className: "number-column-item add-number-column-description"
|
|
245
|
-
}, intl.get('Add_new_field'))));
|
|
246
|
-
};
|
|
247
|
-
_this.onDeleteNumericColumnItem = function (index) {
|
|
248
|
-
var _ref = _this.props.config || {},
|
|
249
|
-
y_axis_left_group_by_numeric_columns = _ref.y_axis_left_group_by_numeric_columns;
|
|
250
|
-
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
251
|
-
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
252
|
-
y_axis_left_group_by_numeric_columns.splice(index - 1, 1);
|
|
253
|
-
_this.props.onChange({
|
|
254
|
-
y_axis_left_group_by_numeric_columns: _toConsumableArray(y_axis_left_group_by_numeric_columns)
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
_this.onAddNumericColumn = function () {
|
|
258
|
-
var config = _this.props.config;
|
|
259
|
-
var _ref2 = config || {},
|
|
260
|
-
y_axis_left_group_by_numeric_columns = _ref2.y_axis_left_group_by_numeric_columns;
|
|
261
|
-
var newNumericColumnKey = _this.numericColumnsOptions[0].value.key;
|
|
262
|
-
if (Array.isArray(y_axis_left_group_by_numeric_columns)) {
|
|
263
|
-
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
264
|
-
y_axis_left_group_by_numeric_columns.push({
|
|
265
|
-
column_key: newNumericColumnKey,
|
|
266
|
-
summary_method: STATISTIC_SUMMARY_CALCULATION_METHOD[0]
|
|
267
|
-
});
|
|
268
|
-
} else {
|
|
269
|
-
y_axis_left_group_by_numeric_columns = [{
|
|
270
|
-
column_key: newNumericColumnKey,
|
|
271
|
-
summary_method: STATISTIC_SUMMARY_CALCULATION_METHOD[0]
|
|
272
|
-
}];
|
|
273
|
-
}
|
|
274
|
-
_this.props.onChange({
|
|
275
|
-
y_axis_left_group_by_numeric_columns: _toConsumableArray(y_axis_left_group_by_numeric_columns)
|
|
276
|
-
});
|
|
277
|
-
};
|
|
278
|
-
_this.onChangeNumericSummaryColumn = function (option, index) {
|
|
279
|
-
var column = option.value;
|
|
280
|
-
var newXAxisColumnKey = column.key;
|
|
281
|
-
var validValue = newXAxisColumnKey === 'Groupby_null' ? null : newXAxisColumnKey;
|
|
282
|
-
var statistic = _this.props.statistic;
|
|
283
|
-
var config = statistic.config;
|
|
284
|
-
var summaryMethods = StatisticsUtils.isDateSummaryColumn(column) ? STATISTIC_DATE_SUMMARY_CALCULATION_METHOD : STATISTIC_SUMMARY_CALCULATION_METHOD;
|
|
285
|
-
if (index === 0) {
|
|
286
|
-
var y_axis_left_summary_method = config.y_axis_left_summary_method;
|
|
287
|
-
if (!summaryMethods.includes(y_axis_left_summary_method)) {
|
|
288
|
-
y_axis_left_summary_method = summaryMethods[0];
|
|
289
|
-
}
|
|
290
|
-
_this.props.onChange({
|
|
291
|
-
y_axis_left_summary_column: validValue,
|
|
292
|
-
y_axis_left_summary_method: y_axis_left_summary_method
|
|
293
|
-
});
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
var y_axis_left_group_by_numeric_columns = config.y_axis_left_group_by_numeric_columns;
|
|
297
|
-
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
298
|
-
y_axis_left_group_by_numeric_columns = _toConsumableArray(y_axis_left_group_by_numeric_columns);
|
|
299
|
-
var selectedItem = y_axis_left_group_by_numeric_columns[index - 1];
|
|
300
|
-
var _selectedItem = selectedItem,
|
|
301
|
-
summary_method = _selectedItem.summary_method;
|
|
302
|
-
if (summaryMethods.includes(summary_method)) {
|
|
303
|
-
selectedItem = Object.assign({}, selectedItem, {
|
|
304
|
-
column_key: validValue
|
|
305
|
-
});
|
|
306
|
-
} else {
|
|
307
|
-
selectedItem = Object.assign({}, selectedItem, {
|
|
308
|
-
column_key: validValue,
|
|
309
|
-
summary_method: summaryMethods[0]
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
y_axis_left_group_by_numeric_columns[index - 1] = selectedItem;
|
|
313
|
-
_this.props.onChange({
|
|
314
|
-
y_axis_left_group_by_numeric_columns: y_axis_left_group_by_numeric_columns
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
_this.onChangeNumericSummaryMethod = function (option, index) {
|
|
318
|
-
var config = _this.props.config;
|
|
319
|
-
if (index === 0) {
|
|
320
|
-
var y_axis_left_summary_method = config.y_axis_left_summary_method;
|
|
321
|
-
if (y_axis_left_summary_method === option.value) return;
|
|
322
|
-
_this.props.onChange({
|
|
323
|
-
y_axis_left_summary_method: option.value
|
|
324
|
-
});
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
var _ref3 = config || {},
|
|
328
|
-
y_axis_left_group_by_numeric_columns = _ref3.y_axis_left_group_by_numeric_columns;
|
|
329
|
-
y_axis_left_group_by_numeric_columns = y_axis_left_group_by_numeric_columns || [];
|
|
330
|
-
var selectedItem = y_axis_left_group_by_numeric_columns[index - 1];
|
|
331
|
-
selectedItem = Object.assign({}, selectedItem, {
|
|
332
|
-
summary_method: option.value
|
|
333
|
-
});
|
|
334
|
-
y_axis_left_group_by_numeric_columns[index - 1] = selectedItem;
|
|
335
|
-
_this.props.onChange({
|
|
336
|
-
y_axis_left_group_by_numeric_columns: y_axis_left_group_by_numeric_columns
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
_this.renderGroupbyNumericColumns = function () {
|
|
340
|
-
var _this$props3 = _this.props,
|
|
341
|
-
config = _this$props3.config,
|
|
342
|
-
statistic = _this$props3.statistic;
|
|
343
|
-
var y_axis_left_group_by_numeric_columns = config.y_axis_left_group_by_numeric_columns;
|
|
344
|
-
if (!y_axis_left_group_by_numeric_columns || !Array.isArray(y_axis_left_group_by_numeric_columns)) return null;
|
|
345
|
-
return y_axis_left_group_by_numeric_columns.map(function (item, index) {
|
|
346
|
-
return /*#__PURE__*/React.createElement(NumericSummaryItem, {
|
|
347
|
-
statistic: statistic,
|
|
348
|
-
key: "number-column-".concat(index),
|
|
349
|
-
numericColumnOptions: _this.numericColumnsOptions,
|
|
350
|
-
onColumnOptionChange: _this.onChangeNumericSummaryColumn,
|
|
351
|
-
onSummaryMethodChange: _this.onChangeNumericSummaryMethod,
|
|
352
|
-
index: index + 1,
|
|
353
|
-
onDelete: _this.onDeleteNumericColumnItem,
|
|
354
|
-
value: item
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
};
|
|
358
|
-
_this.useMultipleSummaryColumns = function () {
|
|
359
|
-
var _this$props4 = _this.props,
|
|
360
|
-
config = _this$props4.config,
|
|
361
|
-
summaryType = _this$props4.summaryType,
|
|
362
|
-
useMultipleSummaryColumns = _this$props4.useMultipleSummaryColumns;
|
|
363
|
-
if (config.type === STATISTIC_TYPE.COMBINATION) {
|
|
364
|
-
if (useMultipleSummaryColumns && summaryType === STATISTIC_SUMMARY_TYPE.ADVANCED && config.y_axis_left_group_by_multiple_numeric_column) {
|
|
365
|
-
return true;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return false;
|
|
369
|
-
};
|
|
370
|
-
_this.initTable(_props);
|
|
371
|
-
_this.initColumns();
|
|
372
|
-
_this.summaryTypeOptions = _this.getSummaryTypeOptions();
|
|
373
|
-
_this.summaryMethodsOptions = _this.getSummaryMethodsOptions();
|
|
374
|
-
return _this;
|
|
375
|
-
}
|
|
376
|
-
_createClass(SummarySettings, [{
|
|
377
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
378
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
379
|
-
if (nextProps.config.table_id !== this.props.config.table_id) {
|
|
380
|
-
this.initTable(nextProps);
|
|
381
|
-
this.initColumns();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}, {
|
|
385
|
-
key: "render",
|
|
386
|
-
value: function render() {
|
|
387
|
-
var summaryType = this.props.summaryType;
|
|
388
|
-
var _useMultipleSummaryColumns = this.useMultipleSummaryColumns();
|
|
389
|
-
return /*#__PURE__*/React.createElement(Fragment, null, this.renderSummaryTypes(), !_useMultipleSummaryColumns && summaryType === STATISTIC_SUMMARY_TYPE.ADVANCED && /*#__PURE__*/React.createElement(Fragment, null, this.renderNumericColumn(), this.renderSummaryMethod()), _useMultipleSummaryColumns && this.renderNumericSummaryItem());
|
|
390
|
-
}
|
|
391
|
-
}]);
|
|
392
|
-
return SummarySettings;
|
|
393
|
-
}(Component);
|
|
394
|
-
export default SummarySettings;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
.seastatistic-settings .seastatistic-parameter-container {
|
|
2
|
-
margin-bottom: 5px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.seastatistic-settings .seastatistic-toggle-parameter {
|
|
6
|
-
height: 36px;
|
|
7
|
-
padding-left: 8px;
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
font-size: 14px;
|
|
10
|
-
background-color: #fff;
|
|
11
|
-
display: flex;
|
|
12
|
-
border-radius: 4px;
|
|
13
|
-
border: 1px solid hsl(0, 0%, 80%);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.seastatistic-settings .seastatistic-toggle-parameter .custom-switch {
|
|
17
|
-
flex-direction: row-reverse;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.seastatistic-settings .seastatistic-toggle-parameter .custom-switch-indicator {
|
|
21
|
-
width: 22px;
|
|
22
|
-
height: 12px;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.seastatistic-settings .seastatistic-toggle-parameter .custom-switch-indicator::before {
|
|
27
|
-
height: 8px;
|
|
28
|
-
width: 8px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.seastatistic-settings .seastatistic-toggle-parameter .custom-switch-input:checked ~ .custom-switch-indicator:before {
|
|
32
|
-
left: 12px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.seastatistic-settings .seastatistic-toggle-parameter .custom-switch-description {
|
|
36
|
-
margin-left: 0.5rem;
|
|
37
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
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 dayjs from 'dayjs';
|
|
7
|
-
import Calendar from '@seafile/seafile-calendar';
|
|
8
|
-
import DatePicker from '@seafile/seafile-calendar/lib/Picker';
|
|
9
|
-
import { translateCalendar } from '../../../utils';
|
|
10
|
-
import intl from '../../../intl';
|
|
11
|
-
import 'dayjs/locale/zh-cn';
|
|
12
|
-
import 'dayjs/locale/en-gb';
|
|
13
|
-
import '@seafile/seafile-calendar/assets/index.css';
|
|
14
|
-
var now = dayjs();
|
|
15
|
-
var DATE_FORMAT = 'YYYY-MM-DD';
|
|
16
|
-
var TimePicker = /*#__PURE__*/function (_Component) {
|
|
17
|
-
_inherits(TimePicker, _Component);
|
|
18
|
-
var _super = _createSuper(TimePicker);
|
|
19
|
-
function TimePicker(props) {
|
|
20
|
-
var _this;
|
|
21
|
-
_classCallCheck(this, TimePicker);
|
|
22
|
-
_this = _super.call(this, props);
|
|
23
|
-
_this.getDefaultMinutesTime = function () {
|
|
24
|
-
var value = _this.props.value;
|
|
25
|
-
if (value) return dayjs(value).format('HH:mm');
|
|
26
|
-
return '';
|
|
27
|
-
};
|
|
28
|
-
_this.getCalendarContainer = function () {
|
|
29
|
-
return _this.calendarContainerRef.current;
|
|
30
|
-
};
|
|
31
|
-
_this.onChange = function (value) {
|
|
32
|
-
_this.setState({
|
|
33
|
-
value: value
|
|
34
|
-
}, function () {
|
|
35
|
-
if (_this.state.value) {
|
|
36
|
-
_this.props.onChange(_this.state.value.format(DATE_FORMAT));
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
_this.onClickRightPanelTime = function () {
|
|
41
|
-
setTimeout(function () {
|
|
42
|
-
_this.toggleCalendar(false);
|
|
43
|
-
}, 1);
|
|
44
|
-
};
|
|
45
|
-
_this.onOpenChange = function (open) {
|
|
46
|
-
if (open) {
|
|
47
|
-
_this.toggleCalendar(open);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
_this.onClear = function () {
|
|
51
|
-
_this.setState({
|
|
52
|
-
value: null
|
|
53
|
-
}, function () {
|
|
54
|
-
_this.setState({
|
|
55
|
-
open: true
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
_this.onReadOnlyFocus = function () {
|
|
60
|
-
if (!_this.state.open && _this.state.isMouseDown) {
|
|
61
|
-
_this.setState({
|
|
62
|
-
isMouseDown: false
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
_this.setState({
|
|
66
|
-
open: true
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
_this.handleMouseDown = function (e) {
|
|
71
|
-
e.preventDefault();
|
|
72
|
-
};
|
|
73
|
-
_this.toggleCalendar = function (open) {
|
|
74
|
-
_this.setState({
|
|
75
|
-
open: open
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
_this.state = {
|
|
79
|
-
open: false,
|
|
80
|
-
value: null
|
|
81
|
-
};
|
|
82
|
-
_this.calendarContainerRef = React.createRef();
|
|
83
|
-
_this.defaultCalendarValue = null;
|
|
84
|
-
return _this;
|
|
85
|
-
}
|
|
86
|
-
_createClass(TimePicker, [{
|
|
87
|
-
key: "componentDidMount",
|
|
88
|
-
value: function componentDidMount() {
|
|
89
|
-
var value = this.props.value;
|
|
90
|
-
var iszhcn = window.seaStatistic.context.getSetting('lang') === 'zh-cn';
|
|
91
|
-
if (iszhcn) {
|
|
92
|
-
now = now.locale('zh-cn');
|
|
93
|
-
} else {
|
|
94
|
-
now = now.locale('en-gb');
|
|
95
|
-
}
|
|
96
|
-
this.defaultCalendarValue = now.clone();
|
|
97
|
-
if (value && dayjs(value).isValid()) {
|
|
98
|
-
var validValue = dayjs(value).isValid() ? dayjs(value) : dayjs(this.defaultCalendarValue);
|
|
99
|
-
this.setState({
|
|
100
|
-
value: iszhcn ? dayjs(validValue).locale('zh-cn') : dayjs(validValue).locale('en-gb')
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "render",
|
|
106
|
-
value: function render() {
|
|
107
|
-
var _this2 = this;
|
|
108
|
-
var isReadOnly = this.props.isReadOnly;
|
|
109
|
-
var _this$state = this.state,
|
|
110
|
-
value = _this$state.value,
|
|
111
|
-
open = _this$state.open;
|
|
112
|
-
var minutesTime = this.getDefaultMinutesTime();
|
|
113
|
-
var columnDataFormat = this.getColumnFormat();
|
|
114
|
-
if (isReadOnly) return /*#__PURE__*/React.createElement("input", {
|
|
115
|
-
className: "ant-calendar-picker-input ant-input form-control",
|
|
116
|
-
value: value && value.format(columnDataFormat) || '',
|
|
117
|
-
disabled: true
|
|
118
|
-
});
|
|
119
|
-
var clearStyle = {
|
|
120
|
-
position: 'absolute',
|
|
121
|
-
top: '15px',
|
|
122
|
-
left: '225px',
|
|
123
|
-
color: 'gray',
|
|
124
|
-
fontSize: '12px',
|
|
125
|
-
cursor: 'pointer'
|
|
126
|
-
};
|
|
127
|
-
var clearIcon = React.createElement('i', {
|
|
128
|
-
className: 'item-icon dtable-font dtable-icon-x',
|
|
129
|
-
style: clearStyle
|
|
130
|
-
});
|
|
131
|
-
var calendar = /*#__PURE__*/React.createElement(Calendar, {
|
|
132
|
-
className: "dtable-rc-calendar",
|
|
133
|
-
locale: translateCalendar(),
|
|
134
|
-
style: {
|
|
135
|
-
zIndex: 1001
|
|
136
|
-
},
|
|
137
|
-
dateInputPlaceholder: intl.get('Please_input_date'),
|
|
138
|
-
format: DATE_FORMAT,
|
|
139
|
-
defaultValue: this.defaultCalendarValue,
|
|
140
|
-
showDateInput: true,
|
|
141
|
-
focusablePanel: false,
|
|
142
|
-
onClear: this.onClear,
|
|
143
|
-
clearIcon: clearIcon,
|
|
144
|
-
showHourAndMinute: false,
|
|
145
|
-
defaultMinutesTime: minutesTime,
|
|
146
|
-
onClickRightPanelTime: this.onClickRightPanelTime
|
|
147
|
-
});
|
|
148
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
className: "date-picker-container",
|
|
150
|
-
ref: function ref(_ref2) {
|
|
151
|
-
return _this2.datePicker = _ref2;
|
|
152
|
-
}
|
|
153
|
-
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
154
|
-
calendar: calendar,
|
|
155
|
-
value: value,
|
|
156
|
-
onChange: this.onChange,
|
|
157
|
-
getCalendarContainer: this.getCalendarContainer,
|
|
158
|
-
onOpenChange: this.onOpenChange,
|
|
159
|
-
open: open,
|
|
160
|
-
style: {
|
|
161
|
-
zIndex: 1001
|
|
162
|
-
}
|
|
163
|
-
}, function (_ref) {
|
|
164
|
-
var value = _ref.value;
|
|
165
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
166
|
-
tabIndex: "0",
|
|
167
|
-
onFocus: _this2.onReadOnlyFocus
|
|
168
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
169
|
-
tabIndex: "-1",
|
|
170
|
-
onChange: function onChange() {},
|
|
171
|
-
className: "ant-calendar-picker-input ant-input form-control",
|
|
172
|
-
value: value && value.format(columnDataFormat) || '',
|
|
173
|
-
onMouseDown: _this2.handleMouseDown
|
|
174
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
175
|
-
ref: _this2.calendarContainerRef
|
|
176
|
-
}));
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
}]);
|
|
180
|
-
return TimePicker;
|
|
181
|
-
}(Component);
|
|
182
|
-
export default TimePicker;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { FormGroup, Input, Label } from 'reactstrap';
|
|
4
|
-
import intl from '../../../../intl';
|
|
5
|
-
var TitleText = function TitleText(props) {
|
|
6
|
-
var _useState = useState(props.text || ''),
|
|
7
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
-
currText = _useState2[0],
|
|
9
|
-
setCurrText = _useState2[1];
|
|
10
|
-
var onKeyDown = function onKeyDown(event) {
|
|
11
|
-
if (event.key === 'Enter') {
|
|
12
|
-
event.preventDefault();
|
|
13
|
-
event.target.blur();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var onSaveText = function onSaveText() {
|
|
17
|
-
props.modifyText(currText);
|
|
18
|
-
};
|
|
19
|
-
return /*#__PURE__*/React.createElement(FormGroup, {
|
|
20
|
-
className: "statistic-title-text"
|
|
21
|
-
}, /*#__PURE__*/React.createElement(Label, null, intl.get('Title')), /*#__PURE__*/React.createElement(Input, {
|
|
22
|
-
type: "text",
|
|
23
|
-
value: currText,
|
|
24
|
-
onBlur: onSaveText,
|
|
25
|
-
onChange: function onChange(event) {
|
|
26
|
-
return setCurrText(event.target.value);
|
|
27
|
-
},
|
|
28
|
-
onKeyDown: onKeyDown
|
|
29
|
-
}));
|
|
30
|
-
};
|
|
31
|
-
export default TitleText;
|