@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
67 lines (66 loc) • 2.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolPanelApiImpl = void 0;
const tslib_1 = require("tslib");
const ApiBase_1 = require("./ApiBase");
const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
const ToolPanelRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ToolPanelRedux"));
const ToolPanelRedux_1 = require("../../Redux/ActionsReducers/ToolPanelRedux");
class ToolPanelApiImpl extends ApiBase_1.ApiBase {
getToolPanelState() {
return this.getAdaptableState().ToolPanel;
}
showToolPanelPopup() {
this.showModulePopup(ModuleConstants.ToolPanelModuleId);
}
openAdapTableToolPanel() {
const agGridApi = this.getAgGridApi();
if (agGridApi) {
agGridApi.openToolPanel('adaptable');
}
}
closeAdapTableToolPanel() {
const agGridApi = this.getAgGridApi();
if (agGridApi) {
agGridApi.closeToolPanel();
}
}
getCustomToolPanels() {
return this.getToolPanelOptions().customToolPanels ?? [];
}
getCustomToolPanelButtons() {
return this.getToolPanelOptions().customButtons ?? [];
}
getCustomToolPanelByName(name) {
return this.getCustomToolPanels().find((customToolPanel) => customToolPanel.name === name);
}
setAdaptableToolPanelVisibilityMode(adaptableToolPanel, visibilityMode) {
if (visibilityMode === 'expanded') {
this.setExpandedToolPanelVisibility(adaptableToolPanel);
}
else {
this.setCollapsedToolPanelVisibility(adaptableToolPanel);
}
}
setCustomToolPanelVisibilityMode(customToolPanelName, visibilityMode) {
if (visibilityMode === 'expanded') {
this.setExpandedToolPanelVisibility(customToolPanelName);
}
else {
this.setCollapsedToolPanelVisibility(customToolPanelName);
}
}
setModuleButtons(moduleButtons) {
this.dispatchAction((0, ToolPanelRedux_1.ToolPanelSetModuleButtons)(moduleButtons));
}
getModuleButtons() {
return this.getToolPanelState()?.ModuleButtons ?? [];
}
setExpandedToolPanelVisibility(toolPanelName) {
this.dispatchAction(ToolPanelRedux.ToolPanelExpandToolPanel(toolPanelName));
}
setCollapsedToolPanelVisibility(toolPanelName) {
this.dispatchAction(ToolPanelRedux.ToolPanelCollapseToolPanel(toolPanelName));
}
}
exports.ToolPanelApiImpl = ToolPanelApiImpl;