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

Clean show modal property editor #5436

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 10 additions & 17 deletions packages/survey-creator-core/src/property-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -1289,7 +1282,7 @@ export abstract class PropertyGridEditor implements IPropertyGridEditor {
question,
options
);
if (!surveyPropertyEditor) return null;
if (!surveyPropertyEditor) return;
if (property.type !== "condition") {
surveyPropertyEditor.editSurvey.css = defaultV2Css;
}
Expand Down Expand Up @@ -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 {
Expand Down
Loading