UNPKG

@adaptabletools/adaptable-cjs

Version:

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

51 lines (50 loc) 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RowFormApiImpl = void 0; const ApiBase_1 = require("./ApiBase"); const RowFormInternalApi_1 = require("../Internal/RowFormInternalApi"); const PopupRedux_1 = require("../../Redux/ActionsReducers/PopupRedux"); class RowFormApiImpl extends ApiBase_1.ApiBase { constructor(_adaptable) { super(_adaptable); this.internalApi = new RowFormInternalApi_1.RowFormInternalApi(_adaptable); } displayEditRowForm(primaryKey) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKey); if (!rowNode) { this.logWarn(`Cannot edit row: rowNode not found for primaryKey ${primaryKey}`); } const editForm = this.internalApi.buildRowEditForm(rowNode); this.dispatchAction((0, PopupRedux_1.PopupShowForm)({ Id: 'edit_row_form', Form: editForm, // formProps are added to the formContext FormProps: { rowNode, }, })); } displayCreateRowForm() { const createForm = this.internalApi.buildRowCreateForm(); this.dispatchAction((0, PopupRedux_1.PopupShowForm)({ Id: 'create_row_form', Form: createForm, })); } displayCloneRowForm(primaryKey) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKey); if (!rowNode) { this.logWarn(`Can NOT clone row: rowNode not found for primaryKey ${primaryKey}`); } const createForm = this.internalApi.buildRowCreateForm(rowNode); this.dispatchAction((0, PopupRedux_1.PopupShowForm)({ Id: 'create_row_form', Form: createForm, // formProps are added to the formContext FormProps: { clonedRowNode: rowNode, }, })); } } exports.RowFormApiImpl = RowFormApiImpl;