@nocobase/plugin-data-visualization 0.11.1-alpha.5 → 0.12.0-alpha.2

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 (132) hide show
  1. package/client.d.ts +2 -2
  2. package/client.js +1 -1
  3. package/dist/client/chart/antd/antd.d.ts +7 -0
  4. package/dist/client/chart/antd/index.d.ts +4 -0
  5. package/dist/client/chart/antd/statistic.d.ts +19 -0
  6. package/dist/client/chart/antd/table.d.ts +6 -0
  7. package/dist/client/chart/chart.d.ts +65 -0
  8. package/dist/client/chart/g2plot/bar.d.ts +16 -0
  9. package/dist/client/chart/g2plot/dualAxes.d.ts +20 -0
  10. package/dist/client/chart/g2plot/g2plot.d.ts +19 -0
  11. package/dist/client/chart/g2plot/index.d.ts +6 -0
  12. package/dist/client/chart/g2plot/pie.d.ts +17 -0
  13. package/dist/client/chart/library.d.ts +28 -0
  14. package/{lib → dist}/client/hooks.d.ts +22 -154
  15. package/{lib → dist}/client/index.d.ts +3 -1
  16. package/dist/client/index.js +67448 -0
  17. package/{lib → dist}/client/renderer/ChartRendererProvider.d.ts +1 -8
  18. package/{lib → dist}/client/renderer/index.d.ts +0 -2
  19. package/{lib → dist}/client/utils.d.ts +1 -1
  20. package/{lib → dist}/index.d.ts +1 -0
  21. package/dist/index.js +18 -0
  22. package/dist/locale/en-US.js +26 -0
  23. package/dist/locale/fr-FR.js +5 -0
  24. package/dist/locale/ja-JP.js +5 -0
  25. package/dist/locale/pt-BR.js +26 -0
  26. package/dist/locale/ru-RU.js +5 -0
  27. package/dist/locale/tr-TR.js +5 -0
  28. package/dist/locale/zh-CN.js +74 -0
  29. package/dist/server/actions/formatter.js +41 -0
  30. package/{src/server/actions/query.ts → dist/server/actions/query.js} +75 -133
  31. package/dist/server/index.js +11 -0
  32. package/dist/server/plugin.js +42 -0
  33. package/package.json +23 -22
  34. package/server.d.ts +2 -2
  35. package/server.js +1 -1
  36. package/lib/client/Settings.js +0 -81
  37. package/lib/client/block/ChartBlock.js +0 -74
  38. package/lib/client/block/ChartBlockDesigner.js +0 -35
  39. package/lib/client/block/ChartBlockInitializer.js +0 -114
  40. package/lib/client/block/ChartConfigure.js +0 -499
  41. package/lib/client/block/formatters.js +0 -58
  42. package/lib/client/block/index.js +0 -49
  43. package/lib/client/block/schemas/configure.js +0 -517
  44. package/lib/client/block/transformers.js +0 -68
  45. package/lib/client/hooks.js +0 -275
  46. package/lib/client/index.js +0 -80
  47. package/lib/client/locale/index.js +0 -37
  48. package/lib/client/renderer/ChartLibrary.d.ts +0 -72
  49. package/lib/client/renderer/ChartLibrary.js +0 -146
  50. package/lib/client/renderer/ChartRenderer.js +0 -181
  51. package/lib/client/renderer/ChartRendererProvider.js +0 -105
  52. package/lib/client/renderer/index.js +0 -49
  53. package/lib/client/renderer/library/AntdLibrary.d.ts +0 -2
  54. package/lib/client/renderer/library/AntdLibrary.js +0 -123
  55. package/lib/client/renderer/library/G2PlotLibrary.d.ts +0 -2
  56. package/lib/client/renderer/library/G2PlotLibrary.js +0 -288
  57. package/lib/client/renderer/library/index.d.ts +0 -3
  58. package/lib/client/renderer/library/index.js +0 -15
  59. package/lib/client/utils.js +0 -137
  60. package/lib/index.js +0 -13
  61. package/lib/locale/en-US.js +0 -29
  62. package/lib/locale/fr-FR.js +0 -8
  63. package/lib/locale/ja-JP.js +0 -8
  64. package/lib/locale/pt-BR.js +0 -29
  65. package/lib/locale/ru-RU.js +0 -8
  66. package/lib/locale/tr-TR.js +0 -8
  67. package/lib/locale/zh-CN.js +0 -77
  68. package/lib/server/actions/formatter.js +0 -44
  69. package/lib/server/actions/query.js +0 -331
  70. package/lib/server/index.js +0 -13
  71. package/lib/server/plugin.js +0 -64
  72. package/src/client/Settings.tsx +0 -43
  73. package/src/client/__tests__/chart-configure.test.tsx +0 -14
  74. package/src/client/__tests__/chart-library.test.ts +0 -78
  75. package/src/client/__tests__/chart-renderer.test.tsx +0 -30
  76. package/src/client/__tests__/hooks.test.ts +0 -261
  77. package/src/client/block/ChartBlock.tsx +0 -24
  78. package/src/client/block/ChartBlockDesigner.tsx +0 -19
  79. package/src/client/block/ChartBlockInitializer.tsx +0 -82
  80. package/src/client/block/ChartConfigure.tsx +0 -446
  81. package/src/client/block/formatters.ts +0 -70
  82. package/src/client/block/index.ts +0 -4
  83. package/src/client/block/schemas/configure.ts +0 -504
  84. package/src/client/block/transformers.ts +0 -52
  85. package/src/client/hooks.ts +0 -239
  86. package/src/client/index.tsx +0 -47
  87. package/src/client/locale/index.ts +0 -18
  88. package/src/client/renderer/ChartLibrary.tsx +0 -183
  89. package/src/client/renderer/ChartRenderer.tsx +0 -129
  90. package/src/client/renderer/ChartRendererProvider.tsx +0 -123
  91. package/src/client/renderer/index.ts +0 -4
  92. package/src/client/renderer/library/AntdLibrary.tsx +0 -94
  93. package/src/client/renderer/library/G2PlotLibrary.tsx +0 -236
  94. package/src/client/renderer/library/index.tsx +0 -4
  95. package/src/client/utils.ts +0 -102
  96. package/src/index.ts +0 -1
  97. package/src/locale/en-US.ts +0 -23
  98. package/src/locale/fr-FR.ts +0 -1
  99. package/src/locale/ja-JP.ts +0 -1
  100. package/src/locale/pt-BR.ts +0 -23
  101. package/src/locale/ru-RU.ts +0 -1
  102. package/src/locale/tr-TR.ts +0 -1
  103. package/src/locale/zh-CN.ts +0 -72
  104. package/src/server/__tests__/api.test.ts +0 -102
  105. package/src/server/__tests__/formatter.test.ts +0 -49
  106. package/src/server/__tests__/query.test.ts +0 -220
  107. package/src/server/actions/formatter.ts +0 -49
  108. package/src/server/collections/.gitkeep +0 -0
  109. package/src/server/index.ts +0 -1
  110. package/src/server/plugin.ts +0 -37
  111. /package/{lib → dist}/client/Settings.d.ts +0 -0
  112. /package/{lib → dist}/client/block/ChartBlock.d.ts +0 -0
  113. /package/{lib → dist}/client/block/ChartBlockDesigner.d.ts +0 -0
  114. /package/{lib → dist}/client/block/ChartBlockInitializer.d.ts +0 -0
  115. /package/{lib → dist}/client/block/ChartConfigure.d.ts +0 -0
  116. /package/{lib → dist}/client/block/formatters.d.ts +0 -0
  117. /package/{lib → dist}/client/block/index.d.ts +0 -0
  118. /package/{lib → dist}/client/block/schemas/configure.d.ts +0 -0
  119. /package/{lib → dist}/client/block/transformers.d.ts +0 -0
  120. /package/{lib → dist}/client/locale/index.d.ts +0 -0
  121. /package/{lib → dist}/client/renderer/ChartRenderer.d.ts +0 -0
  122. /package/{lib → dist}/locale/en-US.d.ts +0 -0
  123. /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
  124. /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
  125. /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
  126. /package/{lib → dist}/locale/ru-RU.d.ts +0 -0
  127. /package/{lib → dist}/locale/tr-TR.d.ts +0 -0
  128. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  129. /package/{lib → dist}/server/actions/formatter.d.ts +0 -0
  130. /package/{lib → dist}/server/actions/query.d.ts +0 -0
  131. /package/{lib → dist}/server/index.d.ts +0 -0
  132. /package/{lib → dist}/server/plugin.d.ts +0 -0
@@ -1,517 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.transformSchema = exports.querySchema = exports.getConfigSchema = void 0;
7
- function _shared() {
8
- const data = require("@formily/shared");
9
- _shared = function _shared() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- var _locale = require("../../locale");
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
- const getArraySchema = (fields = {}, extra = {}) => _objectSpread(_objectSpread({
21
- type: 'array',
22
- 'x-decorator': 'FormItem',
23
- 'x-component': 'ArrayItems'
24
- }, extra), {}, {
25
- items: {
26
- type: 'object',
27
- properties: {
28
- space: {
29
- type: 'void',
30
- 'x-component': 'Space',
31
- properties: _objectSpread(_objectSpread({
32
- sort: {
33
- type: 'void',
34
- 'x-decorator': 'FormItem',
35
- 'x-component': 'ArrayItems.SortHandle'
36
- }
37
- }, fields), {}, {
38
- remove: {
39
- type: 'void',
40
- 'x-decorator': 'FormItem',
41
- 'x-component': 'ArrayItems.Remove'
42
- }
43
- })
44
- }
45
- }
46
- },
47
- properties: {
48
- add: {
49
- type: 'void',
50
- title: '{{t("Add field")}}',
51
- 'x-component': 'ArrayItems.Addition'
52
- }
53
- }
54
- });
55
- const getConfigSchema = general => ({
56
- type: 'void',
57
- properties: {
58
- config: {
59
- type: 'object',
60
- properties: {
61
- chartType: {
62
- type: 'string',
63
- title: '{{t("Chart type")}}',
64
- 'x-decorator': 'FormItem',
65
- 'x-component': 'Select',
66
- 'x-component-props': {
67
- placeholder: '{{t("Please select a chart type.")}}'
68
- },
69
- enum: '{{ chartTypes }}'
70
- },
71
- [(0, _shared().uid)()]: {
72
- type: 'void',
73
- properties: {
74
- general
75
- }
76
- },
77
- [(0, _shared().uid)()]: {
78
- type: 'void',
79
- properties: {
80
- advanced: {
81
- type: 'json',
82
- title: '{{t("JSON config")}}',
83
- 'x-decorator': 'FormItem',
84
- 'x-decorator-props': {
85
- extra: (0, _locale.lang)('Same properties set in the form above will be overwritten by this JSON config.')
86
- },
87
- 'x-component': 'Input.JSON',
88
- 'x-component-props': {
89
- autoSize: {
90
- minRows: 3
91
- }
92
- }
93
- }
94
- }
95
- },
96
- reference: {
97
- type: 'string',
98
- 'x-reactions': {
99
- dependencies: ['.chartType'],
100
- fulfill: {
101
- schema: {
102
- 'x-content': '{{ getReference($deps[0]) }}'
103
- }
104
- }
105
- }
106
- }
107
- }
108
- }
109
- }
110
- });
111
- exports.getConfigSchema = getConfigSchema;
112
- const querySchema = {
113
- type: 'void',
114
- properties: {
115
- settings: {
116
- type: 'void',
117
- // 'x-component': 'FormItem',
118
- properties: {
119
- // mode: {
120
- // type: 'string',
121
- // 'x-decorator': 'FormItem',
122
- // 'x-decorator-props': {
123
- // style: {
124
- // display: 'inline-block',
125
- // width: '45%',
126
- // },
127
- // },
128
- // 'x-component': 'Radio.Group',
129
- // 'x-component-props': {
130
- // defaultValue: 'builder',
131
- // optionType: 'button',
132
- // buttonStyle: 'solid',
133
- // },
134
- // enum: [
135
- // {
136
- // label: lang('Builder mode'),
137
- // value: 'builder',
138
- // },
139
- // {
140
- // label: lang('SQL mode'),
141
- // value: 'sql',
142
- // },
143
- // ],
144
- // 'x-reactions': [
145
- // {
146
- // target: 'query.builder',
147
- // fulfill: {
148
- // state: {
149
- // visible: '{{ $self.value !== "sql" }}',
150
- // },
151
- // },
152
- // },
153
- // {
154
- // target: 'query.sql',
155
- // fulfill: {
156
- // state: {
157
- // visible: '{{ $self.value === "sql" }}',
158
- // },
159
- // },
160
- // },
161
- // ],
162
- // },
163
- collection: {
164
- title: '{{t("Collection")}}',
165
- type: 'string',
166
- 'x-decorator': 'FormItem',
167
- 'x-component': 'Select',
168
- 'x-component-props': {
169
- options: '{{ collectionOptions }}',
170
- onChange: '{{ onCollectionChange }}',
171
- placeholder: '{{t("Collection")}}'
172
- }
173
- }
174
- }
175
- },
176
- query: {
177
- type: 'object',
178
- properties: {
179
- builder: {
180
- type: 'void',
181
- properties: {
182
- collapse: {
183
- type: 'void',
184
- 'x-decorator': 'FormItem',
185
- 'x-component': 'FormCollapse',
186
- 'x-component-props': {
187
- formCollapse: '{{formCollapse}}'
188
- },
189
- properties: {
190
- pane1: {
191
- type: 'void',
192
- 'x-component': 'FormCollapse.CollapsePanel',
193
- 'x-component-props': {
194
- header: (0, _locale.lang)('Measures'),
195
- key: 'measures'
196
- },
197
- properties: {
198
- measures: getArraySchema({
199
- field: {
200
- type: 'string',
201
- 'x-decorator': 'FormItem',
202
- 'x-component': 'Cascader',
203
- 'x-component-props': {
204
- placeholder: '{{t("Field")}}',
205
- fieldNames: {
206
- label: 'title',
207
- value: 'name',
208
- children: 'children'
209
- }
210
- },
211
- enum: '{{ fieldOptions }}',
212
- required: true
213
- },
214
- aggregation: {
215
- type: 'string',
216
- 'x-decorator': 'FormItem',
217
- 'x-component': 'Select',
218
- 'x-component-props': {
219
- placeholder: '{{t("Aggregation")}}'
220
- },
221
- enum: [{
222
- label: '{{t("Sum")}}',
223
- value: 'sum'
224
- }, {
225
- label: '{{t("Count")}}',
226
- value: 'count'
227
- }, {
228
- label: '{{t("Avg")}}',
229
- value: 'avg'
230
- }, {
231
- label: '{{t("Max")}}',
232
- value: 'max'
233
- }, {
234
- label: '{{t("Min")}}',
235
- value: 'min'
236
- }]
237
- },
238
- alias: {
239
- type: 'string',
240
- 'x-decorator': 'FormItem',
241
- 'x-component': 'Input',
242
- 'x-component-props': {
243
- placeholder: '{{t("Alias")}}',
244
- style: {
245
- minWidth: '100px'
246
- }
247
- }
248
- }
249
- }, {
250
- required: true,
251
- 'x-component-props': {
252
- style: {
253
- overflow: 'auto'
254
- }
255
- }
256
- })
257
- }
258
- },
259
- pane2: {
260
- type: 'void',
261
- 'x-component': 'FormCollapse.CollapsePanel',
262
- 'x-component-props': {
263
- header: (0, _locale.lang)('Dimensions'),
264
- key: 'dimensions'
265
- },
266
- properties: {
267
- dimensions: getArraySchema({
268
- field: {
269
- type: 'string',
270
- 'x-decorator': 'FormItem',
271
- 'x-component': 'Cascader',
272
- 'x-component-props': {
273
- placeholder: '{{t("Field")}}',
274
- fieldNames: {
275
- label: 'title',
276
- value: 'name',
277
- children: 'children'
278
- }
279
- },
280
- enum: '{{ fieldOptions }}',
281
- required: true
282
- },
283
- format: {
284
- type: 'string',
285
- 'x-decorator': 'FormItem',
286
- 'x-component': 'Select',
287
- 'x-component-props': {
288
- placeholder: '{{t("Format")}}',
289
- style: {
290
- maxWidth: '120px'
291
- }
292
- },
293
- 'x-reactions': '{{ useFormatterOptions }}',
294
- 'x-visible': '{{ $self.dataSource && $self.dataSource.length }}'
295
- },
296
- alias: {
297
- type: 'string',
298
- 'x-decorator': 'FormItem',
299
- 'x-component': 'Input',
300
- 'x-component-props': {
301
- placeholder: '{{t("Alias")}}',
302
- style: {
303
- minWidth: '100px'
304
- }
305
- }
306
- }
307
- }, {
308
- 'x-component-props': {
309
- style: {
310
- overflow: 'auto'
311
- }
312
- }
313
- })
314
- }
315
- },
316
- pane3: {
317
- type: 'void',
318
- 'x-component': 'FormCollapse.CollapsePanel',
319
- 'x-component-props': {
320
- header: (0, _locale.lang)('Filter'),
321
- key: 'filter'
322
- },
323
- properties: {
324
- filter: {
325
- type: 'object',
326
- 'x-decorator': 'FormItem',
327
- 'x-decorator-props': {
328
- style: {
329
- overflow: 'auto'
330
- }
331
- },
332
- 'x-component': 'Filter',
333
- 'x-component-props': {
334
- options: '{{ filterOptions }}'
335
- // dynamicComponent: 'Input',
336
- }
337
- }
338
- }
339
- },
340
-
341
- pane4: {
342
- type: 'void',
343
- 'x-component': 'FormCollapse.CollapsePanel',
344
- 'x-component-props': {
345
- header: (0, _locale.lang)('Sort'),
346
- key: 'sort'
347
- },
348
- properties: {
349
- orders: getArraySchema({
350
- field: {
351
- type: 'string',
352
- 'x-decorator': 'FormItem',
353
- 'x-component': 'Cascader',
354
- 'x-component-props': {
355
- placeholder: '{{t("Field")}}'
356
- },
357
- 'x-reactions': '{{ useOrderOptions }}',
358
- required: true
359
- },
360
- order: {
361
- type: 'string',
362
- 'x-decorator': 'FormItem',
363
- 'x-component': 'Radio.Group',
364
- 'x-component-props': {
365
- defaultValue: 'ASC',
366
- optionType: 'button',
367
- style: {
368
- width: '128px'
369
- }
370
- },
371
- enum: ['ASC', 'DESC']
372
- }
373
- }, {
374
- 'x-reactions': '{{ useOrderReaction }}',
375
- 'x-component-props': {
376
- style: {
377
- overflow: 'auto'
378
- }
379
- }
380
- })
381
- }
382
- }
383
- }
384
- },
385
- limit: {
386
- title: '{{t("Limit")}}',
387
- type: 'number',
388
- 'x-decorator': 'FormItem',
389
- 'x-component': 'InputNumber',
390
- 'x-component-props': {
391
- defaultValue: 2000,
392
- max: 2000,
393
- min: 1,
394
- style: {
395
- width: '100px'
396
- }
397
- }
398
- }
399
- }
400
- },
401
- // sql: {
402
- // type: 'object',
403
- // properties: {
404
- // select: {
405
- // type: 'void',
406
- // 'x-decorator': 'p',
407
- // 'x-component': 'Text',
408
- // 'x-component-props': {
409
- // code: true,
410
- // },
411
- // 'x-content': 'SELECT',
412
- // },
413
- // fields: {
414
- // type: 'string',
415
- // 'x-decorator': 'FormItem',
416
- // 'x-component': 'Input.TextArea',
417
- // 'x-component-props': {
418
- // autoSize: {
419
- // minRows: 2,
420
- // },
421
- // placeholder: 'Fields',
422
- // },
423
- // required: true,
424
- // },
425
- // from: {
426
- // type: 'void',
427
- // 'x-decorator': 'p',
428
- // 'x-component': 'FromSql',
429
- // },
430
- // clauses: {
431
- // type: 'string',
432
- // 'x-decorator': 'FormItem',
433
- // 'x-component': 'Input.TextArea',
434
- // 'x-component-props': {
435
- // autoSize: {
436
- // minRows: 5,
437
- // },
438
- // placeholder: 'Join, Where, Group By, Having, Order By, Limit',
439
- // },
440
- // required: true,
441
- // },
442
- // },
443
- // },
444
- cache: {
445
- type: 'object',
446
- properties: {
447
- enabled: {
448
- type: 'boolean',
449
- title: '{{t("Enable cache")}}',
450
- 'x-decorator': 'FormItem',
451
- 'x-component': 'Switch'
452
- },
453
- ttl: {
454
- type: 'number',
455
- title: '{{t("TTL (second)")}}',
456
- 'x-decorator': 'FormItem',
457
- 'x-component': 'InputNumber',
458
- 'x-component-props': {
459
- defaultValue: 60,
460
- min: 1,
461
- style: {
462
- width: '100px'
463
- }
464
- }
465
- }
466
- }
467
- }
468
- }
469
- }
470
- }
471
- };
472
- exports.querySchema = querySchema;
473
- const transformSchema = {
474
- type: 'void',
475
- properties: {
476
- transform: getArraySchema({
477
- field: {
478
- type: 'string',
479
- 'x-decorator': 'FormItem',
480
- 'x-component': 'Select',
481
- 'x-component-props': {
482
- placeholder: '{{t("Field")}}',
483
- style: {
484
- maxWidth: '100px'
485
- }
486
- },
487
- 'x-reactions': '{{ useChartFields }}'
488
- },
489
- type: {
490
- type: 'string',
491
- 'x-decorator': 'FormItem',
492
- 'x-component': 'Select',
493
- 'x-component-props': {
494
- placeholder: '{{t("Type")}}'
495
- },
496
- 'x-reactions': '{{ useFieldTypeOptions }}'
497
- },
498
- format: {
499
- type: 'string',
500
- 'x-decorator': 'FormItem',
501
- 'x-component': 'Select',
502
- 'x-component-props': {
503
- placeholder: '{{t("Format")}}'
504
- },
505
- 'x-reactions': '{{ useTransformers }}',
506
- 'x-visible': '{{ $self.dataSource && $self.dataSource.length }}'
507
- }
508
- }, {
509
- 'x-decorator-props': {
510
- style: {
511
- width: '50%'
512
- }
513
- }
514
- })
515
- }
516
- };
517
- exports.transformSchema = transformSchema;
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- function _client() {
8
- const data = require("@nocobase/utils/client");
9
- _client = function _client() {
10
- return data;
11
- };
12
- return data;
13
- }
14
- const transformers = {
15
- datetime: {
16
- YYYY: val => (0, _client().dayjs)(val).format('YYYY'),
17
- MM: val => (0, _client().dayjs)(val).format('MM'),
18
- DD: val => (0, _client().dayjs)(val).format('DD'),
19
- 'YYYY-MM': val => (0, _client().dayjs)(val).format('YYYY-MM'),
20
- 'YYYY-MM-DD': val => (0, _client().dayjs)(val).format('YYYY-MM-DD'),
21
- 'YYYY-MM-DD hh:mm': val => (0, _client().dayjs)(val).format('YYYY-MM-DD hh:mm'),
22
- 'YYYY-MM-DD hh:mm:ss': val => (0, _client().dayjs)(val).format('YYYY-MM-DD hh:mm:ss')
23
- },
24
- date: {
25
- YYYY: val => (0, _client().dayjs)(val).format('YYYY'),
26
- MM: val => (0, _client().dayjs)(val).format('MM'),
27
- DD: val => (0, _client().dayjs)(val).format('DD'),
28
- 'YYYY-MM': val => (0, _client().dayjs)(val).format('YYYY-MM'),
29
- 'YYYY-MM-DD': val => (0, _client().dayjs)(val).format('YYYY-MM-DD')
30
- },
31
- time: {
32
- 'hh:mm:ss': val => (0, _client().dayjs)(val).format('hh:mm:ss'),
33
- 'hh:mm': val => (0, _client().dayjs)(val).format('hh:mm'),
34
- hh: val => (0, _client().dayjs)(val).format('hh')
35
- },
36
- number: {
37
- Percent: val => new Intl.NumberFormat('en-US', {
38
- style: 'percent',
39
- minimumFractionDigits: 2,
40
- maximumFractionDigits: 2
41
- }).format(val),
42
- Currency: (val, locale = 'en-US') => {
43
- const currency = {
44
- 'zh-CN': 'CNY',
45
- 'en-US': 'USD',
46
- 'ja-JP': 'JPY',
47
- 'ko-KR': 'KRW',
48
- 'pt-BR': 'BRL',
49
- 'ru-RU': 'RUB',
50
- 'tr-TR': 'TRY',
51
- 'es-ES': 'EUR'
52
- }[locale];
53
- return new Intl.NumberFormat(locale, {
54
- style: 'currency',
55
- currency
56
- }).format(val);
57
- },
58
- Exponential: val => {
59
- var _val;
60
- return (_val = +val) === null || _val === void 0 ? void 0 : _val.toExponential();
61
- },
62
- Abbreviation: (val, locale = 'en-US') => new Intl.NumberFormat(locale, {
63
- notation: 'compact'
64
- }).format(val)
65
- }
66
- };
67
- var _default = transformers;
68
- exports.default = _default;