From 41ef470d6147637e2b478bc0a761655b8fc07160 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 18 Apr 2024 17:51:44 +0200 Subject: [PATCH 1/3] chore: improve some typings --- .../src/property-grid/index.ts | 19 +++++++++++++------ .../src/property-grid/values.ts | 6 +++++- 2 files changed, 18 insertions(+), 7 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..8b628a9080 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -19,7 +19,8 @@ import { PopupBaseViewModel, surveyLocalization, QuestionTextBase, - IDialogOptions + IDialogOptions, + IAction } from "survey-core"; import { editorLocalization, getLocString } from "../editorLocalization"; import { EditableObject } from "../editable-object"; @@ -426,7 +427,7 @@ export class PropertyGridTitleActionsCreator { property: JsonObjectProperty, question: Question, enabled: boolean - ): any { + ): IAction { var setupAction = { id: "property-grid-setup", iconName: property.isArray ? "icon-fast-entry" : "icon-wizard", @@ -439,7 +440,7 @@ export class PropertyGridTitleActionsCreator { }; return setupAction; } - private createPropertyHelpAction(question: Question): any { + private createPropertyHelpAction(question: Question): Action | null { if (!question.description) return null; const action = new Action({ title: "", @@ -661,11 +662,17 @@ export class PropertyJSONGenerator { } return panel; } - private updateQuestionJSONOnSameLine(json: any) { + private updateQuestionJSONOnSameLine(json: any): void { json.titleLocation = "left"; json.minWidth = "50px"; } - private createPanelJSON(category: string, title: string, isChild: boolean): any { + private createPanelJSON(category: string, title: string, isChild: boolean): { + type: "panel", + name: string, + title: string, + elements: [] + state?: "collapsed" + } { const res: any = { type: "panel", name: category, @@ -1553,7 +1560,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 { diff --git a/packages/survey-creator-core/src/property-grid/values.ts b/packages/survey-creator-core/src/property-grid/values.ts index 1c2c61a833..997773a59c 100644 --- a/packages/survey-creator-core/src/property-grid/values.ts +++ b/packages/survey-creator-core/src/property-grid/values.ts @@ -16,7 +16,11 @@ export abstract class PropertyGridValueEditorBase extends PropertyGridEditor { obj: Base, prop: JsonObjectProperty, options: ISurveyCreatorOptions - ): any { + ): { + type: "linkvalue", + showValueInLink: false, + titleLocation: "hidden" + } { return { type: "linkvalue", showValueInLink: false, From 2531d6b04b9217680664e9a46dd1b623b8a6b66f Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Fri, 19 Apr 2024 10:53:22 +0200 Subject: [PATCH 2/3] chore: fix type --- packages/survey-creator-core/src/property-grid/index.ts | 2 +- 1 file changed, 1 insertion(+), 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 8b628a9080..7a7e807556 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -670,7 +670,7 @@ export class PropertyJSONGenerator { type: "panel", name: string, title: string, - elements: [] + elements: Array state?: "collapsed" } { const res: any = { From da6cba15d47e7e0461f7829900081885243c8877 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Wed, 24 Apr 2024 11:02:47 +0200 Subject: [PATCH 3/3] chore: fix eslint warnings --- packages/survey-creator-core/src/property-grid/index.ts | 4 ++-- packages/survey-creator-core/src/property-grid/values.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/survey-creator-core/src/property-grid/index.ts b/packages/survey-creator-core/src/property-grid/index.ts index 7a7e807556..fdac2cbb25 100644 --- a/packages/survey-creator-core/src/property-grid/index.ts +++ b/packages/survey-creator-core/src/property-grid/index.ts @@ -670,8 +670,8 @@ export class PropertyJSONGenerator { type: "panel", name: string, title: string, - elements: Array - state?: "collapsed" + elements: Array, + state?: "collapsed", } { const res: any = { type: "panel", diff --git a/packages/survey-creator-core/src/property-grid/values.ts b/packages/survey-creator-core/src/property-grid/values.ts index 997773a59c..3b807b74b8 100644 --- a/packages/survey-creator-core/src/property-grid/values.ts +++ b/packages/survey-creator-core/src/property-grid/values.ts @@ -19,7 +19,7 @@ export abstract class PropertyGridValueEditorBase extends PropertyGridEditor { ): { type: "linkvalue", showValueInLink: false, - titleLocation: "hidden" + titleLocation: "hidden", } { return { type: "linkvalue",