sea-chart 2.0.37 → 2.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/api/index.js +20 -69
  2. package/dist/assets/css/sea-chart-d3-tooltip.css +0 -1
  3. package/dist/components/cell-factory/FormatterConfig.js +55 -62
  4. package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
  5. package/dist/components/cell-factory/SingleSelectOption.js +11 -18
  6. package/dist/components/cell-factory/cell-editor-factory.js +5 -12
  7. package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
  8. package/dist/components/cell-factory/link-content.js +30 -38
  9. package/dist/components/chart-color-selector/color-selector.js +11 -18
  10. package/dist/components/collaborator/index.js +7 -14
  11. package/dist/components/color-picker/index.js +12 -19
  12. package/dist/components/color-popover/color-rules/color-rule.js +26 -34
  13. package/dist/components/color-popover/color-rules/index.js +7 -15
  14. package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
  15. package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
  16. package/dist/components/color-popover/color-rules/rule-filters/number-input.js +9 -17
  17. package/dist/components/color-popover/color-rules-popover.js +31 -37
  18. package/dist/components/color-popover/color-selector-popover.js +12 -20
  19. package/dist/components/color-setting/color-group-selector.js +13 -21
  20. package/dist/components/common-add-tool/index.js +8 -15
  21. package/dist/components/data-process-setter/data-setting-header.js +7 -14
  22. package/dist/components/data-process-setter/hide-column-setter.js +13 -20
  23. package/dist/components/data-process-setter/index.js +4 -27
  24. package/dist/components/data-process-setter/sort-setter.js +18 -26
  25. package/dist/components/draggable/Draggable.js +7 -13
  26. package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +41 -48
  27. package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
  28. package/dist/components/drill-down-settings/index.js +11 -18
  29. package/dist/components/dtable-popover/index.js +13 -20
  30. package/dist/components/dtable-search-input/index.js +13 -21
  31. package/dist/components/font-settings/index.js +14 -22
  32. package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
  33. package/dist/components/goal-line-setting/index.js +12 -19
  34. package/dist/components/highlighter/highlighter.js +7 -14
  35. package/dist/components/icon/index.js +12 -23
  36. package/dist/components/index.js +7 -48
  37. package/dist/components/loading/index.js +6 -13
  38. package/dist/components/number-input/index.js +11 -24
  39. package/dist/components/pixel-editor/index.js +15 -23
  40. package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +13 -16
  41. package/dist/components/popover/hide-column-popover/hide-column-popover.css +5 -1
  42. package/dist/components/popover/hide-column-popover/hide-column-popover.js +28 -38
  43. package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
  44. package/dist/components/popover/sort-popover/sort-popover.js +58 -69
  45. package/dist/components/resize-handle/ResizeHandle.js +6 -13
  46. package/dist/components/row-card/row-card-header-cell.js +17 -24
  47. package/dist/components/row-card/row-card-header.js +15 -22
  48. package/dist/components/row-card/row-card-item.js +35 -43
  49. package/dist/components/row-card/row-card.js +17 -25
  50. package/dist/components/statistic-record-dialog/index.js +61 -68
  51. package/dist/components/tooltip/index.js +39 -28
  52. package/dist/components/types-dialog/index.js +62 -70
  53. package/dist/components/types-dialog/use-force-update.js +4 -10
  54. package/dist/constants/color-rules.js +8 -14
  55. package/dist/constants/common-constants.js +8 -14
  56. package/dist/constants/error.js +2 -8
  57. package/dist/constants/geolocation.js +9 -15
  58. package/dist/constants/index.js +142 -271
  59. package/dist/constants/key-codes.js +0 -2
  60. package/dist/constants/model.js +3 -9
  61. package/dist/constants/regions.js +3 -8
  62. package/dist/constants/style.js +6 -12
  63. package/dist/constants/table.js +1 -7
  64. package/dist/constants/type-image.js +33 -39
  65. package/dist/constants/type.js +3 -9
  66. package/dist/context.js +13 -20
  67. package/dist/editor/index.js +13 -16
  68. package/dist/index.js +13 -104
  69. package/dist/intl.js +10 -17
  70. package/dist/locale/index.js +16 -23
  71. package/dist/locale/lang/de.js +2 -7
  72. package/dist/locale/lang/en.js +2 -7
  73. package/dist/locale/lang/es.js +2 -7
  74. package/dist/locale/lang/fr.js +2 -7
  75. package/dist/locale/lang/pt.js +2 -7
  76. package/dist/locale/lang/ru.js +2 -7
  77. package/dist/locale/lang/zh_CN.js +2 -7
  78. package/dist/model/area-group.js +12 -19
  79. package/dist/model/area.js +12 -19
  80. package/dist/model/bar-custom.js +11 -18
  81. package/dist/model/bar-group.js +12 -19
  82. package/dist/model/bar-stack.js +10 -17
  83. package/dist/model/bar.js +11 -18
  84. package/dist/model/base-model.js +4 -11
  85. package/dist/model/basic-number-card.js +13 -20
  86. package/dist/model/chart.js +7 -13
  87. package/dist/model/combination.js +15 -22
  88. package/dist/model/compare-bar.js +14 -21
  89. package/dist/model/completeness-group.js +11 -18
  90. package/dist/model/completeness.js +10 -17
  91. package/dist/model/dashboard.js +7 -14
  92. package/dist/model/funnel.js +14 -21
  93. package/dist/model/generic-model.js +135 -143
  94. package/dist/model/heat-map.js +9 -16
  95. package/dist/model/horizontal-bar.js +11 -18
  96. package/dist/model/horizontal-group-bar.js +10 -17
  97. package/dist/model/index.js +69 -93
  98. package/dist/model/line-group.js +13 -20
  99. package/dist/model/line.js +12 -19
  100. package/dist/model/map-bubble.js +14 -17
  101. package/dist/model/map.js +12 -19
  102. package/dist/model/mirror.js +13 -20
  103. package/dist/model/pie.js +12 -19
  104. package/dist/model/ring.js +12 -19
  105. package/dist/model/scatter.js +10 -17
  106. package/dist/model/stacked-horizontal-bar.js +11 -18
  107. package/dist/model/table-element.js +5 -12
  108. package/dist/model/table.js +7 -14
  109. package/dist/model/tree-map.js +7 -14
  110. package/dist/model/trend.js +11 -18
  111. package/dist/model/user.js +1 -7
  112. package/dist/model/world-map-bubble.js +12 -19
  113. package/dist/model/world-map.js +12 -19
  114. package/dist/services/map-json.js +14 -17
  115. package/dist/settings/advance-bar-settings/data-settings.js +36 -44
  116. package/dist/settings/advance-bar-settings/index.js +3 -20
  117. package/dist/settings/advance-bar-settings/style-settings.js +66 -73
  118. package/dist/settings/bar-settings/data-settings.js +39 -47
  119. package/dist/settings/bar-settings/index.js +3 -20
  120. package/dist/settings/bar-settings/style-settings.js +51 -59
  121. package/dist/settings/basic-number-card/data-settings.js +50 -57
  122. package/dist/settings/basic-number-card/index.js +3 -20
  123. package/dist/settings/basic-number-card/style-settings.js +19 -27
  124. package/dist/settings/combination-settings/data-settings.js +55 -64
  125. package/dist/settings/combination-settings/index.js +3 -20
  126. package/dist/settings/combination-settings/style-settings.js +67 -75
  127. package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
  128. package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
  129. package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
  130. package/dist/settings/completeness-settings/index.js +3 -20
  131. package/dist/settings/completeness-settings/style-settings.js +19 -26
  132. package/dist/settings/dashboard-settings/data-settings.js +44 -51
  133. package/dist/settings/dashboard-settings/index.js +2 -13
  134. package/dist/settings/data-settings.js +72 -79
  135. package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
  136. package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
  137. package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
  138. package/dist/settings/funnel-settings/components/funnel-layer-setting.js +22 -30
  139. package/dist/settings/funnel-settings/data-settings.js +23 -31
  140. package/dist/settings/funnel-settings/index.js +3 -20
  141. package/dist/settings/funnel-settings/style-settings.js +11 -19
  142. package/dist/settings/heat-map-settings/data-settings.js +18 -26
  143. package/dist/settings/heat-map-settings/index.js +3 -20
  144. package/dist/settings/heat-map-settings/style-settings.js +18 -26
  145. package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
  146. package/dist/settings/horizontal-bar-settings/index.js +3 -20
  147. package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
  148. package/dist/settings/index.js +57 -70
  149. package/dist/settings/map-settings/components/location-field-selector.js +10 -17
  150. package/dist/settings/map-settings/components/map-level-selector.js +11 -18
  151. package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
  152. package/dist/settings/map-settings/index.js +3 -20
  153. package/dist/settings/map-settings/map-data-settings.js +23 -30
  154. package/dist/settings/map-settings/map-style-settings.js +27 -35
  155. package/dist/settings/mirror-settings/data-settings.js +26 -34
  156. package/dist/settings/mirror-settings/index.js +2 -13
  157. package/dist/settings/pie-settings/data-settings.js +33 -41
  158. package/dist/settings/pie-settings/index.js +3 -20
  159. package/dist/settings/pie-settings/style-settings.js +47 -55
  160. package/dist/settings/scatter/data-settings.js +27 -34
  161. package/dist/settings/scatter/index.js +3 -12
  162. package/dist/settings/stacks-settings/index.js +19 -27
  163. package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
  164. package/dist/settings/style-settings.js +65 -73
  165. package/dist/settings/table-element-settings/components/data-filter.js +49 -58
  166. package/dist/settings/table-element-settings/data-settings.js +21 -29
  167. package/dist/settings/table-element-settings/index.css +1 -31
  168. package/dist/settings/table-element-settings/index.js +2 -13
  169. package/dist/settings/table-settings/data-settings.js +113 -120
  170. package/dist/settings/table-settings/index.js +2 -13
  171. package/dist/settings/time-comparison-settings/data-settings.js +43 -51
  172. package/dist/settings/time-comparison-settings/index.js +3 -20
  173. package/dist/settings/time-comparison-settings/style-settings.js +44 -52
  174. package/dist/settings/trend-settings/data-settings.js +24 -32
  175. package/dist/settings/trend-settings/index.js +3 -20
  176. package/dist/settings/trend-settings/style-setting.js +19 -27
  177. package/dist/settings/widgets/basic-summary/index.js +59 -66
  178. package/dist/settings/widgets/chart-type/index.js +18 -26
  179. package/dist/settings/widgets/color-settings/index.js +72 -80
  180. package/dist/settings/widgets/common-data-settings.js +27 -34
  181. package/dist/settings/widgets/data-filter/index.js +59 -59
  182. package/dist/settings/widgets/data-sort.js +16 -24
  183. package/dist/settings/widgets/date-summary-item.js +26 -34
  184. package/dist/settings/widgets/display-values-settings/index.js +14 -22
  185. package/dist/settings/widgets/divider/index.js +8 -16
  186. package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
  187. package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
  188. package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
  189. package/dist/settings/widgets/font-settings/index.js +4 -27
  190. package/dist/settings/widgets/group-by.js +52 -59
  191. package/dist/settings/widgets/min-max-setting.js +10 -18
  192. package/dist/settings/widgets/mininum-slice-percent.js +10 -18
  193. package/dist/settings/widgets/numeric-summary-item.js +25 -33
  194. package/dist/settings/widgets/select-line-type/index.js +10 -17
  195. package/dist/settings/widgets/select-table/index.js +9 -16
  196. package/dist/settings/widgets/select-view/index.js +20 -28
  197. package/dist/settings/widgets/stack.js +14 -22
  198. package/dist/settings/widgets/summary-method-setting.js +17 -25
  199. package/dist/settings/widgets/summary-settings.js +75 -82
  200. package/dist/settings/widgets/switch/index.js +9 -16
  201. package/dist/settings/widgets/text-horizontal-settings.js +15 -23
  202. package/dist/settings/widgets/time-picker.js +29 -37
  203. package/dist/settings/widgets/title-settings/index.js +29 -37
  204. package/dist/settings/widgets/title-settings/title-text.js +5 -12
  205. package/dist/settings/widgets/x-axios.js +0 -1
  206. package/dist/settings/widgets/y-axis-group-settings.js +65 -72
  207. package/dist/utils/cell-format-utils.js +25 -33
  208. package/dist/utils/cell-value-utils.js +4 -11
  209. package/dist/utils/chart-utils/base-utils.js +467 -367
  210. package/dist/utils/chart-utils/index.js +29 -40
  211. package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +78 -85
  212. package/dist/utils/chart-utils/original-data-utils/card-calculator.js +20 -21
  213. package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
  214. package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +21 -28
  215. package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
  216. package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +28 -26
  217. package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
  218. package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +19 -26
  219. package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +94 -97
  220. package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -25
  221. package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +50 -36
  222. package/dist/utils/chart-utils/sql-statistics-utils.js +385 -388
  223. package/dist/utils/chart.js +9 -17
  224. package/dist/utils/collaborator-manager.js +3 -9
  225. package/dist/utils/collaborator-utils.js +19 -31
  226. package/dist/utils/collaborator.js +6 -15
  227. package/dist/utils/color-utils.js +18 -29
  228. package/dist/utils/column-utils.js +88 -102
  229. package/dist/utils/common-utils.js +28 -53
  230. package/dist/utils/concurrency-manager.js +1 -7
  231. package/dist/utils/contexts.js +7 -11
  232. package/dist/utils/date-translate.js +12 -20
  233. package/dist/utils/digital-sign-utils.js +7 -14
  234. package/dist/utils/event-bus.js +1 -7
  235. package/dist/utils/hotkey.js +5 -11
  236. package/dist/utils/index.js +73 -219
  237. package/dist/utils/key-generator.js +2 -9
  238. package/dist/utils/map.js +22 -31
  239. package/dist/utils/object-utils.js +2 -8
  240. package/dist/utils/options-utils.js +10 -18
  241. package/dist/utils/row-record-utils.js +251 -183
  242. package/dist/utils/row-utils.js +27 -38
  243. package/dist/utils/search.js +24 -32
  244. package/dist/utils/sql/chart-data-sql.js +106 -112
  245. package/dist/utils/sql/column-2-sql-column.js +162 -172
  246. package/dist/utils/sql/index.js +3 -27
  247. package/dist/utils/trend-utils.js +50 -45
  248. package/dist/view/index.css +2 -8
  249. package/dist/view/index.js +102 -103
  250. package/dist/view/title/index.js +16 -24
  251. package/dist/view/wrapper/area-group.js +57 -57
  252. package/dist/view/wrapper/area.js +43 -51
  253. package/dist/view/wrapper/bar-compare.js +56 -48
  254. package/dist/view/wrapper/bar-custom-stack.js +73 -55
  255. package/dist/view/wrapper/bar-group.js +94 -73
  256. package/dist/view/wrapper/bar-stack.js +49 -57
  257. package/dist/view/wrapper/bar.js +40 -48
  258. package/dist/view/wrapper/basic-number-card.js +50 -34
  259. package/dist/view/wrapper/chart-component.js +164 -569
  260. package/dist/view/wrapper/combination.js +55 -63
  261. package/dist/view/wrapper/completeness-group.js +140 -93
  262. package/dist/view/wrapper/completeness.js +36 -44
  263. package/dist/view/wrapper/dashboard.js +104 -59
  264. package/dist/view/wrapper/funnel.js +40 -43
  265. package/dist/view/wrapper/heat-map.js +62 -70
  266. package/dist/view/wrapper/horizontal-bar-group.js +70 -58
  267. package/dist/view/wrapper/horizontal-bar-stack.js +48 -56
  268. package/dist/view/wrapper/horizontal-bar.js +41 -49
  269. package/dist/view/wrapper/index.js +107 -115
  270. package/dist/view/wrapper/line-group.js +49 -52
  271. package/dist/view/wrapper/line.js +42 -50
  272. package/dist/view/wrapper/map-bubble.js +40 -48
  273. package/dist/view/wrapper/map-world-bubble.js +40 -47
  274. package/dist/view/wrapper/map-world.js +42 -49
  275. package/dist/view/wrapper/map.js +42 -50
  276. package/dist/view/wrapper/mirror.js +41 -49
  277. package/dist/view/wrapper/pie.js +45 -53
  278. package/dist/view/wrapper/ring.js +50 -58
  279. package/dist/view/wrapper/scatter.js +50 -56
  280. package/dist/view/wrapper/table/index.js +14 -22
  281. package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
  282. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +53 -61
  283. package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
  284. package/dist/view/wrapper/table/two-dimension-table.js +85 -92
  285. package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
  286. package/dist/view/wrapper/table-element/components/formatter.js +90 -99
  287. package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
  288. package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
  289. package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
  290. package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
  291. package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
  292. package/dist/view/wrapper/table-element/components/record.js +13 -20
  293. package/dist/view/wrapper/table-element/components/records-body.js +9 -17
  294. package/dist/view/wrapper/table-element/components/records-header/index.js +7 -16
  295. package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
  296. package/dist/view/wrapper/table-element/components/records.js +25 -33
  297. package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +8 -13
  298. package/dist/view/wrapper/table-element/components/utils.js +6 -16
  299. package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
  300. package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
  301. package/dist/view/wrapper/table-element/index.js +30 -43
  302. package/dist/view/wrapper/treemap.js +38 -46
  303. package/dist/view/wrapper/trend.js +80 -65
  304. package/package.json +15 -12
@@ -1,19 +1,11 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _dtableUtils = require("dtable-utils");
12
- var _utils = require("../../../utils");
13
- var _intl = _interopRequireDefault(require("../../../intl"));
14
- var _constants = require("../../../constants");
15
- var _pivotTableDisplayName = _interopRequireDefault(require("./pivot-table-display-name"));
16
- class TwoDimensionTable extends _react.PureComponent {
1
+ import React, { PureComponent } from 'react';
2
+ import classnames from 'classnames';
3
+ import { CellType, isNumber } from 'dtable-utils';
4
+ import { BaseUtils, formatRowTotal } from '../../../utils';
5
+ import intl from '../../../intl';
6
+ import { CHART_SUMMARY_TYPE, CHART_THEME_COLOR } from '../../../constants';
7
+ import PivotTableDisplayName from './pivot-table-display-name';
8
+ class TwoDimensionTable extends PureComponent {
17
9
  constructor() {
18
10
  super(...arguments);
19
11
  this.getCells = row => {
@@ -66,10 +58,10 @@ class TwoDimensionTable extends _react.PureComponent {
66
58
  cellIdx: selectedCellIdx
67
59
  } = selectedCell || {};
68
60
  const isSelectedTotalCellBottom = selectRowIdx === 0 && selectedCellIdx === (Array.isArray(pivot_columns) ? pivot_columns.length : 0);
69
- const isCollaborator = columnGroupbyColumn.type === _dtableUtils.CellType.COLLABORATOR;
70
- return /*#__PURE__*/_react.default.createElement("thead", {
61
+ const isCollaborator = columnGroupbyColumn.type === CellType.COLLABORATOR;
62
+ return /*#__PURE__*/React.createElement("thead", {
71
63
  className: "seatable-table-header-sm"
72
- }, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
64
+ }, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
73
65
  className: "pivot-table-header"
74
66
  }, !rowGroupName && groupName), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
75
67
  let {
@@ -79,39 +71,40 @@ class TwoDimensionTable extends _react.PureComponent {
79
71
  original_key = [original_key];
80
72
  }
81
73
  let isSelectedHeaderBottom = selectRowIdx === 0 && selectedCellIdx === index;
82
- return /*#__PURE__*/_react.default.createElement("th", {
83
- className: (0, _classnames.default)('pivot-table-header', {
74
+ return /*#__PURE__*/React.createElement("th", {
75
+ className: classnames('pivot-table-header', {
84
76
  'selected-pivot-cell-top': isSelectedHeaderBottom
85
77
  }),
86
- key: "pivot-column-".concat(index)
87
- }, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
78
+ key: `pivot-column-${index}`
79
+ }, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
88
80
  value: original_key,
89
81
  column: columnGroupbyColumn || {},
90
82
  rowData: item,
91
83
  globalTheme: globalTheme
92
84
  }));
93
- }), display_total && /*#__PURE__*/_react.default.createElement("th", {
94
- className: (0, _classnames.default)('pivot-table-header', {
85
+ }), display_total && /*#__PURE__*/React.createElement("th", {
86
+ className: classnames('pivot-table-header', {
95
87
  'selected-pivot-cell-top': isSelectedTotalCellBottom
96
88
  })
97
- }, /*#__PURE__*/_react.default.createElement("div", null, _intl.default.get('Total')))), isSingleNumericColumn === 'false' && summary_columns && summary_columns.length && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
89
+ }, /*#__PURE__*/React.createElement("div", null, intl.get('Total')))), isSingleNumericColumn === 'false' && summary_columns && summary_columns.length && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
98
90
  className: "pivot-table-header"
99
91
  }), Array.isArray(pivot_columns) && pivot_columns.map((item, index) => {
100
- return /*#__PURE__*/_react.default.createElement("th", {
92
+ return /*#__PURE__*/React.createElement("th", {
93
+ key: `pivot-column-${index}`,
101
94
  className: "pivot-table-header summary-columns-header"
102
- }, /*#__PURE__*/_react.default.createElement("div", {
95
+ }, /*#__PURE__*/React.createElement("div", {
103
96
  className: "pivot-table-header-summary-columns-container"
104
97
  }, summary_columns.map((column, idx) => {
105
- return /*#__PURE__*/_react.default.createElement("div", {
106
- className: (0, _classnames.default)('pivot-table-header'),
107
- key: "pivot-column-".concat(idx)
108
- }, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
98
+ return /*#__PURE__*/React.createElement("div", {
99
+ className: classnames('pivot-table-header'),
100
+ key: `pivot-summary-column-${idx}`
101
+ }, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
109
102
  value: column.name,
110
103
  column: column || {},
111
104
  globalTheme: globalTheme
112
105
  }));
113
106
  })));
114
- }), display_total && /*#__PURE__*/_react.default.createElement("th", {
107
+ }), display_total && /*#__PURE__*/React.createElement("th", {
115
108
  className: "pivot-table-header"
116
109
  })));
117
110
  };
@@ -140,23 +133,23 @@ class TwoDimensionTable extends _react.PureComponent {
140
133
  this.renderEmpty = (summaryColumns, cellIdx) => {
141
134
  if (summaryColumns && (summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.length) !== 0) {
142
135
  return summaryColumns.map(item => {
143
- return /*#__PURE__*/_react.default.createElement("div", {
144
- key: "table-cell-".concat(item === null || item === void 0 ? void 0 : item.key),
145
- className: (0, _classnames.default)('pivot-cell', {
136
+ return /*#__PURE__*/React.createElement("div", {
137
+ key: `table-cell-${item === null || item === void 0 ? void 0 : item.key}`,
138
+ className: classnames('pivot-cell', {
146
139
  'pivot-empty-cell': true
147
140
  })
148
- }, /*#__PURE__*/_react.default.createElement("i", null));
141
+ }, /*#__PURE__*/React.createElement("i", null));
149
142
  });
150
143
  }
151
- return /*#__PURE__*/_react.default.createElement("div", {
152
- key: "table-cell-".concat(cellIdx),
153
- className: (0, _classnames.default)('pivot-cell', {
144
+ return /*#__PURE__*/React.createElement("div", {
145
+ key: `table-cell-${cellIdx}`,
146
+ className: classnames('pivot-cell', {
154
147
  'pivot-empty-cell': true
155
148
  })
156
- }, /*#__PURE__*/_react.default.createElement("i", null));
149
+ }, /*#__PURE__*/React.createElement("i", null));
157
150
  };
158
151
  this.getRowTotal = (rowTotal, value) => {
159
- if (value && (0, _dtableUtils.isNumber)(value)) {
152
+ if (value && isNumber(value)) {
160
153
  return rowTotal + value;
161
154
  }
162
155
  return rowTotal;
@@ -191,12 +184,12 @@ class TwoDimensionTable extends _react.PureComponent {
191
184
  let pivotColumnCells = [];
192
185
  const isSelectRowTotalCellRight = selectRowIdx === pivotRowsLen && selectedCellIdx === 0;
193
186
  const isSelectTotal = selectRowIdx === pivotRowsLen && selectedCellIdx === (Array.isArray(pivot_columns) ? pivot_columns.length : 0);
194
- const tableTotalDisplayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, pivot_table_total, summaryMethod);
195
- const isValidTableTotalDisplayValue = _utils.BaseUtils.isValidValue(tableTotalDisplayValue, display_empty);
196
- const isCount = summary_type === _constants.CHART_SUMMARY_TYPE.COUNT;
187
+ const tableTotalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivot_table_total, summaryMethod);
188
+ const isValidTableTotalDisplayValue = BaseUtils.isValidValue(tableTotalDisplayValue, display_empty);
189
+ const isCount = summary_type === CHART_SUMMARY_TYPE.COUNT;
197
190
  this.isCount = isCount;
198
- const isCollaborator = groupbyColumn.type === _dtableUtils.CellType.COLLABORATOR;
199
- return /*#__PURE__*/_react.default.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
191
+ const isCollaborator = groupbyColumn.type === CellType.COLLABORATOR;
192
+ return /*#__PURE__*/React.createElement("tbody", null, pivotRowsLen > 0 && pivot_rows.map((rowItem, rowIdx) => {
200
193
  let {
201
194
  name,
202
195
  total
@@ -214,13 +207,13 @@ class TwoDimensionTable extends _react.PureComponent {
214
207
  pivotColumnCells[rowIdx] = rowItem.rows || [];
215
208
  }
216
209
  let rowTotal = 0;
217
- return /*#__PURE__*/_react.default.createElement("tr", {
210
+ return /*#__PURE__*/React.createElement("tr", {
218
211
  key: 'table-row' + rowIdx
219
- }, /*#__PURE__*/_react.default.createElement("td", {
220
- className: (0, _classnames.default)('pivot-row-name', {
212
+ }, /*#__PURE__*/React.createElement("td", {
213
+ className: classnames('pivot-row-name', {
221
214
  'selected-pivot-cell-left': isSelectedRowNameRight
222
215
  })
223
- }, /*#__PURE__*/_react.default.createElement(_pivotTableDisplayName.default, {
216
+ }, /*#__PURE__*/React.createElement(PivotTableDisplayName, {
224
217
  value: name,
225
218
  column: groupbyColumn,
226
219
  rowData: rowItem,
@@ -234,7 +227,7 @@ class TwoDimensionTable extends _react.PureComponent {
234
227
  } = c;
235
228
  if (isCount) {
236
229
  const displayValue = total;
237
- const isValidDisplayValue = _utils.BaseUtils.isValidValue(displayValue, display_empty);
230
+ const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
238
231
  rowTotal = this.getRowTotal(rowTotal, displayValue);
239
232
  if (c && Array.isArray(c.rows) && c.rows.length > 0) {
240
233
  pivotRowCells.push(...c.rows);
@@ -244,14 +237,14 @@ class TwoDimensionTable extends _react.PureComponent {
244
237
  pivotColumnCells[cellIdx] = [...c.rows];
245
238
  }
246
239
  }
247
- return /*#__PURE__*/_react.default.createElement("td", {
248
- className: (0, _classnames.default)('pivot-cell', {
240
+ return /*#__PURE__*/React.createElement("td", {
241
+ className: classnames('pivot-cell', {
249
242
  'pivot-empty-cell': !isValidDisplayValue,
250
243
  'selected-pivot-cell': isSelectedCell,
251
244
  'selected-pivot-cell-top': isSelectedCellTop,
252
245
  'selected-pivot-cell-left': isSelectedCellLeft
253
246
  }),
254
- key: "table-cell-".concat(cellIdx),
247
+ key: `table-cell-${cellIdx}`,
255
248
  onClick: () => this.toggleRecords({
256
249
  ...c,
257
250
  name: rowItem === null || rowItem === void 0 ? void 0 : rowItem.name
@@ -260,39 +253,39 @@ class TwoDimensionTable extends _react.PureComponent {
260
253
  cellIdx
261
254
  }),
262
255
  title: displayValue
263
- }, isValidDisplayValue ? displayValue : /*#__PURE__*/_react.default.createElement("i", null), /*#__PURE__*/_react.default.createElement("span", {
264
- className: (0, _classnames.default)({
256
+ }, isValidDisplayValue ? displayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
257
+ className: classnames({
265
258
  'selected-pivot-cell-border': isSelectedCell
266
259
  })
267
260
  }));
268
261
  }
269
- return /*#__PURE__*/_react.default.createElement("td", {
270
- className: (0, _classnames.default)('pivot-cell'),
271
- key: "table-cell-".concat(cellIdx)
272
- }, /*#__PURE__*/_react.default.createElement("div", {
273
- className: (0, _classnames.default)('pivot-cells-container')
262
+ return /*#__PURE__*/React.createElement("td", {
263
+ className: classnames('pivot-cell'),
264
+ key: `table-cell-${cellIdx}`
265
+ }, /*#__PURE__*/React.createElement("div", {
266
+ className: classnames('pivot-cells-container')
274
267
  }, total && total.map && total.map((summaryCell, idx) => {
275
268
  const summaryCellColumnKey = summaryCell[2];
276
269
  const summaryCellColumn = summaryColumns === null || summaryColumns === void 0 ? void 0 : summaryColumns.find(item => item.key === summaryCellColumnKey);
277
- const displayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryCellColumn, summaryCell[1], summaryMethod);
278
- const isValidDisplayValue = _utils.BaseUtils.isValidValue(displayValue, display_empty);
270
+ const displayValue = BaseUtils.getSummaryValueDisplayString(summaryCellColumn, summaryCell[1], summaryMethod);
271
+ const isValidDisplayValue = BaseUtils.isValidValue(displayValue, display_empty);
279
272
  rowTotal = this.getRowTotal(rowTotal, summaryCell[1]);
280
- return /*#__PURE__*/_react.default.createElement("div", {
281
- key: "table-cell-".concat(cellIdx, "-").concat(idx),
282
- className: (0, _classnames.default)('pivot-cell', {
273
+ return /*#__PURE__*/React.createElement("div", {
274
+ key: `table-cell-${cellIdx}-${idx}`,
275
+ className: classnames('pivot-cell', {
283
276
  'pivot-empty-cell': !isValidDisplayValue,
284
277
  'selected-pivot-cell': isSelectedCell,
285
278
  'selected-pivot-cell-top': isSelectedCellTop,
286
279
  'selected-pivot-cell-left': isSelectedCellLeft
287
280
  })
288
- }, isValidDisplayValue ? displayValue : /*#__PURE__*/_react.default.createElement("i", null), /*#__PURE__*/_react.default.createElement("span", {
289
- className: (0, _classnames.default)({
281
+ }, isValidDisplayValue ? displayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
282
+ className: classnames({
290
283
  'selected-pivot-cell-border': isSelectedCell
291
284
  })
292
285
  }));
293
286
  }), !total && !(typeof total === 'number') && this.renderEmpty(summaryColumns, cellIdx)));
294
- }), display_total && /*#__PURE__*/_react.default.createElement("td", {
295
- className: (0, _classnames.default)('pivot-cell', {
287
+ }), display_total && /*#__PURE__*/React.createElement("td", {
288
+ className: classnames('pivot-cell', {
296
289
  'selected-pivot-cell': isSelectedTotalCell,
297
290
  'selected-pivot-cell-top': isSelectedTotalCellTop,
298
291
  'selected-pivot-cell-left': isSelectedTotalCellLeft
@@ -306,29 +299,29 @@ class TwoDimensionTable extends _react.PureComponent {
306
299
  cellIdx: cells.length
307
300
  }),
308
301
  title: rowTotal
309
- }, _utils.BaseUtils.isValidValue(rowTotal, display_empty) ? (0, _utils.formatRowTotal)(rowTotal) : /*#__PURE__*/_react.default.createElement("i", null), /*#__PURE__*/_react.default.createElement("span", {
310
- className: (0, _classnames.default)({
302
+ }, BaseUtils.isValidValue(rowTotal, display_empty) ? BaseUtils.getSummaryValueDisplayString(summaryColumn, rowTotal, summaryMethod) : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
303
+ className: classnames({
311
304
  'selected-pivot-cell-border': isSelectedTotalCell
312
305
  })
313
306
  })));
314
- }), display_total && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
315
- className: (0, _classnames.default)('pivot-column-total', {
307
+ }), display_total && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
308
+ className: classnames('pivot-column-total', {
316
309
  'selected-pivot-cell-left': isSelectRowTotalCellRight
317
310
  })
318
- }, /*#__PURE__*/_react.default.createElement("div", null, _intl.default.get('Total'))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
311
+ }, /*#__PURE__*/React.createElement("div", null, intl.get('Total'))), Array.isArray(pivot_columns) && pivot_columns.map((c, index) => {
319
312
  const pivotColumnCell = pivotColumnCells[index];
320
313
  const isSelectRowTotalCell = selectRowIdx === pivot_rows.length && selectedCellIdx === index;
321
314
  const isSelectRowTotalCellLeft = selectRowIdx === pivot_rows.length && selectedCellIdx - 1 === index;
322
315
  const pivotColumnTotal = pivot_columns_total[c.key];
323
- const totalDisplayValue = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summaryMethod);
324
- const isValidTotalDisplayValue = _utils.BaseUtils.isValidValue(totalDisplayValue, display_empty);
325
- return /*#__PURE__*/_react.default.createElement("td", {
326
- className: (0, _classnames.default)('pivot-cell', {
316
+ const totalDisplayValue = BaseUtils.getSummaryValueDisplayString(summaryColumn, pivotColumnTotal, summaryMethod);
317
+ const isValidTotalDisplayValue = BaseUtils.isValidValue(totalDisplayValue, display_empty);
318
+ return /*#__PURE__*/React.createElement("td", {
319
+ className: classnames('pivot-cell', {
327
320
  'pivot-empty-cell': !isValidTotalDisplayValue,
328
321
  'selected-pivot-cell': isSelectRowTotalCell,
329
322
  'selected-pivot-cell-left': isSelectRowTotalCellLeft
330
323
  }),
331
- key: "total-cell-".concat(index),
324
+ key: `total-cell-${index}`,
332
325
  onClick: () => this.toggleRecords({
333
326
  rows: pivotColumnCell,
334
327
  total: pivot_columns_total[c.key]
@@ -337,13 +330,13 @@ class TwoDimensionTable extends _react.PureComponent {
337
330
  cellIdx: index
338
331
  }),
339
332
  title: totalDisplayValue
340
- }, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/_react.default.createElement("i", null), /*#__PURE__*/_react.default.createElement("span", {
341
- className: (0, _classnames.default)({
333
+ }, isValidTotalDisplayValue ? totalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
334
+ className: classnames({
342
335
  'selected-pivot-cell-border': isSelectRowTotalCell
343
336
  })
344
337
  }));
345
- }), /*#__PURE__*/_react.default.createElement("td", {
346
- className: (0, _classnames.default)('pivot-cell pivot-table-total', {
338
+ }), /*#__PURE__*/React.createElement("td", {
339
+ className: classnames('pivot-cell pivot-table-total', {
347
340
  'pivot-empty-cell': !isValidTableTotalDisplayValue,
348
341
  'selected-pivot-cell': isSelectTotal
349
342
  }),
@@ -351,8 +344,8 @@ class TwoDimensionTable extends _react.PureComponent {
351
344
  rowIdx: pivot_rows.length,
352
345
  cellIdx: Array.isArray(pivot_columns) ? pivot_columns.length : 0
353
346
  })
354
- }, isValidTableTotalDisplayValue ? tableTotalDisplayValue : /*#__PURE__*/_react.default.createElement("i", null), /*#__PURE__*/_react.default.createElement("span", {
355
- className: (0, _classnames.default)({
347
+ }, isValidTableTotalDisplayValue ? tableTotalDisplayValue : /*#__PURE__*/React.createElement("i", null), /*#__PURE__*/React.createElement("span", {
348
+ className: classnames({
356
349
  'selected-pivot-cell-border': isSelectTotal
357
350
  })
358
351
  }))));
@@ -365,16 +358,16 @@ class TwoDimensionTable extends _react.PureComponent {
365
358
  globalTheme
366
359
  } = this.props;
367
360
  if (!groupbyColumn) return '';
368
- return /*#__PURE__*/_react.default.createElement("table", {
361
+ return /*#__PURE__*/React.createElement("table", {
369
362
  className: "sea-chart-pivot-table",
370
363
  style: {
371
- color: _constants.CHART_THEME_COLOR[globalTheme].pivotTextColor
364
+ color: CHART_THEME_COLOR[globalTheme].pivotTextColor
372
365
  }
373
- }, /*#__PURE__*/_react.default.createElement("caption", {
366
+ }, /*#__PURE__*/React.createElement("caption", {
374
367
  className: "column-title"
375
- }, columnGroupbyColumn.name), /*#__PURE__*/_react.default.createElement("caption", {
368
+ }, columnGroupbyColumn.name), /*#__PURE__*/React.createElement("caption", {
376
369
  className: "row-title"
377
370
  }, groupbyColumn.name), this.renderHeader(), this.renderRows());
378
371
  }
379
372
  }
380
- var _default = exports.default = TwoDimensionTable;
373
+ export default TwoDimensionTable;
@@ -1,47 +1,39 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTwoDimensionArrayValue = exports.getFormulaArrayValue = exports.getCellRecordWidth = exports.convertValueToDtableLongTextValue = exports.DATASET_NOT_SUPPORT_COLUMN_TYPES = void 0;
7
- exports.isArrayFormalColumn = isArrayFormalColumn;
8
- exports.isValidCellValue = void 0;
9
- var _dtableUtils = require("dtable-utils");
10
- var _seafileEditor = require("@seafile/seafile-editor");
11
- const DATASET_NOT_SUPPORT_COLUMN_TYPES = exports.DATASET_NOT_SUPPORT_COLUMN_TYPES = [_dtableUtils.CellType.BUTTON];
12
- const getCellRecordWidth = function (column) {
1
+ import { CellType } from 'dtable-utils';
2
+ import { getPreviewContent } from '@seafile/seafile-editor';
3
+ export const DATASET_NOT_SUPPORT_COLUMN_TYPES = [CellType.BUTTON];
4
+ export const getCellRecordWidth = function (column) {
13
5
  let isSample = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
14
6
  let {
15
7
  type,
16
8
  data
17
9
  } = column;
18
10
  switch (type) {
19
- case _dtableUtils.CellType.DATE:
11
+ case CellType.DATE:
20
12
  {
21
13
  let isShowHourAndMinute = data && data.format && data.format.indexOf('HH:mm') > -1;
22
14
  return isShowHourAndMinute ? 160 : 110;
23
15
  }
24
- case _dtableUtils.CellType.LONG_TEXT:
25
- case _dtableUtils.CellType.AUTO_NUMBER:
26
- case _dtableUtils.CellType.URL:
27
- case _dtableUtils.CellType.EMAIL:
16
+ case CellType.LONG_TEXT:
17
+ case CellType.AUTO_NUMBER:
18
+ case CellType.URL:
19
+ case CellType.EMAIL:
28
20
  {
29
21
  return 200;
30
22
  }
31
- case _dtableUtils.CellType.CHECKBOX:
23
+ case CellType.CHECKBOX:
32
24
  {
33
25
  return 80;
34
26
  }
35
- case _dtableUtils.CellType.NUMBER:
27
+ case CellType.NUMBER:
36
28
  {
37
29
  return 120;
38
30
  }
39
- case _dtableUtils.CellType.CTIME:
40
- case _dtableUtils.CellType.MTIME:
31
+ case CellType.CTIME:
32
+ case CellType.MTIME:
41
33
  {
42
34
  return 170;
43
35
  }
44
- case _dtableUtils.CellType.RATE:
36
+ case CellType.RATE:
45
37
  {
46
38
  const {
47
39
  rate_max_number
@@ -49,8 +41,8 @@ const getCellRecordWidth = function (column) {
49
41
  const rateMaxNumber = rate_max_number || 5;
50
42
  return 16 * rateMaxNumber + 20;
51
43
  }
52
- case _dtableUtils.CellType.IMAGE:
53
- case _dtableUtils.CellType.FILE:
44
+ case CellType.IMAGE:
45
+ case CellType.FILE:
54
46
  {
55
47
  return isSample ? 60 : 160;
56
48
  }
@@ -60,8 +52,7 @@ const getCellRecordWidth = function (column) {
60
52
  }
61
53
  }
62
54
  };
63
- exports.getCellRecordWidth = getCellRecordWidth;
64
- const getFormulaArrayValue = function (value) {
55
+ export const getFormulaArrayValue = function (value) {
65
56
  let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
66
57
  if (!Array.isArray(value)) return [];
67
58
  if (!isFlat) return getTwoDimensionArrayValue(value);
@@ -86,19 +77,17 @@ const getFormulaArrayValue = function (value) {
86
77
  });
87
78
  }).flat().filter(item => isValidCellValue(item));
88
79
  };
89
- exports.getFormulaArrayValue = getFormulaArrayValue;
90
- const convertValueToDtableLongTextValue = value => {
80
+ export const convertValueToDtableLongTextValue = value => {
91
81
  const valueType = Object.prototype.toString.call(value);
92
82
  if (value && valueType === '[object String]') {
93
- return (0, _seafileEditor.getPreviewContent)(value);
83
+ return getPreviewContent(value);
94
84
  }
95
85
  if (valueType === '[object Object]') {
96
86
  return value;
97
87
  }
98
88
  return '';
99
89
  };
100
- exports.convertValueToDtableLongTextValue = convertValueToDtableLongTextValue;
101
- const isValidCellValue = value => {
90
+ export const isValidCellValue = value => {
102
91
  if (value === undefined) return false;
103
92
  if (value === null) return false;
104
93
  if (value === '') return false;
@@ -106,8 +95,7 @@ const isValidCellValue = value => {
106
95
  if (JSON.stringify(value) === '[]') return false;
107
96
  return true;
108
97
  };
109
- exports.isValidCellValue = isValidCellValue;
110
- const getTwoDimensionArrayValue = value => {
98
+ export const getTwoDimensionArrayValue = value => {
111
99
  if (!Array.isArray(value)) return [];
112
100
  return value.map(item => {
113
101
  if (Object.prototype.toString.call(item) !== '[object Object]') {
@@ -130,7 +118,6 @@ const getTwoDimensionArrayValue = value => {
130
118
  });
131
119
  });
132
120
  };
133
- exports.getTwoDimensionArrayValue = getTwoDimensionArrayValue;
134
- function isArrayFormalColumn(columnType) {
135
- return [_dtableUtils.CellType.IMAGE, _dtableUtils.CellType.FILE, _dtableUtils.CellType.MULTIPLE_SELECT, _dtableUtils.CellType.COLLABORATOR].includes(columnType);
121
+ export function isArrayFormalColumn(columnType) {
122
+ return [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR].includes(columnType);
136
123
  }