From 658a5d8b5529c3f942e81bd4851aa7ac9dd483a8 Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Fri, 27 Dec 2024 18:42:58 +0300 Subject: [PATCH] #6336 SurveyCreator: Rename `maximum...` properties Fixes #6336 --- .../survey-creator-core/src/creator-base.ts | 52 ++++++++++++++----- .../src/creator-options.ts | 39 ++++++++++---- .../src/creator-settings.ts | 5 ++ 3 files changed, 74 insertions(+), 22 deletions(-) diff --git a/packages/survey-creator-core/src/creator-base.ts b/packages/survey-creator-core/src/creator-base.ts index 33a119164b..e18b56f183 100644 --- a/packages/survey-creator-core/src/creator-base.ts +++ b/packages/survey-creator-core/src/creator-base.ts @@ -887,36 +887,62 @@ export class SurveyCreatorModel extends Base /** * Limits the number of columns that users can add to [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel), [Matrix Dynamic](https://surveyjs.io/Documentation/Library?id=questionmatrixdynamicmodel), and [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumColumnsCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxColumns`) */ - public maximumColumnsCount: number = - settings.propertyGrid.maximumColumnsCount; + public maxColumns: number = + settings.propertyGrid.maximumColumnsCount || settings.propertyGrid.maxColumns; + /** + * Obsolete. Use `maxColumns` instead. + */ + public get maximumColumnsCount() { return this.maxColumns; } + public set maximumColumnsCount(val) { this.maxColumns = val; } /** * Limits the number of choices that users can add to [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), and [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumChoicesCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxChoices`) + */ + public maxChoices: number = + settings.propertyGrid.maximumChoicesCount || settings.propertyGrid.maxChoices; + /** + * Obsolete. Use `maxChoices` instead. */ - public maximumChoicesCount: number = - settings.propertyGrid.maximumChoicesCount; + public get maximumChoicesCount() { return this.maxChoices; } + public set maximumChoicesCount(val) { this.maxChoices = val; } + /** * Limits the minimum number of choices in [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), and [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel) questions. Set this property if users should not delete choices below the specified limit. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.minimumChoicesCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.minChoices`) */ - public minimumChoicesCount: number = - settings.propertyGrid.minimumChoicesCount; + public minChoices: number = + settings.propertyGrid.minimumChoicesCount || settings.propertyGrid.minChoices; + /** + * Obsolete. Use `minChoices` instead. + */ + public get minimumChoicesCount() { return this.minChoices; } + public set minimumChoicesCount(val) { this.minChoices = val; } /** * Limits the number of rows that users can add to [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel) and [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumRowsCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxRows`) + */ + public maxRows: number = settings.propertyGrid.maximumRowsCount || settings.propertyGrid.maxRows; + /** + * Obsolete. Use `maxRows` instead. */ - public maximumRowsCount: number = settings.propertyGrid.maximumRowsCount; + public get maximumRowsCount() { return this.maxRows; } + public set maximumRowsCount(val) { this.maxRows = val; } /** * Limits the number of rate values that users can add to [Rating](https://surveyjs.io/Documentation/Library?id=questionratingmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumRateValues`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxRateValues`) + */ + public maxRateValues: number = settings.propertyGrid.maximumRateValues || settings.propertyGrid.maxRateValues; + /** + * Obsolete. Use `maxRateValues` instead. */ - public maximumRateValues: number = settings.propertyGrid.maximumRateValues; + public get maximumRateValues() { return this.maxRateValues; } + public set maximumRateValues(val) { this.maxRateValues = val; } /** * Limits the number of nested panels within a [Panel](https://surveyjs.io/form-library/documentation/api-reference/panel-model) element. diff --git a/packages/survey-creator-core/src/creator-options.ts b/packages/survey-creator-core/src/creator-options.ts index 1ca31ec034..6519adf47a 100644 --- a/packages/survey-creator-core/src/creator-options.ts +++ b/packages/survey-creator-core/src/creator-options.ts @@ -182,33 +182,54 @@ export interface ICreatorOptions { /** * Limits the number of columns that users can add to [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel), [Matrix Dynamic](https://surveyjs.io/Documentation/Library?id=questionmatrixdynamicmodel), and [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumColumnsCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxColumns`) */ - maximumColumnsCount?: number; + maxColumns?: number; /** * Limits the minimum number of choices in [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), and [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel) questions. Set this property if users should not delete choices below the specified limit. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.minimumChoicesCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.minChoices`) */ - minimumChoicesCount?: number; + minChoices?: number; /** * Limits the number of choices that users can add to [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), and [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumChoicesCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxChoices`) */ - maximumChoicesCount?: number; + maxChoices?: number; /** * Limits the number of rows that users can add to [Matrix](https://surveyjs.io/Documentation/Library?id=questionmatrixmodel) and [Matrix Dropdown](https://surveyjs.io/Documentation/Library?id=questionmatrixdropdownmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumRowsCount`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxRows`) */ - maximumRowsCount?: number; + maxRows?: number; /** * Limits the number of rate values that users can add to [Rating](https://surveyjs.io/Documentation/Library?id=questionratingmodel) questions. * - * Default value: 0 (unlimited, taken from `settings.propertyGrid.maximumRateValues`) + * Default value: 0 (unlimited, taken from `settings.propertyGrid.maxRateValues`) + */ + maxRateValues?: number; + /** + * Obsolete. Use `maxColumns` instead. + */ + maximumColumnsCount?: number; + /** + * Obsolete. Use `minChoices` instead. + */ + minimumChoicesCount?: number; + /** + * Obsolete. Use `maxChoices` instead. + */ + maximumChoicesCount?: number; + /** + * Obsolete. Use `maxRows` instead. + */ + maximumRowsCount?: number; + /** + * Obsolete. Use `maxRateValues` instead. */ maximumRateValues?: number; + /** * Limits the number of items in a logical expression. * diff --git a/packages/survey-creator-core/src/creator-settings.ts b/packages/survey-creator-core/src/creator-settings.ts index 9cc1058636..1fafce4daf 100644 --- a/packages/survey-creator-core/src/creator-settings.ts +++ b/packages/survey-creator-core/src/creator-settings.ts @@ -93,6 +93,11 @@ export var settings = { maxCharsInButtonGroup: 25, showNavigationButtons: false, enableSearch: true, + maxColumns: 0, + minChoices: 0, + maxChoices: 0, + maxRows: 0, + maxRateValues: 0, maximumColumnsCount: 0, minimumChoicesCount: 0, maximumChoicesCount: 0,