Skip to content

Commit

Permalink
Make updates for the Property Grid (#7823)
Browse files Browse the repository at this point in the history
* Make updates for the Property Grid

* Work for new Property Grid

* Work for updated PG

* Fix dynamic panel tests

* Fix markup tests

* Update etalons
  • Loading branch information
RomanTsukanov authored Feb 9, 2024
1 parent 423100b commit 9850f6f
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 48 deletions.
10 changes: 5 additions & 5 deletions src/localization/english.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export var englishStrings = {
chooseFile: "Choose file(s)...",
noFileChosen: "No file chosen",
filePlaceholder: "Drag and drop a file here or click the button below to select a file to upload.",
confirmDelete: "Do you want to delete the record?",
confirmDelete: "Are you sure you want to delete this record?",
keyDuplicationError: "This value should be unique.",
addColumn: "Add Column",
addRow: "Add Row",
Expand Down Expand Up @@ -101,12 +101,12 @@ export var englishStrings = {
modalApplyButtonText: "Apply",
filterStringPlaceholder: "Type to search...",
emptyMessage: "No data to display",
noEntriesText: "There are no entries yet.\nClick the button below to add a new entry.",
noEntriesReadonlyText: "There are no entries.",
noEntriesText: "No entries yet.\nClick the button below to add a new entry.",
noEntriesReadonlyText: "No entries.",
more: "More",
tagboxDoneButtonCaption: "OK",
selectToRankEmptyRankedAreaText: "All choices are ranked",
selectToRankEmptyUnrankedAreaText: "Drag and drop choices here to rank them",
selectToRankEmptyRankedAreaText: "All choices are selected for ranking",
selectToRankEmptyUnrankedAreaText: "Drag choices here to rank them",
ok: "OK",
cancel: "Cancel",
};
Expand Down
2 changes: 1 addition & 1 deletion src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ Serializer.addClass(
{ name: "minWidth", defaultFunc: () => "auto" },
{ name: "maxWidth", defaultFunc: () => settings.maxWidth },
{ name: "innerIndent:number", default: 0, choices: [0, 1, 2, 3] },
{ name: "indent:number", default: 0, choices: [0, 1, 2, 3] },
{ name: "indent:number", default: 0, choices: [0, 1, 2, 3], visible: false },
{
name: "page",
isSerializable: false,
Expand Down
37 changes: 30 additions & 7 deletions src/question_paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ export class QuestionPanelDynamicModel extends Question
.toString();
}
/**
* A text displayed when Dynamic Panel contains no entries. Applies only in the Default V2 theme.
* A text displayed when Dynamic Panel contains no entries.
*/
public get noEntriesText(): string {
return this.getLocalizableStringText("noEntriesText");
Expand Down Expand Up @@ -2372,6 +2372,7 @@ Serializer.addClass(
name: "panelsState",
default: "default",
choices: ["default", "collapsed", "expanded", "firstExpanded"],
visibleIf: (obj: any) => { return obj.renderMode === "list"; }
},
{ name: "keyName" },
{
Expand All @@ -2382,24 +2383,45 @@ Serializer.addClass(
{
name: "confirmDeleteText",
serializationProperty: "locConfirmDeleteText",
visibleIf: (obj: any) => { return obj.confirmDelete; }
},
{
name: "panelAddText",
serializationProperty: "locPanelAddText",
visibleIf: (obj: any) => { return obj.allowAddPanel; }
},
{
name: "panelRemoveText",
serializationProperty: "locPanelRemoveText",
visibleIf: (obj: any) => { return obj.allowRemovePanel; }
},
{
name: "panelPrevText",
serializationProperty: "locPanelPrevText",
visibleIf: (obj: any) => { return obj.renderMode !== "list"; }
},
{
name: "panelNextText",
serializationProperty: "locPanelNextText",
visibleIf: (obj: any) => { return obj.renderMode !== "list"; }
},
{ name: "panelAddText", serializationProperty: "locPanelAddText" },
{ name: "panelRemoveText", serializationProperty: "locPanelRemoveText" },
{ name: "panelPrevText", serializationProperty: "locPanelPrevText" },
{ name: "panelNextText", serializationProperty: "locPanelNextText" },
{
name: "showQuestionNumbers",
default: "off",
choices: ["off", "onPanel", "onSurvey"],
},
{ name: "showRangeInProgress:boolean", default: true },
{
name: "showRangeInProgress:boolean",
default: true,
visibleIf: (obj: any) => { return obj.renderMode !== "list"; }
},
{
name: "renderMode",
default: "list",
choices: ["list", "progressTop", "progressBottom", "progressTopBottom", "tab"],
},
{
name: "tabAlign", default: "center", choices: ["center", "left", "right"],
name: "tabAlign", default: "center", choices: ["left", "center", "right"],
visibleIf: (obj: any) => { return obj.renderMode === "tab"; }
},
{
Expand All @@ -2416,6 +2438,7 @@ Serializer.addClass(
name: "panelRemoveButtonLocation",
default: "bottom",
choices: ["bottom", "right"],
visibleIf: (obj: any) => { return obj.allowRemovePanel; }
},
],
function () {
Expand Down
28 changes: 14 additions & 14 deletions src/question_rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ Serializer.addClass(
default: "labels",
category: "rateValues",
choices: ["labels", "stars", "smileys"],
visibleIndex: 0
visibleIndex: 1
},
{
name: "scaleColorMode",
Expand All @@ -896,7 +896,7 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return obj.rateDisplayMode == "smileys";
},
visibleIndex: 1
visibleIndex: 2
},
{
name: "rateColorMode",
Expand All @@ -906,20 +906,20 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return obj.rateDisplayMode == "smileys" && obj.scaleColorMode == "monochrome";
},
visibleIndex: 2
visibleIndex: 3
},
{
name: "autoGenerate",
category: "rateValues",
default: true,
choices: [true, false],
visibleIndex: 4
visibleIndex: 5
},
{
name: "rateCount:number",
default: 5,
category: "rateValues",
visibleIndex: 3,
visibleIndex: 4,
onSettingValue: (obj: any, val: any): any => {
if (val < 2) return 2;
if (val > settings.ratingMaximumRateValueCount && val > obj.rateValues.length) return settings.ratingMaximumRateValueCount;
Expand All @@ -936,7 +936,7 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return !obj.autoGenerate;
},
visibleIndex: 5
visibleIndex: 6
},
{
name: "rateMin:number", default: 1,
Expand All @@ -946,7 +946,7 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return !!obj.autoGenerate;
},
visibleIndex: 6
visibleIndex: 7
},
{
name: "rateMax:number", default: 5,
Expand All @@ -956,7 +956,7 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return !!obj.autoGenerate;
},
visibleIndex: 7
visibleIndex: 8
},
{
name: "rateStep:number", default: 1, minValue: 0.1,
Expand All @@ -969,39 +969,39 @@ Serializer.addClass(
visibleIf: function (obj: any) {
return !!obj.autoGenerate;
},
visibleIndex: 8
visibleIndex: 9
},
{
name: "minRateDescription",
alternativeName: "mininumRateDescription",
serializationProperty: "locMinRateDescription",
visibleIndex: 17
visibleIndex: 18
},
{
name: "maxRateDescription",
alternativeName: "maximumRateDescription",
serializationProperty: "locMaxRateDescription",
visibleIndex: 18
visibleIndex: 19
},
{
name: "displayRateDescriptionsAsExtremeItems:boolean",
default: false,
visibleIndex: 19,
visibleIndex: 21,
visibleIf: function (obj: any) {
return obj.rateType == "labels";
}
},
{
name: "rateDescriptionLocation",
default: "leftRight",
category: "layout",
choices: ["leftRight", "top", "bottom", "topBottom"],
visibleIndex: 20
},
{
name: "displayMode",
default: "auto",
choices: ["auto", "buttons", "dropdown"],
visibleIndex: 20
visibleIndex: 0
},
{ name: "itemComponent", visible: false,
defaultFunc: (obj: any): any => {
Expand Down
60 changes: 49 additions & 11 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7757,7 +7757,11 @@ Serializer.addClass("survey", [
default: "bottom",
choices: ["none", "top", "bottom", "both"],
},
{ name: "showPrevButton:boolean", default: true },
{
name: "showPrevButton:boolean",
default: true,
visibleIf: (obj: any) => { return obj.showNavigationButtons !== "none"; }
},
{ name: "showTitle:boolean", default: true },
{ name: "showPageTitles:boolean", default: true },
{ name: "showCompletedPage:boolean", default: true },
Expand Down Expand Up @@ -7808,9 +7812,19 @@ Serializer.addClass("survey", [
"requiredQuestions",
"correctQuestions",
],
visibleIf: (obj: any) => { return obj.showProgressBar !== "off"; }
},
{
name: "progressBarShowPageTitles:switch",
category: "navigation",
visibleIf: (obj: any) => { return obj.showProgressBar !== "off" && obj.progressBarType === "pages"; }
},
{
name: "progressBarShowPageNumbers:switch",
default: false,
category: "navigation",
visibleIf: (obj: any) => { return obj.showProgressBar !== "off" && obj.progressBarType === "pages"; }
},
{ name: "progressBarShowPageTitles:switch", category: "navigation" },
{ name: "progressBarShowPageNumbers:switch", default: false, category: "navigation" },
{
name: "showTOC:switch",
default: false
Expand Down Expand Up @@ -7850,12 +7864,36 @@ Serializer.addClass("survey", [
},
{ name: "autoGrowComment:boolean", default: false },
{ name: "allowResizeComment:boolean", default: true },
{ name: "startSurveyText", serializationProperty: "locStartSurveyText" },
{ name: "pagePrevText", serializationProperty: "locPagePrevText" },
{ name: "pageNextText", serializationProperty: "locPageNextText" },
{ name: "completeText", serializationProperty: "locCompleteText" },
{ name: "previewText", serializationProperty: "locPreviewText" },
{ name: "editText", serializationProperty: "locEditText" },
{
name: "startSurveyText",
serializationProperty: "locStartSurveyText",
visibleIf: (obj: any) => { return obj.firstPageIsStarted; }
},
{
name: "pagePrevText",
serializationProperty: "locPagePrevText",
visibleIf: (obj: any) => { return obj.showNavigationButtons !== "none" && obj.showPrevButton; }
},
{
name: "pageNextText",
serializationProperty: "locPageNextText",
visibleIf: (obj: any) => { return obj.showNavigationButtons !== "none"; }
},
{
name: "completeText",
serializationProperty: "locCompleteText",
visibleIf: (obj: any) => { return obj.showNavigationButtons !== "none"; }
},
{
name: "previewText",
serializationProperty: "locPreviewText",
visibleIf: (obj: any) => { return obj.showPreviewBeforeComplete !== "noPreview"; }
},
{
name: "editText",
serializationProperty: "locEditText",
visibleIf: (obj: any) => { return obj.showPreviewBeforeComplete !== "noPreview"; }
},
{ name: "requiredText", default: "*" },
{
name: "questionStartIndex",
Expand Down Expand Up @@ -7887,7 +7925,7 @@ Serializer.addClass("survey", [
{
name: "questionsOnPageMode",
default: "standard",
choices: ["singlePage", "standard", "questionPerPage"],
choices: ["standard", "singlePage", "questionPerPage"],
},
{
name: "showPreviewBeforeComplete",
Expand All @@ -7904,7 +7942,7 @@ Serializer.addClass("survey", [
{
name: "showTimerPanelMode",
default: "all",
choices: ["all", "page", "survey"],
choices: ["page", "survey", "all"],
},
{
name: "widthMode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>
<div class="sv-ranking__container sv-ranking__container--empty sv-ranking__container--to" data-ranking="to-container">
<div class="sv-ranking__container-placeholder">
<span class="sv-string-viewer">Drag and drop choices here to rank them</span>
<span class="sv-string-viewer">Drag choices here to rank them</span>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</div>
<div class="sv-ranking__container sv-ranking__container--empty sv-ranking__container--to" data-ranking="to-container">
<div class="sv-ranking__container-placeholder">
<span class="sv-string-viewer">Drag and drop choices here to rank them</span>
<span class="sv-string-viewer">Drag choices here to rank them</span>
</div>
</div>
</div>
16 changes: 8 additions & 8 deletions tests/question_paneldynamic_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4635,7 +4635,7 @@ QUnit.test("noEntriesText property for panel dynamic", function (assert) {
]
});
question = <QuestionPanelDynamicModel>survey.getQuestionByName("q1");
assert.equal(question.noEntriesText, "There are no entries yet.\nClick the button below to add a new entry.", "noEntriesText default value");
assert.equal(question.noEntriesText, "No entries yet.\nClick the button below to add a new entry.", "noEntriesText default value");
});

QUnit.test("noEntriesReadonlyText property for panel dynamic", function (assert) {
Expand All @@ -4647,11 +4647,11 @@ QUnit.test("noEntriesReadonlyText property for panel dynamic", function (assert)
});
const panel1 = <QuestionPanelDynamicModel>survey.getQuestionByName("panel1");
const panel2 = <QuestionPanelDynamicModel>survey.getQuestionByName("panel2");
assert.equal(panel1.noEntriesText.indexOf("There are no entries yet.\nClick the button below to add a new entry."), 0, "panel1 default");
assert.equal(panel2.noEntriesText.indexOf("There are no entries."), 0, "panel2: text for allowAddPanel false");
assert.equal(panel1.noEntriesText.indexOf("No entries yet.\nClick the button below to add a new entry."), 0, "panel1 default");
assert.equal(panel2.noEntriesText.indexOf("No entries."), 0, "panel2: text for allowAddPanel false");
panel1.allowAddPanel = false;
assert.equal(panel1.noEntriesText.indexOf("There are no entries."), 0, "panel1: text for allowAddPanel false");
assert.equal(panel2.noEntriesText.indexOf("There are no entries."), 0, "panel2: text for allowAddPanel false");
assert.equal(panel1.noEntriesText.indexOf("No entries."), 0, "panel1: text for allowAddPanel false");
assert.equal(panel2.noEntriesText.indexOf("No entries."), 0, "panel2: text for allowAddPanel false");
});

QUnit.test("Question defaultValueExpression in panel dynamic", function(
Expand Down Expand Up @@ -5281,10 +5281,10 @@ QUnit.test("NoentriesText and readOnly", (assert) => {
});
const panel1 = <QuestionPanelDynamicModel>survey.getQuestionByName("panel1");
const panel2 = <QuestionPanelDynamicModel>survey.getQuestionByName("panel2");
assert.equal(panel1.noEntriesText.indexOf("There are no entries yet."), 0, "panel1: text for editing");
assert.equal(panel2.noEntriesText.indexOf("There are no entries."), 0, "panel2: text for readonly");
assert.equal(panel1.noEntriesText.indexOf("No entries yet."), 0, "panel1: text for editing");
assert.equal(panel2.noEntriesText.indexOf("No entries."), 0, "panel2: text for readonly");
survey.mode = "display";
assert.equal(panel1.noEntriesText.indexOf("There are no entries."), 0, "panel1: text for readonly");
assert.equal(panel1.noEntriesText.indexOf("No entries."), 0, "panel1: text for readonly");
});
QUnit.test("Carry forward in panel dynamic", function (assert) {
const survey = new SurveyModel({
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9850f6f

Please sign in to comment.