dtable-statistic 4.3.2 → 4.3.3

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 (222) hide show
  1. package/es/api/dtable-db-api.js +10 -3
  2. package/es/calculator/base-calculator.js +20 -12
  3. package/es/calculator/basic-chart-calculator.js +72 -65
  4. package/es/calculator/combination-calculator.js +64 -57
  5. package/es/calculator/compare-bar-calculator.js +33 -26
  6. package/es/calculator/completeness-calculator.js +37 -30
  7. package/es/calculator/copy-value.js +7 -1
  8. package/es/calculator/dashboard-calculator.js +20 -13
  9. package/es/calculator/heat-map-calculator.js +25 -18
  10. package/es/calculator/horizontal-bar-calculator.js +15 -8
  11. package/es/calculator/index.js +42 -35
  12. package/es/calculator/map-calculator.js +29 -22
  13. package/es/calculator/mirror-calculator.js +27 -20
  14. package/es/calculator/number-card-calculator.js +17 -10
  15. package/es/calculator/pivot-table-calculator.js +65 -58
  16. package/es/calculator/scatter-calculator.js +21 -14
  17. package/es/calculator/thread-manager.js +7 -1
  18. package/es/calculator/trend-calculator.js +29 -22
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +83 -76
  20. package/es/calculator/workers/calculator.worker.js +33 -30
  21. package/es/calculator/workers/card-calculator-worker.js +19 -13
  22. package/es/calculator/workers/combination-calculator-worker.js +53 -46
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +29 -22
  24. package/es/calculator/workers/completeness-calculator-worker.js +41 -34
  25. package/es/calculator/workers/dashboard-calculator-worker.js +24 -18
  26. package/es/calculator/workers/mirror-calculator-worker.js +29 -22
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +84 -77
  28. package/es/calculator/workers/scatter-calculator-worker.js +27 -20
  29. package/es/calculator/workers/trend-calculator-worker.js +34 -27
  30. package/es/calculator/world-map-calculator.js +24 -17
  31. package/es/components/common-add-tool.js +12 -5
  32. package/es/components/dialog/chart-addition-edit-dialog.js +20 -12
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +110 -103
  34. package/es/components/dialog/color-theme-dialog.js +22 -15
  35. package/es/components/dialog/delete-confirmation-dialog.js +18 -11
  36. package/es/components/dialog/enlarged-chart-dialog.js +28 -20
  37. package/es/components/dialog/new-table-dialog.js +23 -16
  38. package/es/components/dialog/new-view-dialog.js +22 -15
  39. package/es/components/dialog/rename-view-dialog.js +22 -14
  40. package/es/components/dialog/statistic-record-dialog/index.js +45 -37
  41. package/es/components/dialog/statistic-types-dialog/index.js +22 -14
  42. package/es/components/dialog/table-select-dialog.js +23 -15
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +56 -43
  44. package/es/components/dtable-popover.js +19 -12
  45. package/es/components/dtable-search-input.js +21 -13
  46. package/es/components/dtable-select.js +20 -12
  47. package/es/components/icon.js +11 -4
  48. package/es/components/index.js +76 -11
  49. package/es/components/loading.js +10 -3
  50. package/es/components/modal-portal.js +12 -5
  51. package/es/components/popover/color-rules/color-rule.js +33 -25
  52. package/es/components/popover/color-rules/index.js +14 -6
  53. package/es/components/popover/color-rules/rule-filters/filter.js +35 -28
  54. package/es/components/popover/color-rules/rule-filters/index.js +25 -17
  55. package/es/components/popover/color-rules/rule-filters/number-input.js +17 -9
  56. package/es/components/popover/color-rules-popover.js +32 -24
  57. package/es/components/popover/color-selector-popover.js +17 -10
  58. package/es/components/seatable-radio/index.js +16 -9
  59. package/es/components/select/index.js +9 -2
  60. package/es/components/select/option-group.js +27 -19
  61. package/es/components/select/option.js +14 -6
  62. package/es/components/select/select.js +25 -17
  63. package/es/components/toast/alert.js +31 -24
  64. package/es/components/toast/index.js +10 -3
  65. package/es/components/toast/toast.js +20 -12
  66. package/es/components/toast/toastManager.js +17 -9
  67. package/es/components/toast/toaster.js +14 -6
  68. package/es/constants/color-rules.js +12 -6
  69. package/es/constants/dtable-select-style.js +9 -4
  70. package/es/constants/event-types.js +10 -4
  71. package/es/constants/index.js +96 -67
  72. package/es/constants/key-codes.js +2 -0
  73. package/es/constants/map.js +8 -2
  74. package/es/constants/model.js +26 -20
  75. package/es/constants/regions.js +8 -3
  76. package/es/constants/zIndexes.js +7 -1
  77. package/es/custom-g2.js +236 -208
  78. package/es/dashboard.js +58 -50
  79. package/es/desktop-dashboard.js +55 -47
  80. package/es/index.js +6 -3
  81. package/es/locale/index.js +13 -10
  82. package/es/locale/lang/de.js +7 -1
  83. package/es/locale/lang/en.js +7 -1
  84. package/es/locale/lang/fr.js +7 -1
  85. package/es/locale/lang/zh_CN.js +7 -1
  86. package/es/mobile-dashboard.js +46 -38
  87. package/es/model/bar-group.js +19 -11
  88. package/es/model/bar.js +18 -10
  89. package/es/model/base-model.js +9 -2
  90. package/es/model/basic-number-card.js +16 -8
  91. package/es/model/collaborators.js +9 -2
  92. package/es/model/combination.js +20 -12
  93. package/es/model/compare-bar.js +24 -16
  94. package/es/model/completeness-group.js +16 -8
  95. package/es/model/completeness.js +13 -5
  96. package/es/model/custom-bar.js +14 -6
  97. package/es/model/dashboard.js +14 -6
  98. package/es/model/generic-model.js +141 -133
  99. package/es/model/heat-map.js +19 -11
  100. package/es/model/horizontal-bar-group.js +18 -10
  101. package/es/model/horizontal-bar.js +18 -10
  102. package/es/model/index.js +185 -53
  103. package/es/model/map.js +23 -15
  104. package/es/model/mirror.js +21 -13
  105. package/es/model/pie.js +18 -10
  106. package/es/model/ring.js +19 -11
  107. package/es/model/scatter.js +14 -6
  108. package/es/model/statistic-dashboard.js +9 -2
  109. package/es/model/table.js +18 -10
  110. package/es/model/trend.js +20 -12
  111. package/es/model/world-map.js +21 -13
  112. package/es/service/chart-service.js +14 -7
  113. package/es/service/dashboard-service.js +42 -35
  114. package/es/service/map-json.js +14 -8
  115. package/es/stat-editor/chart-name-editor.js +15 -8
  116. package/es/stat-editor/index.js +24 -16
  117. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +30 -22
  118. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +57 -49
  119. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +32 -24
  120. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +11 -4
  121. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +27 -19
  122. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +51 -43
  123. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +31 -23
  124. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +31 -23
  125. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +48 -40
  126. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +29 -21
  127. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +34 -26
  128. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +55 -47
  129. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +30 -22
  130. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +26 -18
  131. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +35 -27
  132. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +32 -24
  133. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +41 -33
  134. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +30 -22
  135. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +25 -17
  136. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +54 -46
  137. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +31 -23
  138. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +34 -26
  139. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +85 -77
  140. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +29 -21
  141. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +81 -73
  142. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +24 -16
  143. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +27 -19
  144. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +26 -18
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +59 -51
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +27 -19
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +57 -49
  148. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +20 -12
  149. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +56 -48
  150. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +17 -9
  151. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +29 -21
  152. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +38 -30
  153. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +58 -50
  154. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +25 -17
  155. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +56 -47
  156. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +20 -12
  157. package/es/stat-editor/stat-settings/color-setting/color-picker.js +19 -12
  158. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +70 -62
  159. package/es/stat-editor/stat-settings/map/map-level.js +20 -13
  160. package/es/stat-editor/stat-settings/map/map-province-city.js +27 -20
  161. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +19 -11
  162. package/es/stat-editor/stat-settings/public-setting/base-settings.js +28 -20
  163. package/es/stat-editor/stat-settings/public-setting/calender.js +29 -22
  164. package/es/stat-editor/stat-settings/public-setting/column-settings.js +13 -6
  165. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +16 -9
  166. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +21 -13
  167. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +15 -8
  168. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +19 -11
  169. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +35 -27
  170. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +15 -8
  171. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +26 -18
  172. package/es/stat-list/chart-preview.js +33 -20
  173. package/es/stat-list/index.js +36 -28
  174. package/es/stat-view/area-chart.js +51 -44
  175. package/es/stat-view/bar-chart.js +55 -48
  176. package/es/stat-view/base-chart.js +32 -24
  177. package/es/stat-view/basic-number-card.js +26 -19
  178. package/es/stat-view/combination-chart.js +57 -50
  179. package/es/stat-view/compare-chart.js +47 -40
  180. package/es/stat-view/completeness-chart.js +37 -30
  181. package/es/stat-view/custom-bar.js +38 -31
  182. package/es/stat-view/dashboard-chart.js +22 -15
  183. package/es/stat-view/heat-map.js +50 -43
  184. package/es/stat-view/horizontal-bar-chart.js +59 -52
  185. package/es/stat-view/index.js +80 -73
  186. package/es/stat-view/line-chart.js +47 -40
  187. package/es/stat-view/map.js +40 -33
  188. package/es/stat-view/mirror.js +28 -21
  189. package/es/stat-view/pie-chart.js +36 -29
  190. package/es/stat-view/pivot-table/index.js +39 -32
  191. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +39 -31
  192. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +37 -29
  193. package/es/stat-view/pivot-table/pivot-table-display-name.js +54 -46
  194. package/es/stat-view/pivot-table/two-dimension-table.js +70 -62
  195. package/es/stat-view/ring-chart.js +46 -39
  196. package/es/stat-view/scatter-chart.js +37 -30
  197. package/es/stat-view/treemap-chart.js +45 -38
  198. package/es/stat-view/trend-chart.js +39 -32
  199. package/es/stat-view/world-map.js +40 -33
  200. package/es/tabs/index.js +40 -32
  201. package/es/tabs/tab.js +35 -27
  202. package/es/utils/basic-chart-utils.js +9 -2
  203. package/es/utils/cell-format.js +22 -14
  204. package/es/utils/cell-value.js +14 -7
  205. package/es/utils/collaborator.js +13 -4
  206. package/es/utils/color-utils.js +29 -18
  207. package/es/utils/column-utils.js +29 -18
  208. package/es/utils/column.js +11 -4
  209. package/es/utils/common-utils.js +67 -43
  210. package/es/utils/date-format.js +8 -2
  211. package/es/utils/export-table-utils.js +91 -82
  212. package/es/utils/index.js +100 -11
  213. package/es/utils/map.js +36 -26
  214. package/es/utils/model.js +14 -6
  215. package/es/utils/object.js +15 -6
  216. package/es/utils/pivot-table.js +23 -16
  217. package/es/utils/row-utils.js +34 -24
  218. package/es/utils/search.js +29 -21
  219. package/es/utils/sql-utils.js +75 -65
  220. package/es/utils/stat-utils.js +67 -60
  221. package/es/utils/trend-utils.js +40 -32
  222. package/package.json +82 -125
@@ -1,7 +1,13 @@
1
- import { filterRow, getValidFilters } from 'dtable-store';
2
- import { STAT_TYPE, TYPE_COLOR_USING } from '../constants';
3
- import { COLOR_RULE_FILTER_TYPE_MAP, FILTER_TYPE_2_CELL_TYPE } from '../constants/color-rules';
4
- export const getValidColorRules = colorRules => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getValidColorRules = exports.getLabelColorFromSpecificColor = exports.getLabelColorFromColorRules = exports.getLabelColor = exports.getConvertedColorRules = void 0;
7
+ var _dtableStore = require("dtable-store");
8
+ var _constants = require("../constants");
9
+ var _colorRules = require("../constants/color-rules");
10
+ const getValidColorRules = colorRules => {
5
11
  if (!Array.isArray(colorRules) || colorRules.length === 0) {
6
12
  return [];
7
13
  }
@@ -14,8 +20,8 @@ export const getValidColorRules = colorRules => {
14
20
  return;
15
21
  }
16
22
  columns.push({
17
- key: COLOR_RULE_FILTER_TYPE_MAP.NUMERIC_VALUE,
18
- type: FILTER_TYPE_2_CELL_TYPE[filterType]
23
+ key: _colorRules.COLOR_RULE_FILTER_TYPE_MAP.NUMERIC_VALUE,
24
+ type: _colorRules.FILTER_TYPE_2_CELL_TYPE[filterType]
19
25
  });
20
26
  keyExistColumnMap[filterType] = true;
21
27
  });
@@ -30,7 +36,7 @@ export const getValidColorRules = colorRules => {
30
36
  column_key: filter.filter_type
31
37
  };
32
38
  });
33
- const validFilters = getValidFilters(convertedFilters, columns);
39
+ const validFilters = (0, _dtableStore.getValidFilters)(convertedFilters, columns);
34
40
  if (validFilters.length === 0) {
35
41
  return null;
36
42
  }
@@ -40,7 +46,8 @@ export const getValidColorRules = colorRules => {
40
46
  };
41
47
  }).filter(Boolean);
42
48
  };
43
- export const getConvertedColorRules = colorRules => {
49
+ exports.getValidColorRules = getValidColorRules;
50
+ const getConvertedColorRules = colorRules => {
44
51
  const validColorRules = getValidColorRules(colorRules);
45
52
  return validColorRules.map(colorRule => {
46
53
  const convertedFilters = colorRule.filters.map(filter => {
@@ -52,7 +59,7 @@ export const getConvertedColorRules = colorRules => {
52
59
  column_key: filter_type,
53
60
  column: {
54
61
  key: filter_type,
55
- type: FILTER_TYPE_2_CELL_TYPE[filter_type]
62
+ type: _colorRules.FILTER_TYPE_2_CELL_TYPE[filter_type]
56
63
  }
57
64
  };
58
65
  });
@@ -62,13 +69,14 @@ export const getConvertedColorRules = colorRules => {
62
69
  };
63
70
  });
64
71
  };
65
- export const getLabelColorFromSpecificColor = chart => {
72
+ exports.getConvertedColorRules = getConvertedColorRules;
73
+ const getLabelColorFromSpecificColor = chart => {
66
74
  switch (chart.type) {
67
- case STAT_TYPE.BAR:
75
+ case _constants.STAT_TYPE.BAR:
68
76
  {
69
77
  return chart.y_axis_label_color;
70
78
  }
71
- case STAT_TYPE.HORIZONTAL_BAR:
79
+ case _constants.STAT_TYPE.HORIZONTAL_BAR:
72
80
  {
73
81
  return chart.horizontal_axis_label_color;
74
82
  }
@@ -78,7 +86,8 @@ export const getLabelColorFromSpecificColor = chart => {
78
86
  }
79
87
  }
80
88
  };
81
- export const getLabelColorFromColorRules = (colorRules, value) => {
89
+ exports.getLabelColorFromSpecificColor = getLabelColorFromSpecificColor;
90
+ const getLabelColorFromColorRules = (colorRules, value) => {
82
91
  if (!colorRules) {
83
92
  return null;
84
93
  }
@@ -93,25 +102,26 @@ export const getLabelColorFromColorRules = (colorRules, value) => {
93
102
  filter_conjunction,
94
103
  filters
95
104
  } = colorRule;
96
- if (filterRow(row, filter_conjunction, filters)) {
105
+ if ((0, _dtableStore.filterRow)(row, filter_conjunction, filters)) {
97
106
  matchedRuleColor = color;
98
107
  break;
99
108
  }
100
109
  }
101
110
  return matchedRuleColor;
102
111
  };
103
- export const getLabelColor = _ref => {
112
+ exports.getLabelColorFromColorRules = getLabelColorFromColorRules;
113
+ const getLabelColor = _ref => {
104
114
  let {
105
115
  chart,
106
116
  colorRules,
107
117
  value
108
118
  } = _ref;
109
119
  switch (chart.color_option) {
110
- case TYPE_COLOR_USING.USE_SPECIFIC_COLORS:
120
+ case _constants.TYPE_COLOR_USING.USE_SPECIFIC_COLORS:
111
121
  {
112
122
  return getLabelColorFromSpecificColor(chart);
113
123
  }
114
- case TYPE_COLOR_USING.USE_RULES:
124
+ case _constants.TYPE_COLOR_USING.USE_RULES:
115
125
  {
116
126
  return getLabelColorFromColorRules(colorRules, value);
117
127
  }
@@ -120,4 +130,5 @@ export const getLabelColor = _ref => {
120
130
  return null;
121
131
  }
122
132
  }
123
- };
133
+ };
134
+ exports.getLabelColor = getLabelColor;
@@ -1,11 +1,18 @@
1
- import { CellType, isDateColumn, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES } from 'dtable-store';
2
- import { MIRROR_COLUMN_LIST } from '../constants';
3
- export function getColorFromSingleSelectColumn(column, target) {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getColorFromSingleSelectColumn = getColorFromSingleSelectColumn;
7
+ exports.isWorldMapColumn = exports.isStatisticDateColumn = exports.isMirrorColumn = exports.isMapColumn = void 0;
8
+ var _dtableStore = require("dtable-store");
9
+ var _constants = require("../constants");
10
+ function getColorFromSingleSelectColumn(column, target) {
4
11
  let {
5
12
  type: columnType,
6
13
  data: columnData
7
14
  } = column;
8
- if (columnType !== CellType.SINGLE_SELECT) {
15
+ if (columnType !== _dtableStore.CellType.SINGLE_SELECT) {
9
16
  return null;
10
17
  }
11
18
  const options = columnData ? columnData.options : [];
@@ -19,17 +26,18 @@ export function getColorFromSingleSelectColumn(column, target) {
19
26
  const color = selectedOption && selectedOption.color;
20
27
  return color || null;
21
28
  }
22
- export const isStatisticDateColumn = column => {
29
+ const isStatisticDateColumn = column => {
23
30
  if (!column) return false;
24
- return isDateColumn(column);
31
+ return (0, _dtableStore.isDateColumn)(column);
25
32
  };
26
- export const isMapColumn = column => {
33
+ exports.isStatisticDateColumn = isStatisticDateColumn;
34
+ const isMapColumn = column => {
27
35
  if (!column) return false;
28
36
  const {
29
37
  type,
30
38
  data
31
39
  } = column;
32
- if (type === CellType.GEOLOCATION) {
40
+ if (type === _dtableStore.CellType.GEOLOCATION) {
33
41
  const {
34
42
  geo_format
35
43
  } = data || {};
@@ -38,13 +46,13 @@ export const isMapColumn = column => {
38
46
  }
39
47
  return true;
40
48
  }
41
- if (FORMULA_COLUMN_TYPES.includes(type)) {
49
+ if (_dtableStore.FORMULA_COLUMN_TYPES.includes(type)) {
42
50
  const {
43
51
  result_type,
44
52
  array_type,
45
53
  array_data
46
54
  } = data || {};
47
- if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
55
+ if (result_type !== _dtableStore.FORMULA_RESULT_TYPE.ARRAY || array_type !== _dtableStore.CellType.GEOLOCATION) {
48
56
  return false;
49
57
  }
50
58
  const {
@@ -57,18 +65,20 @@ export const isMapColumn = column => {
57
65
  }
58
66
  return false;
59
67
  };
60
- export const isMirrorColumn = column => {
68
+ exports.isMapColumn = isMapColumn;
69
+ const isMirrorColumn = column => {
61
70
  if (!column) return false;
62
- return MIRROR_COLUMN_LIST.includes(column.type);
71
+ return _constants.MIRROR_COLUMN_LIST.includes(column.type);
63
72
  };
64
- export const isWorldMapColumn = column => {
73
+ exports.isMirrorColumn = isMirrorColumn;
74
+ const isWorldMapColumn = column => {
65
75
  if (!column) return false;
66
76
  const {
67
77
  type,
68
78
  data
69
79
  } = column;
70
- if (type === CellType.TEXT) return true;
71
- if (type === CellType.GEOLOCATION) {
80
+ if (type === _dtableStore.CellType.TEXT) return true;
81
+ if (type === _dtableStore.CellType.GEOLOCATION) {
72
82
  const {
73
83
  geo_format
74
84
  } = data || {};
@@ -76,7 +86,7 @@ export const isWorldMapColumn = column => {
76
86
  return true;
77
87
  }
78
88
  }
79
- if (FORMULA_COLUMN_TYPES.includes(type)) {
89
+ if (_dtableStore.FORMULA_COLUMN_TYPES.includes(type)) {
80
90
  const {
81
91
  data
82
92
  } = column;
@@ -85,7 +95,7 @@ export const isWorldMapColumn = column => {
85
95
  array_type,
86
96
  array_data
87
97
  } = data || {};
88
- if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
98
+ if (result_type !== _dtableStore.FORMULA_RESULT_TYPE.ARRAY || array_type !== _dtableStore.CellType.GEOLOCATION) {
89
99
  return false;
90
100
  }
91
101
  const {
@@ -96,4 +106,5 @@ export const isWorldMapColumn = column => {
96
106
  }
97
107
  }
98
108
  return false;
99
- };
109
+ };
110
+ exports.isWorldMapColumn = isWorldMapColumn;
@@ -1,12 +1,19 @@
1
- import { DEFAULT_DATE_FORMAT } from 'dtable-store';
2
- export function getSelectColumnOptions(column) {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDateColumnFormat = getDateColumnFormat;
7
+ exports.getSelectColumnOptions = getSelectColumnOptions;
8
+ var _dtableStore = require("dtable-store");
9
+ function getSelectColumnOptions(column) {
3
10
  if (!column || !column.data || !Array.isArray(column.data.options)) {
4
11
  return [];
5
12
  }
6
13
  return column.data.options;
7
14
  }
8
- export function getDateColumnFormat(column) {
9
- let format = column && column.data && column.data.format ? column.data.format : DEFAULT_DATE_FORMAT;
15
+ function getDateColumnFormat(column) {
16
+ let format = column && column.data && column.data.format ? column.data.format : _dtableStore.DEFAULT_DATE_FORMAT;
10
17
  // Old Europe format is D/M/YYYY new format is DD/MM/YYYY
11
18
  format = format.replace(/D\/M\/YYYY/, 'DD/MM/YYYY');
12
19
  return format;
@@ -1,12 +1,25 @@
1
- import { CellType, COLLABORATOR_COLUMN_TYPES, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE, generatorBase64Code, isNumber, TableUtils } from 'dtable-store';
2
- import intl from 'react-intl-universal';
3
- import { STAT_TYPE, DEFAULT_LABEL_FONT_SIZE, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, CHART_STYLE_COLORS, PIE_COLOR_OPTIONS, SUMMARY_METHOD_MAP } from '../constants';
4
- import StatUtils from './stat-utils';
5
- export const generatorUniqueId = list => {
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.arraysEqual = arraysEqual;
8
+ exports.formatNumericValue = void 0;
9
+ exports.formatPieChartData = formatPieChartData;
10
+ exports.isShapeEqual = exports.isBoolean = exports.isArrayCellValue = exports.getSummaryResult = exports.getSummaryColumnMethod = exports.getLabelFontSize = exports.getImageUrl = exports.getCurrentTheme = exports.generatorUniqueId = void 0;
11
+ exports.isStatItemEqual = isStatItemEqual;
12
+ exports.shallowEqual = shallowEqual;
13
+ exports.sortDataByGroupSum = exports.shouldCalculateStatItem = void 0;
14
+ var _dtableStore = require("dtable-store");
15
+ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
16
+ var _constants = require("../constants");
17
+ var _statUtils = _interopRequireDefault(require("./stat-utils"));
18
+ const generatorUniqueId = list => {
6
19
  let uniqueId;
7
20
  let isUnique = false;
8
21
  while (!isUnique) {
9
- uniqueId = generatorBase64Code();
22
+ uniqueId = (0, _dtableStore.generatorBase64Code)();
10
23
 
11
24
  // eslint-disable-next-line
12
25
  if (!Array.isArray(list) || list.length === 0) {
@@ -19,25 +32,28 @@ export const generatorUniqueId = list => {
19
32
  }
20
33
  return uniqueId;
21
34
  };
22
- export const getImageUrl = imageName => {
35
+ exports.generatorUniqueId = generatorUniqueId;
36
+ const getImageUrl = imageName => {
23
37
  const {
24
38
  mediaUrl
25
39
  } = window.dtable;
26
40
  return "".concat(mediaUrl, "dtable-statistic/img/").concat(imageName);
27
41
  };
28
- export const isShapeEqual = (position1, position2) => {
42
+ exports.getImageUrl = getImageUrl;
43
+ const isShapeEqual = (position1, position2) => {
29
44
  if (position1 && position2) {
30
45
  return position1.w === position2.w && position1.h === position2.h;
31
46
  }
32
47
  if (!position1 && !position2) return true;
33
48
  return false;
34
49
  };
35
- export function isStatItemEqual(prevStatItem, chart) {
50
+ exports.isShapeEqual = isShapeEqual;
51
+ function isStatItemEqual(prevStatItem, chart) {
36
52
  let statItemType = prevStatItem.type;
37
53
  if (statItemType !== chart.type) return false;
38
54
  return shallowEqual(prevStatItem, chart);
39
55
  }
40
- export function shallowEqual(objA, objB) {
56
+ function shallowEqual(objA, objB) {
41
57
  if (objA === objB) {
42
58
  return true;
43
59
  }
@@ -71,7 +87,7 @@ export function shallowEqual(objA, objB) {
71
87
  if (key === 'show_y_axis_right_label') continue;
72
88
  if (key === 'y_axis_left_label_position') continue;
73
89
  if (key === 'y_axis_right_label_position') continue;
74
- if (objA.type !== 'basic_number_card' && objA.type !== STAT_TYPE.DASHBOARD && key === 'name') continue;
90
+ if (objA.type !== 'basic_number_card' && objA.type !== _constants.STAT_TYPE.DASHBOARD && key === 'name') continue;
75
91
  if (Object.prototype.hasOwnProperty.call(objB, key)) {
76
92
  if (Array.isArray(valueA) && Array.isArray(valueB)) {
77
93
  let isArrayEqual = arraysEqual(valueA, valueB);
@@ -89,7 +105,7 @@ export function shallowEqual(objA, objB) {
89
105
  return true;
90
106
  }
91
107
  const IGNORE_STAT_KEYS = ['layout', 'name', 'show_y_axis_label', 'show_x_axis_label', 'show_vertical_axis_label', 'show_horizontal_axis_label', 'vertical_axis_label_position', 'horizontal_axis_label_position', 'horizontal_axis_label_color', 'y_axis_label_color', 'data_color', 'display_data', 'show_y_axis_left_label', 'show_y_axis_right_label', 'x_axis_label_position', 'y_axis_label_position', 'y_axis_left_color', 'y_axis_right_color', 'y_axis_left_label_position', 'y_axis_right_label_position', 'minimum_slice_percent', 'bubble_color', 'map_type', 'legend_direction', 'legend_size', 'completed_color', 'uncompleted_color', 'display_percentage', 'label_font_size'];
92
- export const shouldCalculateStatItem = (prevStatItem, chart) => {
108
+ const shouldCalculateStatItem = (prevStatItem, chart) => {
93
109
  let statItemType = prevStatItem.type;
94
110
  if (statItemType !== chart.type) return true;
95
111
  if (prevStatItem === chart) {
@@ -121,7 +137,8 @@ export const shouldCalculateStatItem = (prevStatItem, chart) => {
121
137
  }
122
138
  return false;
123
139
  };
124
- export function arraysEqual(arrayA, arrayB) {
140
+ exports.shouldCalculateStatItem = shouldCalculateStatItem;
141
+ function arraysEqual(arrayA, arrayB) {
125
142
  if (arrayA === null || arrayB === null) return false;
126
143
  if (arrayA.length !== arrayB.length) return false;
127
144
  for (let i = 0; i < arrayA.length; i++) {
@@ -129,37 +146,37 @@ export function arraysEqual(arrayA, arrayB) {
129
146
  }
130
147
  return true;
131
148
  }
132
- export const isArrayCellValue = column => {
149
+ const isArrayCellValue = column => {
133
150
  if (!column) return false;
134
151
  const {
135
152
  type,
136
153
  data
137
154
  } = column;
138
- return MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[type] || FORMULA_COLUMN_TYPES_MAP[type] && data && data.result_type === FORMULA_RESULT_TYPE.ARRAY && COLLABORATOR_COLUMN_TYPES.includes(data.array_type) // the collaborator lookup is not formatted
155
+ return _constants.MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP[type] || _dtableStore.FORMULA_COLUMN_TYPES_MAP[type] && data && data.result_type === _dtableStore.FORMULA_RESULT_TYPE.ARRAY && _dtableStore.COLLABORATOR_COLUMN_TYPES.includes(data.array_type) // the collaborator lookup is not formatted
139
156
  ;
140
157
  };
141
-
142
- export const getSummaryResult = function (results, summaryMethod) {
158
+ exports.isArrayCellValue = isArrayCellValue;
159
+ const getSummaryResult = function (results, summaryMethod) {
143
160
  let precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
144
- const numericResults = Array.isArray(results) && results.length > 0 ? results.filter(res => isNumber(res)) : [];
161
+ const numericResults = Array.isArray(results) && results.length > 0 ? results.filter(res => (0, _dtableStore.isNumber)(res)) : [];
145
162
  switch (summaryMethod) {
146
- case SUMMARY_METHOD_MAP.Max:
163
+ case _constants.SUMMARY_METHOD_MAP.Max:
147
164
  {
148
165
  return getMax(numericResults);
149
166
  }
150
- case SUMMARY_METHOD_MAP.Min:
167
+ case _constants.SUMMARY_METHOD_MAP.Min:
151
168
  {
152
169
  return getMin(numericResults);
153
170
  }
154
- case SUMMARY_METHOD_MAP.Sum:
171
+ case _constants.SUMMARY_METHOD_MAP.Sum:
155
172
  {
156
173
  return getSum(numericResults, precision);
157
174
  }
158
- case SUMMARY_METHOD_MAP.Mean:
175
+ case _constants.SUMMARY_METHOD_MAP.Mean:
159
176
  {
160
177
  return getMean(numericResults, precision);
161
178
  }
162
- case SUMMARY_METHOD_MAP.Distinct_values:
179
+ case _constants.SUMMARY_METHOD_MAP.Distinct_values:
163
180
  {
164
181
  let count = 0;
165
182
  let existMap = {};
@@ -185,6 +202,7 @@ export const getSummaryResult = function (results, summaryMethod) {
185
202
  }
186
203
  }
187
204
  };
205
+ exports.getSummaryResult = getSummaryResult;
188
206
  const getMax = list => {
189
207
  if (list.length === 0) return 0;
190
208
  return Number.parseFloat(Math.max.apply(null, list));
@@ -215,7 +233,7 @@ const getPieColor = (color_option, column, index, data, currentTheme) => {
215
233
  const {
216
234
  colors
217
235
  } = currentTheme;
218
- if (color_option === PIE_COLOR_OPTIONS[1] && (columnType === CellType.SINGLE_SELECT || columnType === CellType.MULTIPLE_SELECT)) {
236
+ if (color_option === _constants.PIE_COLOR_OPTIONS[1] && (columnType === _dtableStore.CellType.SINGLE_SELECT || columnType === _dtableStore.CellType.MULTIPLE_SELECT)) {
219
237
  if (columnData && columnData.options) {
220
238
  const selectedItem = columnData.options.find(item => item.name === data.name) || {};
221
239
  return selectedItem.color || '#dbdbdb';
@@ -226,7 +244,7 @@ const getPieColor = (color_option, column, index, data, currentTheme) => {
226
244
  return colors[colorIndex];
227
245
  }
228
246
  };
229
- export function formatPieChartData(data, statItem, table, currentTheme) {
247
+ function formatPieChartData(data, statItem, table, currentTheme) {
230
248
  const {
231
249
  groupby_column_key,
232
250
  color_option,
@@ -235,7 +253,7 @@ export function formatPieChartData(data, statItem, table, currentTheme) {
235
253
  summary_type
236
254
  } = statItem;
237
255
  const isAdvanced = summary_type === 'advanced';
238
- const column = TableUtils.getTableColumnByKey(table, groupby_column_key);
256
+ const column = _dtableStore.TableUtils.getTableColumnByKey(table, groupby_column_key);
239
257
  let sum = data.reduce((total, currentValue) => {
240
258
  return total += currentValue.value;
241
259
  }, 0);
@@ -266,8 +284,8 @@ export function formatPieChartData(data, statItem, table, currentTheme) {
266
284
  }, 0);
267
285
  let formattedValueSum = filteredSum;
268
286
  if (isAdvanced) {
269
- const summaryColumn = TableUtils.getTableColumnByKey(table, summary_column_key);
270
- formattedValueSum = StatUtils.getFormattedValue(filteredSum, summaryColumn, summaryMethod);
287
+ const summaryColumn = _dtableStore.TableUtils.getTableColumnByKey(table, summary_column_key);
288
+ formattedValueSum = _statUtils.default.getFormattedValue(filteredSum, summaryColumn, summaryMethod);
271
289
  }
272
290
  let original_name_list = [];
273
291
  let name_list = [];
@@ -287,7 +305,7 @@ export function formatPieChartData(data, statItem, table, currentTheme) {
287
305
  rows,
288
306
  name_list,
289
307
  original_name_list,
290
- name: intl.get('Others'),
308
+ name: _reactIntlUniversal.default.get('Others'),
291
309
  value: filteredSum,
292
310
  formatted_value: formattedValueSum,
293
311
  color: '#dbdbdb',
@@ -300,7 +318,7 @@ export function formatPieChartData(data, statItem, table, currentTheme) {
300
318
  data.colorSet = colorSet;
301
319
  return data;
302
320
  }
303
- export const formatNumericValue = function (value) {
321
+ const formatNumericValue = function (value) {
304
322
  let column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
305
323
  const data = column.data || {};
306
324
  let {
@@ -309,30 +327,34 @@ export const formatNumericValue = function (value) {
309
327
  value = value || 0;
310
328
  return parseFloat(value.toFixed(precision));
311
329
  };
312
- export const getLabelFontSize = label_font_size => {
313
- return isNumber(label_font_size) ? label_font_size : DEFAULT_LABEL_FONT_SIZE;
330
+ exports.formatNumericValue = formatNumericValue;
331
+ const getLabelFontSize = label_font_size => {
332
+ return (0, _dtableStore.isNumber)(label_font_size) ? label_font_size : _constants.DEFAULT_LABEL_FONT_SIZE;
314
333
  };
315
- export const getSummaryColumnMethod = function (method, summaryColumnName) {
334
+ exports.getLabelFontSize = getLabelFontSize;
335
+ const getSummaryColumnMethod = function (method, summaryColumnName) {
316
336
  let useSingleQuote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
317
337
  if (method === 'Distinct_values') {
318
338
  return "COUNT(DISTINCT ".concat(summaryColumnName, ")");
319
339
  }
320
340
  return "".concat(method, "(").concat(useSingleQuote ? '`' : '').concat(summaryColumnName).concat(useSingleQuote ? '`' : '', ")");
321
341
  };
322
- export const getCurrentTheme = colorThemeName => {
342
+ exports.getSummaryColumnMethod = getSummaryColumnMethod;
343
+ const getCurrentTheme = colorThemeName => {
323
344
  if (colorThemeName) {
324
- const currentColorTheme = CHART_STYLE_COLORS.find(item => item.name === colorThemeName);
325
- return currentColorTheme || CHART_STYLE_COLORS[0];
345
+ const currentColorTheme = _constants.CHART_STYLE_COLORS.find(item => item.name === colorThemeName);
346
+ return currentColorTheme || _constants.CHART_STYLE_COLORS[0];
326
347
  }
327
- return CHART_STYLE_COLORS[0];
348
+ return _constants.CHART_STYLE_COLORS[0];
328
349
  };
329
350
 
330
351
  // for stacked bar, stacked horizontal bar
331
- export const sortDataByGroupSum = (data, sortType) => {
352
+ exports.getCurrentTheme = getCurrentTheme;
353
+ const sortDataByGroupSum = (data, sortType) => {
332
354
  const nameSumMap = [];
333
355
  data.forEach(item => {
334
- if (nameSumMap.filter(filteredItem => filteredItem.name == item.name).length == 0) {
335
- const items = data.filter(originItem => originItem.name == item.name);
356
+ if (nameSumMap.filter(filteredItem => filteredItem.name === item.name).length === 0) {
357
+ const items = data.filter(originItem => originItem.name === item.name);
336
358
  const valueSum = items.reduce((accumulator, currentItem) => accumulator + currentItem.value, 0);
337
359
  nameSumMap.push({
338
360
  name: item.name,
@@ -343,9 +365,11 @@ export const sortDataByGroupSum = (data, sortType) => {
343
365
  });
344
366
 
345
367
  // sort group
346
- StatUtils.sortDataByKey(nameSumMap, 'valueSum', sortType);
368
+ _statUtils.default.sortDataByKey(nameSumMap, 'valueSum', sortType);
347
369
  return nameSumMap.reduce((accumulator, currentItem) => accumulator.concat(currentItem.items), []);
348
370
  };
349
- export const isBoolean = val => {
371
+ exports.sortDataByGroupSum = sortDataByGroupSum;
372
+ const isBoolean = val => {
350
373
  return typeof val === 'boolean';
351
- };
374
+ };
375
+ exports.isBoolean = isBoolean;
@@ -1,3 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTodayDate = getTodayDate;
7
+ exports.translateCalendar = translateCalendar;
1
8
  const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
2
9
  const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
3
10
  const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
@@ -61,5 +68,4 @@ function getTodayDate() {
61
68
  hour = hour > 9 ? hour : "0".concat(hour);
62
69
  minute = minute > 9 ? minute : "0".concat(minute);
63
70
  return "".concat(year, "-").concat(month, "-").concat(date, " ").concat(hour, ":").concat(minute);
64
- }
65
- export { translateCalendar, getTodayDate };
71
+ }