@elastic/charts
Version:
Elastic-Charts data visualization library
51 lines • 2.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createChartSelectorsFactory = exports.EMPTY_LEGEND_ITEM_LIST = exports.EMPTY_LEGEND_LIST = exports.EMPTY_LEGEND_ITEM_EXTRA_VALUES = exports.EMPTY_TOOLTIP = void 0;
const get_internal_is_intialized_1 = require("./selectors/get_internal_is_intialized");
const get_screenreader_data_1 = require("./selectors/get_screenreader_data");
const constants_1 = require("../common/constants");
exports.EMPTY_TOOLTIP = { header: null, values: [] };
exports.EMPTY_LEGEND_ITEM_EXTRA_VALUES = new Map();
exports.EMPTY_LEGEND_LIST = [];
exports.EMPTY_LEGEND_ITEM_LIST = [];
const EMPTY_DIMENSION = { top: 0, left: 0, width: 0, height: 0 };
const EMPTY_SM_DOMAINS = { smVDomain: [], smHDomain: [] };
const EMPTY_OBJ = {};
const EMPTY_TOOLTIP_VISIBILITY = {
visible: false,
isExternal: false,
displayOnly: false,
isPinnable: false,
};
const createChartSelectorsFactory = (overrides = {}, callbacksCreators = []) => () => {
const callbacks = callbacksCreators.map((cb) => cb());
const chartSelectors = {
isInitialized: () => get_internal_is_intialized_1.InitStatus.SpecNotInitialized,
isBrushAvailable: () => false,
isBrushing: () => false,
isChartEmpty: () => true,
getLegendItems: () => exports.EMPTY_LEGEND_LIST,
getLegendItemsLabels: () => exports.EMPTY_LEGEND_ITEM_LIST,
getLegendExtraValues: () => exports.EMPTY_LEGEND_ITEM_EXTRA_VALUES,
getLongestLegendFormattedValue: () => undefined,
getPointerCursor: () => constants_1.DEFAULT_CSS_CURSOR,
isTooltipVisible: () => EMPTY_TOOLTIP_VISIBILITY,
getTooltipInfo: () => exports.EMPTY_TOOLTIP,
getTooltipAnchor: () => null,
getProjectionContainerArea: () => EMPTY_DIMENSION,
getMainProjectionArea: () => EMPTY_DIMENSION,
getBrushArea: () => null,
getDebugState: () => EMPTY_OBJ,
getChartTypeDescription: () => '',
getScreenReaderData: get_screenreader_data_1.getScreenReaderDataSelector,
getSmallMultiplesDomains: () => EMPTY_SM_DOMAINS,
canDisplayChartTitles: () => true,
...overrides,
eventCallbacks: (state) => {
callbacks.forEach((cb) => cb(state));
},
};
return chartSelectors;
};
exports.createChartSelectorsFactory = createChartSelectorsFactory;
//# sourceMappingURL=chart_selectors.js.map