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,247 @@
1
+ import { CellType, DEFAULT_DATE_FORMAT, FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE } from 'dtable-utils';
2
+ import { MIRROR_COLUMN_LIST } from '../constants';
3
+ export function getSelectColumnOptions(column) {
4
+ if (!column || !column.data || !Array.isArray(column.data.options)) {
5
+ return [];
6
+ }
7
+ return column.data.options;
8
+ }
9
+ export var getDateColumnFormat = function getDateColumnFormat(column) {
10
+ var format = column && column.data && column.data.format ? column.data.format : DEFAULT_DATE_FORMAT;
11
+ // Old Europe format is D/M/YYYY new format is DD/MM/YYYY
12
+ return format;
13
+ };
14
+ export var isCheckboxColumn = function isCheckboxColumn(column) {
15
+ var type = column.type,
16
+ data = column.data;
17
+ if (FORMULA_COLUMN_TYPES_MAP[type]) {
18
+ var _ref = data || {},
19
+ result_type = _ref.result_type,
20
+ array_type = _ref.array_type;
21
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
22
+ return array_type === CellType.CHECKBOX;
23
+ }
24
+ return false;
25
+ }
26
+ return type === CellType.CHECKBOX;
27
+ };
28
+ export var getColumnByKey = function getColumnByKey(columnKey, columns) {
29
+ if (!columnKey || !Array.isArray(columns)) {
30
+ return null;
31
+ }
32
+ return columns.find(function (column) {
33
+ return column.key === columnKey;
34
+ });
35
+ };
36
+ export var getColumnByName = function getColumnByName(columnName, columns) {
37
+ if (!columnName || !Array.isArray(columns)) {
38
+ return null;
39
+ }
40
+ return columns.find(function (column) {
41
+ return column.name === columnName;
42
+ });
43
+ };
44
+ export var getColumnByType = function getColumnByType(columnType, columns) {
45
+ if (!columnType || !Array.isArray(columns)) {
46
+ return null;
47
+ }
48
+ return columns.find(function (column) {
49
+ return column.type === columnType;
50
+ });
51
+ };
52
+ export var getColumnByIndex = function getColumnByIndex(index, columns) {
53
+ if (Array.isArray(columns)) {
54
+ return columns[index];
55
+ }
56
+ if (typeof Immutable !== 'undefined') {
57
+ return columns.get(index);
58
+ }
59
+ return null;
60
+ };
61
+ export var getColumnWidth = function getColumnWidth(column) {
62
+ var type = column.type,
63
+ data = column.data;
64
+ switch (type) {
65
+ case CellType.DATE:
66
+ {
67
+ var isShowHourAndMinute = data && data.format && data.format.indexOf('HH:mm') > -1;
68
+ return isShowHourAndMinute ? 160 : 100;
69
+ }
70
+ case CellType.CTIME:
71
+ case CellType.MTIME:
72
+ case CellType.LINK:
73
+ case CellType.GEOLOCATION:
74
+ {
75
+ return 160;
76
+ }
77
+ case CellType.COLLABORATOR:
78
+ {
79
+ return 100;
80
+ }
81
+ case CellType.CHECKBOX:
82
+ {
83
+ return 40;
84
+ }
85
+ case CellType.NUMBER:
86
+ case CellType.AUTO_NUMBER:
87
+ {
88
+ return 120;
89
+ }
90
+ case CellType.RATE:
91
+ {
92
+ var _ref2 = data || {},
93
+ rate_max_number = _ref2.rate_max_number;
94
+ var rateMaxNumber = rate_max_number || 5;
95
+ return 16 * rateMaxNumber + 20;
96
+ }
97
+ default:
98
+ {
99
+ return 100;
100
+ }
101
+ }
102
+ };
103
+ export var isNameColumn = function isNameColumn(column) {
104
+ return column.key === '0000';
105
+ };
106
+ export var isUrlColumn = function isUrlColumn(column) {
107
+ var type = column.type,
108
+ data = column.data;
109
+ if (FORMULA_COLUMN_TYPES_MAP[type]) {
110
+ var _ref3 = data || {},
111
+ result_type = _ref3.result_type,
112
+ array_type = _ref3.array_type;
113
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
114
+ return array_type === CellType.URL;
115
+ }
116
+ return false;
117
+ }
118
+ return type === CellType.URL;
119
+ };
120
+ export var getLinkColumns = function getLinkColumns(columns) {
121
+ if (!columns) {
122
+ return [];
123
+ }
124
+ return columns.filter(function (column) {
125
+ return column.type === CellType.LINK && column.data;
126
+ });
127
+ };
128
+ export var calculateFormulaRows = function calculateFormulaRows(rows, columns) {
129
+ var COMPUTED_COLUMN_TYPES = [CellType.FORMULA, CellType.LINK_FORMULA, CellType.LINK];
130
+ var formulaColumns = columns.filter(function (column) {
131
+ return COMPUTED_COLUMN_TYPES.includes(column.type);
132
+ });
133
+ var formula_rows = {};
134
+ if (formulaColumns.length > 0) {
135
+ rows.forEach(function (row) {
136
+ var formulaRow = {};
137
+ formulaColumns.forEach(function (column) {
138
+ return formulaRow[column.key] = row[column.key];
139
+ });
140
+ formula_rows[row._id] = formulaRow;
141
+ });
142
+ }
143
+ return formula_rows;
144
+ };
145
+ export var handleCascadeColumn = function handleCascadeColumn(optionValue, columnKey, columns, row) {
146
+ var updated = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
147
+ var processedColumns = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new Set();
148
+ // This column has already been processed, avoid circular dependency.
149
+ if (!Array.isArray(columns) || processedColumns.has(columnKey)) {
150
+ return updated;
151
+ }
152
+ processedColumns.add(columnKey);
153
+ var singleSelectColumns = columns.filter(function (column) {
154
+ return column.type === CellType.SINGLE_SELECT;
155
+ });
156
+ for (var i = 0; i < singleSelectColumns.length; i++) {
157
+ var singleSelectColumn = singleSelectColumns[i];
158
+ var _singleSelectColumn$d = singleSelectColumn.data,
159
+ cascade_column_key = _singleSelectColumn$d.cascade_column_key,
160
+ cascade_settings = _singleSelectColumn$d.cascade_settings;
161
+ if (cascade_column_key === columnKey) {
162
+ var childColumnKey = singleSelectColumn.key;
163
+ var childColumnOptions = cascade_settings[optionValue];
164
+ var childColumnCellValue = row[childColumnKey];
165
+ var cellValueInOptions = childColumnOptions && childColumnOptions.includes(childColumnCellValue);
166
+ if (!cellValueInOptions) {
167
+ updated[childColumnKey] = '';
168
+ handleCascadeColumn('', childColumnKey, columns, row, updated, processedColumns);
169
+ }
170
+ }
171
+ }
172
+ return updated;
173
+ };
174
+ export var isFrozen = function isFrozen(column) {
175
+ if (!column) return false;
176
+ return column.frozen === true;
177
+ };
178
+ export var findLastFrozenColumnIndex = function findLastFrozenColumnIndex(columns) {
179
+ for (var i = 0; i < columns.length; i++) {
180
+ if (isFrozen(columns[i])) {
181
+ return i;
182
+ }
183
+ }
184
+ return -1;
185
+ };
186
+ export var isStatisticMapColumn = function isStatisticMapColumn(column) {
187
+ if (!column) return false;
188
+ var type = column.type,
189
+ data = column.data;
190
+ if (type === CellType.GEOLOCATION) {
191
+ var _ref4 = data || {},
192
+ geo_format = _ref4.geo_format;
193
+ if (geo_format === 'lng_lat' || geo_format === 'country_region') {
194
+ return false;
195
+ }
196
+ return true;
197
+ }
198
+ if (FORMULA_COLUMN_TYPES_MAP[type]) {
199
+ var _ref5 = data || {},
200
+ result_type = _ref5.result_type,
201
+ array_type = _ref5.array_type,
202
+ array_data = _ref5.array_data;
203
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
204
+ return false;
205
+ }
206
+ var _ref6 = array_data || {},
207
+ _geo_format = _ref6.geo_format;
208
+ if (_geo_format === 'lng_lat' || _geo_format === 'country_region') {
209
+ return false;
210
+ }
211
+ return true;
212
+ }
213
+ return false;
214
+ };
215
+ export var isStatisticWorldMapColumn = function isStatisticWorldMapColumn(column) {
216
+ if (!column) return false;
217
+ var type = column.type,
218
+ data = column.data;
219
+ if (type === CellType.TEXT) return true;
220
+ if (type === CellType.GEOLOCATION) {
221
+ var _ref7 = data || {},
222
+ geo_format = _ref7.geo_format;
223
+ if (geo_format === 'country_region') {
224
+ return true;
225
+ }
226
+ }
227
+ if (FORMULA_COLUMN_TYPES_MAP[type]) {
228
+ var _data = column.data;
229
+ var _ref8 = _data || {},
230
+ result_type = _ref8.result_type,
231
+ array_type = _ref8.array_type,
232
+ array_data = _ref8.array_data;
233
+ if (result_type !== FORMULA_RESULT_TYPE.ARRAY || array_type !== CellType.GEOLOCATION) {
234
+ return false;
235
+ }
236
+ var _ref9 = array_data || {},
237
+ _geo_format2 = _ref9.geo_format;
238
+ if (_geo_format2 === 'country_region') {
239
+ return true;
240
+ }
241
+ }
242
+ return false;
243
+ };
244
+ export var isStatisticMirrorColumn = function isStatisticMirrorColumn(column) {
245
+ if (!column) return false;
246
+ return MIRROR_COLUMN_LIST.includes(column.type);
247
+ };