Skip to content

Commit

Permalink
fix: liquid data is not in object form antvis antvis#6145
Browse files Browse the repository at this point in the history
  • Loading branch information
the-lemonboy committed Jul 23, 2024
1 parent 08c941b commit 33c9f13
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/composition/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepMix, isNumber } from '@antv/util';
import { deepMix } from '@antv/util';

type Adapter<T> = (options: T, ...rest: any[]) => T;

Expand All @@ -16,13 +16,19 @@ export function useOverrideAdaptor<T>(adaptor: Adapter<T>): Adapter<T> {
return (options?, ...rest) => deepMix({}, options, adaptor(options, ...rest));
}

export function isObject(d) {
if (d instanceof Date) return false;
return typeof d === 'object';
}
export function mergeData(
dataDescriptor: any[] | { value: any; [key: string]: any } | number,
dataDescriptor: any[] | { value: any; [key: string]: any },
dataValue: any[],
) {
if (!dataDescriptor) return dataValue;
if (Array.isArray(dataDescriptor)) return dataDescriptor;
if (isNumber(dataDescriptor)) return dataDescriptor;
const { value = dataValue, ...rest } = dataDescriptor;
return { ...rest, value };
if (isObject(dataDescriptor)) {
const { value, ...rest } = dataDescriptor;
return { ...rest, value: dataValue };
}
return dataDescriptor;
}

0 comments on commit 33c9f13

Please sign in to comment.