/** sap.m */ import type Button from 'sap/m/Button'; import type Dialog from 'sap/m/Dialog'; /** sap.ui.core */ import type UI5Element from 'sap/ui/core/Element'; /** sap.ui.base */ import type Event from 'sap/ui/base/Event'; /** sap.ui.model */ import JSONModel from 'sap/ui/model/json/JSONModel'; /** sap.ui.rta */ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring'; /** sap.ui.dt */ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry'; /** sap.ui.fl */ import type { AddTableCellFragmentChangeContentType } from 'sap/ui/fl/Change'; /** sap.ui.layout */ import { type SimpleForm } from 'sap/ui/layout/form'; import { MessageBarType, setApplicationRequiresReload } from '@sap-ux-private/control-property-editor-common'; import { CommunicationService } from '../../cpe/communication-service.js'; import { getResourceModel } from '../../i18n.js'; import Input from 'sap/m/Input'; import ManagedObject from 'sap/ui/base/ManagedObject'; import Control from 'sap/ui/core/Control'; import { ValueState } from 'sap/ui/core/library'; import Change from 'sap/ui/fl/Change'; import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition.js'; import { setAdditionalChangeInfoForChangeFile } from '../../utils/additional-change-info.js'; import { getChangeDefinition } from '../../utils/changes.js'; import { getError } from '../../utils/error.js'; import { sendInfoCenterMessage } from '../../utils/info-center-message.js'; import { getFragments } from '../api-handler.js'; import CommandExecutor from '../command-executor.js'; import ControlUtils from '../control-utils.js'; import { type AddFragmentModel, type AddFragmentOptions } from './AddFragment.controller.js'; import BaseDialog from './BaseDialog.controller.js'; const radix = 10; type AddTableColumnsFragmentsModel = AddFragmentModel & { getProperty(sPath: '/newColumnFragmentName'): string; getProperty(sPath: '/newCellFragmentName'): string; }; const COLUMNS_AGGREGATION = 'columns'; const ITEMS_AGGREGATION = 'items'; const CELLS_AGGREGATION = 'cells'; interface CreateFragmentProps { index: string | number; fragments: { fragmentName: string; targetAggregation: string }[]; } /** * @namespace open.ux.preview.client.adp.controllers */ export default class AddTableColumnFragments extends BaseDialog { constructor( name: string, overlays: UI5Element, rta: RuntimeAuthoring, readonly options: AddFragmentOptions, telemetryData?: QuickActionTelemetryData ) { super(name, telemetryData); this.rta = rta; this.overlays = overlays; this.model = new JSONModel({ title: options.title }); this.commandExecutor = new CommandExecutor(this.rta); } /** * Setups the Dialog and the JSON Model * * @param {Dialog} dialog - Dialog instance */ async setup(dialog: Dialog): Promise { this.dialog = dialog; this.setEscapeHandler(); await this.buildDialogData(); const resourceModel = await getResourceModel('open.ux.preview.client'); this.dialog.setModel(resourceModel, 'i18n'); this.dialog.setModel(this.model); this.dialog.open(); } /** * Handles create button press * * @param event Event */ async onCreateBtnPress(event: Event) { const source = event.getSource