UNPKG

@adaptabletools/adaptable-cjs

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

57 lines (56 loc) 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShortcutApiImpl = void 0; const tslib_1 = require("tslib"); const ShortcutRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ShortcutRedux")); const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants")); const ApiBase_1 = require("./ApiBase"); class ShortcutApiImpl extends ApiBase_1.ApiBase { getShortcutState() { return this.getAdaptableState().Shortcut; } getShortcuts(config) { return (this.handleLayoutAssociatedObjects(this.getShortcutState().Shortcuts, 'Shortcut', config) ?? []); } getShortcutById(id) { return this.getShortcuts().find((shortcut) => shortcut?.Uuid === id); } getActiveShortcuts() { return this.getShortcuts().filter((shortcut) => !shortcut.IsSuspended); } getSuspendedShortcuts() { return this.getShortcuts().filter((shortcut) => shortcut.IsSuspended); } addShortcut(shortcut) { this.addUidToAdaptableObject(shortcut); this.dispatchAction(ShortcutRedux.ShortcutAdd(shortcut)); return this.getShortcutById(shortcut.Uuid); } deleteShortcut(shortcut) { this.dispatchAction(ShortcutRedux.ShortcutDelete(shortcut)); } deleteAllShortcuts() { this.getShortcuts().forEach((s) => { this.deleteShortcut(s); }); } suspendShortcut(shortcut) { this.dispatchAction(ShortcutRedux.ShortcutSuspend(shortcut)); return this.getShortcutById(shortcut.Uuid); } unSuspendShortcut(shortcut) { this.dispatchAction(ShortcutRedux.ShortcutUnSuspend(shortcut)); return this.getShortcutById(shortcut.Uuid); } suspendAllShortcut() { this.dispatchAction(ShortcutRedux.ShortcutSuspendAll()); } unSuspendAllShortcut() { this.dispatchAction(ShortcutRedux.ShortcutUnSuspendAll()); } openShortcutSettingsPanel() { this.showModulePopup(ModuleConstants.ShortcutModuleId); } } exports.ShortcutApiImpl = ShortcutApiImpl;