dtable-statistic 4.3.3 → 4.3.4

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 +3 -10
  2. package/es/calculator/base-calculator.js +12 -20
  3. package/es/calculator/basic-chart-calculator.js +65 -72
  4. package/es/calculator/combination-calculator.js +57 -64
  5. package/es/calculator/compare-bar-calculator.js +26 -33
  6. package/es/calculator/completeness-calculator.js +30 -37
  7. package/es/calculator/copy-value.js +1 -7
  8. package/es/calculator/dashboard-calculator.js +13 -20
  9. package/es/calculator/heat-map-calculator.js +18 -25
  10. package/es/calculator/horizontal-bar-calculator.js +8 -15
  11. package/es/calculator/index.js +35 -42
  12. package/es/calculator/map-calculator.js +22 -29
  13. package/es/calculator/mirror-calculator.js +20 -27
  14. package/es/calculator/number-card-calculator.js +10 -17
  15. package/es/calculator/pivot-table-calculator.js +58 -65
  16. package/es/calculator/scatter-calculator.js +14 -21
  17. package/es/calculator/thread-manager.js +1 -7
  18. package/es/calculator/trend-calculator.js +22 -29
  19. package/es/calculator/workers/basic-chart-calculator-worker.js +76 -83
  20. package/es/calculator/workers/calculator.worker.js +30 -33
  21. package/es/calculator/workers/card-calculator-worker.js +13 -19
  22. package/es/calculator/workers/combination-calculator-worker.js +46 -53
  23. package/es/calculator/workers/compare-bar-chart-calculator-worker.js +22 -29
  24. package/es/calculator/workers/completeness-calculator-worker.js +34 -41
  25. package/es/calculator/workers/dashboard-calculator-worker.js +18 -24
  26. package/es/calculator/workers/mirror-calculator-worker.js +22 -29
  27. package/es/calculator/workers/pivot-table-calculator-worker.js +77 -84
  28. package/es/calculator/workers/scatter-calculator-worker.js +20 -27
  29. package/es/calculator/workers/trend-calculator-worker.js +27 -34
  30. package/es/calculator/world-map-calculator.js +17 -24
  31. package/es/components/common-add-tool.js +5 -12
  32. package/es/components/dialog/chart-addition-edit-dialog.js +12 -20
  33. package/es/components/dialog/chart-addition-widgets/chart-selector.js +101 -108
  34. package/es/components/dialog/color-theme-dialog.js +15 -22
  35. package/es/components/dialog/delete-confirmation-dialog.js +11 -18
  36. package/es/components/dialog/enlarged-chart-dialog.js +20 -28
  37. package/es/components/dialog/new-table-dialog.js +16 -23
  38. package/es/components/dialog/new-view-dialog.js +14 -21
  39. package/es/components/dialog/rename-view-dialog.js +14 -22
  40. package/es/components/dialog/statistic-record-dialog/index.js +37 -45
  41. package/es/components/dialog/statistic-types-dialog/index.js +14 -22
  42. package/es/components/dialog/table-select-dialog.js +15 -23
  43. package/es/components/dropdown-menu/statistic-dropdown-menu.js +41 -49
  44. package/es/components/dtable-popover.js +12 -19
  45. package/es/components/dtable-search-input.js +13 -21
  46. package/es/components/dtable-select.js +15 -21
  47. package/es/components/icon.js +4 -11
  48. package/es/components/index.js +11 -76
  49. package/es/components/loading.js +3 -10
  50. package/es/components/modal-portal.js +5 -12
  51. package/es/components/popover/color-rules/color-rule.js +25 -33
  52. package/es/components/popover/color-rules/index.js +6 -14
  53. package/es/components/popover/color-rules/rule-filters/filter.js +27 -34
  54. package/es/components/popover/color-rules/rule-filters/index.js +17 -25
  55. package/es/components/popover/color-rules/rule-filters/number-input.js +9 -17
  56. package/es/components/popover/color-rules-popover.js +24 -32
  57. package/es/components/popover/color-selector-popover.js +10 -17
  58. package/es/components/seatable-radio/index.js +9 -16
  59. package/es/components/select/index.js +2 -9
  60. package/es/components/select/option-group.js +19 -27
  61. package/es/components/select/option.js +6 -14
  62. package/es/components/select/select.js +17 -25
  63. package/es/components/toast/alert.js +24 -31
  64. package/es/components/toast/index.js +3 -10
  65. package/es/components/toast/toast.js +12 -20
  66. package/es/components/toast/toastManager.js +9 -17
  67. package/es/components/toast/toaster.js +6 -14
  68. package/es/constants/color-rules.js +6 -12
  69. package/es/constants/dtable-select-style.js +4 -9
  70. package/es/constants/event-types.js +4 -10
  71. package/es/constants/index.js +67 -96
  72. package/es/constants/key-codes.js +0 -2
  73. package/es/constants/map.js +2 -8
  74. package/es/constants/model.js +20 -26
  75. package/es/constants/regions.js +3 -8
  76. package/es/constants/zIndexes.js +1 -7
  77. package/es/custom-g2.js +208 -236
  78. package/es/dashboard.js +50 -58
  79. package/es/desktop-dashboard.js +47 -55
  80. package/es/index.js +3 -6
  81. package/es/locale/index.js +10 -13
  82. package/es/locale/lang/de.js +1 -7
  83. package/es/locale/lang/en.js +1 -7
  84. package/es/locale/lang/fr.js +1 -7
  85. package/es/locale/lang/zh_CN.js +1 -7
  86. package/es/mobile-dashboard.js +38 -46
  87. package/es/model/bar-group.js +11 -19
  88. package/es/model/bar.js +10 -18
  89. package/es/model/base-model.js +2 -9
  90. package/es/model/basic-number-card.js +8 -16
  91. package/es/model/collaborators.js +2 -9
  92. package/es/model/combination.js +12 -20
  93. package/es/model/compare-bar.js +16 -24
  94. package/es/model/completeness-group.js +8 -16
  95. package/es/model/completeness.js +5 -13
  96. package/es/model/custom-bar.js +6 -14
  97. package/es/model/dashboard.js +6 -14
  98. package/es/model/generic-model.js +133 -141
  99. package/es/model/heat-map.js +11 -19
  100. package/es/model/horizontal-bar-group.js +10 -18
  101. package/es/model/horizontal-bar.js +10 -18
  102. package/es/model/index.js +53 -185
  103. package/es/model/map.js +15 -23
  104. package/es/model/mirror.js +13 -21
  105. package/es/model/pie.js +10 -18
  106. package/es/model/ring.js +11 -19
  107. package/es/model/scatter.js +6 -14
  108. package/es/model/statistic-dashboard.js +2 -9
  109. package/es/model/table.js +10 -18
  110. package/es/model/trend.js +12 -20
  111. package/es/model/world-map.js +13 -21
  112. package/es/service/chart-service.js +7 -14
  113. package/es/service/dashboard-service.js +34 -41
  114. package/es/service/map-json.js +8 -14
  115. package/es/stat-editor/chart-name-editor.js +8 -15
  116. package/es/stat-editor/index.js +16 -24
  117. package/es/stat-editor/stat-settings/advance-chart-settings/basic-number-card-settings.js +21 -29
  118. package/es/stat-editor/stat-settings/advance-chart-settings/combination-settings.js +49 -57
  119. package/es/stat-editor/stat-settings/advance-chart-settings/dashboard-chart-settings.js +23 -31
  120. package/es/stat-editor/stat-settings/advance-chart-settings/geo-granularity-settings.js +4 -11
  121. package/es/stat-editor/stat-settings/advance-chart-settings/heat-map-settings.js +19 -27
  122. package/es/stat-editor/stat-settings/advance-chart-settings/index.js +43 -51
  123. package/es/stat-editor/stat-settings/advance-chart-settings/map-settings.js +23 -31
  124. package/es/stat-editor/stat-settings/advance-chart-settings/mirror-settings.js +23 -31
  125. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/combination-style-setting.js +37 -45
  126. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/heat-map-settings.js +19 -27
  127. package/es/stat-editor/stat-settings/advance-chart-settings/style-setting/map-setting.js +26 -34
  128. package/es/stat-editor/stat-settings/advance-chart-settings/summary-settings.js +47 -55
  129. package/es/stat-editor/stat-settings/advance-chart-settings/trend-chart-settings.js +22 -30
  130. package/es/stat-editor/stat-settings/advance-chart-settings/world-map-settings.js +18 -26
  131. package/es/stat-editor/stat-settings/basic-chart-settings/advance-bar-chart-settings.js +27 -35
  132. package/es/stat-editor/stat-settings/basic-chart-settings/bar-settings.js +24 -32
  133. package/es/stat-editor/stat-settings/basic-chart-settings/completeness-chart-settings.js +33 -41
  134. package/es/stat-editor/stat-settings/basic-chart-settings/custom-bar-settings.js +22 -30
  135. package/es/stat-editor/stat-settings/basic-chart-settings/groupby-settings.js +27 -26
  136. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-axis-group-settings.js +46 -54
  137. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-bar-settings.js +23 -31
  138. package/es/stat-editor/stat-settings/basic-chart-settings/horizontal-group-chart-settings.js +26 -34
  139. package/es/stat-editor/stat-settings/basic-chart-settings/index.js +77 -85
  140. package/es/stat-editor/stat-settings/basic-chart-settings/pie-settings.js +21 -29
  141. package/es/stat-editor/stat-settings/basic-chart-settings/pivot-table-settings.js +73 -81
  142. package/es/stat-editor/stat-settings/basic-chart-settings/scatter-settings.js +16 -24
  143. package/es/stat-editor/stat-settings/basic-chart-settings/stack-item-settings.js +19 -27
  144. package/es/stat-editor/stat-settings/basic-chart-settings/stacks-settings.js +18 -26
  145. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/bar-chart-style-setting.js +49 -57
  146. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/completeness-style.js +17 -25
  147. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/horizontal-bar-chart-style.js +47 -55
  148. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/label-font-size-editor.js +11 -19
  149. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/pie-chart-style-settings.js +45 -53
  150. package/es/stat-editor/stat-settings/basic-chart-settings/style-setting/time-compare-style.js +9 -17
  151. package/es/stat-editor/stat-settings/basic-chart-settings/summary-method-setting.js +20 -28
  152. package/es/stat-editor/stat-settings/basic-chart-settings/summary-settings.js +30 -38
  153. package/es/stat-editor/stat-settings/basic-chart-settings/time-comparison-settings.js +50 -58
  154. package/es/stat-editor/stat-settings/basic-chart-settings/timer-picker.js +17 -25
  155. package/es/stat-editor/stat-settings/basic-chart-settings/y-axis-group-settings.js +47 -55
  156. package/es/stat-editor/stat-settings/color-setting/color-group-selector.js +11 -19
  157. package/es/stat-editor/stat-settings/color-setting/color-picker.js +12 -19
  158. package/es/stat-editor/stat-settings/color-setting/color-use-type-selector.js +62 -70
  159. package/es/stat-editor/stat-settings/map/map-level.js +13 -20
  160. package/es/stat-editor/stat-settings/map/map-province-city.js +20 -27
  161. package/es/stat-editor/stat-settings/public-setting/axis-label-position-setting.js +11 -19
  162. package/es/stat-editor/stat-settings/public-setting/base-settings.js +20 -28
  163. package/es/stat-editor/stat-settings/public-setting/calender.js +22 -29
  164. package/es/stat-editor/stat-settings/public-setting/column-settings.js +6 -13
  165. package/es/stat-editor/stat-settings/public-setting/custom-title-setting.js +9 -16
  166. package/es/stat-editor/stat-settings/public-setting/data-sort-setting.js +13 -21
  167. package/es/stat-editor/stat-settings/public-setting/ind-toggle-setting.js +8 -15
  168. package/es/stat-editor/stat-settings/public-setting/min-max-setting.js +11 -19
  169. package/es/stat-editor/stat-settings/public-setting/numeric-summary-item.js +27 -35
  170. package/es/stat-editor/stat-settings/public-setting/toggle-setting.js +8 -15
  171. package/es/stat-editor/stat-settings/public-setting/type-settings/index.js +18 -26
  172. package/es/stat-list/chart-preview.js +20 -28
  173. package/es/stat-list/index.js +27 -35
  174. package/es/stat-view/area-chart.js +43 -50
  175. package/es/stat-view/bar-chart.js +47 -54
  176. package/es/stat-view/base-chart.js +24 -32
  177. package/es/stat-view/basic-number-card.js +19 -26
  178. package/es/stat-view/combination-chart.js +49 -56
  179. package/es/stat-view/compare-chart.js +39 -46
  180. package/es/stat-view/completeness-chart.js +28 -35
  181. package/es/stat-view/custom-bar.js +31 -38
  182. package/es/stat-view/dashboard-chart.js +15 -22
  183. package/es/stat-view/heat-map.js +43 -50
  184. package/es/stat-view/horizontal-bar-chart.js +51 -58
  185. package/es/stat-view/index.js +73 -80
  186. package/es/stat-view/line-chart.js +39 -46
  187. package/es/stat-view/map.js +33 -40
  188. package/es/stat-view/mirror.js +21 -28
  189. package/es/stat-view/pie-chart.js +29 -36
  190. package/es/stat-view/pivot-table/index.js +32 -39
  191. package/es/stat-view/pivot-table/one-dimension-table-no-numeric-columns.js +31 -39
  192. package/es/stat-view/pivot-table/one-dimension-table-with-numeric-columns.js +29 -37
  193. package/es/stat-view/pivot-table/pivot-table-display-name.js +46 -54
  194. package/es/stat-view/pivot-table/two-dimension-table.js +62 -70
  195. package/es/stat-view/ring-chart.js +38 -45
  196. package/es/stat-view/scatter-chart.js +30 -37
  197. package/es/stat-view/treemap-chart.js +37 -44
  198. package/es/stat-view/trend-chart.js +32 -39
  199. package/es/stat-view/world-map.js +33 -40
  200. package/es/tabs/index.js +32 -40
  201. package/es/tabs/tab.js +26 -34
  202. package/es/utils/basic-chart-utils.js +2 -9
  203. package/es/utils/cell-format.js +14 -22
  204. package/es/utils/cell-value.js +7 -14
  205. package/es/utils/collaborator.js +4 -13
  206. package/es/utils/color-utils.js +18 -29
  207. package/es/utils/column-utils.js +18 -29
  208. package/es/utils/column.js +4 -11
  209. package/es/utils/common-utils.js +41 -65
  210. package/es/utils/date-format.js +2 -8
  211. package/es/utils/export-table-utils.js +82 -91
  212. package/es/utils/index.js +11 -100
  213. package/es/utils/map.js +26 -36
  214. package/es/utils/model.js +6 -14
  215. package/es/utils/object.js +6 -15
  216. package/es/utils/pivot-table.js +16 -23
  217. package/es/utils/row-utils.js +23 -33
  218. package/es/utils/search.js +21 -29
  219. package/es/utils/sql-utils.js +65 -75
  220. package/es/utils/stat-utils.js +60 -66
  221. package/es/utils/trend-utils.js +32 -40
  222. package/package.json +1 -1
@@ -1,18 +1,11 @@
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");
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';
16
9
  const isEmptyName = title => {
17
10
  return title === null || title === '';
18
11
  };
@@ -21,7 +14,7 @@ const isSummaryDateColumn = summaryColumn => {
21
14
  const {
22
15
  type
23
16
  } = summaryColumn;
24
- return type !== _dtableStore.CellType.LINK && (0, _dtableStore.isDateColumn)(summaryColumn);
17
+ return type !== CellType.LINK && isDateColumn(summaryColumn);
25
18
  };
26
19
 
27
20
  // eslint-disable-next-line
@@ -34,53 +27,53 @@ const getTableValueDisplayName = (value, column) => {
34
27
  collaborators
35
28
  } = window.app.state;
36
29
  switch (type) {
37
- case _dtableStore.CellType.SINGLE_SELECT:
38
- case _dtableStore.CellType.MULTIPLE_SELECT:
30
+ case CellType.SINGLE_SELECT:
31
+ case CellType.MULTIPLE_SELECT:
39
32
  {
40
- let options = (0, _column.getSelectColumnOptions)(column);
41
- let option = (0, _dtableStore.getOption)(options, value) || {};
33
+ let options = getSelectColumnOptions(column);
34
+ let option = getOption(options, value) || {};
42
35
  return option.name;
43
36
  }
44
- case _dtableStore.CellType.COLLABORATOR:
37
+ case CellType.COLLABORATOR:
45
38
  {
46
- let collaborator = (0, _dtableStore.getCollaborator)(collaborators, value) || {};
39
+ let collaborator = getCollaborator(collaborators, value) || {};
47
40
  return collaborator.name;
48
41
  }
49
- case _dtableStore.CellType.CREATOR:
50
- case _dtableStore.CellType.LAST_MODIFIER:
42
+ case CellType.CREATOR:
43
+ case CellType.LAST_MODIFIER:
51
44
  {
52
- let collaborator = (0, _collaborator.getKnownCreatorByEmail)(collaborators, value) || {};
45
+ let collaborator = getKnownCreatorByEmail(collaborators, value) || {};
53
46
  return collaborator.name;
54
47
  }
55
- case _dtableStore.CellType.NUMBER:
48
+ case CellType.NUMBER:
56
49
  {
57
50
  let valueNumber = parseFloat(value);
58
- let displayValue = (0, _dtableStore.isNumber)(valueNumber) ? (0, _dtableStore.getNumberDisplayString)(valueNumber, data) : value;
51
+ let displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
59
52
  return displayValue;
60
53
  }
61
- case _dtableStore.CellType.DATE:
54
+ case CellType.DATE:
62
55
  {
63
56
  let displayValue = value;
64
57
  if (value && value.split('-').length === 3) {
65
- let format = (0, _column.getDateColumnFormat)(column);
58
+ let format = getDateColumnFormat(column);
66
59
  let spaceIndex = format.indexOf(' ');
67
60
  if (spaceIndex > -1) {
68
61
  format = format.slice(0, spaceIndex);
69
62
  }
70
- displayValue = (0, _dayjs.default)(value).format(format);
63
+ displayValue = dayjs(value).format(format);
71
64
  }
72
65
  return displayValue;
73
66
  }
74
- case _dtableStore.CellType.FORMULA:
75
- case _dtableStore.CellType.LINK_FORMULA:
67
+ case CellType.FORMULA:
68
+ case CellType.LINK_FORMULA:
76
69
  {
77
70
  let displayValue = value;
78
71
  let {
79
72
  result_type
80
73
  } = data || {};
81
- if (result_type === _dtableStore.FORMULA_RESULT_TYPE.NUMBER) {
74
+ if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
82
75
  let valueNumber = parseFloat(value);
83
- displayValue = (0, _dtableStore.isNumber)(valueNumber) ? (0, _dtableStore.getNumberDisplayString)(valueNumber, data) : value;
76
+ displayValue = isNumber(valueNumber) ? getNumberDisplayString(valueNumber, data) : value;
84
77
  }
85
78
  return displayValue;
86
79
  }
@@ -96,19 +89,19 @@ const getValidValueForColumn = (column, value) => {
96
89
  type,
97
90
  data
98
91
  } = column;
99
- if (_dtableStore.FORMULA_COLUMN_TYPES.includes(type)) return '';
100
- if (type === _dtableStore.CellType.NUMBER) {
92
+ if (FORMULA_COLUMN_TYPES.includes(type)) return '';
93
+ if (type === CellType.NUMBER) {
101
94
  if (!value && value !== 0) return '';
102
95
  if (typeof value === 'number') return value;
103
96
  return '';
104
97
  }
105
- if (type === _dtableStore.CellType.DATE) {
98
+ if (type === CellType.DATE) {
106
99
  if (!value) return '';
107
100
  if (typeof value !== 'string') return '';
108
101
  const validValueFormat = data && data.format && data.format.indexOf('HH:mm') > -1 ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD';
109
- return (0, _dayjs.default)(value).format(validValueFormat);
102
+ return dayjs(value).format(validValueFormat);
110
103
  }
111
- if (type === _dtableStore.CellType.TEXT) return value ? value : '';
104
+ if (type === CellType.TEXT) return value ? value : '';
112
105
  return '';
113
106
  };
114
107
  const exportOneDimensionToTable = _ref => {
@@ -132,7 +125,7 @@ const exportOneDimensionToTable = _ref => {
132
125
  let columns = [{
133
126
  // first column
134
127
  key: '0000',
135
- type: _dtableStore.CellType.TEXT,
128
+ type: CellType.TEXT,
136
129
  name: groupbyColumn.name,
137
130
  data: null
138
131
  }];
@@ -179,8 +172,8 @@ const exportOneDimensionToTable = _ref => {
179
172
 
180
173
  // total column
181
174
  const totalColumn = {
182
- type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
183
- name: _reactIntlUniversal.default.get('Total'),
175
+ type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
176
+ name: intl.get('Total'),
184
177
  data: columnData
185
178
  };
186
179
  columns.push(totalColumn);
@@ -192,14 +185,14 @@ const exportOneDimensionToTable = _ref => {
192
185
  original_name,
193
186
  total
194
187
  } = item;
195
- const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
188
+ const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
196
189
  let cellValue = total.total;
197
190
  if (_isDateSummaryColumn && cellValue) {
198
- cellValue = isIncludeHour ? (0, _dayjs.default)(cellValue).format('YYYY-MM-DD HH:mm') : (0, _dayjs.default)(cellValue).format('YYYY-MM-DD');
191
+ cellValue = isIncludeHour ? dayjs(cellValue).format('YYYY-MM-DD HH:mm') : dayjs(cellValue).format('YYYY-MM-DD');
199
192
  }
200
193
  const newRow = {
201
194
  [groupbyColumn.name]: groupName,
202
- [_reactIntlUniversal.default.get('Total')]: cellValue
195
+ [intl.get('Total')]: cellValue
203
196
  };
204
197
  rows.push(newRow);
205
198
  });
@@ -218,9 +211,9 @@ const exportOneDimensionToTable = _ref => {
218
211
  if (column) {
219
212
  const columnName = column.name;
220
213
  let columnData;
221
- let columnType = _dtableStore.CellType.NUMBER;
214
+ let columnType = CellType.NUMBER;
222
215
  if (isSummaryDateColumn(column)) {
223
- columnType = _dtableStore.CellType.DATE;
216
+ columnType = CellType.DATE;
224
217
  const {
225
218
  format
226
219
  } = column.data || {};
@@ -265,7 +258,7 @@ const exportOneDimensionToTable = _ref => {
265
258
  original_name,
266
259
  total
267
260
  } = item;
268
- const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
261
+ const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
269
262
  let newRow = {
270
263
  [groupbyColumn.name]: groupName
271
264
  };
@@ -282,9 +275,9 @@ const exportOneDimensionToTable = _ref => {
282
275
  data
283
276
  } = column;
284
277
  let cellValue = total[cellValueKey];
285
- if (type === _dtableStore.CellType.DATE && cellValue) {
278
+ if (type === CellType.DATE && cellValue) {
286
279
  const dateFormat = data && data.format && data.format.indexOf('HH:mm') > -1 ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD';
287
- cellValue = (0, _dayjs.default)(cellValue).format(dateFormat);
280
+ cellValue = dayjs(cellValue).format(dateFormat);
288
281
  }
289
282
  newRow[name] = cellValue;
290
283
  });
@@ -315,7 +308,7 @@ const exportTwoDimensionToTable = _ref2 => {
315
308
  let columns = [{
316
309
  // first column
317
310
  key: '0000',
318
- type: _dtableStore.CellType.TEXT,
311
+ type: CellType.TEXT,
319
312
  name: groupbyColumn.name,
320
313
  data: null
321
314
  }];
@@ -361,9 +354,9 @@ const exportTwoDimensionToTable = _ref2 => {
361
354
  key,
362
355
  original_key
363
356
  } = item;
364
- const columnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
357
+ const columnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : key;
365
358
  const newColumn = {
366
- type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
359
+ type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
367
360
  name: columnName,
368
361
  data: columnData
369
362
  };
@@ -373,8 +366,8 @@ const exportTwoDimensionToTable = _ref2 => {
373
366
 
374
367
  // total column
375
368
  const totalColumn = {
376
- type: _isDateSummaryColumn ? _dtableStore.CellType.DATE : _dtableStore.CellType.NUMBER,
377
- name: _reactIntlUniversal.default.get('Total'),
369
+ type: _isDateSummaryColumn ? CellType.DATE : CellType.NUMBER,
370
+ name: intl.get('Total'),
378
371
  data: columnData
379
372
  };
380
373
  columns.push(totalColumn);
@@ -389,20 +382,20 @@ const exportTwoDimensionToTable = _ref2 => {
389
382
  total
390
383
  } = item;
391
384
  if (isEmptyName(original_name)) {
392
- name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
385
+ name = intl.get(EMPTY_NAME);
393
386
  }
394
387
  let newRow = {
395
388
  [groupbyColumn.name]: name
396
389
  };
397
390
  let cellValue = total;
398
391
  if (_isDateSummaryColumn && cellValue) {
399
- cellValue = (0, _dayjs.default)(cellValue).format(dateFormat);
392
+ cellValue = dayjs(cellValue).format(dateFormat);
400
393
  }
401
- newRow[_reactIntlUniversal.default.get('Total')] = cellValue;
394
+ newRow[intl.get('Total')] = cellValue;
402
395
  Object.keys(cells).forEach(key => {
403
396
  let cellValue = cells[key].total;
404
397
  if (_isDateSummaryColumn) {
405
- cellValue = cellValue ? (0, _dayjs.default)(cellValue).format(dateFormat) : '';
398
+ cellValue = cellValue ? dayjs(cellValue).format(dateFormat) : '';
406
399
  }
407
400
  newRow[columnMap[key]] = cellValue;
408
401
  });
@@ -435,7 +428,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
435
428
  let columns = [{
436
429
  // name column
437
430
  key: '0000',
438
- type: _dtableStore.CellType.TEXT,
431
+ type: CellType.TEXT,
439
432
  name: groupbyColumnName,
440
433
  data: null
441
434
  }];
@@ -445,7 +438,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
445
438
  key: pivotColumnKey,
446
439
  original_key
447
440
  } = pivotColumn;
448
- const pivotColumnColumnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : pivotColumnKey;
441
+ const pivotColumnColumnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : pivotColumnKey;
449
442
  summaryColumns.forEach(summaryColumn => {
450
443
  const {
451
444
  key,
@@ -458,7 +451,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
458
451
  const newColumnName = "".concat(pivotColumnColumnName, "-").concat(column_name);
459
452
  columns.push({
460
453
  // just support number column
461
- type: _dtableStore.CellType.NUMBER,
454
+ type: CellType.NUMBER,
462
455
  name: newColumnName,
463
456
  data
464
457
  });
@@ -473,8 +466,8 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
473
466
  });
474
467
  });
475
468
  columns.push({
476
- type: _dtableStore.CellType.NUMBER,
477
- name: _reactIntlUniversal.default.get('Total'),
469
+ type: CellType.NUMBER,
470
+ name: intl.get('Total'),
478
471
  data: firstSummaryColumn.data
479
472
  });
480
473
  let rows = [];
@@ -485,7 +478,7 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
485
478
  cells
486
479
  } = pivotRow;
487
480
  if (isEmptyName(original_name)) {
488
- name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
481
+ name = intl.get(EMPTY_NAME);
489
482
  }
490
483
  let newRow = {
491
484
  [groupbyColumnName]: name
@@ -505,12 +498,12 @@ const getTwoDimensionWithSummaryColumns = _ref3 => {
505
498
  if (!Array.isArray(cellRows) || cellRows.length === 0) {
506
499
  newRow[name] = 0;
507
500
  } else {
508
- const cellValue = (0, _pivotTable.getPivotTableSummaryTotal)(type, key, sqlKey, _constants.STATISTICS_COUNT_TYPE.ADVANCED, method, cellRows, formulaRows, isSqlQuery);
501
+ const cellValue = getPivotTableSummaryTotal(type, key, sqlKey, STATISTICS_COUNT_TYPE.ADVANCED, method, cellRows, formulaRows, isSqlQuery);
509
502
  newRow[name] = cellValue;
510
503
  total += cellValue;
511
504
  }
512
505
  });
513
- newRow[_reactIntlUniversal.default.get('Total')] = total;
506
+ newRow[intl.get('Total')] = total;
514
507
  rows.push(newRow);
515
508
  });
516
509
  return {
@@ -537,7 +530,7 @@ const updatedOneDimensionToTable = _ref5 => {
537
530
  statisticTableColumns
538
531
  } = statisticalResult;
539
532
  if (!groupbyColumn) return {};
540
- const nameColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
533
+ const nameColumn = TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
541
534
  if (!nameColumn) return {};
542
535
  const {
543
536
  pivot_rows,
@@ -554,7 +547,7 @@ const updatedOneDimensionToTable = _ref5 => {
554
547
 
555
548
  // one dimension table no summary columns
556
549
  if (pivot_columns.length < 2) {
557
- columnMap['total'] = _dtableStore.TableUtils.getTableColumnByName(updateTable, _reactIntlUniversal.default.get('Total'));
550
+ columnMap['total'] = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
558
551
 
559
552
  // updated rows
560
553
  pivot_rows.forEach(item => {
@@ -563,7 +556,7 @@ const updatedOneDimensionToTable = _ref5 => {
563
556
  original_name,
564
557
  total
565
558
  } = item;
566
- const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
559
+ const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
567
560
  const row = tableRows.find(row => row[nameColumn.key] === groupName);
568
561
  const totalColumn = columnMap['total'];
569
562
  if (row) {
@@ -571,7 +564,7 @@ const updatedOneDimensionToTable = _ref5 => {
571
564
  let updateRow = {};
572
565
  let oldRow = {};
573
566
  const validTotalCellValue = getValidValueForColumn(totalColumn, total.total);
574
- if (totalColumn && (0, _cellValue.isCellValueChanged)(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
567
+ if (totalColumn && isCellValueChanged(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
575
568
  updateRow[totalColumn.key] = validTotalCellValue;
576
569
  oldRow[totalColumn.key] = row[totalColumn.key];
577
570
  }
@@ -606,7 +599,7 @@ const updatedOneDimensionToTable = _ref5 => {
606
599
  } = item;
607
600
  const column = statisticTableColumns.find(column => column.key === key);
608
601
  if (column) {
609
- columnMap[key] = _dtableStore.TableUtils.getTableColumnByName(updateTable, column.name);
602
+ columnMap[key] = TableUtils.getTableColumnByName(updateTable, column.name);
610
603
  }
611
604
  });
612
605
 
@@ -620,7 +613,7 @@ const updatedOneDimensionToTable = _ref5 => {
620
613
  original_name,
621
614
  total
622
615
  } = item;
623
- const groupName = isEmptyName(original_name) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : name;
616
+ const groupName = isEmptyName(original_name) ? intl.get(EMPTY_NAME) : name;
624
617
  const row = tableRows.find(row => row[nameColumnKey] === groupName);
625
618
  if (row) {
626
619
  let updateRow = {};
@@ -633,7 +626,7 @@ const updatedOneDimensionToTable = _ref5 => {
633
626
  const column = columnMap[key];
634
627
  const cellValueKey = key + method;
635
628
  const totalCellValue = getValidValueForColumn(column, total[cellValueKey]);
636
- if (column && (0, _cellValue.isCellValueChanged)(row[column.key], totalCellValue, column.type)) {
629
+ if (column && isCellValueChanged(row[column.key], totalCellValue, column.type)) {
637
630
  updateRow[column.key] = totalCellValue;
638
631
  oldRow[column.key] = row[column.key];
639
632
  }
@@ -679,7 +672,7 @@ const updateTwoDimensionToTable = _ref6 => {
679
672
  pivotResult,
680
673
  groupbyColumn
681
674
  } = statisticalResult;
682
- const nameColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
675
+ const nameColumn = TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
683
676
  if (!nameColumn) return {};
684
677
  const {
685
678
  pivot_rows,
@@ -701,12 +694,12 @@ const updateTwoDimensionToTable = _ref6 => {
701
694
  key,
702
695
  original_key
703
696
  } = item;
704
- const columnName = isEmptyName(original_key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
705
- const column = _dtableStore.TableUtils.getTableColumnByName(updateTable, columnName);
697
+ const columnName = isEmptyName(original_key) ? intl.get(EMPTY_NAME) : key;
698
+ const column = TableUtils.getTableColumnByName(updateTable, columnName);
706
699
  columnMap[columnName] = column;
707
700
  updateColumns.push(column);
708
701
  });
709
- const totalColumn = _dtableStore.TableUtils.getTableColumnByName(updateTable, _reactIntlUniversal.default.get('Total'));
702
+ const totalColumn = TableUtils.getTableColumnByName(updateTable, intl.get('Total'));
710
703
  columnMap['total'] = totalColumn;
711
704
  updateColumns.push(totalColumn);
712
705
 
@@ -720,7 +713,7 @@ const updateTwoDimensionToTable = _ref6 => {
720
713
  total
721
714
  } = pivotRow;
722
715
  if (isEmptyName(original_name)) {
723
- name = _reactIntlUniversal.default.get(_constants.EMPTY_NAME);
716
+ name = intl.get(EMPTY_NAME);
724
717
  }
725
718
  const {
726
719
  key: nameColumnKey
@@ -733,7 +726,7 @@ const updateTwoDimensionToTable = _ref6 => {
733
726
  let updatedRow = {};
734
727
  let oldRow = {}; // op used
735
728
  const validTotalCellValue = getValidValueForColumn(totalColumn, total);
736
- if (totalColumn && (0, _cellValue.isCellValueChanged)(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
729
+ if (totalColumn && isCellValueChanged(row[totalColumn.key], validTotalCellValue, totalColumn.type)) {
737
730
  updatedRow[totalColumn.key] = validTotalCellValue;
738
731
  oldRow[totalColumn.key] = row[totalColumn.key];
739
732
  }
@@ -745,17 +738,17 @@ const updateTwoDimensionToTable = _ref6 => {
745
738
  type
746
739
  } = column;
747
740
  const newCellValue = key === totalColumn.key ? 0 : null;
748
- if ((0, _cellValue.isCellValueChanged)(row[key], newCellValue, type)) {
741
+ if (isCellValueChanged(row[key], newCellValue, type)) {
749
742
  updatedRow[key] = newCellValue;
750
743
  oldRow[key] = row[key];
751
744
  }
752
745
  });
753
746
  } else {
754
747
  keys.forEach(key => {
755
- const columnName = isEmptyName(key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
748
+ const columnName = isEmptyName(key) ? intl.get(EMPTY_NAME) : key;
756
749
  const column = columnMap[columnName];
757
750
  let validCellValue = getValidValueForColumn(column, cells[key].total);
758
- if (column && (0, _cellValue.isCellValueChanged)(row[column.key], validCellValue, column.type)) {
751
+ if (column && isCellValueChanged(row[column.key], validCellValue, column.type)) {
759
752
  updatedRow[column.key] = validCellValue;
760
753
  oldRow[column.key] = row[column.key];
761
754
  }
@@ -774,7 +767,7 @@ const updateTwoDimensionToTable = _ref6 => {
774
767
  newRow[totalColumn.key] = getValidValueForColumn(totalColumn, name);
775
768
  }
776
769
  Object.keys(cells).forEach(key => {
777
- const columnName = isEmptyName(key) ? _reactIntlUniversal.default.get(_constants.EMPTY_NAME) : key;
770
+ const columnName = isEmptyName(key) ? intl.get(EMPTY_NAME) : key;
778
771
  const column = columnMap[columnName];
779
772
  if (column) {
780
773
  newRow[column.key] = getValidValueForColumn(column, cells[key].total);
@@ -800,7 +793,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
800
793
  const {
801
794
  groupbyColumn
802
795
  } = statisticalResult;
803
- const nameColumn = groupbyColumn && _dtableStore.TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
796
+ const nameColumn = groupbyColumn && TableUtils.getTableColumnByName(updateTable, groupbyColumn.name);
804
797
  if (!nameColumn) return {};
805
798
  const {
806
799
  columns: exportingColumns,
@@ -845,7 +838,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
845
838
  } = tableColumn;
846
839
  const existCellValue = existRow[tableColumnKey];
847
840
  const exportingCellValue = exportingRow[tableColumnName];
848
- if (tableColumn && (0, _cellValue.isCellValueChanged)(existCellValue, exportingCellValue, tableColumnType)) {
841
+ if (tableColumn && isCellValueChanged(existCellValue, exportingCellValue, tableColumnType)) {
849
842
  exportingRowData[tableColumnKey] = exportingCellValue;
850
843
  existRowData[tableColumnKey] = existCellValue;
851
844
  }
@@ -900,7 +893,7 @@ const updateTwoDimensionWithSummaryColumnsToTable = _ref7 => {
900
893
  * ]
901
894
  * }
902
895
  */
903
- const exportStatisticToTable = _ref8 => {
896
+ export const exportStatisticToTable = _ref8 => {
904
897
  let {
905
898
  statisticalResult
906
899
  } = _ref8;
@@ -931,8 +924,7 @@ const exportStatisticToTable = _ref8 => {
931
924
  statisticalResult
932
925
  });
933
926
  };
934
- exports.exportStatisticToTable = exportStatisticToTable;
935
- const updateStatisticToTable = _ref9 => {
927
+ export const updateStatisticToTable = _ref9 => {
936
928
  let {
937
929
  updateTable,
938
930
  statisticalResult
@@ -966,5 +958,4 @@ const updateStatisticToTable = _ref9 => {
966
958
  updateTable,
967
959
  statisticalResult
968
960
  });
969
- };
970
- exports.updateStatisticToTable = updateStatisticToTable;
961
+ };
package/es/utils/index.js CHANGED
@@ -1,108 +1,13 @@
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 => {
1
+ export const isFunction = functionToCheck => {
95
2
  const getType = {};
96
3
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
97
4
  };
98
- exports.isFunction = isFunction;
99
- const getEventClassName = e => {
5
+ export const getEventClassName = e => {
100
6
  // svg mouseEvent event.target.className is an object
101
7
  if (!e || !e.target) return '';
102
8
  return e.target.getAttribute('class') || '';
103
9
  };
104
- exports.getEventClassName = getEventClassName;
105
- const hexToRgb = hex => {
10
+ export const hexToRgb = hex => {
106
11
  hex = hex.replace('#', '');
107
12
  const bigint = parseInt(hex, 16);
108
13
  return {
@@ -111,5 +16,11 @@ const hexToRgb = hex => {
111
16
  b: bigint & 255
112
17
  };
113
18
  };
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);
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';