(
api: ExtensionAPI,
existsEl: Element,
dataIndex: number,
elOption: CustomElementOption,
seriesModel: CustomSeriesModel,
group: ViewRootGroup
)
| 995 | } |
| 996 | |
| 997 | function doCreateOrUpdateEl( |
| 998 | api: ExtensionAPI, |
| 999 | existsEl: Element, |
| 1000 | dataIndex: number, |
| 1001 | elOption: CustomElementOption, |
| 1002 | seriesModel: CustomSeriesModel, |
| 1003 | group: ViewRootGroup |
| 1004 | ): Element { |
| 1005 | |
| 1006 | if (__DEV__) { |
| 1007 | assert(elOption, 'should not have an null/undefined element setting'); |
| 1008 | } |
| 1009 | |
| 1010 | let toBeReplacedIdx = -1; |
| 1011 | const oldEl = existsEl; |
| 1012 | if ( |
| 1013 | existsEl && ( |
| 1014 | doesElNeedRecreate(existsEl, elOption, seriesModel) |
| 1015 | // || ( |
| 1016 | // // PENDING: even in one-to-one mapping case, if el is marked as morph, |
| 1017 | // // do not sure whether the el will be mapped to another el with different |
| 1018 | // // hierarchy in Group tree. So always recreate el rather than reuse the el. |
| 1019 | // morphHelper && morphHelper.isOneToOneFrom(el) |
| 1020 | // ) |
| 1021 | ) |
| 1022 | ) { |
| 1023 | // Should keep at the original index, otherwise "merge by index" will be incorrect. |
| 1024 | toBeReplacedIdx = indexOf(group.childrenRef(), existsEl); |
| 1025 | existsEl = null; |
| 1026 | } |
| 1027 | |
| 1028 | const isInit = !existsEl; |
| 1029 | let el = existsEl; |
| 1030 | |
| 1031 | if (!el) { |
| 1032 | el = createEl(elOption); |
| 1033 | if (oldEl) { |
| 1034 | copyElement(oldEl, el); |
| 1035 | } |
| 1036 | } |
| 1037 | else { |
| 1038 | // FIMXE:NEXT unified clearState? |
| 1039 | // If in some case the performance issue arised, consider |
| 1040 | // do not clearState but update cached normal state directly. |
| 1041 | el.clearStates(); |
| 1042 | } |
| 1043 | |
| 1044 | // Need to set morph: false explictly to disable automatically morphing. |
| 1045 | if ((elOption as CustomBaseZRPathOption).morph === false) { |
| 1046 | (el as ECElement).disableMorphing = true; |
| 1047 | } |
| 1048 | else if ((el as ECElement).disableMorphing) { |
| 1049 | (el as ECElement).disableMorphing = false; |
| 1050 | } |
| 1051 | if (elOption.tooltipDisabled) { |
| 1052 | (el as ECElement).tooltipDisabled = true; |
| 1053 | } |
| 1054 |
no test coverage detected
searching dependent graphs…