From 146220ca70954c72a9234709a142af1fde044258 Mon Sep 17 00:00:00 2001 From: Oliver Hader <oliver@typo3.org> Date: Wed, 17 Nov 2021 18:56:54 +0100 Subject: [PATCH] [TASK] Streamline FormEngine AJAX TypeScript sources Resolves: #96014 Releases: master Change-Id: Ia6fea96a2af2572f5e2c0115aed99c514a168b8d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72215 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> --- .../FormEngine/Container/FlexFormSectionContainer.ts | 1 + .../FormEngine/InlineRelation/AjaxDispatcher.ts | 4 ++-- .../InlineRelation/InlineResponseInterface.ts | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts index c286daeceebf..1edea9f804bb 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts @@ -151,6 +151,7 @@ class FlexFormSectionContainer { const sectionContainer = document.querySelector(dataset.target); sectionContainer.insertAdjacentElement('beforeend', createdContainer); + // @todo deprecate or remove with TYPO3 v12.0 if (data.scriptCall && data.scriptCall.length > 0) { $.each(data.scriptCall, function (index: number, value: string): void { // eslint-disable-next-line no-eval diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts index 3293d5d3d0aa..fa41e5eb07f6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts @@ -27,7 +27,7 @@ interface Message { message: string; } -interface Response { +export interface AjaxDispatcherResponse { hasErrors: boolean; messages: Message[]; stylesheetFiles: string[]; @@ -93,7 +93,7 @@ export class AjaxDispatcher { return context; } - private processResponse(json: Response): Response { + private processResponse(json: AjaxDispatcherResponse): AjaxDispatcherResponse { if (json.hasErrors) { for (const message of json.messages) { Notification.error(message.title, message.message); diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts index 1c5117649e33..871a36364af6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts @@ -11,11 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -export interface InlineResponseInterface { +import {AjaxDispatcherResponse} from 'TYPO3/CMS/Backend/FormEngine/InlineRelation/AjaxDispatcher'; + +export interface InlineResponseInterface extends AjaxDispatcherResponse{ data: string; - inlineData?: InlineData; - scriptCall?: Array<string>; - stylesheetFiles?: Array<string>; + inlineData: InlineData; + scriptCall: Array<string>; + stylesheetFiles: Array<string>; compilerInput?: CompilerInput, } -- GitLab