@visactor/vseed 0.1.25 → 0.1.26

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.
@@ -1,3 +1,6 @@
1
1
  import type { Builder } from '../builder';
2
- export declare const getColorItems: (builder: Builder) => string[];
2
+ export declare const getColorItems: (builder: Builder) => {
3
+ id: string;
4
+ alias: string;
5
+ }[];
3
6
  export declare const getColorIdMap: (builder: Builder) => Record<string, string>;
@@ -9,7 +9,10 @@ const getColorItems = (builder)=>{
9
9
  ...prev,
10
10
  ...cur.unfoldInfo.colorIdMap
11
11
  }), {});
12
- return colorItems.map((d)=>colorIdMap[d]);
12
+ return colorItems.map((d)=>({
13
+ id: d,
14
+ alias: colorIdMap[d]
15
+ }));
13
16
  };
14
17
  const getColorIdMap = (builder)=>{
15
18
  const advancedVSeed = builder.advancedVSeed;
@@ -1 +1 @@
1
- {"version":3,"file":"builder/builder/advanced/colorItems.js","sources":["webpack://@visactor/vseed/./src/builder/builder/advanced/colorItems.ts"],"sourcesContent":["import { unique } from 'remeda'\nimport type { Builder } from '../builder'\nimport { isPivotTable, isTable } from 'src/pipeline'\n\nexport const getColorItems = (builder: Builder): string[] => {\n const advancedVSeed = builder.advancedVSeed\n\n if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed)) {\n return []\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n const colorItems = unique(datasetReshapeInfo.flatMap((d) => d.unfoldInfo.colorItems))\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n return colorItems.map((d) => colorIdMap[d])\n}\n\nexport const getColorIdMap = (builder: Builder): Record<string, string> => {\n const advancedVSeed = builder.advancedVSeed\n\n if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed)) {\n return {}\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n return colorIdMap\n}\n"],"names":["getColorItems","builder","advancedVSeed","isTable","isPivotTable","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","getColorIdMap"],"mappings":";;AAIO,MAAMA,gBAAgB,CAACC;IAC5B,MAAMC,gBAAgBD,QAAQ,aAAa;IAE3C,IAAI,CAACC,iBAAiBC,QAAQF,QAAQ,KAAK,KAAKG,aAAaH,QAAQ,KAAK,GACxE,OAAO,EAAE;IAGX,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAC/B,MAAMI,aAAaC,OAAOF,mBAAmB,OAAO,CAAC,CAACG,IAAMA,EAAE,UAAU,CAAC,UAAU;IACnF,MAAMC,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,OAAOL,WAAW,GAAG,CAAC,CAACE,IAAMC,UAAU,CAACD,EAAE;AAC5C;AAEO,MAAMI,gBAAgB,CAACX;IAC5B,MAAMC,gBAAgBD,QAAQ,aAAa;IAE3C,IAAI,CAACC,iBAAiBC,QAAQF,QAAQ,KAAK,KAAKG,aAAaH,QAAQ,KAAK,GACxE,OAAO,CAAC;IAGV,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAC/B,MAAMO,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,OAAOF;AACT"}
1
+ {"version":3,"file":"builder/builder/advanced/colorItems.js","sources":["webpack://@visactor/vseed/./src/builder/builder/advanced/colorItems.ts"],"sourcesContent":["import { unique } from 'remeda'\nimport type { Builder } from '../builder'\nimport { isPivotTable, isTable } from 'src/pipeline'\n\nexport const getColorItems = (builder: Builder): { id: string; alias: string }[] => {\n const advancedVSeed = builder.advancedVSeed\n\n if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed)) {\n return []\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n const colorItems = unique(datasetReshapeInfo.flatMap((d) => d.unfoldInfo.colorItems))\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n return colorItems.map((d) => ({\n id: d,\n alias: colorIdMap[d],\n }))\n}\n\nexport const getColorIdMap = (builder: Builder): Record<string, string> => {\n const advancedVSeed = builder.advancedVSeed\n\n if (!advancedVSeed || isTable(builder.vseed) || isPivotTable(builder.vseed)) {\n return {}\n }\n\n const { datasetReshapeInfo } = advancedVSeed\n const colorIdMap = datasetReshapeInfo.reduce<Record<string, string>>((prev, cur) => {\n return { ...prev, ...cur.unfoldInfo.colorIdMap }\n }, {})\n\n return colorIdMap\n}\n"],"names":["getColorItems","builder","advancedVSeed","isTable","isPivotTable","datasetReshapeInfo","colorItems","unique","d","colorIdMap","prev","cur","getColorIdMap"],"mappings":";;AAIO,MAAMA,gBAAgB,CAACC;IAC5B,MAAMC,gBAAgBD,QAAQ,aAAa;IAE3C,IAAI,CAACC,iBAAiBC,QAAQF,QAAQ,KAAK,KAAKG,aAAaH,QAAQ,KAAK,GACxE,OAAO,EAAE;IAGX,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAC/B,MAAMI,aAAaC,OAAOF,mBAAmB,OAAO,CAAC,CAACG,IAAMA,EAAE,UAAU,CAAC,UAAU;IACnF,MAAMC,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,OAAOL,WAAW,GAAG,CAAC,CAACE,IAAO;YAC5B,IAAIA;YACJ,OAAOC,UAAU,CAACD,EAAE;QACtB;AACF;AAEO,MAAMI,gBAAgB,CAACX;IAC5B,MAAMC,gBAAgBD,QAAQ,aAAa;IAE3C,IAAI,CAACC,iBAAiBC,QAAQF,QAAQ,KAAK,KAAKG,aAAaH,QAAQ,KAAK,GACxE,OAAO,CAAC;IAGV,MAAM,EAAEI,kBAAkB,EAAE,GAAGH;IAC/B,MAAMO,aAAaJ,mBAAmB,MAAM,CAAyB,CAACK,MAAMC,MACnE;YAAE,GAAGD,IAAI;YAAE,GAAGC,IAAI,UAAU,CAAC,UAAU;QAAC,IAC9C,CAAC;IAEJ,OAAOF;AACT"}
@@ -25,7 +25,10 @@ export declare class Builder implements VSeedBuilder {
25
25
  * @description 获取颜色项, 颜色项可以重复,
26
26
  * @returns 颜色项
27
27
  */
28
- getColorItems: () => string[];
28
+ getColorItems: () => {
29
+ id: string;
30
+ alias: string;
31
+ }[];
29
32
  /**
30
33
  * @description 获取颜色id映射
31
34
  * @returns 颜色id映射
@@ -11,7 +11,10 @@ export declare abstract class VSeedBuilder {
11
11
  static getSpecPipeline: (chartType: ChartType) => SpecPipeline;
12
12
  static getTheme: (themeKey: string) => CustomThemeConfig;
13
13
  static getThemeMap: () => Record<string, CustomThemeConfig>;
14
- abstract getColorItems: () => string[];
14
+ abstract getColorItems: () => {
15
+ id: string;
16
+ alias: string;
17
+ }[];
15
18
  abstract getColorIdMap: () => Record<string, string>;
16
19
  abstract get spec(): Spec | null;
17
20
  abstract set spec(value: Spec | null);
@@ -1 +1 @@
1
- {"version":3,"file":"types/builder/builder.js","sources":["webpack://@visactor/vseed/./src/types/builder/builder.ts"],"sourcesContent":["import type { Spec } from 'src/types'\nimport type { ChartType, CustomThemeConfig } from '../properties'\nimport type { VSeed } from '../vseed'\nimport type { AdvancedPipeline, SpecPipeline } from '../pipeline'\nimport type { AdvancedVSeed } from '../advancedVSeed'\n\nexport abstract class VSeedBuilder {\n abstract build: () => Spec\n abstract buildAdvanced: () => AdvancedVSeed | null\n abstract buildSpec: (advancedVSeed: AdvancedVSeed) => Spec\n\n static getAdvancedPipeline: (chartType: ChartType) => AdvancedPipeline\n static getSpecPipeline: (chartType: ChartType) => SpecPipeline\n static getTheme: (themeKey: string) => CustomThemeConfig\n static getThemeMap: () => Record<string, CustomThemeConfig>\n\n abstract getColorItems: () => string[]\n abstract getColorIdMap: () => Record<string, string>\n\n abstract get spec(): Spec | null\n abstract set spec(value: Spec | null)\n abstract get vseed(): VSeed\n abstract set vseed(value: VSeed)\n abstract get advancedVSeed(): AdvancedVSeed | null\n abstract set advancedVSeed(value: AdvancedVSeed | null)\n}\n"],"names":["VSeedBuilder"],"mappings":"AAMO,MAAeA;IAKpB,OAAO,oBAA+D;IACtE,OAAO,gBAAuD;IAC9D,OAAO,SAAiD;IACxD,OAAO,YAAoD;AAW7D"}
1
+ {"version":3,"file":"types/builder/builder.js","sources":["webpack://@visactor/vseed/./src/types/builder/builder.ts"],"sourcesContent":["import type { Spec } from 'src/types'\nimport type { ChartType, CustomThemeConfig } from '../properties'\nimport type { VSeed } from '../vseed'\nimport type { AdvancedPipeline, SpecPipeline } from '../pipeline'\nimport type { AdvancedVSeed } from '../advancedVSeed'\n\nexport abstract class VSeedBuilder {\n abstract build: () => Spec\n abstract buildAdvanced: () => AdvancedVSeed | null\n abstract buildSpec: (advancedVSeed: AdvancedVSeed) => Spec\n\n static getAdvancedPipeline: (chartType: ChartType) => AdvancedPipeline\n static getSpecPipeline: (chartType: ChartType) => SpecPipeline\n static getTheme: (themeKey: string) => CustomThemeConfig\n static getThemeMap: () => Record<string, CustomThemeConfig>\n\n abstract getColorItems: () => { id: string; alias: string }[]\n abstract getColorIdMap: () => Record<string, string>\n\n abstract get spec(): Spec | null\n abstract set spec(value: Spec | null)\n abstract get vseed(): VSeed\n abstract set vseed(value: VSeed)\n abstract get advancedVSeed(): AdvancedVSeed | null\n abstract set advancedVSeed(value: AdvancedVSeed | null)\n}\n"],"names":["VSeedBuilder"],"mappings":"AAMO,MAAeA;IAKpB,OAAO,oBAA+D;IACtE,OAAO,gBAAuD;IAC9D,OAAO,SAAiD;IACxD,OAAO,YAAoD;AAW7D"}
package/dist/umd/index.js CHANGED
@@ -611,7 +611,10 @@
611
611
  ...prev,
612
612
  ...cur.unfoldInfo.colorIdMap
613
613
  }), {});
614
- return colorItems.map((d)=>colorIdMap[d]);
614
+ return colorItems.map((d)=>({
615
+ id: d,
616
+ alias: colorIdMap[d]
617
+ }));
615
618
  };
616
619
  const getColorIdMap = (builder)=>{
617
620
  const advancedVSeed = builder.advancedVSeed;