Skip to content

Commit

Permalink
Rename addRowLocation into addRowButtonLocation (#9257)
Browse files Browse the repository at this point in the history
* Rename addRowLocation into addRowButtonLocation

* Add a deprecation message

---------

Co-authored-by: RomanTsukanov <[email protected]>
  • Loading branch information
andrewtelnov and RomanTsukanov authored Jan 7, 2025
1 parent 6abb35d commit c5d9708
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/survey-core/src/question_matrixdropdownbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
this.registerPropertyChangedHandlers(
[
"transposeData",
"addRowLocation",
"addRowButtonLocation",
"hideColumnsIfEmpty",
"showHeader",
"minRowCount",
Expand Down
20 changes: 15 additions & 5 deletions packages/survey-core/src/question_matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
}
/**
* A caption for the Add Row button.
* @see addRowLocation
* @see addRowButtonLocation
*/
public get addRowText() {
return this.getLocalizableStringText("addRowText", this.defaultAddRowText);
Expand Down Expand Up @@ -741,14 +741,24 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
* Default value: `"top"` if [`transposeData`](#transposeData) is `true`; `"bottom"` if `transposeData` is `false` or the matrix is in compact mode.
* @see addRowText
*/
public get addRowButtonLocation(): string {
return this.getPropertyValue("addRowButtonLocation");
}
public set addRowButtonLocation(val: string) {
this.setPropertyValue("addRowButtonLocation", val);
}
/**
* Obsolete. Use the [`addRowButtonLocation`](https://surveyjs.io/form-library/documentation/api-reference/dynamic-matrix-table-question-model#addRowButtonLocation) property instead.
* @deprecated
*/
public get addRowLocation(): string {
return this.getPropertyValue("addRowLocation");
return this.addRowButtonLocation;
}
public set addRowLocation(val: string) {
this.setPropertyValue("addRowLocation", val);
this.addRowButtonLocation = val;
}
public getAddRowLocation(): string {
return this.addRowLocation;
return this.addRowButtonLocation;
}
/**
* Specifies whether to hide columns when the matrix does not contain any rows. If you enable this property, the matrix displays the `emptyRowsText` message and the Add Row button.
Expand Down Expand Up @@ -1045,7 +1055,7 @@ Serializer.addClass(
serializationProperty: "locConfirmDeleteText",
},
{
name: "addRowLocation",
name: "addRowButtonLocation", alternativeName: "addRowLocation",
default: "default",
choices: ["default", "top", "bottom", "topBottom"],
},
Expand Down
50 changes: 25 additions & 25 deletions packages/survey-core/tests/question_matrixdynamictests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2201,95 +2201,95 @@ QUnit.test("Matrixdynamic allowRemoveRows property", function (assert) {
question.rowCount = 1;
assert.equal(question.canRemoveRows, false, "not question.rowCount > 1");
});
QUnit.test("Matrixdynamic addRowLocation", function (assert) {
QUnit.test("Matrixdynamic addRowButtonLocation", function (assert) {
var question = new QuestionMatrixDynamicModel("matrix");
assert.equal(
question.renderedTable.showAddRowOnTop,
false,
"columnsLocation='horizontal', addRowLocation='default', #1"
"columnsLocation='horizontal', addRowButtonLocation='default', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
true,
"columnsLocation='horizontal', addRowLocation='default', #2"
"columnsLocation='horizontal', addRowButtonLocation='default', #2"
);
question.addRowLocation = "top";
question.addRowButtonLocation = "top";
assert.equal(
question.renderedTable.showAddRowOnTop,
true,
"columnsLocation='horizontal', addRowLocation='top', #1"
"columnsLocation='horizontal', addRowButtonLocation='top', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
false,
"columnsLocation='horizontal', addRowLocation='top', #2"
"columnsLocation='horizontal', addRowButtonLocation='top', #2"
);
question.addRowLocation = "bottom";
question.addRowButtonLocation = "bottom";
assert.equal(
question.renderedTable.showAddRowOnTop,
false,
"columnsLocation='horizontal', addRowLocation='bottom', #1"
"columnsLocation='horizontal', addRowButtonLocation='bottom', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
true,
"columnsLocation='horizontal', addRowLocation='bottom', #2"
"columnsLocation='horizontal', addRowButtonLocation='bottom', #2"
);
question.addRowLocation = "topBottom";
question.addRowButtonLocation = "topBottom";
assert.equal(
question.renderedTable.showAddRowOnTop,
true,
"columnsLocation='horizontal', addRowLocation='topBottom', #1"
"columnsLocation='horizontal', addRowButtonLocation='topBottom', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
true,
"columnsLocation='horizontal', addRowLocation='topBottom', #2"
"columnsLocation='horizontal', addRowButtonLocation='topBottom', #2"
);
question.columnsLocation = "vertical";
question.addRowLocation = "default";
question.addRowButtonLocation = "default";
assert.equal(
question.renderedTable.showAddRowOnTop,
true,
"columnsLocation='vertical', addRowLocation='default', #1"
"columnsLocation='vertical', addRowButtonLocation='default', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
false,
"columnsLocation='vertical', addRowLocation='default', #2"
"columnsLocation='vertical', addRowButtonLocation='default', #2"
);
question.addRowLocation = "top";
question.addRowButtonLocation = "top";
assert.equal(
question.renderedTable.showAddRowOnTop,
true,
"columnsLocation='vertical', addRowLocation='top', #1"
"columnsLocation='vertical', addRowButtonLocation='top', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
false,
"columnsLocation='vertical', addRowLocation='top', #2"
"columnsLocation='vertical', addRowButtonLocation='top', #2"
);
question.addRowLocation = "bottom";
question.addRowButtonLocation = "bottom";
assert.equal(
question.renderedTable.showAddRowOnTop,
false,
"columnsLocation='vertical', addRowLocation='bottom', #1"
"columnsLocation='vertical', addRowButtonLocation='bottom', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
true,
"columnsLocation='vertical', addRowLocation='bottom', #2"
"columnsLocation='vertical', addRowButtonLocation='bottom', #2"
);
question.addRowLocation = "topBottom";
question.addRowButtonLocation = "topBottom";
assert.equal(
question.renderedTable.showAddRowOnTop,
true,
"columnsLocation='vertical', addRowLocation='topBottom', #1"
"columnsLocation='vertical', addRowButtonLocation='topBottom', #1"
);
assert.equal(
question.renderedTable.showAddRowOnBottom,
true,
"columnsLocation='vertical', addRowLocation='topBottom', #2"
"columnsLocation='vertical', addRowButtonLocation='topBottom', #2"
);
});

Expand Down Expand Up @@ -9953,7 +9953,7 @@ QUnit.test("Totals alingment", function (assert) {
amount: 1,
totalPerRow: 2,
},
addRowLocation: "topBottom",
addRowButtonLocation: "topBottom",
addRowText: "Add Coffee",
},
],
Expand Down
2 changes: 1 addition & 1 deletion visualRegressionTests/tests/defaultV2/matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ frameworks.forEach(framework => {
amount: 1,
totalPerRow: 2,
},
addRowLocation: "topBottom",
addRowButtonLocation: "topBottom",
addRowText: "Add Coffee",
},
],
Expand Down

0 comments on commit c5d9708

Please sign in to comment.