@lingxiteam/ebe-utils 0.1.35 → 0.2.0

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.
@@ -458,14 +458,70 @@ const ReactECharts: LingXiFC<MyReactEChartsProps> = (props, ref) => {
458
458
  obj = {
459
459
  type,
460
460
  ...obj,
461
- data: datasource?.map((j: Record<string, any>) => j[`y${i}`]) || [],
461
+ data:
462
+ datasource?.map((j: Record<string, any>) => {
463
+ if (
464
+ Object.prototype.toString.call(chartColor) ===
465
+ '[object Object]'
466
+ ) {
467
+ if (chartColor.targetVal) {
468
+ const itemStyle = sandBoxSafeRun(chartColor.targetVal, {
469
+ charItem: j,
470
+ });
471
+ if (typeof itemStyle === 'string') {
472
+ return {
473
+ value: j[`y${i}`],
474
+ itemStyle: {
475
+ color: itemStyle,
476
+ },
477
+ };
478
+ }
479
+ if (
480
+ Object.prototype.toString.call(itemStyle) ===
481
+ '[object Object]'
482
+ ) {
483
+ return {
484
+ value: j[`y${i}`],
485
+ itemStyle,
486
+ };
487
+ }
488
+ }
489
+ }
490
+ return j[`y${i}`];
491
+ }) || [],
462
492
  };
463
493
  if (isDataMap) {
464
494
  obj.data =
465
- datasource?.map(
466
- (j: Record<string, any>) =>
467
- j[(transferDataMap as any)[`y${i}`] || `y${i}`],
468
- ) || [];
495
+ datasource?.map((j: Record<string, any>) => {
496
+ if (
497
+ Object.prototype.toString.call(chartColor) ===
498
+ '[object Object]'
499
+ ) {
500
+ if (chartColor.targetVal) {
501
+ const itemStyle = sandBoxSafeRun(chartColor.targetVal, {
502
+ charItem: j,
503
+ });
504
+ if (typeof itemStyle === 'string') {
505
+ return {
506
+ value: j[(transferDataMap as any)[`y${i}`] || `y${i}`],
507
+ itemStyle: {
508
+ color: itemStyle,
509
+ },
510
+ };
511
+ }
512
+ if (
513
+ Object.prototype.toString.call(itemStyle) ===
514
+ '[object Object]'
515
+ ) {
516
+ return {
517
+ value: j[(transferDataMap as any)[`y${i}`] || `y${i}`],
518
+ itemStyle,
519
+ };
520
+ }
521
+ }
522
+ }
523
+ return j[(transferDataMap as any)[`y${i}`] || `y${i}`];
524
+ }) || [];
469
525
  }
470
526
  if (
471
527
  obj.areaStyle?.showColor &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/ebe-utils",
3
- "version": "0.1.35",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -19,7 +19,7 @@
19
19
  "@babel/types": "^7.12.12",
20
20
  "cac": "^6.7.14",
21
21
  "fs-extra": "9.x",
22
- "@lingxiteam/ebe": "0.1.35"
22
+ "@lingxiteam/ebe": "0.2.0"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"