sea-chart 2.0.36 → 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 (300) hide show
  1. package/dist/api/index.js +8 -15
  2. package/dist/components/cell-factory/FormatterConfig.js +55 -62
  3. package/dist/components/cell-factory/SimpleCellFormatter.js +5 -12
  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 +30 -38
  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 +12 -19
  11. package/dist/components/color-popover/color-rules/color-rule.js +26 -34
  12. package/dist/components/color-popover/color-rules/index.js +7 -15
  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 +9 -17
  16. package/dist/components/color-popover/color-rules-popover.js +30 -38
  17. package/dist/components/color-popover/color-selector-popover.js +12 -20
  18. package/dist/components/color-setting/color-group-selector.js +13 -21
  19. package/dist/components/common-add-tool/index.js +8 -15
  20. package/dist/components/data-process-setter/data-setting-header.js +7 -14
  21. package/dist/components/data-process-setter/hide-column-setter.js +13 -20
  22. package/dist/components/data-process-setter/index.js +4 -27
  23. package/dist/components/data-process-setter/sort-setter.js +18 -26
  24. package/dist/components/draggable/Draggable.js +7 -13
  25. package/dist/components/drill-down-settings/drill-down-fields-popover/index.js +40 -48
  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 +5 -12
  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 +26 -34
  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 +55 -65
  43. package/dist/components/resize-handle/ResizeHandle.js +6 -13
  44. package/dist/components/row-card/row-card-header-cell.js +17 -24
  45. package/dist/components/row-card/row-card-header.js +15 -22
  46. package/dist/components/row-card/row-card-item.js +35 -43
  47. package/dist/components/row-card/row-card.js +17 -25
  48. package/dist/components/statistic-record-dialog/index.js +56 -64
  49. package/dist/components/tooltip/index.js +14 -21
  50. package/dist/components/types-dialog/index.js +62 -70
  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 +142 -271
  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 +13 -20
  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 +4 -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 +15 -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 +11 -18
  94. package/dist/model/horizontal-group-bar.js +10 -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 +11 -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 +11 -17
  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 +63 -71
  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 +49 -57
  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 +19 -27
  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 +65 -73
  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 +27 -35
  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 +65 -73
  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 +112 -120
  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 +42 -50
  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 +19 -27
  174. package/dist/settings/widgets/basic-summary/index.js +55 -63
  175. package/dist/settings/widgets/chart-type/index.js +18 -26
  176. package/dist/settings/widgets/color-settings/index.js +72 -80
  177. package/dist/settings/widgets/common-data-settings.js +21 -29
  178. package/dist/settings/widgets/data-filter/index.js +35 -43
  179. package/dist/settings/widgets/data-sort.js +16 -24
  180. package/dist/settings/widgets/date-summary-item.js +26 -34
  181. package/dist/settings/widgets/display-values-settings/index.js +14 -22
  182. package/dist/settings/widgets/divider/index.js +8 -16
  183. package/dist/settings/widgets/font-settings/font-color-settings.js +11 -19
  184. package/dist/settings/widgets/font-settings/font-size-settings.js +14 -22
  185. package/dist/settings/widgets/font-settings/font-weight-settings.js +17 -25
  186. package/dist/settings/widgets/font-settings/index.js +4 -27
  187. package/dist/settings/widgets/group-by.js +51 -59
  188. package/dist/settings/widgets/min-max-setting.js +10 -18
  189. package/dist/settings/widgets/mininum-slice-percent.js +10 -18
  190. package/dist/settings/widgets/numeric-summary-item.js +25 -33
  191. package/dist/settings/widgets/select-line-type/index.js +10 -17
  192. package/dist/settings/widgets/select-table/index.js +9 -16
  193. package/dist/settings/widgets/select-view/index.js +20 -28
  194. package/dist/settings/widgets/stack.js +14 -22
  195. package/dist/settings/widgets/summary-method-setting.js +17 -25
  196. package/dist/settings/widgets/summary-settings.js +74 -82
  197. package/dist/settings/widgets/switch/index.js +9 -16
  198. package/dist/settings/widgets/text-horizontal-settings.js +15 -23
  199. package/dist/settings/widgets/time-picker.js +29 -37
  200. package/dist/settings/widgets/title-settings/index.js +29 -37
  201. package/dist/settings/widgets/title-settings/title-text.js +5 -12
  202. package/dist/settings/widgets/x-axios.js +0 -1
  203. package/dist/settings/widgets/y-axis-group-settings.js +64 -72
  204. package/dist/utils/cell-format-utils.js +17 -27
  205. package/dist/utils/cell-value-utils.js +4 -11
  206. package/dist/utils/chart-utils/base-utils.js +324 -332
  207. package/dist/utils/chart-utils/index.js +28 -41
  208. package/dist/utils/chart-utils/original-data-utils/basic-chart-calculator.js +77 -84
  209. package/dist/utils/chart-utils/original-data-utils/card-calculator.js +13 -20
  210. package/dist/utils/chart-utils/original-data-utils/combination-calculator.js +45 -52
  211. package/dist/utils/chart-utils/original-data-utils/compare-bar-chart-calculator.js +21 -28
  212. package/dist/utils/chart-utils/original-data-utils/completeness-calculator.js +33 -40
  213. package/dist/utils/chart-utils/original-data-utils/dashboard-calculator.js +16 -23
  214. package/dist/utils/chart-utils/original-data-utils/index.js +50 -57
  215. package/dist/utils/chart-utils/original-data-utils/mirror-calculator.js +19 -26
  216. package/dist/utils/chart-utils/original-data-utils/pivot-table-calculator.js +90 -96
  217. package/dist/utils/chart-utils/original-data-utils/scatter-calculator.js +19 -26
  218. package/dist/utils/chart-utils/original-data-utils/trend-calculator.js +31 -38
  219. package/dist/utils/chart-utils/sql-statistics-utils.js +229 -237
  220. package/dist/utils/chart.js +9 -17
  221. package/dist/utils/collaborator-manager.js +3 -9
  222. package/dist/utils/collaborator-utils.js +19 -31
  223. package/dist/utils/collaborator.js +6 -15
  224. package/dist/utils/color-utils.js +18 -29
  225. package/dist/utils/column-utils.js +77 -104
  226. package/dist/utils/common-utils.js +28 -53
  227. package/dist/utils/concurrency-manager.js +1 -7
  228. package/dist/utils/contexts.js +5 -12
  229. package/dist/utils/date-translate.js +12 -20
  230. package/dist/utils/digital-sign-utils.js +7 -14
  231. package/dist/utils/event-bus.js +1 -7
  232. package/dist/utils/hotkey.js +5 -11
  233. package/dist/utils/index.js +54 -221
  234. package/dist/utils/key-generator.js +2 -9
  235. package/dist/utils/map.js +22 -31
  236. package/dist/utils/object-utils.js +2 -8
  237. package/dist/utils/options-utils.js +10 -18
  238. package/dist/utils/row-record-utils.js +166 -178
  239. package/dist/utils/row-utils.js +27 -38
  240. package/dist/utils/search.js +24 -32
  241. package/dist/utils/sql/chart-data-sql.js +106 -112
  242. package/dist/utils/sql/column-2-sql-column.js +158 -168
  243. package/dist/utils/sql/index.js +3 -27
  244. package/dist/utils/trend-utils.js +39 -47
  245. package/dist/view/index.js +90 -96
  246. package/dist/view/title/index.js +16 -24
  247. package/dist/view/wrapper/area-group.js +45 -53
  248. package/dist/view/wrapper/area.js +43 -51
  249. package/dist/view/wrapper/bar-compare.js +38 -46
  250. package/dist/view/wrapper/bar-custom-stack.js +39 -47
  251. package/dist/view/wrapper/bar-group.js +45 -53
  252. package/dist/view/wrapper/bar-stack.js +48 -56
  253. package/dist/view/wrapper/bar.js +40 -48
  254. package/dist/view/wrapper/basic-number-card.js +26 -34
  255. package/dist/view/wrapper/chart-component.js +123 -131
  256. package/dist/view/wrapper/combination.js +55 -63
  257. package/dist/view/wrapper/completeness-group.js +40 -48
  258. package/dist/view/wrapper/completeness.js +36 -44
  259. package/dist/view/wrapper/dashboard.js +39 -44
  260. package/dist/view/wrapper/funnel.js +40 -43
  261. package/dist/view/wrapper/heat-map.js +62 -70
  262. package/dist/view/wrapper/horizontal-bar-group.js +52 -60
  263. package/dist/view/wrapper/horizontal-bar-stack.js +47 -55
  264. package/dist/view/wrapper/horizontal-bar.js +41 -49
  265. package/dist/view/wrapper/index.js +107 -115
  266. package/dist/view/wrapper/line-group.js +43 -51
  267. package/dist/view/wrapper/line.js +42 -50
  268. package/dist/view/wrapper/map-bubble.js +40 -48
  269. package/dist/view/wrapper/map-world-bubble.js +39 -47
  270. package/dist/view/wrapper/map-world.js +41 -49
  271. package/dist/view/wrapper/map.js +42 -50
  272. package/dist/view/wrapper/mirror.js +41 -49
  273. package/dist/view/wrapper/pie.js +44 -52
  274. package/dist/view/wrapper/ring.js +49 -57
  275. package/dist/view/wrapper/scatter.js +42 -50
  276. package/dist/view/wrapper/table/index.js +14 -22
  277. package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +49 -57
  278. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +53 -61
  279. package/dist/view/wrapper/table/pivot-table-display-name.js +82 -90
  280. package/dist/view/wrapper/table/two-dimension-table.js +85 -93
  281. package/dist/view/wrapper/table-element/components/dataset-utils.js +23 -36
  282. package/dist/view/wrapper/table-element/components/formatter.js +90 -99
  283. package/dist/view/wrapper/table-element/components/formatters/FileFormatter/index.js +23 -32
  284. package/dist/view/wrapper/table-element/components/formatters/formula-formatter.js +9 -16
  285. package/dist/view/wrapper/table-element/components/formatters/link-formatter.js +90 -97
  286. package/dist/view/wrapper/table-element/components/formula-formatter.js +9 -16
  287. package/dist/view/wrapper/table-element/components/link-formatter.js +90 -97
  288. package/dist/view/wrapper/table-element/components/record.js +13 -20
  289. package/dist/view/wrapper/table-element/components/records-body.js +9 -17
  290. package/dist/view/wrapper/table-element/components/records-header/index.js +7 -15
  291. package/dist/view/wrapper/table-element/components/records-header/records-header-cell.js +8 -16
  292. package/dist/view/wrapper/table-element/components/records.js +25 -33
  293. package/dist/view/wrapper/table-element/components/resize-column-handle/resize-column-handle.js +5 -12
  294. package/dist/view/wrapper/table-element/components/utils.js +6 -16
  295. package/dist/view/wrapper/table-element/components/value-display-utils.js +4 -11
  296. package/dist/view/wrapper/table-element/components/vertical-scrollbar/index.js +6 -13
  297. package/dist/view/wrapper/table-element/index.js +18 -26
  298. package/dist/view/wrapper/treemap.js +38 -46
  299. package/dist/view/wrapper/trend.js +58 -66
  300. package/package.json +5 -5
@@ -1,13 +1,4 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.convertQuarterToDate = convertQuarterToDate;
8
- exports.getMobileDatePickerLocale = getMobileDatePickerLocale;
9
- exports.translateCalendar = translateCalendar;
10
- var _intl = _interopRequireDefault(require("../intl"));
1
+ import intl from '../intl';
11
2
  const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
12
3
  const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
13
4
  const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
@@ -62,14 +53,14 @@ function translateCalendar(lang) {
62
53
  function getMobileDatePickerLocale() {
63
54
  return {
64
55
  DatePickerLocale: {
65
- year: _intl.default.get('Year'),
66
- month: _intl.default.get('Month'),
67
- day: _intl.default.get('Day'),
68
- hour: _intl.default.get('Hour'),
69
- minute: _intl.default.get('Minute')
56
+ year: intl.get('Year'),
57
+ month: intl.get('Month'),
58
+ day: intl.get('Day'),
59
+ hour: intl.get('Hour'),
60
+ minute: intl.get('Minute')
70
61
  },
71
- okText: _intl.default.get('Done'),
72
- dismissText: _intl.default.get('Cancel')
62
+ okText: intl.get('Done'),
63
+ dismissText: intl.get('Cancel')
73
64
  };
74
65
  }
75
66
  const quarterTimeMap = {
@@ -78,11 +69,12 @@ const quarterTimeMap = {
78
69
  'Q3': '07-01',
79
70
  'Q4': '10-01'
80
71
  };
81
- function convertQuarterToDate(yearQuarter) {
72
+ export function convertQuarterToDate(yearQuarter) {
82
73
  const timeDetailList = yearQuarter.split('-');
83
74
  const year = timeDetailList[0];
84
75
  const quarter = timeDetailList[1];
85
76
  const quarterTime = quarterTimeMap[quarter];
86
- const timeString = "".concat(year, "-").concat(quarterTime);
77
+ const timeString = `${year}-${quarterTime}`;
87
78
  return new Date(timeString);
88
- }
79
+ }
80
+ export { translateCalendar, getMobileDatePickerLocale };
@@ -1,24 +1,17 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _dayjs = _interopRequireDefault(require("dayjs"));
9
- var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
10
- var _dtableUtils = require("dtable-utils");
11
- _dayjs.default.extend(_utc.default);
1
+ import dayjs from 'dayjs';
2
+ import utc from 'dayjs/plugin/utc';
3
+ import { getDigitalSignImageUrl } from 'dtable-utils';
4
+ dayjs.extend(utc);
12
5
  class DigitalSignUtils {
13
6
  static getSignImageUrl(sign) {
14
- return (0, _dtableUtils.getDigitalSignImageUrl)(sign);
7
+ return getDigitalSignImageUrl(sign);
15
8
  }
16
9
  static getUpdatedSign(_ref) {
17
10
  let {
18
11
  username,
19
12
  sign_image_url
20
13
  } = _ref;
21
- const time = (0, _dayjs.default)().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
14
+ const time = dayjs().utc().format('YYYY-MM-DDTHH:mm:ss.SSSZ');
22
15
  return {
23
16
  username,
24
17
  sign_image_url,
@@ -26,4 +19,4 @@ class DigitalSignUtils {
26
19
  };
27
20
  }
28
21
  }
29
- var _default = exports.default = DigitalSignUtils;
22
+ export default DigitalSignUtils;
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  class EventBus {
8
2
  constructor() {
9
3
  this.subscribers = {};
@@ -31,4 +25,4 @@ class EventBus {
31
25
  }
32
26
  }
33
27
  }
34
- var _default = exports.default = new EventBus();
28
+ export default new EventBus();
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.isSpace = exports.isEsc = exports.isEnter = void 0;
8
- var _isHotkey = _interopRequireDefault(require("is-hotkey"));
9
- const isEsc = exports.isEsc = (0, _isHotkey.default)('esc');
10
- const isSpace = exports.isSpace = (0, _isHotkey.default)('space');
11
- const isEnter = exports.isEnter = (0, _isHotkey.default)('enter');
1
+ import isHotkey from 'is-hotkey';
2
+ const isEsc = isHotkey('esc');
3
+ const isSpace = isHotkey('space');
4
+ const isEnter = isHotkey('enter');
5
+ export { isEsc, isEnter, isSpace };
@@ -1,176 +1,19 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "BaseUtils", {
8
- enumerable: true,
9
- get: function () {
10
- return _chartUtils.BaseUtils;
11
- }
12
- });
13
- Object.defineProperty(exports, "ChartDataSQL", {
14
- enumerable: true,
15
- get: function () {
16
- return _sql.ChartDataSQL;
17
- }
18
- });
19
- Object.defineProperty(exports, "ChartUtils", {
20
- enumerable: true,
21
- get: function () {
22
- return _chartUtils.ChartUtils;
23
- }
24
- });
25
- Object.defineProperty(exports, "ObjectUtils", {
26
- enumerable: true,
27
- get: function () {
28
- return _objectUtils.default;
29
- }
30
- });
31
- Object.defineProperty(exports, "chartColumn2SqlColumn", {
32
- enumerable: true,
33
- get: function () {
34
- return _sql.chartColumn2SqlColumn;
35
- }
36
- });
37
- exports.fixGeoGranularity = exports.eventStopPropagation = void 0;
38
- exports.formatRowTotal = formatRowTotal;
39
- exports.formatXAxisLabel = formatXAxisLabel;
40
- Object.defineProperty(exports, "generateChartConfig", {
41
- enumerable: true,
42
- get: function () {
43
- return _chart.generateChartConfig;
44
- }
45
- });
46
- Object.defineProperty(exports, "generateDefaultUser", {
47
- enumerable: true,
48
- get: function () {
49
- return _collaboratorUtils.generateDefaultUser;
50
- }
51
- });
52
- Object.defineProperty(exports, "generatorCommonOptions", {
53
- enumerable: true,
54
- get: function () {
55
- return _optionsUtils.generatorCommonOptions;
56
- }
57
- });
58
- Object.defineProperty(exports, "generatorKey", {
59
- enumerable: true,
60
- get: function () {
61
- return _keyGenerator.generatorKey;
62
- }
63
- });
64
- exports.getChartConfigValueFromKeys = exports.getChartConfigValueByKey = void 0;
65
- Object.defineProperty(exports, "getClientFormulaDisplayString", {
66
- enumerable: true,
67
- get: function () {
68
- return _cellFormatUtils.getClientFormulaDisplayString;
69
- }
70
- });
71
- Object.defineProperty(exports, "getClientLinkDisplayString", {
72
- enumerable: true,
73
- get: function () {
74
- return _cellFormatUtils.getClientLinkDisplayString;
75
- }
76
- });
77
- Object.defineProperty(exports, "getColorFromSingleSelectColumn", {
78
- enumerable: true,
79
- get: function () {
80
- return _columnUtils.getColorFromSingleSelectColumn;
81
- }
82
- });
83
- Object.defineProperty(exports, "getColumnByKey", {
84
- enumerable: true,
85
- get: function () {
86
- return _columnUtils.getColumnByKey;
87
- }
88
- });
89
- Object.defineProperty(exports, "getColumnOptions", {
90
- enumerable: true,
91
- get: function () {
92
- return _dtableUtils.getColumnOptions;
93
- }
94
- });
95
- Object.defineProperty(exports, "getDateColumnFormat", {
96
- enumerable: true,
97
- get: function () {
98
- return _columnUtils.getDateColumnFormat;
99
- }
100
- });
101
- exports.getGeoGranularityByLevel = exports.getFirstDayOfWeekForGroupby = exports.getEventClassName = exports.getErrorMessage = void 0;
102
- Object.defineProperty(exports, "getKnownCollaboratorByEmail", {
103
- enumerable: true,
104
- get: function () {
105
- return _collaboratorUtils.getKnownCollaboratorByEmail;
106
- }
107
- });
108
- Object.defineProperty(exports, "getKnownCollaboratorsByEmails", {
109
- enumerable: true,
110
- get: function () {
111
- return _collaboratorUtils.getKnownCollaboratorsByEmails;
112
- }
113
- });
114
- exports.getMapCanvasStyle = getMapCanvasStyle;
115
- exports.isBoolean = exports.getSortedDataByGivenOrder = exports.getSimilarKeys = void 0;
116
- Object.defineProperty(exports, "isCheckboxColumn", {
117
- enumerable: true,
118
- get: function () {
119
- return _columnUtils.isCheckboxColumn;
120
- }
121
- });
122
- Object.defineProperty(exports, "isFunction", {
123
- enumerable: true,
124
- get: function () {
125
- return _commonUtils.isFunction;
126
- }
127
- });
128
- Object.defineProperty(exports, "isStatisticMapColumn", {
129
- enumerable: true,
130
- get: function () {
131
- return _columnUtils.isStatisticMapColumn;
132
- }
133
- });
134
- Object.defineProperty(exports, "isStatisticMirrorColumn", {
135
- enumerable: true,
136
- get: function () {
137
- return _columnUtils.isStatisticMirrorColumn;
138
- }
139
- });
140
- Object.defineProperty(exports, "isStatisticWorldMapColumn", {
141
- enumerable: true,
142
- get: function () {
143
- return _columnUtils.isStatisticWorldMapColumn;
144
- }
145
- });
146
- Object.defineProperty(exports, "summaryMethodColumn2SqlColumn", {
147
- enumerable: true,
148
- get: function () {
149
- return _sql.summaryMethodColumn2SqlColumn;
150
- }
151
- });
152
- Object.defineProperty(exports, "translateCalendar", {
153
- enumerable: true,
154
- get: function () {
155
- return _dateTranslate.translateCalendar;
156
- }
157
- });
158
- var _lodash = require("lodash");
159
- var _constants = require("../constants");
160
- var _intl = _interopRequireDefault(require("../intl"));
161
- var _error = require("../constants/error");
162
- var _objectUtils = _interopRequireDefault(require("./object-utils"));
163
- var _chartUtils = require("./chart-utils");
164
- var _sql = require("./sql");
165
- var _optionsUtils = require("./options-utils");
166
- var _dtableUtils = require("dtable-utils");
167
- var _cellFormatUtils = require("./cell-format-utils");
168
- var _chart = require("./chart");
169
- var _collaboratorUtils = require("./collaborator-utils");
170
- var _columnUtils = require("./column-utils");
171
- var _keyGenerator = require("./key-generator");
172
- var _dateTranslate = require("./date-translate");
173
- var _commonUtils = require("./common-utils");
1
+ import { cloneDeep } from 'lodash';
2
+ import { GENERIC_KEY_2_SIMILAR_KEYS, GEOLOCATION_GRANULARITY, MAP_LEVEL, MUNICIPALITIES, regions } from '../constants';
3
+ import intl from '../intl';
4
+ import { SERVER_ERROR_DISPLAY_KEY, SERVER_ERROR_MSG } from '../constants/error';
5
+ import ObjectUtils from './object-utils';
6
+ import { BaseUtils, ChartUtils } from './chart-utils';
7
+ import { ChartDataSQL, chartColumn2SqlColumn, summaryMethodColumn2SqlColumn } from './sql';
8
+ export { generatorCommonOptions } from './options-utils';
9
+ export { getColumnOptions } from 'dtable-utils';
10
+ export { getClientFormulaDisplayString, getClientLinkDisplayString } from './cell-format-utils';
11
+ export { generateChartConfig } from './chart';
12
+ export { getKnownCollaboratorByEmail, getKnownCollaboratorsByEmails, generateDefaultUser } from './collaborator-utils';
13
+ export { getDateColumnFormat, isCheckboxColumn, getColumnByKey, isStatisticMapColumn, isStatisticWorldMapColumn, isStatisticMirrorColumn, getColorFromSingleSelectColumn } from './column-utils';
14
+ export { generatorKey } from './key-generator';
15
+ export { translateCalendar } from './date-translate';
16
+ export { isFunction } from './common-utils';
174
17
  const splitLabelWithoutEnglish = label => {
175
18
  let newLabel = '';
176
19
  while (label.length > 0) {
@@ -184,7 +27,7 @@ const splitLabelWithoutEnglish = label => {
184
27
  }
185
28
  return newLabel;
186
29
  };
187
- function formatXAxisLabel(label) {
30
+ export function formatXAxisLabel(label) {
188
31
  let maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
189
32
  const regex = /\b[a-zA-Z0-9'.,-]+\b/g;
190
33
  const words = label.match(regex);
@@ -226,7 +69,7 @@ function formatXAxisLabel(label) {
226
69
  }
227
70
  return result.join('\n');
228
71
  }
229
- function formatRowTotal(rowTotal) {
72
+ export function formatRowTotal(rowTotal) {
230
73
  const rowTotalNum = parseFloat(rowTotal);
231
74
  if (!Number.isNaN(rowTotalNum) && rowTotalNum % 1 !== 0) {
232
75
  return rowTotalNum.toFixed(2);
@@ -243,7 +86,7 @@ function formatRowTotal(rowTotal) {
243
86
  * @param {Array} x_axis_option_list
244
87
  * @returns {Array} sortedData
245
88
  */
246
- const getSortedDataByGivenOrder = (data, x_axis_option_list) => {
89
+ export const getSortedDataByGivenOrder = (data, x_axis_option_list) => {
247
90
  const idIndexMap = {};
248
91
  x_axis_option_list.forEach((item, index) => {
249
92
  idIndexMap[item.id] = index;
@@ -251,13 +94,12 @@ const getSortedDataByGivenOrder = (data, x_axis_option_list) => {
251
94
  let sortedData = [];
252
95
  data.forEach(item => {
253
96
  const index = idIndexMap[item.group_name];
254
- sortedData[index] = (0, _lodash.cloneDeep)(item);
97
+ sortedData[index] = cloneDeep(item);
255
98
  });
256
99
  sortedData = sortedData.filter(Boolean);
257
100
  return sortedData;
258
101
  };
259
- exports.getSortedDataByGivenOrder = getSortedDataByGivenOrder;
260
- function getMapCanvasStyle(container, ratio) {
102
+ export function getMapCanvasStyle(container, ratio) {
261
103
  let cWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
262
104
  let cHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 200;
263
105
  let width, height;
@@ -281,11 +123,11 @@ function getMapCanvasStyle(container, ratio) {
281
123
  height
282
124
  };
283
125
  }
284
- const getErrorMessage = err => {
126
+ export const getErrorMessage = err => {
285
127
  // log error to locate problems
286
128
  console.error(err);
287
129
  if (!err.response) {
288
- return _intl.default.get('Network_error');
130
+ return intl.get('Network_error');
289
131
  }
290
132
  const {
291
133
  status,
@@ -293,44 +135,42 @@ const getErrorMessage = err => {
293
135
  } = err.response;
294
136
  const error_msg = data ? data.error_msg : '';
295
137
  if (status === 400) {
296
- if (error_msg === _error.SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED) {
297
- return _intl.default.get(_error.SERVER_ERROR_DISPLAY_KEY[_error.SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED]);
138
+ if (error_msg === SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED) {
139
+ return intl.get(SERVER_ERROR_DISPLAY_KEY[SERVER_ERROR_MSG.EXECUTION_COST_EXCEEDED]);
298
140
  }
299
141
  }
300
142
  if (status === 403) {
301
- return _intl.default.get('Permission_denied');
143
+ return intl.get('Permission_denied');
302
144
  }
303
145
  if (status === 500 || status === 502) {
304
- return _intl.default.get('Internal_server_error');
146
+ return intl.get('Internal_server_error');
305
147
  }
306
- return _intl.default.get('Error');
148
+ return intl.get('Error');
307
149
  };
308
- exports.getErrorMessage = getErrorMessage;
309
- const getGeoGranularityByLevel = mapLevel => {
150
+ export const getGeoGranularityByLevel = mapLevel => {
310
151
  switch (mapLevel) {
311
- case _constants.MAP_LEVEL.PROVINCE:
152
+ case MAP_LEVEL.PROVINCE:
312
153
  {
313
- return _constants.GEOLOCATION_GRANULARITY.CITY;
154
+ return GEOLOCATION_GRANULARITY.CITY;
314
155
  }
315
- case _constants.MAP_LEVEL.CITY:
156
+ case MAP_LEVEL.CITY:
316
157
  {
317
- return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
158
+ return GEOLOCATION_GRANULARITY.DISTRICT;
318
159
  }
319
160
  default:
320
161
  {
321
162
  // default as 'country'
322
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
163
+ return GEOLOCATION_GRANULARITY.PROVINCE;
323
164
  }
324
165
  }
325
166
  };
326
- exports.getGeoGranularityByLevel = getGeoGranularityByLevel;
327
- const fixGeoGranularity = _ref => {
167
+ export const fixGeoGranularity = _ref => {
328
168
  let {
329
169
  mapLevel,
330
170
  mapLocation
331
171
  } = _ref;
332
- if (!mapLevel || mapLevel === _constants.MAP_LEVEL.COUNTRY || !mapLocation) {
333
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
172
+ if (!mapLevel || mapLevel === MAP_LEVEL.COUNTRY || !mapLocation) {
173
+ return GEOLOCATION_GRANULARITY.PROVINCE;
334
174
  }
335
175
 
336
176
  // e.g. Beijing
@@ -338,66 +178,59 @@ const fixGeoGranularity = _ref => {
338
178
  province: provinceName,
339
179
  city: cityName
340
180
  } = mapLocation;
341
- if (provinceName && _constants.MUNICIPALITIES.includes(provinceName)) {
342
- return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
181
+ if (provinceName && MUNICIPALITIES.includes(provinceName)) {
182
+ return GEOLOCATION_GRANULARITY.DISTRICT;
343
183
  }
344
184
 
345
185
  // e.g. HongKong
346
- const selectedProvince = provinceName && _constants.regions.find(province => province.name === provinceName);
186
+ const selectedProvince = provinceName && regions.find(province => province.name === provinceName);
347
187
  if (selectedProvince && selectedProvince.disable_drill_down) {
348
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
188
+ return GEOLOCATION_GRANULARITY.PROVINCE;
349
189
  }
350
190
  const cities = selectedProvince && selectedProvince.cities;
351
191
  const selectedCity = cities && cityName && cities.find(city => city.name === cityName);
352
- if (mapLevel === _constants.MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
353
- return _constants.GEOLOCATION_GRANULARITY.CITY;
192
+ if (mapLevel === MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
193
+ return GEOLOCATION_GRANULARITY.CITY;
354
194
  }
355
195
 
356
196
  // others
357
197
  return getGeoGranularityByLevel(mapLevel);
358
198
  };
359
- exports.fixGeoGranularity = fixGeoGranularity;
360
- const isBoolean = val => {
199
+ export const isBoolean = val => {
361
200
  return typeof val === 'boolean';
362
201
  };
363
- exports.isBoolean = isBoolean;
364
- const getSimilarKeys = genericKey => {
365
- const similarKeys = _constants.GENERIC_KEY_2_SIMILAR_KEYS[genericKey];
202
+ export const getSimilarKeys = genericKey => {
203
+ const similarKeys = GENERIC_KEY_2_SIMILAR_KEYS[genericKey];
366
204
  return similarKeys || [];
367
205
  };
368
- exports.getSimilarKeys = getSimilarKeys;
369
- const getChartConfigValueFromKeys = (keys, object) => {
206
+ export const getChartConfigValueFromKeys = (keys, object) => {
370
207
  // eslint-disable-next-line
371
- const existKey = keys.find(key => _objectUtils.default.hasOwnProperty(object, key));
208
+ const existKey = keys.find(key => ObjectUtils.hasOwnProperty(object, key));
372
209
  return existKey ? object[existKey] : null;
373
210
  };
374
- exports.getChartConfigValueFromKeys = getChartConfigValueFromKeys;
375
- const getChartConfigValueByKey = (key, object) => {
211
+ export const getChartConfigValueByKey = (key, object) => {
376
212
  const similarKeys = getSimilarKeys(key);
377
213
  if (!Array.isArray(similarKeys) || similarKeys.length === 0) {
378
214
  // get value by the given 'genericKey' directly when has no similar keys.
379
215
  // eslint-disable-next-line
380
- return _objectUtils.default.hasOwnProperty(object, key) ? object[key] : null;
216
+ return ObjectUtils.hasOwnProperty(object, key) ? object[key] : null;
381
217
  }
382
218
 
383
219
  // try to get value from the similar keys
384
220
  return getChartConfigValueFromKeys(similarKeys, object);
385
221
  };
386
- exports.getChartConfigValueByKey = getChartConfigValueByKey;
387
- const eventStopPropagation = event => {
222
+ export const eventStopPropagation = event => {
388
223
  if (!event) return;
389
224
  event.stopPropagation();
390
225
  event.preventDefault && event.preventDefault();
391
226
  event.nativeEvent && event.nativeEvent.stopImmediatePropagation && event.nativeEvent.stopImmediatePropagation();
392
227
  };
393
- exports.eventStopPropagation = eventStopPropagation;
394
- const getEventClassName = e => {
228
+ export const getEventClassName = e => {
395
229
  // svg mouseEvent event.target.className is an object
396
230
  if (!e || !e.target) return '';
397
231
  return e.target.getAttribute('class') || '';
398
232
  };
399
- exports.getEventClassName = getEventClassName;
400
- const getFirstDayOfWeekForGroupby = source => {
233
+ export const getFirstDayOfWeekForGroupby = source => {
401
234
  let firstDayOfWeek = 'Sunday';
402
235
  if (source === 'base') {
403
236
  const {
@@ -417,4 +250,4 @@ const getFirstDayOfWeekForGroupby = source => {
417
250
  }
418
251
  return firstDayOfWeek || 'Sunday';
419
252
  };
420
- exports.getFirstDayOfWeekForGroupby = getFirstDayOfWeekForGroupby;
253
+ export { ObjectUtils, chartColumn2SqlColumn, summaryMethodColumn2SqlColumn, ChartUtils, ChartDataSQL, BaseUtils };
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.generatorKey = void 0;
7
1
  const generatorBase64Code = function () {
8
2
  let keyLength = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4;
9
3
  let possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789';
@@ -13,8 +7,7 @@ const generatorBase64Code = function () {
13
7
  }
14
8
  return key;
15
9
  };
16
- const generatorKey = function () {
10
+ export const generatorKey = function () {
17
11
  let length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 4;
18
12
  return generatorBase64Code(length);
19
- };
20
- exports.generatorKey = generatorKey;
13
+ };
package/dist/utils/map.js CHANGED
@@ -1,33 +1,26 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getRegionScaleOffsets = exports.getGeoGranularityByLevel = exports.fixGeoGranularity = void 0;
7
- var _constants = require("../constants");
1
+ import { GEOLOCATION_GRANULARITY, MAP_LEVEL, MUNICIPALITIES, regions } from '../constants';
8
2
  const COUNTY_SCALE_WIDTH = 5.95;
9
3
  const COUNTY_SCALE_HEIGHT = 4.37;
10
- const getGeoGranularityByLevel = mapLevel => {
4
+ export const getGeoGranularityByLevel = mapLevel => {
11
5
  switch (mapLevel) {
12
- case _constants.MAP_LEVEL.PROVINCE:
6
+ case MAP_LEVEL.PROVINCE:
13
7
  {
14
- return _constants.GEOLOCATION_GRANULARITY.CITY;
8
+ return GEOLOCATION_GRANULARITY.CITY;
15
9
  }
16
- case _constants.MAP_LEVEL.CITY:
10
+ case MAP_LEVEL.CITY:
17
11
  {
18
- return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
12
+ return GEOLOCATION_GRANULARITY.DISTRICT;
19
13
  }
20
14
  default:
21
15
  {
22
16
  // default as 'country'
23
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
17
+ return GEOLOCATION_GRANULARITY.PROVINCE;
24
18
  }
25
19
  }
26
20
  };
27
- exports.getGeoGranularityByLevel = getGeoGranularityByLevel;
28
- const fixGeoGranularity = (mapLevel, mapLocation) => {
29
- if (!mapLevel || mapLevel === _constants.MAP_LEVEL.COUNTRY || !mapLocation) {
30
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
21
+ export const fixGeoGranularity = (mapLevel, mapLocation) => {
22
+ if (!mapLevel || mapLevel === MAP_LEVEL.COUNTRY || !mapLocation) {
23
+ return GEOLOCATION_GRANULARITY.PROVINCE;
31
24
  }
32
25
 
33
26
  // e.g. Beijing
@@ -35,45 +28,44 @@ const fixGeoGranularity = (mapLevel, mapLocation) => {
35
28
  province: provinceName,
36
29
  city: cityName
37
30
  } = mapLocation;
38
- if (provinceName && _constants.MUNICIPALITIES.includes(provinceName)) {
39
- return _constants.GEOLOCATION_GRANULARITY.DISTRICT;
31
+ if (provinceName && MUNICIPALITIES.includes(provinceName)) {
32
+ return GEOLOCATION_GRANULARITY.DISTRICT;
40
33
  }
41
34
 
42
35
  // e.g. HongKong
43
- const selectedProvince = provinceName && _constants.regions.find(province => province.name === provinceName);
36
+ const selectedProvince = provinceName && regions.find(province => province.name === provinceName);
44
37
  if (selectedProvince && selectedProvince.disable_drill_down) {
45
- return _constants.GEOLOCATION_GRANULARITY.PROVINCE;
38
+ return GEOLOCATION_GRANULARITY.PROVINCE;
46
39
  }
47
40
  const cities = selectedProvince && selectedProvince.cities;
48
41
  const selectedCity = cities && cityName && cities.find(city => city.name === cityName);
49
- if (mapLevel === _constants.MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
50
- return _constants.GEOLOCATION_GRANULARITY.CITY;
42
+ if (mapLevel === MAP_LEVEL.CITY && selectedCity && selectedCity.disable_drill_down) {
43
+ return GEOLOCATION_GRANULARITY.CITY;
51
44
  }
52
45
 
53
46
  // others
54
47
  return getGeoGranularityByLevel(mapLevel);
55
48
  };
56
- exports.fixGeoGranularity = fixGeoGranularity;
57
- const getRegionScaleOffsets = (mapLevel, mapLocation) => {
49
+ export const getRegionScaleOffsets = (mapLevel, mapLocation) => {
58
50
  const countryScaleOffsets = {
59
51
  scale_w: COUNTY_SCALE_WIDTH,
60
52
  scale_h: COUNTY_SCALE_HEIGHT
61
53
  };
62
54
  switch (mapLevel) {
63
- case _constants.MAP_LEVEL.PROVINCE:
55
+ case MAP_LEVEL.PROVINCE:
64
56
  {
65
57
  const provinceName = mapLocation && mapLocation.province;
66
- const province = provinceName && _constants.regions.find(province => province.name === provinceName);
58
+ const province = provinceName && regions.find(province => province.name === provinceName);
67
59
  if (!province) return countryScaleOffsets;
68
60
  return {
69
61
  scale_w: province.scale_w,
70
62
  scale_h: province.scale_h
71
63
  };
72
64
  }
73
- case _constants.MAP_LEVEL.CITY:
65
+ case MAP_LEVEL.CITY:
74
66
  {
75
67
  const provinceName = mapLocation && mapLocation.province;
76
- const province = provinceName && _constants.regions.find(province => province.name === provinceName);
68
+ const province = provinceName && regions.find(province => province.name === provinceName);
77
69
  const cities = province && province.cities;
78
70
  const cityName = mapLocation.city;
79
71
  const city = cityName && Array.isArray(cities) && cities.find(city => city.name === cityName);
@@ -89,5 +81,4 @@ const getRegionScaleOffsets = (mapLevel, mapLocation) => {
89
81
  return countryScaleOffsets;
90
82
  }
91
83
  }
92
- };
93
- exports.getRegionScaleOffsets = getRegionScaleOffsets;
84
+ };
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  class ObjectUtils {
8
2
  static getDataType(data) {
9
3
  let type = typeof data;
@@ -17,7 +11,7 @@ class ObjectUtils {
17
11
  }
18
12
  static isObjectChanged(source, comparison) {
19
13
  if (!this.iterable(source)) {
20
- throw new Error("source should be a Object or Array , but got ".concat(this.getDataType(source)));
14
+ throw new Error(`source should be a Object or Array , but got ${this.getDataType(source)}`);
21
15
  }
22
16
  if (this.getDataType(source) !== this.getDataType(comparison)) {
23
17
  return true;
@@ -48,4 +42,4 @@ class ObjectUtils {
48
42
  return Object.prototype.hasOwnProperty.call(obj, propertyKey);
49
43
  }
50
44
  }
51
- var _default = exports.default = ObjectUtils;
45
+ export default ObjectUtils;