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.
Files changed (210) hide show
  1. package/README.md +3 -0
  2. package/es/api/dtable-db-api.js +43 -0
  3. package/es/assets/css/color-picker.css +53 -0
  4. package/es/assets/css/color-rules-popover.css +144 -0
  5. package/es/assets/css/color-theme-dialog.css +40 -0
  6. package/es/assets/css/dashboard.css +562 -0
  7. package/es/assets/css/dialog.css +415 -0
  8. package/es/assets/css/mobile-dashboard.module.css +91 -0
  9. package/es/assets/css/slider.css +77 -0
  10. package/es/assets/css/statistic-chart.module.css +11 -0
  11. package/es/assets/css/statistic-custom-title.module.css +3 -0
  12. package/es/assets/css/statistic-custom.module.css +4 -0
  13. package/es/assets/css/statistic-numeric-column-item.module.css +43 -0
  14. package/es/assets/css/statistic-time-picker.module.css +21 -0
  15. package/es/assets/css/theme.css +61 -0
  16. package/es/assets/images/icon.png +0 -0
  17. package/es/calculator/base-calculator.js +111 -0
  18. package/es/calculator/basic-chart-calculator.js +571 -0
  19. package/es/calculator/combination-calculator.js +296 -0
  20. package/es/calculator/compare-bar-calculator.js +291 -0
  21. package/es/calculator/completeness-calculator.js +307 -0
  22. package/es/calculator/copy-value.js +47 -0
  23. package/es/calculator/dashboard-calculator.js +146 -0
  24. package/es/calculator/heat-map-calculator.js +225 -0
  25. package/es/calculator/horizontal-bar-calculator.js +100 -0
  26. package/es/calculator/index.js +88 -0
  27. package/es/calculator/map-calculator.js +169 -0
  28. package/es/calculator/mirror-calculator.js +217 -0
  29. package/es/calculator/number-card-calculator.js +135 -0
  30. package/es/calculator/pivot-table-calculator.js +810 -0
  31. package/es/calculator/scatter-calculator.js +150 -0
  32. package/es/calculator/thread-manager.js +70 -0
  33. package/es/calculator/trend-calculator.js +204 -0
  34. package/es/calculator/workers/basic-chart-calculator-worker.js +410 -0
  35. package/es/calculator/workers/calculator.worker.js +22 -0
  36. package/es/calculator/workers/card-calculator-worker.js +28 -0
  37. package/es/calculator/workers/combination-calculator-worker.js +257 -0
  38. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +149 -0
  39. package/es/calculator/workers/completeness-calculator-worker.js +153 -0
  40. package/es/calculator/workers/dashboard-calculator-worker.js +56 -0
  41. package/es/calculator/workers/mirror-calculator-worker.js +132 -0
  42. package/es/calculator/workers/pivot-table-calculator-worker.js +615 -0
  43. package/es/calculator/workers/scatter-calculator-worker.js +67 -0
  44. package/es/calculator/workers/trend-calculator-worker.js +93 -0
  45. package/es/calculator/world-map-calculator.js +193 -0
  46. package/es/components/common-add-tool.js +19 -0
  47. package/es/components/dialog/chart-addition-edit-dialog.js +89 -0
  48. package/es/components/dialog/chart-addition-widgets/chart-selector.js +261 -0
  49. package/es/components/dialog/chart-addition-widgets/statistic-chart-selector.module.css +74 -0
  50. package/es/components/dialog/color-theme-dialog.js +71 -0
  51. package/es/components/dialog/enlarged-chart-dialog.js +73 -0
  52. package/es/components/dialog/new-table-dialog.js +113 -0
  53. package/es/components/dialog/new-view-dialog.js +87 -0
  54. package/es/components/dialog/rename-view-dialog.js +87 -0
  55. package/es/components/dialog/statistic-record-dialog/index.css +114 -0
  56. package/es/components/dialog/statistic-record-dialog/index.js +174 -0
  57. package/es/components/dialog/table-select-dialog.js +93 -0
  58. package/es/components/dropdown-menu/statistic-dropdown-menu.js +94 -0
  59. package/es/components/dtable-popover.js +109 -0
  60. package/es/components/dtable-search-input.js +137 -0
  61. package/es/components/dtable-select.js +104 -0
  62. package/es/components/index.js +11 -0
  63. package/es/components/loading.js +8 -0
  64. package/es/components/modal-portal.js +36 -0
  65. package/es/components/popover/color-rules/color-rule.js +179 -0
  66. package/es/components/popover/color-rules/index.js +87 -0
  67. package/es/components/popover/color-rules/rule-filters/filter.js +214 -0
  68. package/es/components/popover/color-rules/rule-filters/index.css +214 -0
  69. package/es/components/popover/color-rules/rule-filters/index.js +97 -0
  70. package/es/components/popover/color-rules/rule-filters/number-input.js +85 -0
  71. package/es/components/popover/color-rules-popover.js +213 -0
  72. package/es/components/popover/color-selector-popover.js +85 -0
  73. package/es/components/seatable-radio/index.css +51 -0
  74. package/es/components/seatable-radio/index.js +28 -0
  75. package/es/components/select/index.js +2 -0
  76. package/es/components/select/option-group.css +104 -0
  77. package/es/components/select/option-group.js +225 -0
  78. package/es/components/select/option.js +51 -0
  79. package/es/components/select/select.css +211 -0
  80. package/es/components/select/select.js +157 -0
  81. package/es/components/toast/alert.js +130 -0
  82. package/es/components/toast/index.js +3 -0
  83. package/es/components/toast/toast.js +164 -0
  84. package/es/components/toast/toastManager.js +150 -0
  85. package/es/components/toast/toaster.js +64 -0
  86. package/es/constants/color-rules.js +8 -0
  87. package/es/constants/dtable-select-style.js +61 -0
  88. package/es/constants/event-types.js +1 -0
  89. package/es/constants/index.js +501 -0
  90. package/es/constants/key-codes.js +102 -0
  91. package/es/constants/zIndexes.js +1 -0
  92. package/es/custom-g2.js +614 -0
  93. package/es/dashboard.js +408 -0
  94. package/es/desktop-dashboard.js +299 -0
  95. package/es/index.js +33 -0
  96. package/es/locale/index.js +17 -0
  97. package/es/locale/lang/de.js +237 -0
  98. package/es/locale/lang/en.js +237 -0
  99. package/es/locale/lang/fr.js +237 -0
  100. package/es/locale/lang/zh_CN.js +237 -0
  101. package/es/mobile-dashboard.js +103 -0
  102. package/es/model/collaborators.js +11 -0
  103. package/es/model/stat-item.js +340 -0
  104. package/es/model/statistic-dashboard.js +8 -0
  105. package/es/service/chart-service.js +192 -0
  106. package/es/service/dashboard-service.js +415 -0
  107. package/es/stat-editor/chart-name-editor.js +75 -0
  108. package/es/stat-editor/index.js +74 -0
  109. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +149 -0
  110. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +415 -0
  111. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +193 -0
  112. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +13 -0
  113. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +107 -0
  114. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +332 -0
  115. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +170 -0
  116. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +141 -0
  117. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +219 -0
  118. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +89 -0
  119. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +132 -0
  120. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +319 -0
  121. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +138 -0
  122. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +135 -0
  123. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +156 -0
  124. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +147 -0
  125. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +195 -0
  126. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +126 -0
  127. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +169 -0
  128. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +352 -0
  129. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +145 -0
  130. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +153 -0
  131. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +466 -0
  132. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +183 -0
  133. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +542 -0
  134. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +111 -0
  135. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +86 -0
  136. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +169 -0
  137. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +273 -0
  138. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +105 -0
  139. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +243 -0
  140. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +65 -0
  141. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +318 -0
  142. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +49 -0
  143. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +124 -0
  144. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +150 -0
  145. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +267 -0
  146. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +109 -0
  147. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +351 -0
  148. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +60 -0
  149. package/es/stat-editor/stat-settings/color-setting/color-picker.js +129 -0
  150. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +348 -0
  151. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +102 -0
  152. package/es/stat-editor/stat-settings/public-setting/base-settings.js +124 -0
  153. package/es/stat-editor/stat-settings/public-setting/calender.js +124 -0
  154. package/es/stat-editor/stat-settings/public-setting/column-settings.js +15 -0
  155. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +60 -0
  156. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +57 -0
  157. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +41 -0
  158. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +64 -0
  159. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +118 -0
  160. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +39 -0
  161. package/es/stat-list/chart-preview.js +139 -0
  162. package/es/stat-list/index.js +275 -0
  163. package/es/stat-view/area-chart.js +521 -0
  164. package/es/stat-view/bar-chart.js +568 -0
  165. package/es/stat-view/base-chart.js +44 -0
  166. package/es/stat-view/basic-number-card.js +255 -0
  167. package/es/stat-view/combination-chart.js +558 -0
  168. package/es/stat-view/compare-chart.js +485 -0
  169. package/es/stat-view/completeness-chart.js +389 -0
  170. package/es/stat-view/custom-bar.js +433 -0
  171. package/es/stat-view/dashboard-chart.js +317 -0
  172. package/es/stat-view/heat-map.js +501 -0
  173. package/es/stat-view/horizontal-bar-chart.js +569 -0
  174. package/es/stat-view/index.js +183 -0
  175. package/es/stat-view/line-chart.js +505 -0
  176. package/es/stat-view/map.js +428 -0
  177. package/es/stat-view/mirror.js +285 -0
  178. package/es/stat-view/pie-chart.js +326 -0
  179. package/es/stat-view/pivot-table/index.js +206 -0
  180. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +133 -0
  181. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +164 -0
  182. package/es/stat-view/pivot-table/statistic-pivot-table.module.css +132 -0
  183. package/es/stat-view/pivot-table/two-dimension-table.js +344 -0
  184. package/es/stat-view/ring-chart.js +416 -0
  185. package/es/stat-view/scatter-chart.js +367 -0
  186. package/es/stat-view/treemap-chart.js +318 -0
  187. package/es/stat-view/trend-chart.js +299 -0
  188. package/es/stat-view/world-map.js +443 -0
  189. package/es/tabs/index.js +252 -0
  190. package/es/tabs/statistic-tabs.module.css +154 -0
  191. package/es/tabs/tab.js +167 -0
  192. package/es/utils/basic-chart-utils.js +24 -0
  193. package/es/utils/cell-format.js +110 -0
  194. package/es/utils/cell-value.js +27 -0
  195. package/es/utils/collaborator.js +31 -0
  196. package/es/utils/color-utils.js +112 -0
  197. package/es/utils/column-utils.js +18 -0
  198. package/es/utils/column.js +13 -0
  199. package/es/utils/common-utils.js +303 -0
  200. package/es/utils/date-format.js +65 -0
  201. package/es/utils/export-table-utils.js +632 -0
  202. package/es/utils/index.js +26 -0
  203. package/es/utils/object.js +26 -0
  204. package/es/utils/row-utils.js +115 -0
  205. package/es/utils/search.js +67 -0
  206. package/es/utils/sql-utils.js +293 -0
  207. package/es/utils/stat-utils.js +353 -0
  208. package/es/utils/trend-utils.js +136 -0
  209. package/index.js +1 -0
  210. package/package.json +188 -0
@@ -0,0 +1,174 @@
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, { Fragment } from 'react';
6
+ import intl from 'react-intl-universal';
7
+ import { Modal, ModalBody } from 'reactstrap';
8
+ import { CellType, Views } from 'dtable-store';
9
+ import { DtableSearchInput, Loading } from '../../index';
10
+ import { searchRows } from '../../../utils';
11
+ import './index.css';
12
+ export var UNSHOWN_COLUMN_TYPES = [CellType.LINK, CellType.LONG_TEXT, CellType.FORMULA, CellType.LINK_FORMULA];
13
+ var StatisticRecordDialog = /*#__PURE__*/function (_React$Component) {
14
+ _inherits(StatisticRecordDialog, _React$Component);
15
+ var _super = _createSuper(StatisticRecordDialog);
16
+ function StatisticRecordDialog(props) {
17
+ var _this;
18
+ _classCallCheck(this, StatisticRecordDialog);
19
+ _this = _super.call(this, props);
20
+ _this.onSearch = function (searchVal) {
21
+ var rows = _this.state.rows;
22
+ var searchRows = _this.getSearchRows(rows, searchVal);
23
+ _this.setState({
24
+ searchRows: searchRows,
25
+ searchVal: searchVal
26
+ });
27
+ };
28
+ _this.clearTimer = function () {
29
+ if (_this.timer) {
30
+ clearTimeout(_this.timer);
31
+ _this.timer = null;
32
+ }
33
+ };
34
+ _this.getStatisticTable = function () {
35
+ var _this$props = _this.props,
36
+ statistic = _this$props.statistic,
37
+ getTableById = _this$props.getTableById;
38
+ var table_id = statistic.table_id;
39
+ return getTableById(table_id);
40
+ };
41
+ _this.getStatisticView = function (table) {
42
+ var statistic = _this.props.statistic;
43
+ var view_id = statistic.view_id;
44
+ return Views.getViewById(table.views, view_id);
45
+ };
46
+ _this.getStatisticColumns = function () {
47
+ var table = _this.getStatisticTable();
48
+ var view = _this.getStatisticView(table);
49
+ return Views.getColumns(view, table);
50
+ };
51
+ _this.clearSearch = function () {
52
+ var rows = _this.state.rows;
53
+ _this.setState({
54
+ searchRows: _this.getSearchRows(rows),
55
+ searchVal: ''
56
+ });
57
+ };
58
+ _this.getSearchRows = function (rows, searchVal) {
59
+ if (searchVal) {
60
+ return searchRows(rows, _this.getStatisticColumns(), searchVal, function (row) {
61
+ return row;
62
+ });
63
+ }
64
+ return rows;
65
+ };
66
+ _this.toggle = function () {
67
+ _this.props.toggleStatisticRecordsDialog();
68
+ };
69
+ _this.renderRowsCards = function (_ref) {
70
+ var table = _ref.table,
71
+ renderedColumns = _ref.renderedColumns,
72
+ searchRows = _ref.searchRows,
73
+ unShowColumnKeyList = _ref.unShowColumnKeyList;
74
+ if (!window.app || !window.app.renderRowsCards) return;
75
+ return window.app.renderRowsCards({
76
+ table: table,
77
+ renderedColumns: renderedColumns,
78
+ unShowColumnKeyList: unShowColumnKeyList,
79
+ isShowRowCardHeader: true,
80
+ columns: table.columns,
81
+ rows: searchRows,
82
+ rowCardType: 'statistic'
83
+ });
84
+ };
85
+ _this.state = {
86
+ rows: [],
87
+ searchVal: '',
88
+ searchRows: []
89
+ };
90
+ return _this;
91
+ }
92
+ _createClass(StatisticRecordDialog, [{
93
+ key: "componentDidUpdate",
94
+ value: function componentDidUpdate(prevProps, prevState) {
95
+ var oldLoading = prevProps.isLoading;
96
+ var _this$props2 = this.props,
97
+ isLoading = _this$props2.isLoading,
98
+ rows = _this$props2.rows;
99
+ if (oldLoading !== isLoading && !isLoading) {
100
+ this.setState({
101
+ rows: rows,
102
+ searchRows: this.getSearchRows(rows)
103
+ });
104
+ }
105
+ }
106
+ }, {
107
+ key: "render",
108
+ value: function render() {
109
+ var _this$props3 = this.props,
110
+ isLoading = _this$props3.isLoading,
111
+ currentDate = _this$props3.currentDate;
112
+ var searchRows = this.state.searchRows;
113
+ var unShowColumnKeyList = ['0000'];
114
+ var table;
115
+ var renderedColumns = [];
116
+ if (!isLoading) {
117
+ table = this.getStatisticTable();
118
+ renderedColumns = table.columns.filter(function (column) {
119
+ return !unShowColumnKeyList.includes(column.key) && !UNSHOWN_COLUMN_TYPES.includes(column.type);
120
+ });
121
+ }
122
+ return /*#__PURE__*/React.createElement(Modal, {
123
+ autoFocus: false,
124
+ toggle: this.toggle,
125
+ isOpen: true,
126
+ className: "statistic-records-dialog",
127
+ zIndex: 1048
128
+ }, isLoading && /*#__PURE__*/React.createElement("div", {
129
+ className: "py-8"
130
+ }, /*#__PURE__*/React.createElement(Loading, null)), !isLoading && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
131
+ className: "search-header"
132
+ }, /*#__PURE__*/React.createElement("span", null, currentDate), /*#__PURE__*/React.createElement("button", {
133
+ type: "button",
134
+ className: "close",
135
+ "aria-label": "Close",
136
+ onClick: this.toggle
137
+ }, /*#__PURE__*/React.createElement("span", {
138
+ "aria-hidden": "true"
139
+ }, "\xD7"))), /*#__PURE__*/React.createElement("div", {
140
+ className: "search-input-container"
141
+ }, /*#__PURE__*/React.createElement("i", {
142
+ className: "header-search-icon dtable-font dtable-icon-search"
143
+ }), /*#__PURE__*/React.createElement(DtableSearchInput, {
144
+ autoFocus: true,
145
+ isClearable: true,
146
+ className: "search-tables-input",
147
+ placeholder: intl.get('Search_records'),
148
+ onChange: this.onSearch,
149
+ clearValue: this.clearSearch,
150
+ components: {
151
+ ClearIndicator: function ClearIndicator(props) {
152
+ return /*#__PURE__*/React.createElement("span", {
153
+ className: "clear-search-text",
154
+ onClick: props.clearValue,
155
+ title: intl.get('Clear_search_text'),
156
+ "aria-label": intl.get('Clear_search_text')
157
+ }, /*#__PURE__*/React.createElement("i", {
158
+ className: "dtable-font dtable-icon-x-"
159
+ }));
160
+ }
161
+ }
162
+ })), /*#__PURE__*/React.createElement(ModalBody, {
163
+ className: "statistic-records-container"
164
+ }, this.renderRowsCards({
165
+ table: table,
166
+ renderedColumns: renderedColumns,
167
+ searchRows: searchRows,
168
+ unShowColumnKeyList: unShowColumnKeyList
169
+ }))));
170
+ }
171
+ }]);
172
+ return StatisticRecordDialog;
173
+ }(React.Component);
174
+ export default StatisticRecordDialog;
@@ -0,0 +1,93 @@
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 { Modal, ModalHeader, ModalBody, ModalFooter, Button, Label, FormGroup } from 'reactstrap';
8
+ import { DTableSelect } from '../../components';
9
+ import { KeyCodes } from '../../constants';
10
+ var TableSelectDialog = /*#__PURE__*/function (_Component) {
11
+ _inherits(TableSelectDialog, _Component);
12
+ var _super = _createSuper(TableSelectDialog);
13
+ function TableSelectDialog(props) {
14
+ var _this;
15
+ _classCallCheck(this, TableSelectDialog);
16
+ _this = _super.call(this, props);
17
+ _this.createTableOptions = function (tables) {
18
+ if (!Array.isArray(tables) || tables.length === 0) return [];
19
+ return tables.map(function (table) {
20
+ var name = table.name,
21
+ value = table._id;
22
+ var label = /*#__PURE__*/React.createElement("span", {
23
+ className: "select-module select-module-name"
24
+ }, name);
25
+ return {
26
+ value: value,
27
+ label: label
28
+ };
29
+ });
30
+ };
31
+ _this.onHotKey = function (e) {
32
+ if (e.keyCode === KeyCodes.Enter) {
33
+ e.preventDefault();
34
+ _this.handleSubmit();
35
+ }
36
+ };
37
+ _this.toggle = function () {
38
+ _this.props.toggle();
39
+ };
40
+ _this.onSelectTable = function (selectedTable) {
41
+ if (selectedTable.value === _this.state.selectedTable.value) return;
42
+ _this.setState({
43
+ selectedTable: selectedTable
44
+ });
45
+ };
46
+ _this.handleSubmit = function () {
47
+ var selectedTable = _this.state.selectedTable;
48
+ _this.props.onSelectTable(selectedTable.value);
49
+ };
50
+ var _tables = props.tables;
51
+ _this.tables = _this.createTableOptions(_tables);
52
+ _this.state = {
53
+ selectedTable: _this.tables[0]
54
+ };
55
+ return _this;
56
+ }
57
+ _createClass(TableSelectDialog, [{
58
+ key: "componentDidMount",
59
+ value: function componentDidMount() {
60
+ document.addEventListener('keydown', this.onHotKey);
61
+ }
62
+ }, {
63
+ key: "componentWillUnmount",
64
+ value: function componentWillUnmount() {
65
+ document.removeEventListener('keydown', this.onHotKey);
66
+ }
67
+ }, {
68
+ key: "render",
69
+ value: function render() {
70
+ var title = this.props.title;
71
+ return /*#__PURE__*/React.createElement(Modal, {
72
+ isOpen: true,
73
+ toggle: this.toggle,
74
+ autoFocus: false
75
+ }, /*#__PURE__*/React.createElement(ModalHeader, {
76
+ toggle: this.toggle
77
+ }, title), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(Label, null, intl.get('Select_table')), /*#__PURE__*/React.createElement(DTableSelect, {
78
+ options: this.tables,
79
+ value: this.state.selectedTable,
80
+ onChange: this.onSelectTable,
81
+ menuPortalTarget: '#wrapper'
82
+ }))), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
83
+ color: "secondary",
84
+ onClick: this.toggle
85
+ }, intl.get('Cancel')), /*#__PURE__*/React.createElement(Button, {
86
+ color: "primary",
87
+ onClick: this.handleSubmit
88
+ }, intl.get('Submit'))));
89
+ }
90
+ }]);
91
+ return TableSelectDialog;
92
+ }(Component);
93
+ export default TableSelectDialog;
@@ -0,0 +1,94 @@
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, { Fragment } from 'react';
6
+ import intl from 'react-intl-universal';
7
+ import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
8
+ import { STAT_TYPE } from '../../constants';
9
+ var StatisticDropdownMenu = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(StatisticDropdownMenu, _React$Component);
11
+ var _super = _createSuper(StatisticDropdownMenu);
12
+ function StatisticDropdownMenu(props) {
13
+ var _this;
14
+ _classCallCheck(this, StatisticDropdownMenu);
15
+ _this = _super.call(this, props);
16
+ _this.onDropdownToggleClick = function (e) {
17
+ e.preventDefault();
18
+ e.stopPropagation();
19
+ _this.setState({
20
+ isItemMenuShow: !_this.state.isItemMenuShow
21
+ });
22
+ };
23
+ _this.deleteStatItem = function () {
24
+ _this.props.deleteStatItem();
25
+ };
26
+ _this.editStatItem = function () {
27
+ _this.props.editStatItem();
28
+ };
29
+ _this.state = {
30
+ isItemMenuShow: false
31
+ };
32
+ return _this;
33
+ }
34
+ _createClass(StatisticDropdownMenu, [{
35
+ key: "render",
36
+ value: function render() {
37
+ var _this$props = this.props,
38
+ isTableReadOnly = _this$props.isTableReadOnly,
39
+ chartType = _this$props.chartType;
40
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
41
+ isOpen: this.state.isItemMenuShow,
42
+ toggle: this.onDropdownToggleClick,
43
+ className: "dtable-dropdown-menu"
44
+ }, /*#__PURE__*/React.createElement(DropdownToggle, {
45
+ tag: "span",
46
+ "data-toggle": "dropdown",
47
+ "aria-expanded": this.state.isItemMenuShow
48
+ }, /*#__PURE__*/React.createElement("i", {
49
+ className: "toggle-icon dtable-font dtable-icon-more-level"
50
+ })), /*#__PURE__*/React.createElement(DropdownMenu, {
51
+ className: "stat-item-dropdown-menu",
52
+ right: true
53
+ }, !isTableReadOnly && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DropdownItem, {
54
+ onMouseDown: this.editStatItem
55
+ }, /*#__PURE__*/React.createElement("i", {
56
+ className: "item-icon dtable-font dtable-icon-rename"
57
+ }), /*#__PURE__*/React.createElement("span", {
58
+ className: "item-text"
59
+ }, intl.get('Edit'))), /*#__PURE__*/React.createElement(DropdownItem, {
60
+ onMouseDown: this.props.copyStatItem
61
+ }, /*#__PURE__*/React.createElement("i", {
62
+ className: "item-icon dtable-font dtable-icon-copy"
63
+ }), /*#__PURE__*/React.createElement("span", {
64
+ className: "item-text"
65
+ }, intl.get('Copy')))), chartType === STAT_TYPE.PIVOT_TABLE && !isTableReadOnly && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DropdownItem, {
66
+ onClick: this.props.onNewTableDialogToggle
67
+ }, /*#__PURE__*/React.createElement("i", {
68
+ className: "item-icon dtable-font dtable-icon-export"
69
+ }), /*#__PURE__*/React.createElement("span", {
70
+ className: "item-text"
71
+ }, intl.get('Export_to_a_new_table'))), /*#__PURE__*/React.createElement(DropdownItem, {
72
+ onClick: this.props.onUpdateTableDialogToggle
73
+ }, /*#__PURE__*/React.createElement("i", {
74
+ className: "item-icon dtable-font dtable-icon-update"
75
+ }), /*#__PURE__*/React.createElement("span", {
76
+ className: "item-text"
77
+ }, intl.get('Update_to_a_table')))), /*#__PURE__*/React.createElement(DropdownItem, {
78
+ onMouseDown: this.props.onExportChart
79
+ }, /*#__PURE__*/React.createElement("i", {
80
+ className: "item-icon dtable-font dtable-icon-download"
81
+ }), /*#__PURE__*/React.createElement("span", {
82
+ className: "item-text"
83
+ }, intl.get('Export_as_picture'))), !isTableReadOnly && /*#__PURE__*/React.createElement(DropdownItem, {
84
+ onMouseDown: this.deleteStatItem
85
+ }, /*#__PURE__*/React.createElement("i", {
86
+ className: "item-icon dtable-font dtable-icon-delete"
87
+ }), /*#__PURE__*/React.createElement("span", {
88
+ className: "item-text"
89
+ }, intl.get('Delete'))))));
90
+ }
91
+ }]);
92
+ return StatisticDropdownMenu;
93
+ }(React.Component);
94
+ export default StatisticDropdownMenu;
@@ -0,0 +1,109 @@
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 { Popover } from 'reactstrap';
7
+ import { getEventClassName } from '../utils';
8
+ import { CommonEventTypes, KeyCodes } from '../constants';
9
+ var DTablePopover = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(DTablePopover, _React$Component);
11
+ var _super = _createSuper(DTablePopover);
12
+ function DTablePopover() {
13
+ var _this;
14
+ _classCallCheck(this, DTablePopover);
15
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16
+ args[_key] = arguments[_key];
17
+ }
18
+ _this = _super.call.apply(_super, [this].concat(args));
19
+ _this.dtablePopoverRef = null;
20
+ _this.isSelectOpen = false;
21
+ _this.onHistoryState = function (e) {
22
+ e.preventDefault();
23
+ _this.props.hideDTablePopover(e);
24
+ };
25
+ _this.onKeyDown = function (e) {
26
+ var _this$props = _this.props,
27
+ canHideDTablePopover = _this$props.canHideDTablePopover,
28
+ hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
29
+ if (e.keyCode === KeyCodes.Escape && typeof hideDTablePopoverWithEsc === 'function' && !_this.isSelectOpen) {
30
+ e.preventDefault();
31
+ hideDTablePopoverWithEsc();
32
+ } else if (e.keyCode === KeyCodes.Enter) {
33
+ // Resolve the default behavior of the enter key when entering formulas is blocked
34
+ if (canHideDTablePopover) return;
35
+ e.stopImmediatePropagation();
36
+ }
37
+ };
38
+ _this.setSelectStatus = function (status) {
39
+ _this.isSelectOpen = status;
40
+ };
41
+ _this.onMouseDown = function (e) {
42
+ var canHideDTablePopover = _this.props.canHideDTablePopover;
43
+ if (!canHideDTablePopover) return;
44
+ if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
45
+ _this.props.hideDTablePopover(e);
46
+ }
47
+ };
48
+ _this.onPopoverInsideClick = function (e) {
49
+ e.stopPropagation();
50
+ };
51
+ return _this;
52
+ }
53
+ _createClass(DTablePopover, [{
54
+ key: "componentDidMount",
55
+ value: function componentDidMount() {
56
+ document.addEventListener('mousedown', this.onMouseDown);
57
+ document.addEventListener('keydown', this.onKeyDown);
58
+ window.addEventListener('popstate', this.onHistoryState);
59
+ this.unsubscribeOpenSelect = window.app.eventBus.subscribe(CommonEventTypes.OPEN_SELECT, this.setSelectStatus);
60
+ }
61
+ }, {
62
+ key: "componentWillUnmount",
63
+ value: function componentWillUnmount() {
64
+ document.removeEventListener('mousedown', this.onMouseDown);
65
+ document.removeEventListener('keydown', this.onKeyDown);
66
+ window.removeEventListener('popstate', this.onHistoryState);
67
+ this.unsubscribeOpenSelect();
68
+ }
69
+ }, {
70
+ key: "render",
71
+ value: function render() {
72
+ var _this2 = this;
73
+ var _this$props2 = this.props,
74
+ target = _this$props2.target,
75
+ boundariesElement = _this$props2.boundariesElement,
76
+ innerClassName = _this$props2.innerClassName,
77
+ popoverClassName = _this$props2.popoverClassName,
78
+ hideArrow = _this$props2.hideArrow,
79
+ modifiers = _this$props2.modifiers,
80
+ placement = _this$props2.placement;
81
+ var additionalProps = {};
82
+ if (boundariesElement) {
83
+ additionalProps.boundariesElement = boundariesElement;
84
+ }
85
+ return /*#__PURE__*/React.createElement(Popover, Object.assign({
86
+ placement: placement,
87
+ isOpen: true,
88
+ target: target,
89
+ fade: false,
90
+ hideArrow: hideArrow,
91
+ innerClassName: innerClassName,
92
+ className: popoverClassName,
93
+ modifiers: modifiers
94
+ }, additionalProps), /*#__PURE__*/React.createElement("div", {
95
+ ref: function ref(_ref) {
96
+ return _this2.dtablePopoverRef = _ref;
97
+ },
98
+ onClick: this.onPopoverInsideClick
99
+ }, this.props.children));
100
+ }
101
+ }]);
102
+ return DTablePopover;
103
+ }(React.Component);
104
+ DTablePopover.defaultProps = {
105
+ placement: 'bottom-start',
106
+ hideArrow: true,
107
+ canHideDTablePopover: true
108
+ };
109
+ export default DTablePopover;
@@ -0,0 +1,137 @@
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, Fragment } from 'react';
6
+ import classnames from 'classnames';
7
+ import { isFunction } from '../utils';
8
+ var DtableSearchInput = /*#__PURE__*/function (_Component) {
9
+ _inherits(DtableSearchInput, _Component);
10
+ var _super = _createSuper(DtableSearchInput);
11
+ function DtableSearchInput(props) {
12
+ var _this;
13
+ _classCallCheck(this, DtableSearchInput);
14
+ _this = _super.call(this, props);
15
+ _this.onCompositionStart = function () {
16
+ _this.isInputtingChinese = true;
17
+ };
18
+ _this.onChange = function (e) {
19
+ _this.timer && clearTimeout(_this.timer);
20
+ var _this$props = _this.props,
21
+ onChange = _this$props.onChange,
22
+ wait = _this$props.wait;
23
+ var text = e.target.value;
24
+ _this.setState({
25
+ searchValue: text || ''
26
+ }, function () {
27
+ if (_this.isInputtingChinese) return;
28
+ _this.timer = setTimeout(function () {
29
+ onChange && onChange(_this.state.searchValue.trim());
30
+ }, wait);
31
+ });
32
+ };
33
+ _this.onCompositionEnd = function (e) {
34
+ _this.isInputtingChinese = false;
35
+ _this.onChange(e);
36
+ };
37
+ _this.clearSearch = function () {
38
+ var clearValue = _this.props.clearValue;
39
+ _this.setState({
40
+ searchValue: ''
41
+ }, function () {
42
+ clearValue && clearValue();
43
+ });
44
+ };
45
+ _this.setFocus = function (isSelectAllText) {
46
+ if (_this.inputRef === document.activeElement) return;
47
+ _this.inputRef.focus();
48
+ if (isSelectAllText) {
49
+ var txtLength = _this.state.searchValue.length;
50
+ _this.inputRef.setSelectionRange(0, txtLength);
51
+ }
52
+ };
53
+ _this.renderClear = function () {
54
+ var _this$props2 = _this.props,
55
+ isClearable = _this$props2.isClearable,
56
+ clearClassName = _this$props2.clearClassName,
57
+ _this$props2$componen = _this$props2.components,
58
+ components = _this$props2$componen === void 0 ? {} : _this$props2$componen;
59
+ var searchValue = _this.state.searchValue;
60
+ if (!isClearable || !searchValue) return null;
61
+ var ClearIndicator = components.ClearIndicator;
62
+ if (React.isValidElement(ClearIndicator)) {
63
+ return React.cloneElement(ClearIndicator, {
64
+ clearValue: _this.clearSearch
65
+ });
66
+ } else if (isFunction(ClearIndicator)) {
67
+ return /*#__PURE__*/React.createElement(ClearIndicator, {
68
+ clearValue: _this.clearSearch
69
+ });
70
+ }
71
+ return /*#__PURE__*/React.createElement("i", {
72
+ className: classnames('search-text-clear input-icon-addon', clearClassName),
73
+ onClick: _this.clearSearch
74
+ }, "\xD7");
75
+ };
76
+ _this.state = {
77
+ searchValue: props.value
78
+ };
79
+ _this.isInputtingChinese = false;
80
+ _this.timer = null;
81
+ _this.inputRef = null;
82
+ return _this;
83
+ }
84
+ _createClass(DtableSearchInput, [{
85
+ key: "componentWillReceiveProps",
86
+ value: function componentWillReceiveProps(nextProps) {
87
+ if (nextProps.value !== this.props.value) {
88
+ this.setState({
89
+ searchValue: nextProps.value
90
+ });
91
+ }
92
+ }
93
+ }, {
94
+ key: "componentWillUnmount",
95
+ value: function componentWillUnmount() {
96
+ this.timer && clearTimeout(this.timer);
97
+ this.timer = null;
98
+ this.inputRef = null;
99
+ }
100
+ }, {
101
+ key: "render",
102
+ value: function render() {
103
+ var _this2 = this;
104
+ var _this$props3 = this.props,
105
+ placeholder = _this$props3.placeholder,
106
+ autoFocus = _this$props3.autoFocus,
107
+ className = _this$props3.className,
108
+ onKeyDown = _this$props3.onKeyDown,
109
+ disabled = _this$props3.disabled,
110
+ style = _this$props3.style;
111
+ var searchValue = this.state.searchValue;
112
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", {
113
+ type: "text",
114
+ value: searchValue,
115
+ className: classnames('form-control', className),
116
+ onChange: this.onChange,
117
+ autoFocus: autoFocus,
118
+ placeholder: placeholder,
119
+ onCompositionStart: this.onCompositionStart,
120
+ onCompositionEnd: this.onCompositionEnd,
121
+ onKeyDown: onKeyDown,
122
+ disabled: disabled,
123
+ style: style,
124
+ ref: function ref(_ref) {
125
+ return _this2.inputRef = _ref;
126
+ }
127
+ }), this.renderClear());
128
+ }
129
+ }]);
130
+ return DtableSearchInput;
131
+ }(Component);
132
+ DtableSearchInput.defaultProps = {
133
+ wait: 100,
134
+ disabled: false,
135
+ value: ''
136
+ };
137
+ export default DtableSearchInput;