Skip to content

Commit

Permalink
Merge branch 'master' into feature/vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv2013 committed Dec 29, 2022
2 parents b75a41c + 9107b8d commit 4cbebe5
Show file tree
Hide file tree
Showing 11 changed files with 826 additions and 520 deletions.
31 changes: 19 additions & 12 deletions src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,31 @@ export class Base {
*
* Parameters:
*
* | Parameter | Type | Description |
* | --------- | ---- | ----------- |
* | `sender` | `this` | A SurveyJS object whose property has changed. |
* | `options.name` | `string` | The name of the changed property. |
* | `options.newValue` | `any` | A new value for the property. |
* | `options.oldValue` | `any` | An old value of the property. If the property is an array, `oldValue` contains the same array as `newValue` does. |
* - `sender`: `this`\
* A SurveyJS object whose property has changed.
* - `options.name`: `String`\
* The name of the changed property.
* - `options.newValue`: `any`\
* A new value for the property.
* - `options.oldValue`: `any`\
* An old value of the property. If the property is an array, `oldValue` contains the same array as `newValue` does.
*/
public onPropertyChanged: EventBase<Base> = this.addEvent<Base>();
/**
* An event that is raised when an [ItemValue](https://surveyjs.io/form-library/documentation/itemvalue) property is changed.
* An event that is raised when an [`ItemValue`](https://surveyjs.io/form-library/documentation/itemvalue) property is changed.
*
* Parameters:
*
* - `sender` - A SurveyJS object whose property contains an array of `ItemValue` objects.
* - `options.obj` - An `ItemValue` object.
* - `options.propertyName` - The name of the property to which an array of `ItemValue` objects is assigned (for example, `"choices"` or `"rows"`).
* - `options.name` - The name of the changed property: `"text"` or `"value"`.
* - `options.newValue` - A new value for the property.
* - `sender`: `this`\
* A SurveyJS object whose property contains an array of `ItemValue` objects.
* - `options.obj`: [`ItemValue`](https://surveyjs.io/form-library/documentation/itemvalue)\
* An `ItemValue` object.
* - `options.propertyName`: `String`\
* The name of the property to which an array of `ItemValue` objects is assigned (for example, `"choices"` or `"rows"`).
* - `options.name`: `"text"` | `"value"`\
* The name of the changed property.
* - `options.newValue: `any`\
* A new value for the property.
*/
public onItemValuePropertyChanged: Event<
(sender: Base, options: any) => any,
Expand Down
2 changes: 1 addition & 1 deletion src/dropdownListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class DropdownListModel extends Base {

protected getAvailableItems(): Array<Action> {
return this.question.visibleChoices.map((choice: ItemValue) => new Action({
id: choice.value,
id: <any>new ComputedUpdater<boolean>(() => choice.value),
data: choice,
locTitle: choice.locText,
component: <any>new ComputedUpdater<string>(() => this.question.itemComponent),
Expand Down
2 changes: 1 addition & 1 deletion src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ export class PanelModelBase extends SurveyElement<Question>
var elements = this.elements;
for (var i = 0; i < elements.length; i++) {
var el = elements[i];
if (!el.isVisible) continue;
if (!el.isVisible || !ignoreCollapseState && el.isCollapsed) continue;
if (el.isPanel) {
var res = (<PanelModelBase>(<any>el)).getFirstQuestionToFocus(withError, ignoreCollapseState);
if (!!res) return res;
Expand Down
23 changes: 13 additions & 10 deletions src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ export class Question extends SurveyElement<Question>
*
* Parameters:
*
* - `sender` - A survey that contains the question whose ready state has changed.
* - `options.isReady` - A Boolean value that indicates whether the question is ready.
* - `options.oldIsReady` - A Boolean value that indicates the previous ready state.
* - `sender`: `SurveyModel`\
* A survey instance that contains the question whose ready state has changed.
* - `options.isReady`: `Boolean`\
* Indicates whether the question is ready.
* - `options.oldIsReady`: `Boolean`\
* Indicates the previous ready state.
*/
public onReadyChanged: EventBase<Question> = this.addEvent<Question>();

Expand Down Expand Up @@ -937,7 +940,7 @@ export class Question extends SurveyElement<Question>
if (this.isDesignMode) return;

if (!!this.survey) {
this.expandAllPanels(this.parent);
this.expandAllParents(this);
this.survey.scrollElementToTop(this, this, null, this.id);
}
var id = !onError
Expand All @@ -947,13 +950,13 @@ export class Question extends SurveyElement<Question>
this.fireCallback(this.focusCallback);
}
}
private expandAllPanels(panel: IPanel) {
if (!!panel && !!panel.parent) {
if (panel.isCollapsed) {
panel.expand();
}
this.expandAllPanels(panel.parent);
private expandAllParents(element: IElement) {
if(!element) return;
if(element.isCollapsed) {
element.expand();
}
this.expandAllParents((<any>element).parent);
this.expandAllParents((<any>element).parentQuestion);
}
public focusIn = () => {
(this.survey as SurveyModel).whenQuestionFocusIn(this);
Expand Down
54 changes: 36 additions & 18 deletions src/question_custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,41 @@ export interface ICustomQuestionTypeConfiguration {
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* The custom question.
*/
onCreated?(question: Question): void;
/**
* A function that is called when JSON schemas are loaded.
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A custom question.
*/
onLoaded?(question: Question): void;
/**
* A function that is called after the entire question is rendered.
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `htmlElement`: any - An HTML element that represents the custom question.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A custom question.
* - `htmlElement`: `any`\
* An HTML element that represents the custom question.
*/
onAfterRender?(question: Question, htmlElement: any): void;
/**
* A function that is called each time a question nested within a [composite question](https://surveyjs.io/Documentation/Survey-Creator?id=create-composite-question-types) is rendered.
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The composite question.
* - `element`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - A nested question.
* - `htmlElement`: any - An HTML element that represents the nested question.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A composite question.
* - `element`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A nested question.
* - `htmlElement`: `any`\
* An HTML element that represents a nested question.
*/
onAfterRenderContentElement?(
question: Question,
Expand All @@ -96,9 +103,12 @@ export interface ICustomQuestionTypeConfiguration {
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `propertyName`: string - The name of the changed property.
* - `newValue`: any - A new value for the property.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A custom question.
* - `propertyName`: `String`\
* The name of the changed property.
* - `newValue`: `any`\
* A new value for the property.
*/
onPropertyChanged?(
question: Question,
Expand All @@ -110,21 +120,29 @@ export interface ICustomQuestionTypeConfiguration {
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `name`: string - The question's [name](https://surveyjs.io/Documentation/Library?id=Question#name).
* - `newValue`: any - A new value for the question.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A custom question.
* - `name`: `String`\
* The question's [name](https://surveyjs.io/Documentation/Library?id=Question#name).
* - `newValue`: `any`\
* A new value for the question.
*/
onValueChanged?(question: Question, name: string, newValue: any): void;
/**
* A function that is called when an [ItemValue](https://surveyjs.io/Documentation/Library?id=itemvalue) property is changed.
*
* Parameters:
*
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question) - The custom question.
* - `options.obj`: [ItemValue](https://surveyjs.io/Documentation/Library?id=itemvalue) - An `ItemValue` object.
* - `options.propertyName`: string - The name of the property to which an array of `ItemValue` objects is assigned (for example, `"choices"` or `"rows"`).
* - `options.name`: string - The name of the changed property: `"text"` or `"value"`.
* - `options.newValue`: any - A new value for the property.
* - `question`: [Question](https://surveyjs.io/Documentation/Library?id=Question)\
* A custom question.
* - `options.obj`: [ItemValue](https://surveyjs.io/Documentation/Library?id=itemvalue)\
* An `ItemValue` object.
* - `options.propertyName`: `String`\
* The name of the property to which an array of `ItemValue` objects is assigned (for example, `"choices"` or `"rows"`).
* - `options.name`: `String`\
* The name of the changed property: `"text"` or `"value"`.
* - `options.newValue`: `any`\
* A new value for the property.
*/
onItemValuePropertyChanged?(
question: Question,
Expand Down
6 changes: 4 additions & 2 deletions src/question_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export class QuestionFileModel extends Question {
*
* Parameters:
*
* - `sender` - A question instance that raised the event.
* - `options.state` - Current upload state: `"empty"`, `"loading"`, `"loaded"`, or `"error"`.
* - `sender`: `SurveyModel`\
* A survey instance that raised the event.
* - `options.state`: `String`\
* The current upload state: `"empty"`, `"loading"`, `"loaded"`, or `"error"`.
*/
public onUploadStateChanged: EventBase<QuestionFileModel> = this.addEvent<
QuestionFileModel
Expand Down
Loading

0 comments on commit 4cbebe5

Please sign in to comment.