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,11 +1,18 @@
1
- import dayjs from 'dayjs';
2
- import intl from 'react-intl-universal';
3
- import { getOption, getCollaborator, getNumberDisplayString, isNumber, CellType, FORMULA_RESULT_TYPE, FORMULA_COLUMN_TYPES, isDateColumn, TableUtils } from 'dtable-store';
4
- import { isCellValueChanged } from './cell-value';
5
- import { getSelectColumnOptions, getDateColumnFormat } from './column';
6
- import { getKnownCreatorByEmail } from './collaborator';
7
- import { EMPTY_NAME, STATISTICS_COUNT_TYPE } from '../constants';
8
- import { getPivotTableSummaryTotal } from './pivot-table';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.updateStatisticToTable = exports.exportStatisticToTable = void 0;
8
+ var _dayjs = _interopRequireDefault(require("dayjs"));
9
+ var _reactIntlUniversal = _interopRequireDefault(require("react-intl-universal"));
10
+ var _dtableStore = require("dtable-store");
11
+ var _cellValue = require("./cell-value");
12
+ var _column = require("./column");
13
+ var _collaborator = require("./collaborator");
14
+ var _constants = require("../constants");
15
+ var _pivotTable = require("./pivot-table");
9
16
  const isEmptyName = title => {
10
17
  return title === null || title === '';
11
18
  };
@@ -14,7 +21,7 @@ const isSummaryDateColumn = summaryColumn => {
14
21
  const {
15
22
  type
16
23
  } = summaryColumn;
17
- return type !== CellType.LINK && isDateColumn(summaryColumn);
24
+ return type !== _dtableStore.CellType.LINK && (0, _dtableStore.isDateColumn)(summaryColumn);
18
25
  };
19
26
 
20
27
  // eslint-disable-next-line
@@ -27,53 +34,53 @@ const getTableValueDisplayName = (value, column) => {
27
34
  collaborators
28
35
  } = window.app.state;
29
36
  switch (type) {
30
- case CellType.SINGLE_SELECT:
31
- case CellType.MULTIPLE_SELECT:
37
+ case _dtableStore.CellType.SINGLE_SELECT:
38
+ case _dtableStore.CellType.MULTIPLE_SELECT:
32
39
  {
33
- let options = getSelectColumnOptions(column);
34
- let option = getOption(options, value) || {};
40
+ let options = (0, _column.getSelectColumnOptions)(column);
41
+ let option = (0, _dtableStore.getOption)(options, value) || {};
35
42
  return option.name;
36
43
  }
37
- case CellType.COLLABORATOR:
44
+ case _dtableStore.CellType.COLLABORATOR:
38
45
  {
39
- let collaborator = getCollaborator(collaborators, value) || {};
46
+ let collaborator = (0, _dtableStore.getCollaborator)(collaborators, value) || {};
40
47
  return collaborator.name;
41
48
  }
42
- case CellType.CREATOR:
43
- case CellType.LAST_MODIFIER:
49
+ case _dtableStore.CellType.CREATOR:
50
+ case _dtableStore.CellType.LAST_MODIFIER:
44
51
  {
45
- let collaborator = getKnownCreatorByEmail(collaborators, value) || {};
52
+ let collaborator = (0, _collaborator.getKnownCreatorByEmail)(collaborators, value) || {};
46
53
  return collaborator.name;
47
54
  }
48
- case CellType.NUMBER:
55
+ case _dtableStore.CellType.NUMBER:
49
56
  {
50
57
  let valueNumber = parseFloat(value);
51
- let displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
58
+ let displayValue = (0, _dtableStore.isNumber)(valueNumber) ? (0, _dtableStore.getNumberDisplayString)(valueNumber, data) : value;
52
59
  return displayValue;
53
60
  }
54
- case CellType.DATE:
61
+ case _dtableStore.CellType.DATE:
55
62
  {
56
63
  let displayValue = value;
57
64
  if (value && value.split('-').length === 3) {
58
- let format = getDateColumnFormat(column);
65
+ let format = (0, _column.getDateColumnFormat)(column);
59
66
  let spaceIndex = format.indexOf(' ');
60
67
  if (spaceIndex > -1) {
61
68
  format = format.slice(0, spaceIndex);
62
69
  }
63
- displayValue = dayjs(value).format(format);
70
+ displayValue = (0, _dayjs.default)(value).format(format);
64
71
  }
65
72
  return displayValue;
66
73
  }
67
- case CellType.FORMULA:
68
- case CellType.LINK_FORMULA:
74
+ case _dtableStore.CellType.FORMULA:
75
+ case _dtableStore.CellType.LINK_FORMULA:
69
76
  {
70
77
  let displayValue = value;
71
78
  let {
72
79
  result_type
73
80
  } = data || {};
74
- if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
81
+ if (result_type === _dtableStore.FORMULA_RESULT_TYPE.NUMBER) {
75
82
  let valueNumber = parseFloat(value);
76
- displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
83
+ displayValue = (0, _dtableStore.isNumber)(valueNumber) ? (0, _dtableStore.getNumberDisplayString)(valueNumber, data) : value;
77
84
  }
78
85
  return displayValue;
79
86
  }
@@ -89,19 +96,19 @@ const getValidValueForColumn = (column, value) => {
89
96
  type,
90
97
  data
91
98
  } = column;
92
- if (FORMULA_COLUMN_TYPES.includes(type)) return '';
93
- if (type === CellType.NUMBER) {
99
+ if (_dtableStore.FORMULA_COLUMN_TYPES.includes(type)) return '';
100
+ if (type === _dtableStore.CellType.NUMBER) {
94
101
  if (!value && value !== 0) return '';
95
102
  if (typeof value === 'number') return value;
96
103
  return '';
97
104
  }
98
- if (type === CellType.DATE) {
105
+ if (type === _dtableStore.CellType.DATE) {
99
106
  if (!value) return '';
100
107
  if (typeof value !== 'string') return '';
101
108
  const validValueFormat = data && data.format && data.format.indexOf('HH:mm') > -1 ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD';
102
- return dayjs(value).format(validValueFormat);
109
+ return (0, _dayjs.default)(value).format(validValueFormat);
103
110
  }
104
- if (type === CellType.TEXT) return value ? value : '';
111
+ if (type === _dtableStore.CellType.TEXT) return value ? value : '';
105
112
  return '';
106
113
  };
107
114
  const exportOneDimensionToTable = _ref => {
@@ -125,7 +132,7 @@ const exportOneDimensionToTable = _ref => {
125
132
  let columns = [{
126
133
  // first column
127
134
  key: '0000',
128
- type: CellType.TEXT,
135
+ type: _dtableStore.CellType.TEXT,
129
136
  name: groupbyColumn.name,
130
137
  data: null
131
138
  }];
@@ -172,8 +179,8 @@ const exportOneDimensionToTable = _ref => {
172
179
 
173
180
  // total column
174
181
  const totalColumn = {
175
- type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
176
- name: intl.get('Total'),
182
+ type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
183
+ name: _reactIntlUniversal.default.get('Total'),
177
184
  data: columnData
178
185
  };
179
186
  columns.push(totalColumn);
@@ -185,14 +192,14 @@ const exportOneDimensionToTable = _ref => {
185
192
  original_name,
186
193
  total
187
194
  } = item;
188
- const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
195
+ const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
189
196
  let cellValue = total.total;
190
197
  if (_isDateSummaryColumn && cellValue) {
191
- cellValue = isIncludeHour ? dayjs(cellValue).format('YYYY-MM-DD HH:mm') : dayjs(cellValue).format('YYYY-MM-DD');
198
+ cellValue = isIncludeHour ? (0, _dayjs.default)(cellValue).format('YYYY-MM-DD HH:mm') : (0, _dayjs.default)(cellValue).format('YYYY-MM-DD');
192
199
  }
193
200
  const newRow = {
194
201
  [groupbyColumn.name]: groupName,
195
- [intl.get('Total')]: cellValue
202
+ [_reactIntlUniversal.default.get('Total')]: cellValue
196
203
  };
197
204
  rows.push(newRow);
198
205
  });
@@ -211,9 +218,9 @@ const exportOneDimensionToTable = _ref => {
211
218
  if (column) {
212
219
  const columnName = column.name;
213
220
  let columnData;
214
- let columnType = CellType.NUMBER;
221
+ let columnType = _dtableStore.CellType.NUMBER;
215
222
  if (isSummaryDateColumn(column)) {
216
- columnType = CellType.DATE;
223
+ columnType = _dtableStore.CellType.DATE;
217
224
  const {
218
225
  format
219
226
  } = column.data || {};
@@ -258,7 +265,7 @@ const exportOneDimensionToTable = _ref => {
258
265
  original_name,
259
266
  total
260
267
  } = item;
261
- const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
268
+ const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
262
269
  let newRow = {
263
270
  [groupbyColumn.name]: groupName
264
271
  };
@@ -275,9 +282,9 @@ const exportOneDimensionToTable = _ref => {
275
282
  data
276
283
  } = column;
277
284
  let cellValue = total[cellValueKey];
278
- if (type === CellType.DATE && cellValue) {
285
+ if (type === _dtableStore.CellType.DATE && cellValue) {
279
286
  const dateFormat = data && data.format && data.format.indexOf('HH:mm') > -1 ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD';
280
- cellValue = dayjs(cellValue).format(dateFormat);
287
+ cellValue = (0, _dayjs.default)(cellValue).format(dateFormat);
281
288
  }
282
289
  newRow[name] = cellValue;
283
290
  });
@@ -308,7 +315,7 @@ const exportTwoDimensionToTable = _ref2 => {
308
315
  let columns = [{
309
316
  // first column
310
317
  key: '0000',
311
- type: CellType.TEXT,
318
+ type: _dtableStore.CellType.TEXT,
312
319
  name: groupbyColumn.name,
313
320
  data: null
314
321
  }];
@@ -354,9 +361,9 @@ const exportTwoDimensionToTable = _ref2 => {
354
361
  key,
355
362
  original_key
356
363
  } = item;
357
- const columnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : key;
364
+ const columnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
358
365
  const newColumn = {
359
- type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
366
+ type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
360
367
  name: columnName,
361
368
  data: columnData
362
369
  };
@@ -366,8 +373,8 @@ const exportTwoDimensionToTable = _ref2 => {
366
373
 
367
374
  // total column
368
375
  const totalColumn = {
369
- type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
370
- name: intl.get('Total'),
376
+ type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
377
+ name: _reactIntlUniversal.default.get('Total'),
371
378
  data: columnData
372
379
  };
373
380
  columns.push(totalColumn);
@@ -382,20 +389,20 @@ const exportTwoDimensionToTable = _ref2 => {
382
389
  total
383
390
  } = item;
384
391
  if (isEmptyName(original_name)) {
385
- name = intl.get(EMPTY_NAME);
392
+ name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
386
393
  }
387
394
  let newRow = {
388
395
  [groupbyColumn.name]: name
389
396
  };
390
397
  let cellValue = total;
391
398
  if (_isDateSummaryColumn && cellValue) {
392
- cellValue = dayjs(cellValue).format(dateFormat);
399
+ cellValue = (0, _dayjs.default)(cellValue).format(dateFormat);
393
400
  }
394
- newRow[intl.get('Total')] = cellValue;
401
+ newRow[_reactIntlUniversal.default.get('Total')] = cellValue;
395
402
  Object.keys(cells).forEach(key => {
396
403
  let cellValue = cells[key].total;
397
404
  if (_isDateSummaryColumn) {
398
- cellValue = cellValue ? dayjs(cellValue).format(dateFormat) : '';
405
+ cellValue = cellValue ? (0, _dayjs.default)(cellValue).format(dateFormat) : '';
399
406
  }
400
407
  newRow[columnMap[key]] = cellValue;
401
408
  });
@@ -428,7 +435,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
428
435
  let columns = [{
429
436
  // name column
430
437
  key: '0000',
431
- type: CellType.TEXT,
438
+ type: _dtableStore.CellType.TEXT,
432
439
  name: groupbyColumnName,
433
440
  data: null
434
441
  }];
@@ -438,7 +445,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
438
445
  key: pivotColumnKey,
439
446
  original_key
440
447
  } = pivotColumn;
441
- const pivotColumnColumnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : pivotColumnKey;
448
+ const pivotColumnColumnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : pivotColumnKey;
442
449
  summaryColumns.forEach(summaryColumn => {
443
450
  const {
444
451
  key,
@@ -451,7 +458,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
451
458
  const newColumnName = "".concat(pivotColumnColumnName, "-").concat(column_name);
452
459
  columns.push({
453
460
  // just support number column
454
- type: CellType.NUMBER,
461
+ type: _dtableStore.CellType.NUMBER,
455
462
  name: newColumnName,
456
463
  data
457
464
  });
@@ -466,8 +473,8 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
466
473
  });
467
474
  });
468
475
  columns.push({
469
- type: CellType.NUMBER,
470
- name: intl.get('Total'),
476
+ type: _dtableStore.CellType.NUMBER,
477
+ name: _reactIntlUniversal.default.get('Total'),
471
478
  data: firstSummaryColumn.data
472
479
  });
473
480
  let rows = [];
@@ -478,7 +485,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
478
485
  cells
479
486
  } = pivotRow;
480
487
  if (isEmptyName(original_name)) {
481
- name = intl.get(EMPTY_NAME);
488
+ name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
482
489
  }
483
490
  let newRow = {
484
491
  [groupbyColumnName]: name
@@ -498,12 +505,12 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
498
505
  if (!Array.isArray(cellRows) || cellRows.length === 0) {
499
506
  newRow[name] = 0;
500
507
  } else {
501
- const cellValue = getPivotTableSummaryTotal(type, key, sqlKey, STATISTICS_COUNT_TYPE.ADVANCED, method, cellRows, formulaRows, isSqlQuery);
508
+ const cellValue = (0, _pivotTable.getPivotTableSummaryTotal)(type, key, sqlKey, _constants.STATISTICS_COUNT_TYPE.ADVANCED, method, cellRows, formulaRows, isSqlQuery);
502
509
  newRow[name] = cellValue;
503
510
  total += cellValue;
504
511
  }
505
512
  });
506
- newRow[intl.get('Total')] = total;
513
+ newRow[_reactIntlUniversal.default.get('Total')] = total;
507
514
  rows.push(newRow);
508
515
  });
509
516
  return {
@@ -530,7 +537,7 @@ const updatedOneDimensionToTable = _ref5 => {
530
537
  statisticTableColumns
531
538
  } = statisticalResult;
532
539
  if (!groupbyColumn) return {};
533
- const nameColumn = TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
540
+ const nameColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
534
541
  if (!nameColumn) return {};
535
542
  const {
536
543
  pivot_rows,
@@ -547,7 +554,7 @@ const updatedOneDimensionToTable = _ref5 => {
547
554
 
548
555
  // one dimension table no summary columns
549
556
  if (pivot_columns.length < 2) {
550
- columnMap['total'] = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
557
+ columnMap['total'] = _dtableStore.TableUtils.getTableColumnByName(updateTable, _reactIntlUniversal.default.get('Total'));
551
558
 
552
559
  // updated rows
553
560
  pivot_rows.forEach(item => {
@@ -556,7 +563,7 @@ const updatedOneDimensionToTable = _ref5 => {
556
563
  original_name,
557
564
  total
558
565
  } = item;
559
- const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
566
+ const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
560
567
  const row = tableRows.find(row => row[nameColumn.key] === groupName);
561
568
  const totalColumn = columnMap['total'];
562
569
  if (row) {
@@ -564,7 +571,7 @@ const updatedOneDimensionToTable = _ref5 => {
564
571
  let updateRow = {};
565
572
  let oldRow = {};
566
573
  const validTotalCellValue = getValidValueForColumn(totalColumn, total.total);
567
- if (totalColumn && isCellValueChanged(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
574
+ if (totalColumn && (0, _cellValue.isCellValueChanged)(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
568
575
  updateRow[totalColumn.key] = validTotalCellValue;
569
576
  oldRow[totalColumn.key] = row[totalColumn.key];
570
577
  }
@@ -599,7 +606,7 @@ const updatedOneDimensionToTable = _ref5 => {
599
606
  } = item;
600
607
  const column = statisticTableColumns.find(column => column.key === key);
601
608
  if (column) {
602
- columnMap[key] = TableUtils.getTableColumnByName(updateTable, column.name);
609
+ columnMap[key] = _dtableStore.TableUtils.getTableColumnByName(updateTable, column.name);
603
610
  }
604
611
  });
605
612
 
@@ -613,7 +620,7 @@ const updatedOneDimensionToTable = _ref5 => {
613
620
  original_name,
614
621
  total
615
622
  } = item;
616
- const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
623
+ const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
617
624
  const row = tableRows.find(row => row[nameColumnKey] === groupName);
618
625
  if (row) {
619
626
  let updateRow = {};
@@ -626,7 +633,7 @@ const updatedOneDimensionToTable = _ref5 => {
626
633
  const column = columnMap[key];
627
634
  const cellValueKey = key + method;
628
635
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
629
- if (column && isCellValueChanged(row[column.key], totalCellValue, column.type)) {
636
+ if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
630
637
  updateRow[column.key] = totalCellValue;
631
638
  oldRow[column.key] = row[column.key];
632
639
  }
@@ -672,7 +679,7 @@ const updateTwoDimensionToTable = _ref6 => {
672
679
  pivotResult,
673
680
  groupbyColumn
674
681
  } = statisticalResult;
675
- const nameColumn = TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
682
+ const nameColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
676
683
  if (!nameColumn) return {};
677
684
  const {
678
685
  pivot_rows,
@@ -694,12 +701,12 @@ const updateTwoDimensionToTable = _ref6 => {
694
701
  key,
695
702
  original_key
696
703
  } = item;
697
- const columnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : key;
698
- const column = TableUtils.getTableColumnByName(updateTable, columnName);
704
+ const columnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
705
+ const column = _dtableStore.TableUtils.getTableColumnByName(updateTable, columnName);
699
706
  columnMap[columnName] = column;
700
707
  updateColumns.push(column);
701
708
  });
702
- const totalColumn = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
709
+ const totalColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, _reactIntlUniversal.default.get('Total'));
703
710
  columnMap['total'] = totalColumn;
704
711
  updateColumns.push(totalColumn);
705
712
 
@@ -713,7 +720,7 @@ const updateTwoDimensionToTable = _ref6 => {
713
720
  total
714
721
  } = pivotRow;
715
722
  if (isEmptyName(original_name)) {
716
- name = intl.get(EMPTY_NAME);
723
+ name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
717
724
  }
718
725
  const {
719
726
  key: nameColumnKey
@@ -726,7 +733,7 @@ const updateTwoDimensionToTable = _ref6 => {
726
733
  let updatedRow = {};
727
734
  let oldRow = {}; // op used
728
735
  const validTotalCellValue = getValidValueForColumn(totalColumn, total);
729
- if (totalColumn && isCellValueChanged(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
736
+ if (totalColumn && (0, _cellValue.isCellValueChanged)(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
730
737
  updatedRow[totalColumn.key] = validTotalCellValue;
731
738
  oldRow[totalColumn.key] = row[totalColumn.key];
732
739
  }
@@ -738,17 +745,17 @@ const updateTwoDimensionToTable = _ref6 => {
738
745
  type
739
746
  } = column;
740
747
  const newCellValue = key === totalColumn.key ? 0 : null;
741
- if (isCellValueChanged(row[key], newCellValue, type)) {
748
+ if ((0, _cellValue.isCellValueChanged)(row[key], newCellValue, type)) {
742
749
  updatedRow[key] = newCellValue;
743
750
  oldRow[key] = row[key];
744
751
  }
745
752
  });
746
753
  } else {
747
754
  keys.forEach(key => {
748
- const columnName = isEmptyName(key) ? intl.get(EMPTY_NAME) : key;
755
+ const columnName = isEmptyName(key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
749
756
  const column = columnMap[columnName];
750
757
  let validCellValue = getValidValueForColumn(column, cells[key].total);
751
- if (column && isCellValueChanged(row[column.key], validCellValue, column.type)) {
758
+ if (column && (0, _cellValue.isCellValueChanged)(row[column.key], validCellValue, column.type)) {
752
759
  updatedRow[column.key] = validCellValue;
753
760
  oldRow[column.key] = row[column.key];
754
761
  }
@@ -767,7 +774,7 @@ const updateTwoDimensionToTable = _ref6 => {
767
774
  newRow[totalColumn.key] = getValidValueForColumn(totalColumn, name);
768
775
  }
769
776
  Object.keys(cells).forEach(key => {
770
- const columnName = isEmptyName(key) ? intl.get(EMPTY_NAME) : key;
777
+ const columnName = isEmptyName(key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
771
778
  const column = columnMap[columnName];
772
779
  if (column) {
773
780
  newRow[column.key] = getValidValueForColumn(column, cells[key].total);
@@ -793,7 +800,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
793
800
  const {
794
801
  groupbyColumn
795
802
  } = statisticalResult;
796
- const nameColumn = groupbyColumn && TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
803
+ const nameColumn = groupbyColumn && _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
797
804
  if (!nameColumn) return {};
798
805
  const {
799
806
  columns: exportingColumns,
@@ -838,7 +845,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
838
845
  } = tableColumn;
839
846
  const existCellValue = existRow[tableColumnKey];
840
847
  const exportingCellValue = exportingRow[tableColumnName];
841
- if (tableColumn && isCellValueChanged(existCellValue, exportingCellValue, tableColumnType)) {
848
+ if (tableColumn && (0, _cellValue.isCellValueChanged)(existCellValue, exportingCellValue, tableColumnType)) {
842
849
  exportingRowData[tableColumnKey] = exportingCellValue;
843
850
  existRowData[tableColumnKey] = existCellValue;
844
851
  }
@@ -893,7 +900,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
893
900
  * ]
894
901
  * }
895
902
  */
896
- export const exportStatisticToTable = _ref8 => {
903
+ const exportStatisticToTable = _ref8 => {
897
904
  let {
898
905
  statisticalResult
899
906
  } = _ref8;
@@ -924,7 +931,8 @@ export const exportStatisticToTable = _ref8 => {
924
931
  statisticalResult
925
932
  });
926
933
  };
927
- export const updateStatisticToTable = _ref9 => {
934
+ exports.exportStatisticToTable = exportStatisticToTable;
935
+ const updateStatisticToTable = _ref9 => {
928
936
  let {
929
937
  updateTable,
930
938
  statisticalResult
@@ -958,4 +966,5 @@ export const updateStatisticToTable = _ref9 => {
958
966
  updateTable,
959
967
  statisticalResult
960
968
  });
961
- };
969
+ };
970
+ exports.updateStatisticToTable = updateStatisticToTable;
package/es/utils/index.js CHANGED
@@ -1,13 +1,108 @@
1
- export const isFunction = functionToCheck => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "generateDefaultUser", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _collaborator.generateDefaultUser;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "getClientCellValueDisplayString", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _cellFormat.getClientCellValueDisplayString;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "getClientFormulaDisplayString", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _cellFormat.getClientFormulaDisplayString;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "getDateColumnFormat", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _column.getDateColumnFormat;
28
+ }
29
+ });
30
+ exports.getEventClassName = void 0;
31
+ Object.defineProperty(exports, "getKnownCreatorByEmail", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _collaborator.getKnownCreatorByEmail;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "getSelectColumnOptions", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _column.getSelectColumnOptions;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, "getTodayDate", {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _dateFormat.getTodayDate;
47
+ }
48
+ });
49
+ Object.defineProperty(exports, "hasOwnProperty", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return _object.hasOwnProperty;
53
+ }
54
+ });
55
+ exports.hexToRgb = void 0;
56
+ Object.defineProperty(exports, "isCellValueChanged", {
57
+ enumerable: true,
58
+ get: function () {
59
+ return _cellValue.isCellValueChanged;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, "isEmptyObject", {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _object.isEmptyObject;
66
+ }
67
+ });
68
+ exports.isMobile = exports.isFunction = void 0;
69
+ Object.defineProperty(exports, "isSameObject", {
70
+ enumerable: true,
71
+ get: function () {
72
+ return _object.isSameObject;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, "searchRows", {
76
+ enumerable: true,
77
+ get: function () {
78
+ return _search.searchRows;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, "translateCalendar", {
82
+ enumerable: true,
83
+ get: function () {
84
+ return _dateFormat.translateCalendar;
85
+ }
86
+ });
87
+ var _cellFormat = require("./cell-format");
88
+ var _object = require("./object");
89
+ var _cellValue = require("./cell-value");
90
+ var _collaborator = require("./collaborator");
91
+ var _column = require("./column");
92
+ var _dateFormat = require("./date-format");
93
+ var _search = require("./search");
94
+ const isFunction = functionToCheck => {
2
95
  const getType = {};
3
96
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
4
97
  };
5
- export const getEventClassName = e => {
98
+ exports.isFunction = isFunction;
99
+ const getEventClassName = e => {
6
100
  // svg mouseEvent event.target.className is an object
7
101
  if (!e || !e.target) return '';
8
102
  return e.target.getAttribute('class') || '';
9
103
  };
10
- export const hexToRgb = hex => {
104
+ exports.getEventClassName = getEventClassName;
105
+ const hexToRgb = hex => {
11
106
  hex = hex.replace('#', '');
12
107
  const bigint = parseInt(hex, 16);
13
108
  return {
@@ -16,11 +111,5 @@ export const hexToRgb = hex => {
16
111
  b: bigint & 255
17
112
  };
18
113
  };
19
- export const isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);
20
- export { getClientCellValueDisplayString, getClientFormulaDisplayString } from './cell-format';
21
- export { hasOwnProperty, isEmptyObject, isSameObject } from './object';
22
- export { isCellValueChanged } from './cell-value';
23
- export { getKnownCreatorByEmail, generateDefaultUser } from './collaborator';
24
- export { getDateColumnFormat, getSelectColumnOptions } from './column';
25
- export { translateCalendar, getTodayDate } from './date-format';
26
- export { searchRows } from './search';
114
+ exports.hexToRgb = hexToRgb;
115
+ const isMobile = exports.isMobile = typeof window !== 'undefined' && (window.innerWidth < 768 || navigator.userAgent.toLowerCase().match(/(ipod|ipad|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null);