提交 7090bceb 编写于 作者: 1 100pah

fix: (1) fix series merge mapping (brought by some previous refactor in 5.0)....

fix: (1) fix series merge mapping (brought by some previous refactor in 5.0). (2) tweak id name type and check.
上级 c5f4ef71
...@@ -366,7 +366,6 @@ function mappingByIndex<T extends MappingExistingItem>( ...@@ -366,7 +366,6 @@ function mappingByIndex<T extends MappingExistingItem>(
newCmptOptions: ComponentOption[], newCmptOptions: ComponentOption[],
brandNew: boolean brandNew: boolean
): void { ): void {
let nextIdx = 0;
each(newCmptOptions, function (cmptOption) { each(newCmptOptions, function (cmptOption) {
if (!cmptOption) { if (!cmptOption) {
return; return;
...@@ -374,6 +373,7 @@ function mappingByIndex<T extends MappingExistingItem>( ...@@ -374,6 +373,7 @@ function mappingByIndex<T extends MappingExistingItem>(
// Find the first place that not mapped by id and not internal component (consider the "hole"). // Find the first place that not mapped by id and not internal component (consider the "hole").
let resultItem; let resultItem;
let nextIdx = 0;
while ( while (
// Be `!resultItem` only when `nextIdx >= result.length`. // Be `!resultItem` only when `nextIdx >= result.length`.
(resultItem = result[nextIdx]) (resultItem = result[nextIdx])
...@@ -518,10 +518,10 @@ function keyExistAndEqual( ...@@ -518,10 +518,10 @@ function keyExistAndEqual(
obj1: { id?: OptionId, name?: OptionName }, obj1: { id?: OptionId, name?: OptionName },
obj2: { id?: OptionId, name?: OptionName } obj2: { id?: OptionId, name?: OptionName }
): boolean { ): boolean {
const key1 = obj1[attr]; const key1 = convertOptionIdName(obj1[attr], null);
const key2 = obj2[attr]; const key2 = convertOptionIdName(obj2[attr], null);
// See `MappingExistingItem`. `id` and `name` trade string equals to number. // See `MappingExistingItem`. `id` and `name` trade string equals to number.
return key1 != null && key2 != null && key1 + '' === key2 + ''; return key1 != null && key2 != null && key1 === key2;
} }
/** /**
...@@ -610,8 +610,8 @@ function determineSubType( ...@@ -610,8 +610,8 @@ function determineSubType(
type BatchItem = { type BatchItem = {
seriesId: string, seriesId: OptionId,
dataIndex: number[] dataIndex: number | number[]
}; };
/** /**
* A helper for removing duplicate items between batchA and batchB, * A helper for removing duplicate items between batchA and batchB,
...@@ -641,7 +641,10 @@ export function compressBatches( ...@@ -641,7 +641,10 @@ export function compressBatches(
function makeMap(sourceBatch: BatchItem[], map: InnerMap, otherMap?: InnerMap): void { function makeMap(sourceBatch: BatchItem[], map: InnerMap, otherMap?: InnerMap): void {
for (let i = 0, len = sourceBatch.length; i < len; i++) { for (let i = 0, len = sourceBatch.length; i < len; i++) {
const seriesId = sourceBatch[i].seriesId; const seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);
if (seriesId == null) {
return;
}
const dataIndices = normalizeToArray(sourceBatch[i].dataIndex); const dataIndices = normalizeToArray(sourceBatch[i].dataIndex);
const otherDataIndices = otherMap && otherMap[seriesId]; const otherDataIndices = otherMap && otherMap[seriesId];
......
...@@ -636,13 +636,13 @@ export interface MediaQuery { ...@@ -636,13 +636,13 @@ export interface MediaQuery {
maxAspectRatio?: number; maxAspectRatio?: number;
}; };
export type MediaUnit = { export type MediaUnit = {
query: MediaQuery, query?: MediaQuery,
option: ECUnitOption option: ECUnitOption
}; };
export type ComponentLayoutMode = { export type ComponentLayoutMode = {
// Only support 'box' now. // Only support 'box' now.
type: 'box', type?: 'box',
ignoreSize?: boolean | boolean[] ignoreSize?: boolean | boolean[]
}; };
/******************* Mixins for Common Option Properties ********************** */ /******************* Mixins for Common Option Properties ********************** */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册