@visactor/vseed 0.0.35 → 0.0.36

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.
@@ -150,8 +150,34 @@ export interface DualAxis {
150
150
  * @description 提示信息配置, 用于定义图表的提示信息, 包括提示信息的位置, 格式, 样式等.
151
151
  */
152
152
  tooltip?: Tooltip;
153
+ /**
154
+ * 垂直提示框
155
+ * @description 垂直提示框配置, 用于定义图表的垂直提示框, 包括垂直提示框的颜色、标签样式等.
156
+ */
153
157
  crosshairRect?: CrosshairRect;
158
+ /**
159
+ * @description X轴排序配置, 支持根据维度或指标排序, 以及自定义排序顺序
160
+ * @example
161
+ * sort: {
162
+ * orderBy: 'profit',
163
+ * order: 'asc',
164
+ * }
165
+ * sort: {
166
+ * customOrder:['2019', '2020', '2021']
167
+ * }
168
+ */
154
169
  sort?: Sort;
170
+ /**
171
+ * @description 图例排序配置, 支持根据维度或指标排序, 以及自定义排序顺序
172
+ * @example
173
+ * sortLegend: {
174
+ * orderBy: 'profit',
175
+ * order: 'asc',
176
+ * }
177
+ * sortLegend: {
178
+ * customOrder:['2019', '2020', '2021']
179
+ * }
180
+ */
155
181
  sortLegend?: SortLegend;
156
182
  /**
157
183
  * @description 图表的主题, 主题是优先级较低的功能配置, 包含所有图表类型共用的通用配置, 与单类图表类型共用的图表配置, 内置light与dark两种主题, 用户可以通过Builder自定义主题
@@ -161,9 +187,41 @@ export interface DualAxis {
161
187
  * @example 'customThemeName'
162
188
  */
163
189
  theme?: Theme;
190
+ /**
191
+ * 矩形图元样式
192
+ * @description 条形图样式配置, 用于定义图表的条形图样式, 包括条形图的颜色, 边框, 圆角等.
193
+ * 支持全局样式或条件样式配置
194
+ * 数据筛选器
195
+ * 若配置selector, 提供数值 selector, 局部数据 selector, 条件维度 selector, 条件指标 selector 共四类数据匹配能力
196
+ * 若未配置selector, 则样式全局生效.
197
+ */
164
198
  barStyle?: BarStyle | BarStyle[];
199
+ /**
200
+ * 线图元样式
201
+ * @description 线图元样式配置, 用于定义图表的线图元样式, 包括线图元的颜色, 透明度, 曲线等.
202
+ * 支持全局样式或条件样式配置
203
+ * 数据筛选器
204
+ * 若配置selector, 提供数值 selector, 局部数据 selector, 条件维度 selector, 条件指标 selector 共四类数据匹配能力
205
+ * 若未配置selector, 则样式全局生效.
206
+ */
165
207
  lineStyle?: LineStyle | LineStyle[];
208
+ /**
209
+ * 点图元样式
210
+ * @description 点图元样式配置, 用于定义图表的点图元样式, 包括点图元的颜色, 边框等.
211
+ * 支持全局样式或条件样式配置
212
+ * 数据筛选器
213
+ * 若配置selector, 提供数值 selector, 局部数据 selector, 条件维度 selector, 条件指标 selector 共四类数据匹配能力
214
+ * 若未配置selector, 则样式全局生效.
215
+ */
166
216
  pointStyle?: PointStyle | PointStyle[];
217
+ /**
218
+ * 面积图元样式
219
+ * @description 面积图元样式配置, 用于定义图表的面积图元样式, 包括面积图元的颜色, 透明度, 边框等.
220
+ * 支持全局样式或条件样式配置
221
+ * 数据筛选器
222
+ * 若配置selector, 提供数值 selector, 局部数据 selector, 条件维度 selector, 条件指标 selector 共四类数据匹配能力
223
+ * 若未配置selector, 则样式全局生效.
224
+ */
167
225
  areaStyle?: AreaStyle | AreaStyle[];
168
226
  /**
169
227
  * @description 标注点配置, 根据选择的数据, 定义图表的标注点, 包括标注点的位置, 格式, 样式等.
@@ -117,7 +117,6 @@ export declare const zDualAxis: z.ZodObject<{
117
117
  }>>>;
118
118
  }, z.core.$strip>>>;
119
119
  }, z.core.$strip>]>>;
120
- primaryAlias: z.ZodOptional<z.ZodString>;
121
120
  secondaryMeasures: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
122
121
  id: z.ZodString;
123
122
  alias: z.ZodOptional<z.ZodString>;
@@ -187,7 +186,6 @@ export declare const zDualAxis: z.ZodObject<{
187
186
  }>>>;
188
187
  }, z.core.$strip>>>;
189
188
  }, z.core.$strip>]>>;
190
- secondaryAlias: z.ZodOptional<z.ZodString>;
191
189
  }, z.core.$strip>>>;
192
190
  dualChartType: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
193
191
  primary: z.ZodDefault<z.ZodEnum<{
@@ -45,7 +45,7 @@ export type Axis = {
45
45
  */
46
46
  inverse?: boolean;
47
47
  /**
48
- * 是否在坐标轴上显示 0 值,
48
+ * 是否在坐标轴上强制显示 0 值,
49
49
  * @description 当配置了 min 和 max, 该配置项失效, 仅对数值轴生效
50
50
  * @default true
51
51
  * @example true
@@ -1,8 +1,6 @@
1
1
  import type { Measure } from './measures';
2
2
  export type DualMeasure = {
3
- primaryAlias?: string;
4
3
  primaryMeasures?: Measure | Measure[];
5
- secondaryAlias?: string;
6
4
  secondaryMeasures?: Measure | Measure[];
7
5
  };
8
6
  export type DualMeasures = DualMeasure[];
@@ -70,7 +70,6 @@ export declare const zDualMeasure: z.ZodObject<{
70
70
  }>>>;
71
71
  }, z.core.$strip>>>;
72
72
  }, z.core.$strip>]>>;
73
- primaryAlias: z.ZodOptional<z.ZodString>;
74
73
  secondaryMeasures: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
75
74
  id: z.ZodString;
76
75
  alias: z.ZodOptional<z.ZodString>;
@@ -140,7 +139,6 @@ export declare const zDualMeasure: z.ZodObject<{
140
139
  }>>>;
141
140
  }, z.core.$strip>>>;
142
141
  }, z.core.$strip>]>>;
143
- secondaryAlias: z.ZodOptional<z.ZodString>;
144
142
  }, z.core.$strip>;
145
143
  export declare const zDualMeasures: z.ZodArray<z.ZodObject<{
146
144
  id: z.ZodString;
@@ -213,7 +211,6 @@ export declare const zDualMeasures: z.ZodArray<z.ZodObject<{
213
211
  }>>>;
214
212
  }, z.core.$strip>>>;
215
213
  }, z.core.$strip>]>>;
216
- primaryAlias: z.ZodOptional<z.ZodString>;
217
214
  secondaryMeasures: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
218
215
  id: z.ZodString;
219
216
  alias: z.ZodOptional<z.ZodString>;
@@ -283,5 +280,4 @@ export declare const zDualMeasures: z.ZodArray<z.ZodObject<{
283
280
  }>>>;
284
281
  }, z.core.$strip>>>;
285
282
  }, z.core.$strip>]>>;
286
- secondaryAlias: z.ZodOptional<z.ZodString>;
287
283
  }, z.core.$strip>>;
@@ -14294,7 +14294,6 @@ export declare const zVSeed: z.ZodDiscriminatedUnion<[z.ZodObject<{
14294
14294
  }>>>;
14295
14295
  }, z.core.$strip>>>;
14296
14296
  }, z.core.$strip>]>>;
14297
- primaryAlias: z.ZodOptional<z.ZodString>;
14298
14297
  secondaryMeasures: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
14299
14298
  id: z.ZodString;
14300
14299
  alias: z.ZodOptional<z.ZodString>;
@@ -14364,7 +14363,6 @@ export declare const zVSeed: z.ZodDiscriminatedUnion<[z.ZodObject<{
14364
14363
  }>>>;
14365
14364
  }, z.core.$strip>>>;
14366
14365
  }, z.core.$strip>]>>;
14367
- secondaryAlias: z.ZodOptional<z.ZodString>;
14368
14366
  }, z.core.$strip>>>;
14369
14367
  dualChartType: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
14370
14368
  primary: z.ZodDefault<z.ZodEnum<{
package/dist/umd/index.js CHANGED
@@ -667,6 +667,16 @@
667
667
  for (let [e, c] of n.entries())r[e] = chunk_BCBB46UE_u(c, o, t);
668
668
  return r;
669
669
  }
670
+ function chunk_NMC53JVB_o(e) {
671
+ return "object" == typeof e && null !== e;
672
+ }
673
+ function chunk_5S4PYKVY_t(...e) {
674
+ return chunk_WIMGWYZL_u(chunk_5S4PYKVY_u, e);
675
+ }
676
+ var chunk_5S4PYKVY_u = (e, o)=>({
677
+ ...e,
678
+ ...o
679
+ });
670
680
  const theme_theme = (advancedVSeed, context)=>{
671
681
  const { customTheme, vseed } = context;
672
682
  const { theme = 'light', chartType } = vseed;
@@ -678,6 +688,10 @@
678
688
  if (chartConfigTheme) {
679
689
  const chartConfig = result.config?.[chartType] || {};
680
690
  const mergedConfig = D(chartConfigTheme, chunk_BCBB46UE_d(chartConfig));
691
+ for(const _k in mergedConfig){
692
+ const key = _k;
693
+ if (Array.isArray(mergedConfig[key])) mergedConfig[key] = mergeArray(mergedConfig[key], chartConfigTheme[key]);
694
+ }
681
695
  result.config = {
682
696
  [chartType]: mergedConfig
683
697
  };
@@ -690,6 +704,11 @@
690
704
  };
691
705
  return result;
692
706
  };
707
+ const mergeArray = (arr, themeItem)=>{
708
+ if (!Array.isArray(arr)) return arr;
709
+ if (arr.some((d)=>!chunk_NMC53JVB_o(d))) return arr;
710
+ return arr.map((item)=>chunk_5S4PYKVY_t(themeItem, item));
711
+ };
693
712
  const tableAdvancedPipeline = [
694
713
  initAdvancedVSeed,
695
714
  autoMeasures,
@@ -4467,7 +4486,7 @@
4467
4486
  label: {
4468
4487
  visible: label?.visible,
4469
4488
  flush: true,
4470
- containerAlign: 'left',
4489
+ containerAlign: 'right',
4471
4490
  space: 8,
4472
4491
  style: {
4473
4492
  maxLineWidth: labelAutoLimitLength,
@@ -6003,15 +6022,18 @@
6003
6022
  };
6004
6023
  const dualMeasuresToMeasureTree = (dualMeasures)=>{
6005
6024
  const measureTree = dualMeasures.map((item, index)=>{
6006
- const { primaryMeasures, secondaryMeasures, primaryAlias, secondaryAlias } = item;
6025
+ const { primaryMeasures, secondaryMeasures } = item;
6007
6026
  const groupChildren = [];
6027
+ let id = '';
6008
6028
  if (primaryMeasures) {
6009
6029
  const arrPrimaryMeasures = Array.isArray(primaryMeasures) ? primaryMeasures : [
6010
6030
  primaryMeasures
6011
6031
  ];
6032
+ const alias = arrPrimaryMeasures.map((item)=>item.alias || item.id).toString();
6033
+ id += alias;
6012
6034
  groupChildren.push({
6013
6035
  id: `${index}-primary`,
6014
- alias: primaryAlias || arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
6036
+ alias: arrPrimaryMeasures.map((item)=>item.alias || item.id).toString(),
6015
6037
  children: arrPrimaryMeasures
6016
6038
  });
6017
6039
  }
@@ -6019,17 +6041,14 @@
6019
6041
  const arrSecondaryMeasures = Array.isArray(secondaryMeasures) ? secondaryMeasures : [
6020
6042
  secondaryMeasures
6021
6043
  ];
6044
+ const alias = arrSecondaryMeasures.map((item)=>item.alias || item.id).toString();
6045
+ id += alias;
6022
6046
  groupChildren.push({
6023
6047
  id: `${index}-secondary`,
6024
- alias: secondaryAlias || arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
6048
+ alias: arrSecondaryMeasures.map((item)=>item.alias || item.id).toString(),
6025
6049
  children: arrSecondaryMeasures
6026
6050
  });
6027
6051
  }
6028
- const id = [
6029
- primaryAlias,
6030
- secondaryAlias,
6031
- index
6032
- ].filter((d)=>!chunk_JK3VNB42_n(d)).join('-');
6033
6052
  return {
6034
6053
  id,
6035
6054
  alias: id,
@@ -6503,7 +6522,9 @@
6503
6522
  const { advancedVSeed, vseed } = context;
6504
6523
  const { chartType } = vseed;
6505
6524
  const { locale, datasetReshapeInfo } = advancedVSeed;
6506
- const config = advancedVSeed.config?.[chartType]?.primaryYAxis;
6525
+ const index = datasetReshapeInfo[0].index;
6526
+ const primaryYAxis = advancedVSeed.config?.[chartType]?.primaryYAxis;
6527
+ const config = Array.isArray(primaryYAxis) ? primaryYAxis[index] || primaryYAxis[0] : primaryYAxis;
6507
6528
  if (datasetReshapeInfo[0].foldInfoList?.[0] && chunk_VCYTMP4D_n(datasetReshapeInfo[0].foldInfoList[0].foldMap)) return result;
6508
6529
  const id = `${datasetReshapeInfo[0].id}-primary-axis`;
6509
6530
  const seriesId = `${datasetReshapeInfo[0].id}-primary-series`;
@@ -6602,7 +6623,9 @@
6602
6623
  const { advancedVSeed, vseed } = context;
6603
6624
  const { chartType } = vseed;
6604
6625
  const { locale, datasetReshapeInfo } = advancedVSeed;
6605
- const config = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6626
+ const index = datasetReshapeInfo[0].index;
6627
+ const secondaryYAxis = advancedVSeed.config?.[chartType]?.secondaryYAxis;
6628
+ const config = Array.isArray(secondaryYAxis) ? secondaryYAxis[index] || secondaryYAxis[0] : secondaryYAxis;
6606
6629
  if (chunk_JK3VNB42_n(datasetReshapeInfo[0].foldInfoList?.[1])) return result;
6607
6630
  const id = `${datasetReshapeInfo[0].id}-secondary-axis`;
6608
6631
  const seriesId = `${datasetReshapeInfo[0].id}-secondary-series`;
@@ -12068,9 +12091,7 @@
12068
12091
  const zDualMeasure = schemas_object({
12069
12092
  id: schemas_string(),
12070
12093
  primaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12071
- primaryAlias: schemas_string().optional(),
12072
- secondaryMeasures: schemas_array(zMeasure).or(zMeasure).optional(),
12073
- secondaryAlias: schemas_string().optional()
12094
+ secondaryMeasures: schemas_array(zMeasure).or(zMeasure).optional()
12074
12095
  });
12075
12096
  const zDualMeasures = schemas_array(zDualMeasure);
12076
12097
  const zFoldInfo = schemas_object({