Skip to content

Commit

Permalink
SurveyModel: Update matrix-related API descriptions (#6384)
Browse files Browse the repository at this point in the history
* SurveyModel: Update matrix-related API descriptions

* Add edits after review
  • Loading branch information
RomanTsukanov authored Jun 20, 2023
1 parent 7a48dd9 commit bbc3626
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 115 deletions.
2 changes: 1 addition & 1 deletion src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class Question extends SurveyElement<Question>
/**
* Hides the question number from the title and excludes the question from numbering.
*
* If you want to disable question numbering in the entire survey, set SurveyModel's `showQuestionNumbers` property to `false`.
* If you want to disable question numbering in the entire survey, set `SurveyModel`'s `showQuestionNumbers` property to `false`.
* @see SurveyModel.showQuestionNumbers
*/
public get hideNumber(): boolean {
Expand Down
118 changes: 60 additions & 58 deletions src/survey-events-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface PanelDynamicQuestionEventMixin {
}
export interface MatrixDropdownQuestionEventMixin {
/**
* A Multiple-Choice Matrix question instance for which the event is raised.
* A Multi-Select Matrix question instance for which the event is raised.
*/
question: QuestionMatrixDropdownModelBase;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ export interface CompleteBaseEvent {
}
export interface CompletingEvent extends CompleteBaseEvent {
/**
* Set this property to `false` if you want to prevent survey completion.
* A Boolean property that you can set to `false` if you want to prevent survey completion.
*/
allow: boolean;
allowComplete: boolean;
Expand Down Expand Up @@ -131,14 +131,14 @@ export interface CompleteEvent extends CompleteBaseEvent {
}
export interface ShowingPreviewEvent {
/**
* Set this property to `false` if you want to cancel the preview.
* A Boolean property that you can set to `false` if you want to cancel the preview.
*/
allow: boolean;
allowShowPreview: boolean;
}
export interface NavigateToUrlEvent {
/**
* Set this property to `false` if you want to cancel the navigation and show the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
* A Boolean property that you can set to `false` if you want to cancel the navigation and show the [complete page](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#complete-page).
*/
allow: boolean;
/**
Expand Down Expand Up @@ -174,7 +174,7 @@ export interface CurrentPageChangedEvent {
}
export interface CurrentPageChangingEvent extends CurrentPageChangedEvent {
/**
* Set this property to `false` if you do not want to switch the current page.
* A Boolean property that you can set to `false` if you do not want to switch the current page.
*/
allow: boolean;
allowChanging: boolean;
Expand Down Expand Up @@ -515,13 +515,13 @@ export interface UpdatePanelCssClassesEvent extends PanelEventMixin, UpdateEleme
export interface UpdatePageCssClassesEvent extends PageEventMixin, UpdateElementCssClassesEventMixin { }
export interface UpdateChoiceItemCssEvent extends QuestionEventMixin {
/**
* a string with css classes divided by space. You can change it
* A choice item. To access its value and display text, use the `options.item.value` and `options.item.text` properties.
*/
css: string;
item: ItemValue;
/**
* a choice item of ItemValue type. You can get value or text choice properties as options.item.value or options.choice.text
* A string with CSS classes applied to the choice item. The CSS classes are separated by a space character. You can modify this string to apply custom CSS classes.
*/
item: ItemValue;
css: string;
}
export interface AfterRenderSurveyEvent extends AfterRenderElementEventMixin {
survey: SurveyModel;
Expand Down Expand Up @@ -574,137 +574,139 @@ export interface GetChoiceDisplayValueEvent extends QuestionEventMixin {
}
export interface MatrixRowAddedEvent extends MatrixDynamicQuestionEventMixin {
/**
* a new added row
* An added matrix row.
*/
row: any;
}
export interface MatrixBeforeRowAddedEvent extends MatrixDynamicQuestionEventMixin {
/**
* specifies whether a new row can be added
* A Boolean property that you can set to `false` if you do not want to add the row.
*/
canAddRow: boolean;
}
export interface MatrixRowRemovingEvent extends MatrixDynamicQuestionEventMixin {
/**
* a boolean property. Set it to `false` to disable the row removing
*/
allow: boolean;
/**
* a row object
* A matrix row to be deleted. If you want to clear row data, set the `options.row.value` property to `undefined`.
*/
row: any;
/**
* a row index
* A zero-based index of the matrix row to be deleted.
*/
rowIndex: number;
/**
* A Boolean property that you can set to `false` if you want to cancel row deletion.
*/
allow: boolean;
}
export interface MatrixRowRemovedEvent extends MatrixDynamicQuestionEventMixin {
/**
* a removed row object
* A deleted matrix row.
*/
row: any;
/**
* a removed row index
* A zero-based index of the deleted row.
*/
rowIndex: number;
}
export interface MatrixAllowRemoveRowEvent extends MatrixDynamicQuestionEventMixin {
/**
* a boolean property. Set it to `false` to disable the row removing
*/
allow: boolean;
/**
* a row object
* A matrix row for which the event is raised.
*/
row: any;
/**
* a row index
* A zero-based row index.
*/
rowIndex: number;
/**
* A Boolean property that you can set to `false` if you want to hide the Remove button for this row.
*/
allow: boolean;
}

export interface MatrixCellCreatingBaseEvent extends MatrixDropdownQuestionEventMixin {
/**
* the matrix row object
* A matrix column to which the cell belongs.
*/
row: MatrixDropdownRowModelBase;
column: MatrixDropdownColumn;
/**
* the matrix column name
* The name of the matrix column to which the cell belongs.
*/
columnName: string;
/**
* the matrix column object
* A matrix row to which the cell belongs.
*/
column: MatrixDropdownColumn;
row: MatrixDropdownRowModelBase;
/**
* the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`
* The values of this matrix row.\
* To access a particular column's value, use the following code: `options.rowValue["columnName"]`
*/
rowValue: any;
}
export interface MatrixCellCreatingEvent extends MatrixCellCreatingBaseEvent {
/**
* the cell question type. You can change it
* The type of this matrix cell. You can change this property value to one of the values described in the [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType) documentation.
*/
cellType: string;
}
export interface MatrixCellCreatedEvent extends MatrixCellCreatingBaseEvent {
/**
* the question/editor in the cell. You may customize it, change it's properties, like choices or visible
* A matrix cell for which the event is raised.
*/
cellQuestion: Question;
cell: MatrixDropdownCell;
/**
* the matrix cell
* A Question instance within the matrix cell. You can use the properties and methods exposed by the instance to customize it.
*/
cell: MatrixDropdownCell;
cellQuestion: Question;
}
export interface MatrixAfterCellRenderEvent extends QuestionEventMixin, AfterRenderElementEventMixin {
/**
* the matrix row object
* A matrix cell for which the event is raised.
*/
row: MatrixDropdownRowModelBase;
cell: MatrixDropdownCell;
/**
* the matrix column object
* A Question instance within the matrix cell.
*/
column: MatrixDropdownColumn | MatrixDropdownCell;
cellQuestion: Question;
/**
* the question/editor in the cell
* A matrix row to which the cell belongs.
*/
cellQuestion: Question;
row: MatrixDropdownRowModelBase;
/**
* the matrix cell
* A matrix column to which the cell belongs.
*/
cell: MatrixDropdownCell;
column: MatrixDropdownColumn | MatrixDropdownCell;
}

export interface MatrixCellValueBaseEvent extends MatrixDropdownQuestionEventMixin {
/**
* the function that returns the cell question by column name
* A matrix row to which the cell belongs.
*/
getCellQuestion: (columnName: string) => Question;
row: MatrixDropdownRowModelBase;
/**
* the matrix row object
* The name of a matrix column to which the cell belongs.
*/
row: MatrixDropdownRowModelBase;
columnName: string;
/**
* a new value
* A method that returns a Question instance within the matrix cell given a column name.
*/
value: any;
getCellQuestion: (columnName: string) => Question;
/**
* the matrix column name
* A new cell value.
*/
columnName: string;
value: any;

}

export interface MatrixCellValueChangedEvent extends MatrixCellValueBaseEvent {}
export interface MatrixCellValueChangingEvent extends MatrixCellValueBaseEvent {
/**
* the old value
* A previous cell value.
*/
oldValue: any;
}
export interface MatrixCellValidateEvent extends MatrixCellValueBaseEvent {
/**
* an error string. It is empty by default
* A field for your custom error message. Default value: `undefined`.
*/
error?: string;
}
Expand All @@ -716,7 +718,7 @@ export interface DynamicPanelModifiedEvent extends PanelDynamicQuestionEventMixi
}
export interface DynamicPanelRemovingEvent extends DynamicPanelModifiedEvent {
/**
* Set this property to `false` if you want to cancel the panel deletion.
* A Boolean property that you can set to `false` if you want to cancel panel deletion.
*/
allow: boolean;
}
Expand Down Expand Up @@ -812,13 +814,13 @@ export interface GetPanelTitleActionsEvent extends PanelEventMixin, GetTitleActi
export interface GetPageTitleActionsEvent extends PageEventMixin, GetTitleActionsEventMixin { }
export interface GetPanelFooterActionsEvent extends GetActionsEventMixin, PanelEventMixin {
/**
* A [Dynamic Panel](https://surveyjs.io/form-library/documentation/questionpaneldynamicmodel) to which the Panel belongs. This field is `undefined` if the Panel does not belong to any Dynamic Panel
* A [Dynamic Panel](https://surveyjs.io/form-library/documentation/questionpaneldynamicmodel) to which the Panel belongs. This field is `undefined` if the Panel does not belong to any Dynamic Panel.
*/
question?: QuestionPanelDynamicModel;
}
export interface GetMatrixRowActionsEvent extends QuestionEventMixin, GetActionsEventMixin {
/**
* A matrix row for which the event is fired
* A matrix row for which the event is raised.
*/
row: any;
}
Expand Down Expand Up @@ -849,7 +851,7 @@ export interface MultipleTextItemAddedEvent extends QuestionEventMixin {
}
export interface MatrixColumnAddedEvent extends QuestionEventMixin {
/**
* A new added column.
* An added matrix column.
*/
column: any;
}
Loading

0 comments on commit bbc3626

Please sign in to comment.