UNPKG

@adaptabletools/adaptable-cjs

Version:

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

78 lines (77 loc) 3.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Fdc3ApiImpl = void 0; const ApiBase_1 = require("./ApiBase"); const Fdc3InternalApi_1 = require("../Internal/Fdc3InternalApi"); const Fdc3Context_1 = require("../../AdaptableState/Common/Fdc3Context"); class Fdc3ApiImpl extends ApiBase_1.ApiBase { constructor(_adaptable) { super(_adaptable); this.internalApi = new Fdc3InternalApi_1.Fdc3InternalApi(_adaptable); } getDesktopAgent() { return this.getFdc3Service().getDesktopAgent(); } buildContextDataFromRow(contextType, rowNode) { return this.internalApi.mapRowToContextData(contextType, rowNode); } buildContextDataForPrimaryKey(contextType, primaryKeyValue) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue); if (!rowNode) { this.logWarn(`No row found for primary key value '${primaryKeyValue}'`); return undefined; } return this.buildContextDataFromRow(contextType, rowNode); } raiseIntentFromPrimaryKey(primaryKeyValue, intent, contextType, appIdentifier) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue); if (!rowNode) { this.logWarn(`No row found for primary key value '${primaryKeyValue}'`); return undefined; } return this.raiseIntentFromRow(rowNode, intent, contextType, appIdentifier); } raiseIntentFromRow(rowNode, intent, contextType, appIdentifier) { const contextData = this.buildContextDataFromRow(contextType, rowNode); return this.getFdc3Service().raiseIntent(intent, contextData, appIdentifier); } raiseIntentForContextFromRow(rowNode, contextType, appIdentifier) { const contextData = this.buildContextDataFromRow(contextType, rowNode); return this.getFdc3Service().raiseIntentForContext(contextData, appIdentifier); } raiseIntentForContextFromPrimaryKey(primaryKeyValue, contextType, appIdentifier) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue); if (!rowNode) { this.logWarn(`No row found for primary key value '${primaryKeyValue}'`); return undefined; } return this.raiseIntentForContextFromRow(rowNode, contextType, appIdentifier); } broadcastFromRow(rowNode, contextType, channel) { const contextData = this.buildContextDataFromRow(contextType, rowNode); return this.getFdc3Service().broadcast(contextData, channel); } broadcastFromPrimaryKey(primaryKeyValue, contextType, channel) { const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue); if (!rowNode) { this.logWarn(`No row found for primary key value '${primaryKeyValue}'`); return undefined; } return this.broadcastFromRow(rowNode, contextType, channel); } getContextLabel(contextType) { return this.isStandardContextType(contextType) ? Fdc3Context_1.ContextConfiguration[contextType]?.label : contextType; } isStandardContextType(contextType) { return this.internalApi.isStandardContextType(contextType); } isStandardIntentType(intentType) { return this.internalApi.isStandardIntentType(intentType); } getFdc3Service() { return this.getAdaptableInternalApi().getFdc3Service(); } } exports.Fdc3ApiImpl = Fdc3ApiImpl;