From 692b0333ecf73131be7bde9ff6d12cef595e6030 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 18 Apr 2024 17:40:35 +0200 Subject: [PATCH 1/3] fix: remove unused return value from showModalPropertyEditor --- .../src/property-grid/index.ts | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/packages/survey-creator-core/src/property-grid/index.ts b/packages/survey-creator-core/src/property-grid/index.ts index 194c577bad..017fa260a6 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -137,7 +137,7 @@ export interface IPropertyGridEditor { property: JsonObjectProperty, question: Question, options: ISurveyCreatorOptions - ) => IPropertyEditorSetup; + ) => void; onCreated?: (obj: Base, question: Question, prop: JsonObjectProperty, options: ISurveyCreatorOptions, propGridDefinition?: ISurveyPropertyGridDefinition) => void; onSetup?: (obj: Base, question: Question, prop: JsonObjectProperty, options: ISurveyCreatorOptions) => void; @@ -408,18 +408,6 @@ export class PropertyGridTitleActionsCreator { } }; } - private showModalPropertyEditor( - editor: IPropertyGridEditor, - property: JsonObjectProperty, - question: Question - ) { - return editor.showModalPropertyEditor( - editor, - property, - question, - this.options - ); - } private createEditorSetupAction( editor: IPropertyGridEditor, @@ -433,8 +421,13 @@ export class PropertyGridTitleActionsCreator { enabled: enabled, title: getLocString("pe.edit"), showTitle: false, - action: () => { - return this.showModalPropertyEditor(editor, property, question); + action() { + editor.showModalPropertyEditor( + editor, + property, + question, + this.options + ); } }; return setupAction; @@ -1281,7 +1274,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { question: Question, options: ISurveyCreatorOptions, onClose?: (reason: "apply" | "cancel") => void - ): IPropertyEditorSetup { + ): void { const obj = (question).obj; const surveyPropertyEditor = editor.createPropertyEditorSetup( obj, @@ -1289,14 +1282,14 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { question, options ); - if (!surveyPropertyEditor) return null; + if (!surveyPropertyEditor) return; if (property.type !== "condition") { surveyPropertyEditor.editSurvey.css = defaultV2Css; } if (question.isReadOnly) { surveyPropertyEditor.editSurvey.mode = "display"; } - if (!settings.showDialog) return surveyPropertyEditor; + if (!settings.showDialog) return; const prevCurrentLocale = surveyLocalization.currentLocale; const locale = editorLocalization.currentLocale; surveyLocalization.currentLocale = locale; @@ -1330,7 +1323,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { surveyLocalization.currentLocale = prevCurrentLocale; this.onModalPropertyEditorShown(editor, property, question, options); options.onPropertyGridShowModalCallback(obj, property, question, surveyPropertyEditor, popupModel); - return surveyPropertyEditor; + return; } protected onModalPropertyEditorShown(editor: IPropertyGridEditor, property: JsonObjectProperty, question: Question, @@ -1553,7 +1546,7 @@ export class PropertyGridEditorNumber extends PropertyGridEditor { if (prop.defaultValue !== undefined) { options.value = prop.defaultValue; } else { - if(!prop.isRequired && options.value === "") { + if (!prop.isRequired && options.value === "") { options.value = undefined; } else { From 795a12747ca9192d5321068e87a6716248cc62b0 Mon Sep 17 00:00:00 2001 From: Andrew Telnov Date: Wed, 24 Apr 2024 12:15:42 +0300 Subject: [PATCH 2/3] Remove unneeded return --- packages/survey-creator-core/src/property-grid/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/survey-creator-core/src/property-grid/index.ts b/packages/survey-creator-core/src/property-grid/index.ts index 017fa260a6..60d11d49e9 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -1323,7 +1323,6 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { surveyLocalization.currentLocale = prevCurrentLocale; this.onModalPropertyEditorShown(editor, property, question, options); options.onPropertyGridShowModalCallback(obj, property, question, surveyPropertyEditor, popupModel); - return; } protected onModalPropertyEditorShown(editor: IPropertyGridEditor, property: JsonObjectProperty, question: Question, From 94532501c5c94d474daceaa999038e2ff14f8bf5 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 25 Apr 2024 17:07:07 +0200 Subject: [PATCH 3/3] fix: only change interface return type --- packages/survey-creator-core/src/property-grid/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/survey-creator-core/src/property-grid/index.ts b/packages/survey-creator-core/src/property-grid/index.ts index 60d11d49e9..b1f5e2bb8c 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -1274,7 +1274,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { question: Question, options: ISurveyCreatorOptions, onClose?: (reason: "apply" | "cancel") => void - ): void { + ): IPropertyEditorSetup { const obj = (question).obj; const surveyPropertyEditor = editor.createPropertyEditorSetup( obj, @@ -1289,7 +1289,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { if (question.isReadOnly) { surveyPropertyEditor.editSurvey.mode = "display"; } - if (!settings.showDialog) return; + if (!settings.showDialog) return surveyPropertyEditor; const prevCurrentLocale = surveyLocalization.currentLocale; const locale = editorLocalization.currentLocale; surveyLocalization.currentLocale = locale; @@ -1323,6 +1323,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor { surveyLocalization.currentLocale = prevCurrentLocale; this.onModalPropertyEditorShown(editor, property, question, options); options.onPropertyGridShowModalCallback(obj, property, question, surveyPropertyEditor, popupModel); + return surveyPropertyEditor; } protected onModalPropertyEditorShown(editor: IPropertyGridEditor, property: JsonObjectProperty, question: Question,