(
model: ComponentModel<AxisBaseOption>,
payload: BaseAxisBreakPayload
)
| 522 | } |
| 523 | |
| 524 | function updateModelAxisBreak( |
| 525 | model: ComponentModel<AxisBaseOption>, |
| 526 | payload: BaseAxisBreakPayload |
| 527 | ): AxisBreakUpdateResult { |
| 528 | const result: AxisBreakUpdateResult = {breaks: []}; |
| 529 | |
| 530 | each(payload.breaks, inputBrk => { |
| 531 | if (!inputBrk) { |
| 532 | return; |
| 533 | } |
| 534 | const breakOption = find( |
| 535 | model.get('breaks', true), |
| 536 | brkOption => getScaleBreakHelper()!.identifyAxisBreak(brkOption, inputBrk) |
| 537 | ); |
| 538 | if (!breakOption) { |
| 539 | if (__DEV__) { |
| 540 | warn(`Can not find axis break by start: ${inputBrk.start}, end: ${inputBrk.end}`); |
| 541 | } |
| 542 | return; |
| 543 | } |
| 544 | const actionType = payload.type; |
| 545 | const old = { |
| 546 | isExpanded: !!breakOption.isExpanded |
| 547 | }; |
| 548 | breakOption.isExpanded = |
| 549 | actionType === AXIS_BREAK_EXPAND_ACTION_TYPE ? true |
| 550 | : actionType === AXIS_BREAK_COLLAPSE_ACTION_TYPE ? false |
| 551 | : actionType === AXIS_BREAK_TOGGLE_ACTION_TYPE ? !breakOption.isExpanded |
| 552 | : breakOption.isExpanded; |
| 553 | result.breaks.push({ |
| 554 | start: breakOption.start, |
| 555 | end: breakOption.end, |
| 556 | isExpanded: !!breakOption.isExpanded, |
| 557 | old, |
| 558 | }); |
| 559 | }); |
| 560 | |
| 561 | return result; |
| 562 | } |
| 563 | |
| 564 | |
| 565 | export function installAxisBreakHelper(): void { |
nothing calls this directly
no test coverage detected
searching dependent graphs…