75e168b6dbe5bb200943c0baf1f422f85f73dc9a432992563bdd0419069cdac193ee08532e4481697f97b4521481fc2cf94bfff2cf7e6ebdb53069ad39aa35 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { Dictionary } from 'zrender/lib/core/types.js';
  2. import Displayable from 'zrender/lib/graphic/Displayable.js';
  3. import Element, { ElementEvent } from 'zrender/lib/Element.js';
  4. import Model from '../model/Model.js';
  5. import { SeriesDataType, DisplayState, ECElement, BlurScope, InnerFocus, Payload, HighlightPayload, DownplayPayload, ComponentMainType } from './types.js';
  6. import SeriesModel from '../model/Series.js';
  7. import Path from 'zrender/lib/graphic/Path.js';
  8. import GlobalModel from '../model/Global.js';
  9. import ExtensionAPI from '../core/ExtensionAPI.js';
  10. import ComponentModel from '../model/Component.js';
  11. export declare const HOVER_STATE_NORMAL: 0;
  12. export declare const HOVER_STATE_BLUR: 1;
  13. export declare const HOVER_STATE_EMPHASIS: 2;
  14. export declare const SPECIAL_STATES: readonly ["emphasis", "blur", "select"];
  15. export declare const DISPLAY_STATES: readonly ["normal", "emphasis", "blur", "select"];
  16. export declare const Z2_EMPHASIS_LIFT = 10;
  17. export declare const Z2_SELECT_LIFT = 9;
  18. export declare const HIGHLIGHT_ACTION_TYPE = "highlight";
  19. export declare const DOWNPLAY_ACTION_TYPE = "downplay";
  20. export declare const SELECT_ACTION_TYPE = "select";
  21. export declare const UNSELECT_ACTION_TYPE = "unselect";
  22. export declare const TOGGLE_SELECT_ACTION_TYPE = "toggleSelect";
  23. export declare function setStatesFlag(el: ECElement, stateName: DisplayState): void;
  24. /**
  25. * If we reuse elements when rerender.
  26. * DONT forget to clearStates before we update the style and shape.
  27. * Or we may update on the wrong state instead of normal state.
  28. */
  29. export declare function clearStates(el: Element): void;
  30. /**FI
  31. * Set hover style (namely "emphasis style") of element.
  32. * @param el Should not be `zrender/graphic/Group`.
  33. * @param focus 'self' | 'selfInSeries' | 'series'
  34. */
  35. export declare function setDefaultStateProxy(el: Displayable): void;
  36. export declare function enterEmphasisWhenMouseOver(el: Element, e: ElementEvent): void;
  37. export declare function leaveEmphasisWhenMouseOut(el: Element, e: ElementEvent): void;
  38. export declare function enterEmphasis(el: Element, highlightDigit?: number): void;
  39. export declare function leaveEmphasis(el: Element, highlightDigit?: number): void;
  40. export declare function enterBlur(el: Element): void;
  41. export declare function leaveBlur(el: Element): void;
  42. export declare function enterSelect(el: Element): void;
  43. export declare function leaveSelect(el: Element): void;
  44. export declare function allLeaveBlur(api: ExtensionAPI): void;
  45. export declare function blurSeries(targetSeriesIndex: number, focus: InnerFocus, blurScope: BlurScope, api: ExtensionAPI): void;
  46. export declare function blurComponent(componentMainType: ComponentMainType, componentIndex: number, api: ExtensionAPI): void;
  47. export declare function blurSeriesFromHighlightPayload(seriesModel: SeriesModel, payload: HighlightPayload, api: ExtensionAPI): void;
  48. export declare function findComponentHighDownDispatchers(componentMainType: ComponentMainType, componentIndex: number, name: string, api: ExtensionAPI): {
  49. focusSelf: boolean;
  50. dispatchers: Element[];
  51. };
  52. export declare function handleGlobalMouseOverForHighDown(dispatcher: Element, e: ElementEvent, api: ExtensionAPI): void;
  53. export declare function handleGlobalMouseOutForHighDown(dispatcher: Element, e: ElementEvent, api: ExtensionAPI): void;
  54. export declare function toggleSelectionFromPayload(seriesModel: SeriesModel, payload: Payload, api: ExtensionAPI): void;
  55. export declare function updateSeriesElementSelection(seriesModel: SeriesModel): void;
  56. export declare function getAllSelectedIndices(ecModel: GlobalModel): {
  57. seriesIndex: number;
  58. dataType?: SeriesDataType;
  59. dataIndex: number[];
  60. }[];
  61. /**
  62. * Enable the function that mouseover will trigger the emphasis state.
  63. *
  64. * NOTE:
  65. * This function should be used on the element with dataIndex, seriesIndex.
  66. *
  67. */
  68. export declare function enableHoverEmphasis(el: Element, focus?: InnerFocus, blurScope?: BlurScope): void;
  69. export declare function disableHoverEmphasis(el: Element): void;
  70. export declare function toggleHoverEmphasis(el: Element, focus: InnerFocus, blurScope: BlurScope, isDisabled: boolean): void;
  71. export declare function enableHoverFocus(el: Element, focus: InnerFocus, blurScope: BlurScope): void;
  72. /**
  73. * Set emphasis/blur/selected states of element.
  74. */
  75. export declare function setStatesStylesFromModel(el: Displayable, itemModel: Model<Partial<Record<'emphasis' | 'blur' | 'select', any>>>, styleType?: string, // default itemStyle
  76. getter?: (model: Model) => Dictionary<any>): void;
  77. /**
  78. *
  79. * Set element as highlight / downplay dispatcher.
  80. * It will be checked when element recieved mouseover event or from highlight action.
  81. * It's in change of all highlight/downplay behavior of it's children.
  82. *
  83. * @param el
  84. * @param el.highDownSilentOnTouch
  85. * In touch device, mouseover event will be trigger on touchstart event
  86. * (see module:zrender/dom/HandlerProxy). By this mechanism, we can
  87. * conveniently use hoverStyle when tap on touch screen without additional
  88. * code for compatibility.
  89. * But if the chart/component has select feature, which usually also use
  90. * hoverStyle, there might be conflict between 'select-highlight' and
  91. * 'hover-highlight' especially when roam is enabled (see geo for example).
  92. * In this case, `highDownSilentOnTouch` should be used to disable
  93. * hover-highlight on touch device.
  94. * @param asDispatcher If `false`, do not set as "highDownDispatcher".
  95. */
  96. export declare function setAsHighDownDispatcher(el: Element, asDispatcher: boolean): void;
  97. export declare function isHighDownDispatcher(el: Element): boolean;
  98. /**
  99. * Enable component highlight/downplay features:
  100. * + hover link (within the same name)
  101. * + focus blur in component
  102. */
  103. export declare function enableComponentHighDownFeatures(el: Element, componentModel: ComponentModel, componentHighDownName: string): void;
  104. /**
  105. * Support hightlight/downplay record on each elements.
  106. * For the case: hover highlight/downplay (legend, visualMap, ...) and
  107. * user triggerred hightlight/downplay should not conflict.
  108. * Only all of the highlightDigit cleared, return to normal.
  109. * @param {string} highlightKey
  110. * @return {number} highlightDigit
  111. */
  112. export declare function getHighlightDigit(highlightKey: number): number;
  113. export declare function isSelectChangePayload(payload: Payload): boolean;
  114. export declare function isHighDownPayload(payload: Payload): payload is HighlightPayload | DownplayPayload;
  115. export declare function savePathStates(el: Path): void;