sea-chart 0.0.1

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 (214) hide show
  1. package/README.md +4 -0
  2. package/lib/assets/icons/area-chart.svg +10 -0
  3. package/lib/assets/icons/bar-chart.svg +12 -0
  4. package/lib/assets/icons/card.svg +22 -0
  5. package/lib/assets/icons/combination-chart.svg +17 -0
  6. package/lib/assets/icons/dtable-logo.svg +16 -0
  7. package/lib/assets/icons/facet-chart.svg +12 -0
  8. package/lib/assets/icons/gauge.svg +18 -0
  9. package/lib/assets/icons/heat-map.svg +14 -0
  10. package/lib/assets/icons/histogram.svg +12 -0
  11. package/lib/assets/icons/line-chart.svg +12 -0
  12. package/lib/assets/icons/map.svg +20 -0
  13. package/lib/assets/icons/pie-chart.svg +11 -0
  14. package/lib/assets/icons/rectangular-tree-diagram.svg +10 -0
  15. package/lib/assets/icons/scatter-chart.svg +15 -0
  16. package/lib/assets/icons/type-change.svg +17 -0
  17. package/lib/assets/img/area-chart.png +0 -0
  18. package/lib/assets/img/area-group-chart.png +0 -0
  19. package/lib/assets/img/bar-group.png +0 -0
  20. package/lib/assets/img/bar-stack.png +0 -0
  21. package/lib/assets/img/bar.png +0 -0
  22. package/lib/assets/img/combination-chart.png +0 -0
  23. package/lib/assets/img/compared-chart.png +0 -0
  24. package/lib/assets/img/completeness-chart.png +0 -0
  25. package/lib/assets/img/custom-bar.png +0 -0
  26. package/lib/assets/img/dashboard-chart.png +0 -0
  27. package/lib/assets/img/group-completeness-chart.png +0 -0
  28. package/lib/assets/img/group_line.png +0 -0
  29. package/lib/assets/img/heat-map.png +0 -0
  30. package/lib/assets/img/horizontal-bar.png +0 -0
  31. package/lib/assets/img/horizontal-group-bar.png +0 -0
  32. package/lib/assets/img/line.png +0 -0
  33. package/lib/assets/img/map-bubble.png +0 -0
  34. package/lib/assets/img/map.png +0 -0
  35. package/lib/assets/img/mirror.png +0 -0
  36. package/lib/assets/img/number-card.png +0 -0
  37. package/lib/assets/img/pie.png +0 -0
  38. package/lib/assets/img/pivot-table.png +0 -0
  39. package/lib/assets/img/ring.png +0 -0
  40. package/lib/assets/img/scatter.png +0 -0
  41. package/lib/assets/img/stacked-horizontal-bar.png +0 -0
  42. package/lib/assets/img/treemap.png +0 -0
  43. package/lib/assets/img/trend-chart.png +0 -0
  44. package/lib/assets/img/world-map-bubble.png +0 -0
  45. package/lib/assets/img/world-map.png +0 -0
  46. package/lib/components/collaborator/index.js +24 -0
  47. package/lib/components/formatter/area.js +162 -0
  48. package/lib/components/formatter/bar-group.js +160 -0
  49. package/lib/components/formatter/bar.js +150 -0
  50. package/lib/components/formatter/basic-number-card.js +138 -0
  51. package/lib/components/formatter/chart-component.js +266 -0
  52. package/lib/components/formatter/combination.js +407 -0
  53. package/lib/components/formatter/dashboard.js +182 -0
  54. package/lib/components/formatter/horizontal-bar-group.js +161 -0
  55. package/lib/components/formatter/horizontal-bar.js +152 -0
  56. package/lib/components/formatter/horizontal-component.js +91 -0
  57. package/lib/components/formatter/index.js +181 -0
  58. package/lib/components/formatter/line-group.js +157 -0
  59. package/lib/components/formatter/line.js +170 -0
  60. package/lib/components/formatter/pie.js +201 -0
  61. package/lib/components/formatter/ring.js +277 -0
  62. package/lib/components/formatter/table/index.css +103 -0
  63. package/lib/components/formatter/table/index.js +42 -0
  64. package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +145 -0
  65. package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +193 -0
  66. package/lib/components/formatter/table/pivot-table-display-name.js +249 -0
  67. package/lib/components/formatter/table/two-dimension-table.js +241 -0
  68. package/lib/components/formatter/treemap.js +213 -0
  69. package/lib/components/icon/index.css +5 -0
  70. package/lib/components/icon/index.js +22 -0
  71. package/lib/components/index.js +5 -0
  72. package/lib/components/loading/index.css +54 -0
  73. package/lib/components/loading/index.js +10 -0
  74. package/lib/components/number-input/index.js +31 -0
  75. package/lib/components/pixel-editor/index.css +29 -0
  76. package/lib/components/pixel-editor/index.js +42 -0
  77. package/lib/components/select-group/index.css +67 -0
  78. package/lib/components/select-group/index.js +63 -0
  79. package/lib/components/settings/advance-bar-settings/data-settings.js +120 -0
  80. package/lib/components/settings/advance-bar-settings/index.js +3 -0
  81. package/lib/components/settings/advance-bar-settings/style-settings.js +149 -0
  82. package/lib/components/settings/bar-settings/data-settings.js +137 -0
  83. package/lib/components/settings/bar-settings/index.js +3 -0
  84. package/lib/components/settings/bar-settings/style-settings.js +163 -0
  85. package/lib/components/settings/basic-number-card/data-settings.js +121 -0
  86. package/lib/components/settings/basic-number-card/index.js +3 -0
  87. package/lib/components/settings/basic-number-card/style-settings.js +42 -0
  88. package/lib/components/settings/combination-settings/data-settings.js +256 -0
  89. package/lib/components/settings/combination-settings/index.js +3 -0
  90. package/lib/components/settings/combination-settings/style-settings.js +183 -0
  91. package/lib/components/settings/dashboard-settings/data-settings.js +167 -0
  92. package/lib/components/settings/dashboard-settings/index.js +2 -0
  93. package/lib/components/settings/data-settings.js +67 -0
  94. package/lib/components/settings/horizontal-bar-settings/data-settings.js +45 -0
  95. package/lib/components/settings/horizontal-bar-settings/index.js +3 -0
  96. package/lib/components/settings/horizontal-bar-settings/style-settings.js +38 -0
  97. package/lib/components/settings/index.css +73 -0
  98. package/lib/components/settings/index.js +74 -0
  99. package/lib/components/settings/pie-settings/data-settings.js +123 -0
  100. package/lib/components/settings/pie-settings/index.js +3 -0
  101. package/lib/components/settings/pie-settings/style-settings.js +123 -0
  102. package/lib/components/settings/style-settings.js +100 -0
  103. package/lib/components/settings/table-settings/data-settings.js +488 -0
  104. package/lib/components/settings/table-settings/index.js +2 -0
  105. package/lib/components/settings/time-comparison-settings/data-settings.js +157 -0
  106. package/lib/components/settings/time-comparison-settings/index.js +3 -0
  107. package/lib/components/settings/time-comparison-settings/style-settings.js +191 -0
  108. package/lib/components/settings/widgets/basic-summary/index.css +12 -0
  109. package/lib/components/settings/widgets/basic-summary/index.js +173 -0
  110. package/lib/components/settings/widgets/common-data-settings.js +42 -0
  111. package/lib/components/settings/widgets/data-filter/index.css +17 -0
  112. package/lib/components/settings/widgets/data-filter/index.js +76 -0
  113. package/lib/components/settings/widgets/data-sort.js +38 -0
  114. package/lib/components/settings/widgets/date-summary-item.js +126 -0
  115. package/lib/components/settings/widgets/display-values-settings/index.css +13 -0
  116. package/lib/components/settings/widgets/display-values-settings/index.js +37 -0
  117. package/lib/components/settings/widgets/divider/index.css +4 -0
  118. package/lib/components/settings/widgets/divider/index.js +10 -0
  119. package/lib/components/settings/widgets/font-settings/font-size-settings.js +31 -0
  120. package/lib/components/settings/widgets/font-settings/font-weight-settings.js +46 -0
  121. package/lib/components/settings/widgets/font-settings/index.js +3 -0
  122. package/lib/components/settings/widgets/group-by.js +168 -0
  123. package/lib/components/settings/widgets/label-color.js +30 -0
  124. package/lib/components/settings/widgets/min-max-setting.js +64 -0
  125. package/lib/components/settings/widgets/mininum-slice-percent.js +72 -0
  126. package/lib/components/settings/widgets/numeric-summary-item.js +109 -0
  127. package/lib/components/settings/widgets/select-table/index.css +0 -0
  128. package/lib/components/settings/widgets/select-table/index.js +49 -0
  129. package/lib/components/settings/widgets/stack.js +58 -0
  130. package/lib/components/settings/widgets/statistic-type/index.css +31 -0
  131. package/lib/components/settings/widgets/statistic-type/index.js +54 -0
  132. package/lib/components/settings/widgets/summary-method-setting.js +80 -0
  133. package/lib/components/settings/widgets/summary-settings.js +394 -0
  134. package/lib/components/settings/widgets/switch/index.css +37 -0
  135. package/lib/components/settings/widgets/switch/index.js +21 -0
  136. package/lib/components/settings/widgets/text-horizontal-settings.js +23 -0
  137. package/lib/components/settings/widgets/time-picker.js +182 -0
  138. package/lib/components/settings/widgets/title-settings/index.js +58 -0
  139. package/lib/components/settings/widgets/title-settings/title-text.js +31 -0
  140. package/lib/components/settings/widgets/x-axios.js +0 -0
  141. package/lib/components/settings/widgets/y-axis-group-settings.js +399 -0
  142. package/lib/components/types-dialog/index.css +97 -0
  143. package/lib/components/types-dialog/index.js +127 -0
  144. package/lib/constants/geolocation.js +11 -0
  145. package/lib/constants/index.js +164 -0
  146. package/lib/constants/model.js +167 -0
  147. package/lib/constants/style.js +13 -0
  148. package/lib/constants/type-image.js +32 -0
  149. package/lib/constants/type.js +97 -0
  150. package/lib/context.js +49 -0
  151. package/lib/index.js +6 -0
  152. package/lib/intl.js +37 -0
  153. package/lib/layout/index.js +4 -0
  154. package/lib/layout/statistic/index.css +53 -0
  155. package/lib/layout/statistic/index.js +190 -0
  156. package/lib/layout/title/index.css +3 -0
  157. package/lib/layout/title/index.js +41 -0
  158. package/lib/locale/index.js +11 -0
  159. package/lib/locale/lang/de.js +141 -0
  160. package/lib/locale/lang/en.js +143 -0
  161. package/lib/locale/lang/es.js +141 -0
  162. package/lib/locale/lang/fr.js +141 -0
  163. package/lib/locale/lang/pt.js +141 -0
  164. package/lib/locale/lang/ru.js +141 -0
  165. package/lib/locale/lang/zh_CN.js +143 -0
  166. package/lib/model/area-group.js +51 -0
  167. package/lib/model/area.js +42 -0
  168. package/lib/model/bar-group.js +54 -0
  169. package/lib/model/bar-stack.js +51 -0
  170. package/lib/model/bar.js +48 -0
  171. package/lib/model/base-model.js +11 -0
  172. package/lib/model/basic-number-card.js +32 -0
  173. package/lib/model/combination.js +48 -0
  174. package/lib/model/compare-bar.js +49 -0
  175. package/lib/model/completeness-group.js +34 -0
  176. package/lib/model/completeness.js +28 -0
  177. package/lib/model/dashboard.js +26 -0
  178. package/lib/model/generic-model.js +235 -0
  179. package/lib/model/heat-map.js +33 -0
  180. package/lib/model/horizontal-bar.js +48 -0
  181. package/lib/model/horizontal-group-bar.js +53 -0
  182. package/lib/model/index.js +36 -0
  183. package/lib/model/line-group.js +54 -0
  184. package/lib/model/line.js +48 -0
  185. package/lib/model/map-bubble.js +37 -0
  186. package/lib/model/map.js +37 -0
  187. package/lib/model/mirror.js +36 -0
  188. package/lib/model/pie.js +36 -0
  189. package/lib/model/ring.js +36 -0
  190. package/lib/model/scatter.js +29 -0
  191. package/lib/model/stacked-horizontal-bar.js +42 -0
  192. package/lib/model/statistic.js +22 -0
  193. package/lib/model/table.js +33 -0
  194. package/lib/model/tree-map.js +30 -0
  195. package/lib/model/trend.js +34 -0
  196. package/lib/model/user.js +22 -0
  197. package/lib/model/world-map-bubble.js +36 -0
  198. package/lib/model/world-map.js +36 -0
  199. package/lib/utils/cell-format-utils.js +41 -0
  200. package/lib/utils/chart.js +6 -0
  201. package/lib/utils/collaborator-utils.js +40 -0
  202. package/lib/utils/column-utils.js +247 -0
  203. package/lib/utils/custom-g2.js +612 -0
  204. package/lib/utils/data-filter/filter-item-utils.js +80 -0
  205. package/lib/utils/data-filter/filters-utils.js +406 -0
  206. package/lib/utils/data-filter/index.js +3 -0
  207. package/lib/utils/date-translate.js +66 -0
  208. package/lib/utils/index.js +50 -0
  209. package/lib/utils/key-generator.js +13 -0
  210. package/lib/utils/object-utils.js +61 -0
  211. package/lib/utils/options-utils.js +61 -0
  212. package/lib/utils/statistic-column-2-sql-column-utils.js +499 -0
  213. package/lib/utils/statistic-utils.js +1685 -0
  214. package/package.json +160 -0
@@ -0,0 +1,37 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableById, getTableColumnByKey } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { isStatisticMapColumn } from '../utils';
9
+ import { STATISTIC_TYPE } from '../constants';
10
+ var MapBubble = /*#__PURE__*/function (_BaseModel) {
11
+ _inherits(MapBubble, _BaseModel);
12
+ var _super = _createSuper(MapBubble);
13
+ function MapBubble(options, tables) {
14
+ var _this;
15
+ _classCallCheck(this, MapBubble);
16
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
17
+ type: STATISTIC_TYPE.MAP_BUBBLE
18
+ }));
19
+ _this.geo_column_key = options.x_axis_column_key;
20
+ if (_this.geo_column_key && _this.table_id && tables) {
21
+ var table = getTableById(tables, _this.table_id);
22
+ var column = getTableColumnByKey(table, _this.geo_column_key);
23
+ if (!isStatisticMapColumn(column)) {
24
+ _this.geo_column_key = null;
25
+ }
26
+ }
27
+ _this.geolocation_granularity = options.x_axis_geolocation_granularity;
28
+ _this.summary_type = options.y_axis_summary_type;
29
+ _this.summary_method = options.y_axis_summary_method;
30
+ _this.summary_column_key = options.y_axis_summary_column_key;
31
+ _this.legend_direction = options.legend_direction;
32
+ _this.legend_size = options.legend_size;
33
+ return _this;
34
+ }
35
+ return _createClass(MapBubble);
36
+ }(BaseModel);
37
+ export default MapBubble;
@@ -0,0 +1,37 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableById, getTableColumnByKey } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { isStatisticMapColumn } from '../utils';
9
+ import { STATISTIC_TYPE } from '../constants';
10
+ var Map = /*#__PURE__*/function (_BaseModel) {
11
+ _inherits(Map, _BaseModel);
12
+ var _super = _createSuper(Map);
13
+ function Map(options, tables) {
14
+ var _this;
15
+ _classCallCheck(this, Map);
16
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
17
+ type: STATISTIC_TYPE.MAP
18
+ }));
19
+ _this.geo_column_key = options.x_axis_column_key;
20
+ if (_this.geo_column_key && _this.table_id && tables) {
21
+ var table = getTableById(tables, _this.table_id);
22
+ var column = getTableColumnByKey(table, _this.geo_column_key);
23
+ if (!isStatisticMapColumn(column)) {
24
+ _this.geo_column_key = null;
25
+ }
26
+ }
27
+ _this.geolocation_granularity = options.x_axis_geolocation_granularity;
28
+ _this.summary_type = options.y_axis_summary_type;
29
+ _this.summary_method = options.y_axis_summary_method;
30
+ _this.summary_column_key = options.y_axis_summary_column_key;
31
+ _this.legend_direction = options.legend_direction;
32
+ _this.legend_size = options.legend_size;
33
+ return _this;
34
+ }
35
+ return _createClass(Map);
36
+ }(BaseModel);
37
+ export default Map;
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableById, getTableColumnByKey } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { isBoolean, isStatisticMirrorColumn } from '../utils';
9
+ import { STATISTIC_TYPE } from '../constants';
10
+ var Mirror = /*#__PURE__*/function (_BaseModel) {
11
+ _inherits(Mirror, _BaseModel);
12
+ var _super = _createSuper(Mirror);
13
+ function Mirror(options, tables) {
14
+ var _this;
15
+ _classCallCheck(this, Mirror);
16
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
17
+ type: STATISTIC_TYPE.MIRROR
18
+ }));
19
+ _this.column_key = options.x_axis_column_key;
20
+ if (_this.column && _this.table_id && tables) {
21
+ var table = getTableById(tables, _this.table_id);
22
+ var column = getTableColumnByKey(table, _this.column_key);
23
+ if (!isStatisticMirrorColumn(column)) {
24
+ _this.column_key = null;
25
+ }
26
+ }
27
+ _this.is_transpose = isBoolean(options.is_transpose) ? options.is_transpose : false;
28
+ _this.group_column_key = options.column_groupby_column_key;
29
+ _this.summary_method = options.y_axis_summary_method;
30
+ _this.summary_column_key = options.y_axis_summary_column_key;
31
+ _this.summary_type = options.y_axis_summary_type;
32
+ return _this;
33
+ }
34
+ return _createClass(Mirror);
35
+ }(BaseModel);
36
+ export default Mirror;
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { isBoolean } from '../utils';
8
+ import { STATISTIC_TYPE, STATISTIC_LABEL_POSITIONS, STATISTIC_LABEL_FORMATS, STATISTIC_SUMMARY_TYPE } from '../constants';
9
+ var Pie = /*#__PURE__*/function (_BaseModel) {
10
+ _inherits(Pie, _BaseModel);
11
+ var _super = _createSuper(Pie);
12
+ function Pie(options) {
13
+ var _this;
14
+ _classCallCheck(this, Pie);
15
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
16
+ type: STATISTIC_TYPE.PIE
17
+ }));
18
+ _this.groupby_column_key = options.x_axis_column_key;
19
+ _this.groupby_date_granularity = options.x_axis_date_granularity;
20
+ _this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
21
+ _this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
22
+ _this.summary_column_key = options.y_axis_summary_column_key;
23
+ _this.summary_type = options.y_axis_summary_type || STATISTIC_SUMMARY_TYPE.COUNT;
24
+ _this.summary_method = options.y_axis_summary_method || STATISTIC_SUMMARY_TYPE.SUM;
25
+ _this.show_legend = isBoolean(options.show_legend) ? options.show_legend : true;
26
+ _this.display_label = isBoolean(options.display_label) ? options.display_label : true;
27
+ _this.label_position = options.label_position || STATISTIC_LABEL_POSITIONS[0];
28
+ _this.label_format = options.label_format || STATISTIC_LABEL_FORMATS[0];
29
+ _this.minimum_slice_percent = options.minimum_slice_percent;
30
+ _this.sort_type = options.sort_type;
31
+ _this.label_font_size = options.label_font_size;
32
+ return _this;
33
+ }
34
+ return _createClass(Pie);
35
+ }(BaseModel);
36
+ export default Pie;
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { isBoolean } from '../utils';
8
+ import { STATISTIC_TYPE, STATISTIC_LABEL_POSITIONS, STATISTIC_LABEL_FORMATS, STATISTIC_SUMMARY_TYPE } from '../constants';
9
+ var Ring = /*#__PURE__*/function (_BaseModel) {
10
+ _inherits(Ring, _BaseModel);
11
+ var _super = _createSuper(Ring);
12
+ function Ring(options) {
13
+ var _this;
14
+ _classCallCheck(this, Ring);
15
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
16
+ type: STATISTIC_TYPE.RING
17
+ }));
18
+ _this.groupby_column_key = options.x_axis_column_key;
19
+ _this.groupby_date_granularity = options.x_axis_date_granularity;
20
+ _this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
21
+ _this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
22
+ _this.summary_column_key = options.y_axis_summary_column_key;
23
+ _this.summary_type = options.y_axis_summary_type || STATISTIC_SUMMARY_TYPE.COUNT;
24
+ _this.summary_method = options.y_axis_summary_method || STATISTIC_SUMMARY_TYPE.SUM;
25
+ _this.show_legend = isBoolean(options.show_legend) ? options.show_legend : true;
26
+ _this.display_label = isBoolean(options.display_label) ? options.display_label : true;
27
+ _this.label_position = options.label_position || STATISTIC_LABEL_POSITIONS[0];
28
+ _this.label_format = options.label_format || STATISTIC_LABEL_FORMATS[0];
29
+ _this.minimum_slice_percent = options.minimum_slice_percent;
30
+ _this.sort_type = options.sort_type;
31
+ _this.label_font_size = options.label_font_size;
32
+ return _this;
33
+ }
34
+ return _createClass(Ring);
35
+ }(BaseModel);
36
+ export default Ring;
@@ -0,0 +1,29 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { isBoolean } from '../utils';
8
+ import { STATISTIC_TYPE } from '../constants';
9
+ var Scatter = /*#__PURE__*/function (_BaseModel) {
10
+ _inherits(Scatter, _BaseModel);
11
+ var _super = _createSuper(Scatter);
12
+ function Scatter(options) {
13
+ var _this;
14
+ _classCallCheck(this, Scatter);
15
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
16
+ type: STATISTIC_TYPE.SCATTER
17
+ }));
18
+ _this.x_axis_column_key = options.x_axis_column_key;
19
+ _this.y_axis_summary_column_key = options.y_axis_summary_column_key;
20
+ _this.group_column = options.column_groupby_column_key;
21
+ _this.x_axis_show_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
22
+ _this.x_axis_label_position = options.x_axis_label_position;
23
+ _this.y_axis_show_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
24
+ _this.y_axis_label_position = options.y_axis_label_position;
25
+ return _this;
26
+ }
27
+ return _createClass(Scatter);
28
+ }(BaseModel);
29
+ export default Scatter;
@@ -0,0 +1,42 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { isBoolean } from '../utils';
8
+ import { STATISTIC_TYPE } from '../constants';
9
+ var StackedHorizontalGroupBar = /*#__PURE__*/function (_BaseModel) {
10
+ _inherits(StackedHorizontalGroupBar, _BaseModel);
11
+ var _super = _createSuper(StackedHorizontalGroupBar);
12
+ function StackedHorizontalGroupBar(options) {
13
+ var _this;
14
+ _classCallCheck(this, StackedHorizontalGroupBar);
15
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
16
+ type: STATISTIC_TYPE.STACKED_HORIZONTAL_BAR
17
+ }));
18
+ _this.vertical_axis_column_key = options.x_axis_column_key;
19
+ _this.vertical_axis_date_granularity = options.x_axis_date_granularity;
20
+ _this.vertical_axis_geolocation_granularity = options.x_axis_geolocation_granularity;
21
+ _this.vertical_axis_include_empty = options.x_axis_include_empty_cells;
22
+ _this.horizontal_axis_summary_type = options.y_axis_summary_type;
23
+ _this.show_vertical_axis_label = isBoolean(options.x_axis_show_label) ? options.x_axis_show_label : false;
24
+ _this.show_horizontal_axis_label = isBoolean(options.y_axis_show_label) ? options.y_axis_show_label : false;
25
+ _this.vertical_axis_label_position = options.x_axis_label_position;
26
+ _this.horizontal_axis_label_position = options.y_axis_label_position;
27
+ _this.horizontal_axis_column_key = options.y_axis_summary_column_key;
28
+ _this.horizontal_axis_summary_method = options.y_axis_summary_method;
29
+ _this.horizontal_axis_label_color = options.y_axis_label_color;
30
+
31
+ // column-group
32
+ _this.column_groupby_column_key = options.column_groupby_column_key;
33
+ _this.column_groupby_date_granularity = options.column_groupby_date_granularity;
34
+ _this.column_groupby_geolocation_granularity = options.column_groupby_geolocation_granularity;
35
+ _this.column_groupby_multiple_numeric_column = options.column_groupby_multiple_numeric_column;
36
+ _this.summary_columns = options.summary_columns;
37
+ _this.label_font_size = options.label_font_size;
38
+ return _this;
39
+ }
40
+ return _createClass(StackedHorizontalGroupBar);
41
+ }(BaseModel);
42
+ export default StackedHorizontalGroupBar;
@@ -0,0 +1,22 @@
1
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import { generateChartConfig } from '../utils';
4
+ import { HORIZONTAL_ALIGN, DEFAULT_STATISTIC_FONT_WEIGHT, DEFAULT_STATISTIC_TITLE_FONT_SIZE, SUPPORT_TITLE_CHART_TYPES } from '../constants';
5
+ var StatisticModel = /*#__PURE__*/_createClass(function StatisticModel(options, tables) {
6
+ _classCallCheck(this, StatisticModel);
7
+ var id = options.id,
8
+ style_config = options.style_config;
9
+ this.id = id;
10
+ this.type = 'statistic';
11
+ this.config = generateChartConfig(options, tables);
12
+ this.style_config = style_config || {};
13
+ if (SUPPORT_TITLE_CHART_TYPES.includes(this.config.type)) {
14
+ this.style_config.title = {
15
+ text: '',
16
+ font_size: DEFAULT_STATISTIC_TITLE_FONT_SIZE,
17
+ font_weight: DEFAULT_STATISTIC_FONT_WEIGHT,
18
+ horizontal_align: HORIZONTAL_ALIGN.LEFT
19
+ };
20
+ }
21
+ });
22
+ export default StatisticModel;
@@ -0,0 +1,33 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { STATISTIC_SUMMARY_TYPE, STATISTIC_TYPE } from '../constants';
8
+ var Table = /*#__PURE__*/function (_BaseModel) {
9
+ _inherits(Table, _BaseModel);
10
+ var _super = _createSuper(Table);
11
+ function Table(options) {
12
+ var _this;
13
+ _classCallCheck(this, Table);
14
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
15
+ type: STATISTIC_TYPE.TABLE
16
+ }));
17
+ _this.groupby_column_key = options.x_axis_column_key;
18
+ _this.groupby_date_granularity = options.x_axis_date_granularity;
19
+ _this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
20
+ _this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
21
+ _this.summary_column_key = options.y_axis_summary_column_key;
22
+ _this.summary_method = options.y_axis_summary_method || STATISTIC_SUMMARY_TYPE.SUM;
23
+ _this.summary_type = options.y_axis_summary_type || STATISTIC_SUMMARY_TYPE.COUNT;
24
+ _this.column_groupby_multiple_numeric_column = options.column_groupby_multiple_numeric_column;
25
+ _this.summary_columns = options.summary_columns;
26
+ _this.column_groupby_column_key = options.column_groupby_column_key;
27
+ _this.column_groupby_date_granularity = options.column_groupby_date_granularity;
28
+ _this.column_groupby_geolocation_granularity = options.column_groupby_geolocation_granularity;
29
+ return _this;
30
+ }
31
+ return _createClass(Table);
32
+ }(BaseModel);
33
+ export default Table;
@@ -0,0 +1,30 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import BaseModel from './base-model';
7
+ import { STATISTIC_SUMMARY_TYPE, STATISTIC_TYPE } from '../constants';
8
+ var TreeMap = /*#__PURE__*/function (_BaseModel) {
9
+ _inherits(TreeMap, _BaseModel);
10
+ var _super = _createSuper(TreeMap);
11
+ function TreeMap(options) {
12
+ var _this;
13
+ _classCallCheck(this, TreeMap);
14
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
15
+ type: STATISTIC_TYPE.TREE_MAP
16
+ }));
17
+ _this.groupby_column_key = options.x_axis_column_key;
18
+ _this.groupby_date_granularity = options.x_axis_date_granularity;
19
+ _this.groupby_geolocation_granularity = options.x_axis_geolocation_granularity;
20
+ _this.groupby_include_empty_cells = options.x_axis_include_empty_cells;
21
+ _this.summary_type = options.y_axis_summary_type || STATISTIC_SUMMARY_TYPE.COUNT;
22
+ _this.summary_method = options.y_axis_summary_method || STATISTIC_SUMMARY_TYPE.SUM;
23
+ _this.summary_column_key = options.y_axis_summary_column_key;
24
+ _this.sort_type = options.sort_type;
25
+ _this.minimum_slice_percent = options.minimum_slice_percent;
26
+ return _this;
27
+ }
28
+ return _createClass(TreeMap);
29
+ }(BaseModel);
30
+ export default TreeMap;
@@ -0,0 +1,34 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableColumnByKey, isDateColumn } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { STATISTIC_TYPE } from '../constants';
9
+ var Trend = /*#__PURE__*/function (_BaseModel) {
10
+ _inherits(Trend, _BaseModel);
11
+ var _super = _createSuper(Trend);
12
+ function Trend(options, table) {
13
+ var _this;
14
+ _classCallCheck(this, Trend);
15
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
16
+ type: STATISTIC_TYPE.TREND
17
+ }));
18
+ _this.date_column_key = options.x_axis_column_key;
19
+ _this.date_granularity = options.x_axis_date_granularity;
20
+ if (_this.date_column_key) {
21
+ var column = getTableColumnByKey(table, _this.date_column_key);
22
+ if (!column || !isDateColumn(column)) {
23
+ _this.date_column_key = null;
24
+ _this.date_granularity = null;
25
+ }
26
+ }
27
+ _this.summary_type = options.y_axis_summary_type;
28
+ _this.summary_column_key = options.y_axis_summary_column_key;
29
+ _this.summary_method = options.y_axis_summary_method;
30
+ return _this;
31
+ }
32
+ return _createClass(Trend);
33
+ }(BaseModel);
34
+ export default Trend;
@@ -0,0 +1,22 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ var User = /*#__PURE__*/function () {
4
+ function User(obj) {
5
+ _classCallCheck(this, User);
6
+ this.loaded = obj.loaded || false;
7
+ this.email = obj.email || '';
8
+ this.name = obj.name || '';
9
+ this.avatar_url = obj.avatar_url || '';
10
+ this.contact_email = obj.contact_email || null;
11
+ this.name_pinyin = obj.name_pinyin || '';
12
+ this.id = obj.id_in_org || '';
13
+ }
14
+ _createClass(User, [{
15
+ key: "updateLoaded",
16
+ value: function updateLoaded(loaded) {
17
+ this.loaded = loaded;
18
+ }
19
+ }]);
20
+ return User;
21
+ }();
22
+ export default User;
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableById, getTableColumnByKey } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { isStatisticWorldMapColumn } from '../utils';
9
+ import { STATISTIC_TYPE } from '../constants';
10
+ var WorldMapBubble = /*#__PURE__*/function (_BaseModel) {
11
+ _inherits(WorldMapBubble, _BaseModel);
12
+ var _super = _createSuper(WorldMapBubble);
13
+ function WorldMapBubble(options, tables) {
14
+ var _this;
15
+ _classCallCheck(this, WorldMapBubble);
16
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
17
+ type: STATISTIC_TYPE.WORLD_MAP_BUBBLE
18
+ }));
19
+ _this.column_key = options.x_axis_column_key;
20
+ if (_this.column_key && _this.table_id && tables) {
21
+ var table = getTableById(tables, _this.table_id);
22
+ var column = getTableColumnByKey(table, _this.column_key);
23
+ if (!isStatisticWorldMapColumn(column)) {
24
+ _this.column_key = null;
25
+ }
26
+ }
27
+ _this.summary_type = options.y_axis_summary_type;
28
+ _this.summary_method = options.y_axis_summary_method;
29
+ _this.summary_column_key = options.y_axis_summary_column_key;
30
+ _this.legend_direction = options.legend_direction;
31
+ _this.legend_size = options.legend_size;
32
+ return _this;
33
+ }
34
+ return _createClass(WorldMapBubble);
35
+ }(BaseModel);
36
+ export default WorldMapBubble;
@@ -0,0 +1,36 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import { getTableById, getTableColumnByKey } from 'dtable-utils';
7
+ import BaseModel from './base-model';
8
+ import { isStatisticWorldMapColumn } from '../utils';
9
+ import { STATISTIC_TYPE } from '../constants';
10
+ var WorldMap = /*#__PURE__*/function (_BaseModel) {
11
+ _inherits(WorldMap, _BaseModel);
12
+ var _super = _createSuper(WorldMap);
13
+ function WorldMap(options, tables) {
14
+ var _this;
15
+ _classCallCheck(this, WorldMap);
16
+ _this = _super.call(this, _objectSpread(_objectSpread({}, options), {}, {
17
+ type: STATISTIC_TYPE.WORLD_MAP
18
+ }));
19
+ _this.column_key = options.x_axis_column_key;
20
+ if (_this.column_key && _this.table_id && tables) {
21
+ var table = getTableById(tables, _this.table_id);
22
+ var column = getTableColumnByKey(table, _this.column_key);
23
+ if (!isStatisticWorldMapColumn(column)) {
24
+ _this.column_key = null;
25
+ }
26
+ }
27
+ _this.summary_type = options.y_axis_summary_type;
28
+ _this.summary_method = options.y_axis_summary_method;
29
+ _this.summary_column_key = options.y_axis_summary_column_key;
30
+ _this.legend_direction = options.legend_direction;
31
+ _this.legend_size = options.legend_size;
32
+ return _this;
33
+ }
34
+ return _createClass(WorldMap);
35
+ }(BaseModel);
36
+ export default WorldMap;
@@ -0,0 +1,41 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { COLLABORATOR_COLUMN_TYPES, FORMULA_RESULT_TYPE, getCollaboratorsName, getFormulaDisplayString } from 'dtable-utils';
3
+ import ObjectUtils from './object-utils';
4
+ export var getClientFormulaDisplayString = function getClientFormulaDisplayString(value, columnData) {
5
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
6
+ _ref$collaborators = _ref.collaborators,
7
+ collaborators = _ref$collaborators === void 0 ? [] : _ref$collaborators;
8
+ if (!columnData || !value && value !== 0) return '';
9
+ var result_type = columnData.result_type,
10
+ array_type = columnData.array_type;
11
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
12
+ if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
13
+ if (!value) {
14
+ return null;
15
+ }
16
+ var collaboratorList = Array.isArray(value) ? value : [value];
17
+ return getCollaboratorsName(collaborators, collaboratorList);
18
+ }
19
+ }
20
+ return getFormulaDisplayString(value, columnData, {
21
+ collaborators: collaborators
22
+ });
23
+ };
24
+ export var getClientLinkDisplayString = function getClientLinkDisplayString(links, columnData, _ref2) {
25
+ var _ref2$collaborators = _ref2.collaborators,
26
+ collaborators = _ref2$collaborators === void 0 ? [] : _ref2$collaborators;
27
+ if (!columnData || !Array.isArray(links) || links.length === 0) {
28
+ return null;
29
+ }
30
+
31
+ // eslint-disable-next-line
32
+ var formulaData = ObjectUtils.hasOwnProperty(columnData, 'result_type') ? columnData : _objectSpread(_objectSpread({}, columnData), {}, {
33
+ result_type: FORMULA_RESULT_TYPE.ARRAY
34
+ });
35
+ var displayValue = links.map(function (link) {
36
+ return link.display_value;
37
+ });
38
+ return getClientFormulaDisplayString(displayValue, formulaData, {
39
+ collaborators: collaborators
40
+ });
41
+ };
@@ -0,0 +1,6 @@
1
+ import { GenericModel, STATISTIC_MAP } from '../model';
2
+ export var generateChartConfig = function generateChartConfig(options, tables) {
3
+ var genericChart = new GenericModel(options);
4
+ var ChartModel = STATISTIC_MAP[genericChart.type];
5
+ return new ChartModel(genericChart, tables);
6
+ };
@@ -0,0 +1,40 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { isValidEmail } from 'dtable-utils';
3
+ import { User } from '../model';
4
+ export var getKnownCollaboratorByEmail = function getKnownCollaboratorByEmail(email) {
5
+ var defaultUser = generateDefaultUser(email);
6
+ if (email === 'anonymous' || email === 'Automation Rule') {
7
+ var anonymous = new User(_objectSpread(_objectSpread({}, defaultUser), {}, {
8
+ loaded: true
9
+ }));
10
+ window.seaStatistic.context.updateCollaboratorsCache(email, anonymous);
11
+ return anonymous;
12
+ }
13
+ var creator = window.seaStatistic.context.getCollaboratorFromCache(email);
14
+ if (creator) return creator;
15
+ if (!isValidEmail(email)) {
16
+ creator = new User(_objectSpread(_objectSpread({}, defaultUser), {}, {
17
+ loaded: true
18
+ }));
19
+ window.seaStatistic.context.updateCollaboratorsCache(email, creator);
20
+ return creator;
21
+ }
22
+ creator = window.seaStatistic.context.getCollaboratorFromCache(email);
23
+ if (creator) return creator;
24
+ return null;
25
+ };
26
+ export var getKnownCollaboratorsByEmails = function getKnownCollaboratorsByEmails(emails) {
27
+ if (!Array.isArray(emails) || emails.length === 0) return [];
28
+ return emails.map(function (email) {
29
+ return getKnownCollaboratorByEmail(email);
30
+ });
31
+ };
32
+ export var generateDefaultUser = function generateDefaultUser(name) {
33
+ var mediaUrl = window.seaStatistic.context.getSetting('mediaUrl');
34
+ var defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
35
+ return {
36
+ name: name,
37
+ email: name,
38
+ avatar_url: defaultAvatarUrl
39
+ };
40
+ };