sea-chart 2.0.43 → 2.0.44

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 (302) hide show
  1. package/dist/api/index.js +4 -11
  2. package/dist/components/cell-factory/FormatterConfig.js +55 -62
  3. package/dist/components/cell-factory/SimpleCellFormatter.js +4 -11
  4. package/dist/components/cell-factory/SingleSelectOption.js +11 -18
  5. package/dist/components/cell-factory/cell-editor-factory.js +5 -12
  6. package/dist/components/cell-factory/cell-formatter-factory.js +4 -11
  7. package/dist/components/cell-factory/link-content.js +27 -35
  8. package/dist/components/chart-color-selector/color-selector.js +11 -18
  9. package/dist/components/collaborator/index.js +7 -14
  10. package/dist/components/color-picker/index.js +11 -18
  11. package/dist/components/color-popover/color-rules/color-rule.js +25 -33
  12. package/dist/components/color-popover/color-rules/index.js +6 -14
  13. package/dist/components/color-popover/color-rules/rule-filters/filter.js +27 -34
  14. package/dist/components/color-popover/color-rules/rule-filters/index.js +17 -25
  15. package/dist/components/color-popover/color-rules/rule-filters/number-input.js +10 -18
  16. package/dist/components/color-popover/color-rules-popover.js +26 -34
  17. package/dist/components/color-popover/color-selector-popover.js +10 -18
  18. package/dist/components/color-setting/color-group-selector.js +12 -20
  19. package/dist/components/common-add-tool/index.js +6 -13
  20. package/dist/components/data-process-setter/data-setting-header.js +7 -14
  21. package/dist/components/data-process-setter/hide-column-setter.js +12 -19
  22. package/dist/components/data-process-setter/index.js +4 -27
  23. package/dist/components/data-process-setter/sort-setter.js +16 -24
  24. package/dist/components/draggable/Draggable.js +7 -13
  25. package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +42 -50
  26. package/dist/components/drill-down-settings/drill-down-fields-settings/index.js +10 -18
  27. package/dist/components/drill-down-settings/index.js +11 -18
  28. package/dist/components/dtable-popover/index.js +13 -20
  29. package/dist/components/dtable-search-input/index.js +13 -21
  30. package/dist/components/font-settings/index.js +14 -22
  31. package/dist/components/goal-line-setting/goal-setting-item.js +6 -14
  32. package/dist/components/goal-line-setting/index.js +12 -19
  33. package/dist/components/highlighter/highlighter.js +7 -14
  34. package/dist/components/icon/index.js +4 -11
  35. package/dist/components/index.js +7 -48
  36. package/dist/components/loading/index.js +6 -13
  37. package/dist/components/number-input/index.js +4 -11
  38. package/dist/components/pixel-editor/index.js +15 -23
  39. package/dist/components/popover/hide-column-popover/hide-column-popover-widgets/hide-column-item.js +8 -15
  40. package/dist/components/popover/hide-column-popover/hide-column-popover.js +25 -33
  41. package/dist/components/popover/sort-popover/sort-popover-widgets/sort-utils.js +9 -18
  42. package/dist/components/popover/sort-popover/sort-popover.js +54 -64
  43. package/dist/components/resize-handle/ResizeHandle.js +6 -13
  44. package/dist/components/row-card/row-card-header-cell.js +15 -22
  45. package/dist/components/row-card/row-card-header.js +14 -21
  46. package/dist/components/row-card/row-card-item.js +33 -41
  47. package/dist/components/row-card/row-card.js +15 -23
  48. package/dist/components/statistic-record-dialog/index.js +56 -64
  49. package/dist/components/tooltip/index.js +21 -21
  50. package/dist/components/types-dialog/index.js +56 -64
  51. package/dist/components/types-dialog/use-force-update.js +4 -10
  52. package/dist/constants/color-rules.js +8 -14
  53. package/dist/constants/common-constants.js +8 -14
  54. package/dist/constants/error.js +2 -8
  55. package/dist/constants/geolocation.js +9 -15
  56. package/dist/constants/index.js +149 -273
  57. package/dist/constants/key-codes.js +0 -2
  58. package/dist/constants/model.js +3 -9
  59. package/dist/constants/regions.js +3 -8
  60. package/dist/constants/style.js +6 -12
  61. package/dist/constants/table.js +1 -7
  62. package/dist/constants/type-image.js +33 -39
  63. package/dist/constants/type.js +3 -9
  64. package/dist/context.js +20 -24
  65. package/dist/editor/index.js +8 -15
  66. package/dist/index.js +13 -104
  67. package/dist/intl.js +10 -17
  68. package/dist/locale/index.js +16 -23
  69. package/dist/locale/lang/de.js +1 -7
  70. package/dist/locale/lang/en.js +1 -7
  71. package/dist/locale/lang/es.js +1 -7
  72. package/dist/locale/lang/fr.js +1 -7
  73. package/dist/locale/lang/pt.js +1 -7
  74. package/dist/locale/lang/ru.js +1 -7
  75. package/dist/locale/lang/zh_CN.js +1 -7
  76. package/dist/model/area-group.js +12 -19
  77. package/dist/model/area.js +12 -19
  78. package/dist/model/bar-custom.js +11 -18
  79. package/dist/model/bar-group.js +12 -19
  80. package/dist/model/bar-stack.js +10 -17
  81. package/dist/model/bar.js +11 -18
  82. package/dist/model/base-model.js +8 -11
  83. package/dist/model/basic-number-card.js +13 -20
  84. package/dist/model/chart.js +7 -13
  85. package/dist/model/combination.js +19 -22
  86. package/dist/model/compare-bar.js +14 -21
  87. package/dist/model/completeness-group.js +11 -18
  88. package/dist/model/completeness.js +10 -17
  89. package/dist/model/dashboard.js +7 -14
  90. package/dist/model/funnel.js +14 -21
  91. package/dist/model/generic-model.js +135 -143
  92. package/dist/model/heat-map.js +9 -16
  93. package/dist/model/horizontal-bar.js +15 -18
  94. package/dist/model/horizontal-group-bar.js +14 -17
  95. package/dist/model/index.js +69 -93
  96. package/dist/model/line-group.js +13 -20
  97. package/dist/model/line.js +12 -19
  98. package/dist/model/map-bubble.js +12 -19
  99. package/dist/model/map.js +12 -19
  100. package/dist/model/mirror.js +13 -20
  101. package/dist/model/pie.js +12 -19
  102. package/dist/model/ring.js +12 -19
  103. package/dist/model/scatter.js +10 -17
  104. package/dist/model/stacked-horizontal-bar.js +15 -18
  105. package/dist/model/table-element.js +5 -12
  106. package/dist/model/table.js +7 -14
  107. package/dist/model/tree-map.js +7 -14
  108. package/dist/model/trend.js +11 -18
  109. package/dist/model/user.js +1 -7
  110. package/dist/model/world-map-bubble.js +12 -19
  111. package/dist/model/world-map.js +12 -19
  112. package/dist/services/map-json.js +7 -13
  113. package/dist/settings/advance-bar-settings/data-settings.js +36 -44
  114. package/dist/settings/advance-bar-settings/index.js +3 -20
  115. package/dist/settings/advance-bar-settings/style-settings.js +83 -74
  116. package/dist/settings/bar-settings/data-settings.js +39 -47
  117. package/dist/settings/bar-settings/index.js +3 -20
  118. package/dist/settings/bar-settings/style-settings.js +69 -60
  119. package/dist/settings/basic-number-card/data-settings.js +49 -57
  120. package/dist/settings/basic-number-card/index.js +3 -20
  121. package/dist/settings/basic-number-card/style-settings.js +18 -26
  122. package/dist/settings/combination-settings/data-settings.js +55 -63
  123. package/dist/settings/combination-settings/index.js +3 -20
  124. package/dist/settings/combination-settings/style-settings.js +94 -77
  125. package/dist/settings/completeness-settings/callbacks/callbacks.js +16 -27
  126. package/dist/settings/completeness-settings/data-settings/completion-settings.js +21 -28
  127. package/dist/settings/completeness-settings/data-settings/data-settings.js +25 -32
  128. package/dist/settings/completeness-settings/index.js +3 -20
  129. package/dist/settings/completeness-settings/style-settings.js +19 -26
  130. package/dist/settings/dashboard-settings/data-settings.js +43 -51
  131. package/dist/settings/dashboard-settings/index.js +2 -13
  132. package/dist/settings/data-settings.js +72 -79
  133. package/dist/settings/funnel-settings/components/dnd-item/dnd-item.js +12 -19
  134. package/dist/settings/funnel-settings/components/dnd-list.js +15 -23
  135. package/dist/settings/funnel-settings/components/funnel-label-setting.js +32 -40
  136. package/dist/settings/funnel-settings/components/funnel-layer-setting.js +20 -28
  137. package/dist/settings/funnel-settings/data-settings.js +23 -31
  138. package/dist/settings/funnel-settings/index.js +3 -20
  139. package/dist/settings/funnel-settings/style-settings.js +11 -19
  140. package/dist/settings/heat-map-settings/data-settings.js +18 -26
  141. package/dist/settings/heat-map-settings/index.js +3 -20
  142. package/dist/settings/heat-map-settings/style-settings.js +18 -26
  143. package/dist/settings/horizontal-bar-settings/data-settings.js +12 -19
  144. package/dist/settings/horizontal-bar-settings/index.js +3 -20
  145. package/dist/settings/horizontal-bar-settings/style-settings.js +12 -19
  146. package/dist/settings/index.js +52 -70
  147. package/dist/settings/map-settings/components/location-field-selector.js +10 -17
  148. package/dist/settings/map-settings/components/map-level-selector.js +11 -18
  149. package/dist/settings/map-settings/components/map-province-city-selector.js +19 -26
  150. package/dist/settings/map-settings/index.js +3 -20
  151. package/dist/settings/map-settings/map-data-settings.js +23 -30
  152. package/dist/settings/map-settings/map-style-settings.js +26 -34
  153. package/dist/settings/mirror-settings/data-settings.js +26 -34
  154. package/dist/settings/mirror-settings/index.js +2 -13
  155. package/dist/settings/pie-settings/data-settings.js +33 -41
  156. package/dist/settings/pie-settings/index.js +3 -20
  157. package/dist/settings/pie-settings/style-settings.js +47 -55
  158. package/dist/settings/scatter/data-settings.js +27 -34
  159. package/dist/settings/scatter/index.js +3 -12
  160. package/dist/settings/stacks-settings/index.js +19 -27
  161. package/dist/settings/stacks-settings/stack-item-settings.js +19 -27
  162. package/dist/settings/style-settings.js +64 -72
  163. package/dist/settings/table-element-settings/components/data-filter.js +30 -38
  164. package/dist/settings/table-element-settings/data-settings.js +21 -29
  165. package/dist/settings/table-element-settings/index.js +2 -13
  166. package/dist/settings/table-settings/data-settings.js +111 -119
  167. package/dist/settings/table-settings/index.js +2 -13
  168. package/dist/settings/time-comparison-settings/data-settings.js +43 -51
  169. package/dist/settings/time-comparison-settings/index.js +3 -20
  170. package/dist/settings/time-comparison-settings/style-settings.js +62 -53
  171. package/dist/settings/trend-settings/data-settings.js +24 -32
  172. package/dist/settings/trend-settings/index.js +3 -20
  173. package/dist/settings/trend-settings/style-setting.js +17 -25
  174. package/dist/settings/widgets/axis-title-font-settings/index.js +39 -0
  175. package/dist/settings/widgets/basic-summary/index.js +55 -63
  176. package/dist/settings/widgets/chart-type/index.js +18 -26
  177. package/dist/settings/widgets/color-settings/index.js +72 -80
  178. package/dist/settings/widgets/common-data-settings.js +21 -29
  179. package/dist/settings/widgets/data-filter/index.js +35 -43
  180. package/dist/settings/widgets/data-sort.js +16 -24
  181. package/dist/settings/widgets/date-summary-item.js +24 -32
  182. package/dist/settings/widgets/display-values-settings/index.js +14 -22
  183. package/dist/settings/widgets/divider/index.js +8 -16
  184. package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
  185. package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
  186. package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
  187. package/dist/settings/widgets/font-settings/index.js +4 -27
  188. package/dist/settings/widgets/group-by.js +51 -59
  189. package/dist/settings/widgets/min-max-setting.js +10 -18
  190. package/dist/settings/widgets/mininum-slice-percent.js +10 -18
  191. package/dist/settings/widgets/numeric-summary-item.js +23 -31
  192. package/dist/settings/widgets/select-line-type/index.js +10 -17
  193. package/dist/settings/widgets/select-table/index.js +9 -16
  194. package/dist/settings/widgets/select-view/index.js +20 -28
  195. package/dist/settings/widgets/stack.js +14 -22
  196. package/dist/settings/widgets/summary-method-setting.js +17 -25
  197. package/dist/settings/widgets/summary-settings.js +72 -80
  198. package/dist/settings/widgets/switch/index.js +8 -15
  199. package/dist/settings/widgets/text-horizontal-settings.js +15 -23
  200. package/dist/settings/widgets/time-picker.js +29 -37
  201. package/dist/settings/widgets/title-settings/index.js +29 -37
  202. package/dist/settings/widgets/title-settings/title-text.js +5 -12
  203. package/dist/settings/widgets/x-axios.js +0 -1
  204. package/dist/settings/widgets/y-axis-group-settings.js +63 -71
  205. package/dist/utils/cell-format-utils.js +18 -28
  206. package/dist/utils/cell-value-utils.js +5 -12
  207. package/dist/utils/chart-utils/base-utils.js +362 -334
  208. package/dist/utils/chart-utils/index.js +28 -41
  209. package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +80 -86
  210. package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
  211. package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
  212. package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +19 -26
  213. package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +32 -39
  214. package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
  215. package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
  216. package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +21 -28
  217. package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +91 -97
  218. package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
  219. package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
  220. package/dist/utils/chart-utils/sql-statistics-utils.js +284 -246
  221. package/dist/utils/chart.js +9 -17
  222. package/dist/utils/collaborator-manager.js +3 -9
  223. package/dist/utils/collaborator-utils.js +18 -30
  224. package/dist/utils/collaborator.js +4 -13
  225. package/dist/utils/color-utils.js +18 -29
  226. package/dist/utils/column-utils.js +65 -92
  227. package/dist/utils/common-utils.js +27 -52
  228. package/dist/utils/concurrency-manager.js +1 -7
  229. package/dist/utils/contexts.js +5 -12
  230. package/dist/utils/date-translate.js +11 -19
  231. package/dist/utils/digital-sign-utils.js +7 -14
  232. package/dist/utils/event-bus.js +1 -7
  233. package/dist/utils/hotkey.js +5 -11
  234. package/dist/utils/index.js +54 -221
  235. package/dist/utils/key-generator.js +2 -9
  236. package/dist/utils/map.js +22 -31
  237. package/dist/utils/object-utils.js +1 -7
  238. package/dist/utils/options-utils.js +8 -16
  239. package/dist/utils/row-record-utils.js +182 -178
  240. package/dist/utils/row-utils.js +27 -38
  241. package/dist/utils/search.js +24 -32
  242. package/dist/utils/sql/chart-data-sql.js +49 -55
  243. package/dist/utils/sql/column-2-sql-column.js +146 -154
  244. package/dist/utils/sql/index.js +3 -27
  245. package/dist/utils/trend-utils.js +39 -47
  246. package/dist/view/index.css +0 -17
  247. package/dist/view/index.js +89 -95
  248. package/dist/view/title/index.js +15 -23
  249. package/dist/view/wrapper/area-group.js +53 -72
  250. package/dist/view/wrapper/area.js +51 -72
  251. package/dist/view/wrapper/bar-compare.js +43 -56
  252. package/dist/view/wrapper/bar-custom-stack.js +50 -120
  253. package/dist/view/wrapper/bar-group.js +51 -94
  254. package/dist/view/wrapper/bar-stack.js +54 -90
  255. package/dist/view/wrapper/bar.js +45 -66
  256. package/dist/view/wrapper/basic-number-card.js +25 -26
  257. package/dist/view/wrapper/chart-component.js +539 -162
  258. package/dist/view/wrapper/combination.js +63 -83
  259. package/dist/view/wrapper/completeness-group.js +42 -96
  260. package/dist/view/wrapper/completeness.js +42 -96
  261. package/dist/view/wrapper/dashboard.js +33 -47
  262. package/dist/view/wrapper/funnel.js +36 -56
  263. package/dist/view/wrapper/heat-map.js +126 -104
  264. package/dist/view/wrapper/horizontal-bar-group.js +57 -76
  265. package/dist/view/wrapper/horizontal-bar-stack.js +56 -109
  266. package/dist/view/wrapper/horizontal-bar.js +45 -68
  267. package/dist/view/wrapper/index.js +110 -115
  268. package/dist/view/wrapper/line-group.js +48 -66
  269. package/dist/view/wrapper/line.js +47 -67
  270. package/dist/view/wrapper/map-bubble.js +46 -59
  271. package/dist/view/wrapper/map-world-bubble.js +45 -58
  272. package/dist/view/wrapper/map-world.js +47 -60
  273. package/dist/view/wrapper/map.js +48 -60
  274. package/dist/view/wrapper/mirror.js +40 -61
  275. package/dist/view/wrapper/pie.js +48 -59
  276. package/dist/view/wrapper/ring.js +52 -63
  277. package/dist/view/wrapper/scatter.js +49 -67
  278. package/dist/view/wrapper/table/index.js +13 -21
  279. package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
  280. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +50 -58
  281. package/dist/view/wrapper/table/pivot-table-display-name.js +83 -91
  282. package/dist/view/wrapper/table/two-dimension-table.js +76 -84
  283. package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
  284. package/dist/view/wrapper/table-element/components/formatter.js +96 -105
  285. package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +22 -31
  286. package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
  287. package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +73 -80
  288. package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
  289. package/dist/view/wrapper/table-element/components/link-formatter.js +73 -80
  290. package/dist/view/wrapper/table-element/components/record.js +10 -17
  291. package/dist/view/wrapper/table-element/components/records-body.js +17 -19
  292. package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
  293. package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
  294. package/dist/view/wrapper/table-element/components/records.js +23 -33
  295. package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
  296. package/dist/view/wrapper/table-element/components/utils.js +5 -15
  297. package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
  298. package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
  299. package/dist/view/wrapper/table-element/index.js +18 -26
  300. package/dist/view/wrapper/treemap.js +39 -57
  301. package/dist/view/wrapper/trend.js +41 -48
  302. package/package.json +1 -1
@@ -1,30 +1,15 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireDefault(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _lodashEs = require("lodash-es");
12
- var d3 = _interopRequireWildcard(require("d3"));
13
- var _classnames = _interopRequireDefault(require("classnames"));
14
- var _constants = require("../../constants");
15
- var _utils = require("../../utils");
16
- var _colorUtils = require("../../utils/color-utils");
17
- var _intl = _interopRequireDefault(require("../../intl"));
18
- var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
19
- var _chartComponent = _interopRequireDefault(require("./chart-component"));
20
- class Bar extends _chartComponent.default {
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import * as d3 from 'd3';
4
+ import { TYPE_COLOR_USING, CHART_STYLE_COLORS, CHART_THEME_COLOR } from '../../constants';
5
+ import { BaseUtils, isFunction } from '../../utils';
6
+ import { getLabelColor, getConvertedColorRules } from '../../utils/color-utils';
7
+ import intl from '../../intl';
8
+ import ToolTip from '../../components/tooltip';
9
+ import ChartComponent from './chart-component';
10
+ class Bar extends ChartComponent {
21
11
  constructor(props) {
22
12
  super(props);
23
- this.handleResize = () => {
24
- this.destroyChart();
25
- this.createChart();
26
- this.drawChart();
27
- };
28
13
  this.createChart = () => {
29
14
  const {
30
15
  chart
@@ -37,8 +22,8 @@ class Bar extends _chartComponent.default {
37
22
  const initConfig = {
38
23
  insertPadding: 30,
39
24
  borderRadius: 0.2,
40
- marginLeft: y_axis_show_label ? 20 : 0,
41
- marginBottom: x_axis_show_label ? 20 : 0,
25
+ marginLeft: y_axis_show_label ? this.getAxisTitleHeight(chart.config.y_axis_label_font_size) : 0,
26
+ marginBottom: x_axis_show_label ? this.getAxisTitleHeight(chart.config.x_axis_label_font_size) : 0,
42
27
  marginTop: y_axis_show_value ? 15 : 0
43
28
  };
44
29
  this.initChart(this.container, chart === null || chart === void 0 ? void 0 : chart.id, initConfig);
@@ -50,11 +35,11 @@ class Bar extends _chartComponent.default {
50
35
  let {
51
36
  result: data
52
37
  } = this.props;
53
- data = _utils.BaseUtils.formatEmptyName(data, '', _intl.default.get('Empty'));
38
+ data = BaseUtils.formatEmptyName(data, '', intl.get('Empty'));
54
39
  if (!Array.isArray(data)) return;
55
40
  this.draw(data);
56
41
  this.renderAxisLabel(this.props.chart, this.props.tables, this.container);
57
- (0, _utils.isFunction)(customRender) && customRender(this.chart);
42
+ isFunction(customRender) && customRender(this.chart);
58
43
  };
59
44
  this.getFillColor = data => {
60
45
  const {
@@ -66,12 +51,12 @@ class Bar extends _chartComponent.default {
66
51
  color_option,
67
52
  y_axis_label_color_rules
68
53
  } = chart.config;
69
- let chartBarColor = y_axis_label_color || _constants.CHART_STYLE_COLORS[0];
54
+ let chartBarColor = y_axis_label_color || CHART_STYLE_COLORS[0];
70
55
  if (chartColorTheme) {
71
- chartBarColor = _utils.BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
56
+ chartBarColor = BaseUtils.getCurrentTheme(chartColorTheme).colors[0];
72
57
  }
73
- const colorRules = color_option === _constants.TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && (0, _colorUtils.getConvertedColorRules)(y_axis_label_color_rules);
74
- const color = (0, _colorUtils.getLabelColor)({
58
+ const colorRules = color_option === TYPE_COLOR_USING.USE_RULES && y_axis_label_color_rules && getConvertedColorRules(y_axis_label_color_rules);
59
+ const color = getLabelColor({
75
60
  chart: chart.config,
76
61
  colorRules,
77
62
  value: data.value
@@ -95,7 +80,7 @@ class Bar extends _chartComponent.default {
95
80
  items: [{
96
81
  color: this.getFillColor(data),
97
82
  name: data.name,
98
- value: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
83
+ value: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(data.value), y_axis_summary_method)
99
84
  }]
100
85
  };
101
86
  this.setState({
@@ -137,7 +122,7 @@ class Bar extends _chartComponent.default {
137
122
  tables,
138
123
  summaryColumn
139
124
  } = this.props;
140
- const theme = _constants.CHART_THEME_COLOR[globalTheme];
125
+ const theme = CHART_THEME_COLOR[globalTheme];
141
126
  const {
142
127
  display_goal_line,
143
128
  goal_value,
@@ -165,7 +150,7 @@ class Bar extends _chartComponent.default {
165
150
  const y = d3.scaleLinear().domain(y_axis_auto_range ? [0, d3.max(data, d => d.value)] : [y_axis_min, y_axis_max]).range([chartHeight - insertPadding, insertPadding + marginTop]);
166
151
 
167
152
  // Y axis
168
- this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
153
+ this.chart.append('g').attr('class', 'y-axis-wrapper').attr('transform', `translate(${insertPadding}, 0)`).call(d3.axisLeft(y).tickSizeInner(0).ticks(5).tickFormat(d => BaseUtils.getSummaryValueDisplayString(summaryColumn, d, y_axis_summary_method))).call(g => this.drawYaxis(g, theme));
169
154
  const x = d3.scaleBand().domain(data.map(item => item.name)).range([insertPadding + this.horizontalOverflowOffset, chartWidth - insertPadding]).paddingInner(0.5).paddingOuter(0.1);
170
155
 
171
156
  // X axis
@@ -177,7 +162,7 @@ class Bar extends _chartComponent.default {
177
162
  this.checkTickOverlap(g);
178
163
  });
179
164
  const contentWrapper = this.chart.append('g').attr('class', 'content-wrapper');
180
- contentWrapper.selectAll().data(data).join('rect').attr('opacity', 1).attr('fill', d => d3.color(this.getFillColor(d))).attr('data-x', d => x(d.name)).attr('data-y', d => y(d.value)).attr('data-width', x.bandwidth()).attr('data-value', d => d.value).attr('data-groupName', d => d.name).attr('data-slugid', d => d.slugId).attr('x', d => x(d.name)).attr('y', d => y(d.value)).attr('width', x.bandwidth()).attr('height', d => y(0) - y(d.value)).call(g => {
165
+ contentWrapper.selectAll().data(data).join('rect').attr('opacity', 1).attr('fill', d => d3.color(this.getFillColor(d))).attr('data-x', d => x(d.name)).attr('data-y', d => y(d.value)).attr('data-width', x.bandwidth()).attr('data-value', d => d.value).attr('data-groupName', d => d.name).attr('x', d => x(d.name)).attr('y', d => y(d.value)).attr('width', x.bandwidth()).attr('height', d => y(0) - y(d.value)).call(g => {
181
166
  g.nodes().forEach(path => {
182
167
  // Add label
183
168
  if (y_axis_show_value) {
@@ -188,14 +173,12 @@ class Bar extends _chartComponent.default {
188
173
  y: Number(path.dataset.y),
189
174
  theme,
190
175
  label_font_size,
191
- text: _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(path.dataset.value), y_axis_summary_method)
176
+ text: BaseUtils.getSummaryValueDisplayString(summaryColumn, Number(path.dataset.value), y_axis_summary_method)
192
177
  });
193
178
  }
194
179
  // add rect borderRadius
195
180
  this.addClipPath({
196
- rect: path,
197
- parentNode: path.parentNode,
198
- rectId: path.getAttribute('data-slugid')
181
+ rect: path
199
182
  });
200
183
  });
201
184
  }).on('click', (event, data) => {
@@ -208,6 +191,9 @@ class Bar extends _chartComponent.default {
208
191
  }).on('mouseleave', event => {
209
192
  this.hiddenTooltip(event);
210
193
  this.handleAcitveAndInActiveState('active', event);
194
+ }).call(g => {
195
+ this.animateRectGrowInY(g);
196
+ this.animateFadeIn(contentWrapper.selectAll('text'), this.transitionDuration, this.transitionDuration * 0.5);
211
197
  });
212
198
  if (display_goal_line && goal_label && goal_value) {
213
199
  this.setDispalyGoalLine(goal_label, goal_value, insertPadding, y);
@@ -222,12 +208,11 @@ class Bar extends _chartComponent.default {
222
208
  componentDidMount() {
223
209
  this.createChart();
224
210
  this.drawChart();
225
- this.debouncedHandleResize = (0, _lodashEs.debounce)(this.handleResize, 300);
226
- window.addEventListener('resize', this.debouncedHandleResize);
211
+ super.componentDidMount();
227
212
  }
228
213
  componentDidUpdate(prevProps) {
229
214
  super.componentDidUpdate(prevProps);
230
- if (_utils.BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
215
+ if (BaseUtils.shouldChartComponentUpdate(prevProps, this.props)) {
231
216
  this.destroyChart();
232
217
  this.createChart();
233
218
  this.drawChart();
@@ -235,23 +220,17 @@ class Bar extends _chartComponent.default {
235
220
  }
236
221
  componentWillUnmount() {
237
222
  this.destroyChart();
238
- window.removeEventListener('resize', this.debouncedHandleResize);
223
+ super.componentWillUnmount();
239
224
  }
240
225
  render() {
241
- const {
242
- chart
243
- } = this.props;
244
226
  const {
245
227
  tooltipData,
246
228
  toolTipPosition
247
229
  } = this.state;
248
- return /*#__PURE__*/_react.default.createElement("div", {
230
+ return /*#__PURE__*/React.createElement("div", {
249
231
  ref: ref => this.container = ref,
250
- className: (0, _classnames.default)('sea-chart-container', {
251
- 'show-x-axis-label': this.isShowXAxisLabel(chart),
252
- 'show-y-axis-label': this.isShowYAxisLabel(chart)
253
- })
254
- }, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
232
+ className: "sea-chart-container"
233
+ }, /*#__PURE__*/React.createElement(ToolTip, {
255
234
  tooltipData: tooltipData,
256
235
  toolTipPosition: toolTipPosition,
257
236
  chart: this.chart
@@ -259,16 +238,16 @@ class Bar extends _chartComponent.default {
259
238
  }
260
239
  }
261
240
  Bar.propTypes = {
262
- canvasStyle: _propTypes.default.object,
263
- chart: _propTypes.default.object,
264
- groupbyColumn: _propTypes.default.object,
265
- columnGroupbyColumn: _propTypes.default.object,
266
- summaryColumn: _propTypes.default.object,
267
- result: _propTypes.default.array,
268
- tables: _propTypes.default.array,
269
- globalTheme: _propTypes.default.string,
270
- chartColorTheme: _propTypes.default.string,
271
- toggleRecords: _propTypes.default.func,
272
- customRender: _propTypes.default.func
241
+ canvasStyle: PropTypes.object,
242
+ chart: PropTypes.object,
243
+ groupbyColumn: PropTypes.object,
244
+ columnGroupbyColumn: PropTypes.object,
245
+ summaryColumn: PropTypes.object,
246
+ result: PropTypes.array,
247
+ tables: PropTypes.array,
248
+ globalTheme: PropTypes.string,
249
+ chartColorTheme: PropTypes.string,
250
+ toggleRecords: PropTypes.func,
251
+ customRender: PropTypes.func
273
252
  };
274
- var _default = exports.default = Bar;
253
+ export default Bar;
@@ -1,17 +1,9 @@
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 _dtableUtils = require("dtable-utils");
11
- var _utils = require("../../utils");
12
- var _intl = _interopRequireDefault(require("../../intl"));
13
- var _constants = require("../../constants");
14
- class BasicNumericCard extends _react.Component {
1
+ import React, { Component } from 'react';
2
+ import { isNumber, isEmpty } from 'dtable-utils';
3
+ import { BaseUtils } from '../../utils';
4
+ import intl from '../../intl';
5
+ import { BASIC_NUMBER_CARD_CALCULATION_METHOD, EMPTY_NAME, CHART_THEME_COLOR } from '../../constants';
6
+ class BasicNumericCard extends Component {
15
7
  constructor(props) {
16
8
  super(props);
17
9
  this.setCurrentLineHeight = () => {
@@ -25,7 +17,7 @@ class BasicNumericCard extends _react.Component {
25
17
  const currentLineHeight = parseFloat(computedStyle.lineHeight);
26
18
  const currentLabelHeight = parseFloat(computedStyle.height);
27
19
  if (prevLineHeight === currentLineHeight && prevLabelHeight === currentLabelHeight) return;
28
- if ((0, _dtableUtils.isNumber)(currentLineHeight) && (0, _dtableUtils.isNumber)(currentLabelHeight)) {
20
+ if (isNumber(currentLineHeight) && isNumber(currentLabelHeight)) {
29
21
  this.setState({
30
22
  currentLineHeight,
31
23
  currentLabelHeight
@@ -51,7 +43,7 @@ class BasicNumericCard extends _react.Component {
51
43
  }
52
44
  };
53
45
  this.formatData = data => {
54
- if (!data && data !== 0) return _intl.default.get(_constants.EMPTY_NAME);
46
+ if (isEmpty(data)) return intl.get(EMPTY_NAME);
55
47
  const {
56
48
  chart,
57
49
  summaryColumn
@@ -61,11 +53,15 @@ class BasicNumericCard extends _react.Component {
61
53
  summary_method
62
54
  } = chart.config;
63
55
  // COUNT / SUMMARIZE_A_FIELD
64
- if (summary_type !== _constants.BASIC_NUMBER_CARD_CALCULATION_METHOD) {
65
- const formattedContent = _utils.BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
56
+ if (summary_type !== BASIC_NUMBER_CARD_CALCULATION_METHOD) {
57
+ const formattedContent = BaseUtils.getSummaryValueDisplayString(summaryColumn, data, summary_method);
66
58
  return formattedContent;
67
59
  }
68
60
  let string = data + '';
61
+ const isNegative = string.startsWith('-');
62
+ if (isNegative) {
63
+ string = string.slice(1);
64
+ }
69
65
  const isFloat = string.indexOf('.') > 0;
70
66
  if (isFloat) {
71
67
  string = string.slice(0, string.indexOf('.'));
@@ -84,6 +80,9 @@ class BasicNumericCard extends _react.Component {
84
80
  if (content[0] === ',') {
85
81
  content = content.slice(1);
86
82
  }
83
+ if (isNegative) {
84
+ content = '-' + content;
85
+ }
87
86
  if (isFloat) {
88
87
  const initString = data + '';
89
88
  content = content + initString.slice(initString.indexOf('.'));
@@ -108,7 +107,7 @@ class BasicNumericCard extends _react.Component {
108
107
  chart,
109
108
  result
110
109
  } = this.props;
111
- const theme = _constants.CHART_THEME_COLOR[globalTheme];
110
+ const theme = CHART_THEME_COLOR[globalTheme];
112
111
  const {
113
112
  config
114
113
  } = chart;
@@ -127,20 +126,20 @@ class BasicNumericCard extends _react.Component {
127
126
  const numericValue = typeof result === 'object' && result !== null ? result.value : result;
128
127
  let content = null;
129
128
  if (summary_method === 'Distinct_values') {
130
- content = (0, _dtableUtils.isNumber)(numericValue) ? numericValue : 0;
129
+ content = isNumber(numericValue) ? numericValue : 0;
131
130
  } else {
132
131
  content = this.formatData(numericValue);
133
132
  }
134
- return /*#__PURE__*/_react.default.createElement("div", {
133
+ return /*#__PURE__*/React.createElement("div", {
135
134
  className: "sea-chart-container plugin-number-card"
136
- }, /*#__PURE__*/_react.default.createElement("div", {
135
+ }, /*#__PURE__*/React.createElement("div", {
137
136
  style: {
138
137
  color: theme.cardColor,
139
138
  width: '100%',
140
139
  height: '100%',
141
140
  position: 'relative'
142
141
  }
143
- }, /*#__PURE__*/_react.default.createElement("p", {
142
+ }, /*#__PURE__*/React.createElement("p", {
144
143
  style: {
145
144
  position: 'absolute',
146
145
  width: '100%',
@@ -152,12 +151,12 @@ class BasicNumericCard extends _react.Component {
152
151
  fontWeight: `${font_weight}`,
153
152
  color: `${font_color}`
154
153
  }
155
- }, /*#__PURE__*/_react.default.createElement("span", {
154
+ }, /*#__PURE__*/React.createElement("span", {
156
155
  onClick: this.handleClickNumber,
157
156
  style: {
158
157
  cursor: 'pointer'
159
158
  }
160
- }, content)), /*#__PURE__*/_react.default.createElement("p", {
159
+ }, content)), /*#__PURE__*/React.createElement("p", {
161
160
  ref: ref => this.labelRef = ref,
162
161
  style: {
163
162
  position: 'absolute',
@@ -178,4 +177,4 @@ class BasicNumericCard extends _react.Component {
178
177
  }, name)));
179
178
  }
180
179
  }
181
- var _default = exports.default = BasicNumericCard;
180
+ export default BasicNumericCard;