Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve some typings #5422

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions packages/survey-creator-core/src/property-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {
PopupBaseViewModel,
surveyLocalization,
QuestionTextBase,
IDialogOptions
IDialogOptions,
IAction
} from "survey-core";
import { editorLocalization, getLocString } from "../editorLocalization";
import { EditableObject } from "../editable-object";
Expand Down Expand Up @@ -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",
Expand All @@ -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: "",
Expand Down Expand Up @@ -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: Array<unknown>,
state?: "collapsed",
} {
const res: any = {
type: "panel",
name: category,
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion packages/survey-creator-core/src/property-grid/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading