Skip to content

Commit

Permalink
Merge branch 'master' into bug/6205-popup-height-after-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Sep 4, 2023
2 parents 092b3e3 + bb894ed commit 2704901
Show file tree
Hide file tree
Showing 373 changed files with 10,089 additions and 1,504 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.105](https://github.com/surveyjs/survey-library/compare/v1.9.104...v1.9.105) (2023-08-30)

## [1.9.104](https://github.com/surveyjs/survey-library/compare/v1.9.103...v1.9.104) (2023-08-22)

## [1.9.103](https://github.com/surveyjs/survey-library/compare/v1.9.102...v1.9.103) (2023-08-15)

## [1.9.102](https://github.com/surveyjs/survey-library/compare/v1.9.101...v1.9.102) (2023-08-08)
Expand Down
29 changes: 29 additions & 0 deletions devops-visual-regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
steps:
- checkout: self

- task: PowerShell@2
displayName: 'update Google Chrome to latest'
inputs:
targetType: 'inline'
script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer'
- task: NodeTool@0
inputs:
versionSpec: '14.x'
Expand Down Expand Up @@ -76,6 +81,12 @@ jobs:
steps:
- checkout: self

- task: PowerShell@2
displayName: 'update Google Chrome to latest'
inputs:
targetType: 'inline'
script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer'

- task: NodeTool@0
inputs:
versionSpec: '14.x'
Expand Down Expand Up @@ -132,6 +143,12 @@ jobs:
steps:
- checkout: self

- task: PowerShell@2
displayName: 'update Google Chrome to latest'
inputs:
targetType: 'inline'
script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer'

- task: NodeTool@0
inputs:
versionSpec: '14.x'
Expand Down Expand Up @@ -189,6 +206,12 @@ jobs:
persistCredentials: true
clean: true

- task: PowerShell@2
displayName: 'update Google Chrome to latest'
inputs:
targetType: 'inline'
script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer'

- task: NodeTool@0
inputs:
versionSpec: "14.x"
Expand Down Expand Up @@ -269,6 +292,12 @@ jobs:
persistCredentials: true
clean: true

- task: PowerShell@2
displayName: 'update Google Chrome to latest'
inputs:
targetType: 'inline'
script: '$Path = $env:TEMP; $Installer = ''chrome_installer.exe''; Invoke-WebRequest -Uri ''http://dl.google.com/chrome/install/375.126/chrome_installer.exe'' -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args ''/silent /install'' -Verb RunAs -Wait; Remove-Item -Path $Path\$Installer'

- task: NodeTool@0
inputs:
versionSpec: "16.x"
Expand Down
23 changes: 11 additions & 12 deletions docs/handle-survey-results-continue-incomplete.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Continue an Incomplete Survey

Your respondents may not complete your survey in a single session. In this case, you can restore their answers from the previous session next time they get to the survey. Incomplete results can be loaded from your database or the browser's [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
Respondents may not complete your survey in a single session. In this case, you can restore their answers from the previous session next time they get to the survey. Incomplete results can be loaded from your database or the browser's [`localStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).

To save incomplete results, enable the Survey's [`sendResultOnPageNext`](/Documentation/Library?id=surveymodel#sendResultOnPageNext) property. With this setting, the Survey raises the [`onPartialSend`](/Documentation/Library?id=surveymodel#onPartialSend) event each time a respondent navigates to the next survey page. Handle this event to send incomplete results to your database or `localStorage`:
To save incomplete results, implement a function that sends them to your server or saves them in the `localStorage`. Call this function within `SurveyModel`'s [`onValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValueChanged) and [`onCurrentPageChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onCurrentPageChanged) event handlers to save survey results when users change a question value or switch between pages. If you use the `localStorage`, you also need to delete survey results from it when the survey is completed. Handle the [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event for this purpose.

```js
import { Model } from "survey-core";

const surveyJson = { ... };
const survey = new Model(surveyJson);

survey.sendResultOnPageNext = true;

const storageItemKey = "my-survey";

function saveSurveyData (survey) {
Expand All @@ -20,13 +18,9 @@ function saveSurveyData (survey) {
window.localStorage.setItem(storageItemKey, JSON.stringify(data));
}

// Save survey results
survey.onPartialSend.add((survey) => {
saveSurveyData(survey);
});
survey.onComplete.add((survey) => {
saveSurveyData(survey);
});
// Save survey results to the local storage
survey.onValueChanged.add(saveSurveyData);
survey.onCurrentPageChanged.add(saveSurveyData);

// Restore survey results
const prevData = window.localStorage.getItem(storageItemKey) || null;
Expand All @@ -37,9 +31,14 @@ if (prevData) {
survey.currentPageNo = data.pageNo;
}
}

// Empty the local storage after the survey is completed
survey.onComplete.add(() => {
window.localStorage.setItem(storageItemKey, "");
});
```

[View Demo](https://surveyjs.io/Examples/Library?id=real-patient-history (linkStyle))
[View Demo](/form-library/examples/survey-editprevious/ (linkStyle))

## See Also

Expand Down
2 changes: 1 addition & 1 deletion docs/sidebar.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Categories": [
"Items": [
{
"Name": "overview",
"Title": "Overview"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"testcafe:ci:angular": "testcafe -c 4 -q attemptLimit=5,successThreshold=1 chrome:headless testCafe/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --selector-timeout 1500 --reporter minimal --env=angular",
"prepare": "husky install"
},
"version": "1.9.103",
"version": "1.9.105",
"name": "survey-library",
"private": true,
"devDependencies": {
Expand All @@ -107,7 +107,7 @@
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"ace-builds": "1.2.2",
"ajv": "4.11.2",
"ajv": "6.12.3",
"axe-core": "^3.5.6",
"axe-testcafe": "^3.0.0",
"babel-loader": "8.2.5",
Expand Down
4 changes: 4 additions & 0 deletions packages/survey-angular-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.105](https://github.com/surveyjs/surveyjs/compare/v1.9.104...v1.9.105) (2023-08-30)

## [1.9.104](https://github.com/surveyjs/surveyjs/compare/v1.9.103...v1.9.104) (2023-08-22)

## [1.9.103](https://github.com/surveyjs/surveyjs/compare/v1.9.102...v1.9.103) (2023-08-15)

## [1.9.102](https://github.com/surveyjs/surveyjs/compare/v1.9.101...v1.9.102) (2023-08-08)
Expand Down
19 changes: 14 additions & 5 deletions packages/survey-angular-ui/example/src/testCafe/countriesMock.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"RestResponse": {
"result": [
{ "alpha2_code": "US", "name": "Unated States" },
{ "alpha2_code": "CU", "name": "Cuba" },
{ "alpha2_code": "RO","name":"Romania" }
]
"result": [
{
"alpha2_code": "US",
"name": "United States"
},
{
"alpha2_code": "CU",
"name": "Cuba"
},
{
"alpha2_code": "RO",
"name": "Romania"
}
]
}
}
2 changes: 1 addition & 1 deletion packages/survey-angular-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-angular-ui",
"version": "1.9.103",
"version": "1.9.105",
"description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
"keywords": [
"Survey",
Expand Down
5 changes: 3 additions & 2 deletions packages/survey-angular-ui/src/angular-ui.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ import { PaneldynamicRemoveButtonComponent } from "./components/paneldynamic-act
import { TimerPanelComponent } from "./components/timer-panel/timer-panel.component";
import { NotifierComponent } from "./components/notifier/notifier.component";
import { ComponentsContainerComponent } from "./components-container.component";
import { MultipleTextRowComponent } from "./questions/multipletextrow.component";
@NgModule({
declarations: [
VisibleDirective, Key2ClickDirective, PanelDynamicAddBtn, PanelDynamicNextBtn, PanelDynamicPrevBtn, PanelDynamicProgressText, ElementComponent, TemplateRendererComponent,
Expand All @@ -126,7 +127,7 @@ import { ComponentsContainerComponent } from "./components-container.component";
MultipleTextComponent, MultipleTextItemComponent, DynamicComponentDirective, RankingQuestionComponent, RankingItemComponent, PanelDynamicQuestionComponent, EmbeddedViewContentComponent, CustomWidgetComponent, MatrixCellComponent, MatrixTableComponent, MatrixDropdownComponent,
MatrixDynamicComponent, MatrixDetailButtonComponent, MatrixDynamicRemoveButtonComponent, MatrixDynamicDragDropIconComponent, MatrixRequiredHeader, ExpressionComponent, SafeResourceUrlPipe, BrandInfoComponent,
CustomQuestionComponent, CompositeQuestionComponent, ButtonGroupItemComponent, ButtonGroupQuestionComponent, MatrixRowComponent, ModalComponent, LogoImageComponent, SkeletonComponent, TimerPanelComponent, PaneldynamicRemoveButtonComponent,
NotifierComponent, ComponentsContainerComponent
NotifierComponent, ComponentsContainerComponent, MultipleTextRowComponent
],
imports: [
CommonModule, FormsModule
Expand All @@ -147,7 +148,7 @@ import { ComponentsContainerComponent } from "./components-container.component";
MultipleTextComponent, MultipleTextItemComponent, DynamicComponentDirective, RankingQuestionComponent, RankingItemComponent, PanelDynamicQuestionComponent, EmbeddedViewContentComponent, CustomWidgetComponent, MatrixCellComponent, MatrixTableComponent, MatrixDropdownComponent,
MatrixDynamicComponent, MatrixDetailButtonComponent, MatrixDynamicRemoveButtonComponent, MatrixDynamicDragDropIconComponent, MatrixRequiredHeader, ExpressionComponent, SafeResourceUrlPipe,
CustomQuestionComponent, CompositeQuestionComponent, ButtonGroupQuestionComponent, ModalComponent, LogoImageComponent, SkeletonComponent, TimerPanelComponent, PaneldynamicRemoveButtonComponent,
NotifierComponent, ComponentsContainerComponent
NotifierComponent, ComponentsContainerComponent, MultipleTextRowComponent
],
providers: [PopupService],
})
Expand Down
3 changes: 2 additions & 1 deletion packages/survey-angular-ui/src/angular-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ export * from "./utils/safe-html.pipe";
export * from "./questions/comment.component";
export * from "./questions/signature.component";
export * from "./questions/multipletext.component";
export * from "./errors.component";
export * from "./questions/multipletextitem.component";
export * from "./questions/multipletextrow.component";
export * from "./errors.component";
export * from "./utils/dynamic.directive";
export * from "./questions/ranking.component";
export * from "./questions/ranking-item.component";
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-angular-ui/src/comment.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<textarea *ngIf="!question.isReadOnlyRenderDiv()" [id]="question.commentId" [attr.maxlength]="question.getOthersMaxLength()" [attr.aria-required]="question.ariaRequired" [attr.aria-label]="question.ariaLabel" [attr.placeholder]="question.commentPlaceholder"
<textarea *ngIf="!question.isReadOnlyRenderDiv()" [id]="question.commentId" [attr.maxlength]="question.getOthersMaxLength()" [attr.aria-required]="question.ariaRequired" [attr.aria-label]="question.ariaLabel" [attr.placeholder]="question.renderedCommentPlaceholder"
[value]="comment"
[style.resize]="question.resizeStyle"
[disabled]="question.isInputReadOnly"
Expand Down
20 changes: 4 additions & 16 deletions packages/survey-angular-ui/src/errors.component.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import { Component, DoCheck, ElementRef, HostBinding, Input, OnDestroy, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { Base, SurveyElement, TooltipManager } from "survey-core";
import { Component, HostBinding, Input } from "@angular/core";
import { SurveyElement } from "survey-core";

@Component({
templateUrl: "./errors.component.html",
selector: "'[sv-ng-errors]'"
})
export class ErrorsComponent implements OnDestroy, OnInit {
export class ErrorsComponent {
@Input() element!: SurveyElement | any;
@Input() location?: String;
@ViewChild("errorsContainer", { static: true }) errorsContainerRef!: ElementRef<HTMLDivElement>;
private tooltipManager!: TooltipManager;
constructor(private viewContainerRef: ViewContainerRef) {}
ngOnInit(): void {
if (this.location == "tooltip") {
this.tooltipManager = new TooltipManager(this.viewContainerRef.element.nativeElement);
}
}
ngOnDestroy() {
if (!!this.tooltipManager) {
this.tooltipManager.dispose();
}
}
constructor() {}
@HostBinding("attr.role") get role (): string {
return "alert";
}
Expand Down
1 change: 0 additions & 1 deletion packages/survey-angular-ui/src/question.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<sv-ng-comment [question]="model"></sv-ng-comment>
</div>
<div *ngIf="model.showErrorOnBottom && model.hasVisibleErrors" [element]="model" sv-ng-errors></div>
<div *ngIf="model.isErrorsModeTooltip && model.hasVisibleErrors" [element]="model" [location]="'tooltip'" sv-ng-errors></div>
<div *ngIf="model.hasDescriptionUnderInput" [class]="model.cssDescription" [model]="model.locDescription" sv-ng-string></div>
</div>
<div [element]="model" *ngIf="model.hasTitleOnBottom" sv-ng-element-header></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<div
[class]="model.getFileDecoratorCss()"
>
<span [class]="model.cssClasses.dragAreaPlaceholder">{{ model.dragAreaPlaceholder }}</span>
<span [class]="model.cssClasses.dragAreaPlaceholder">{{ model.renderedPlaceholder }}</span>
<div [class]="model.cssClasses.wrapper">
<label
*ngIf="!model.isReadOnly"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-template #template>
<td [class]="cell.className" [attr.data-responsive-title]="getHeaders()" [title]="cell.getTitle()"
[style]="getCellStyle()" [attr.colspan]="cell.colSpans" #cellContainer>
[style]="getCellStyle()" [attr.colspan]="cell.colSpans" (focusin)="cell.focusIn()" #cellContainer>
<sv-ng-matrix-drag-drop-icon *ngIf="cell.isDragHandlerCell"
[model]="$any({ data: { row: row, question: question } })"></sv-ng-matrix-drag-drop-icon>
<sv-action-bar *ngIf="cell.isActionsCell" [model]="cell.item.getData()" [handleClick]="false"></sv-action-bar>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<table [class]="model.cssClasses.root" #contentElement>
<tbody>
<tr
*ngFor="let row of model.getRows(); index as rowIndex; trackBy: trackRowBy"
[class]="model.cssClasses.row"
>
<ng-container *ngFor="let item of row; trackBy: trackItemBy" >
<td [class]="model.cssClasses.cell" [question]="model" [model]="item" sv-ng-multipletext-item></td>
</ng-container>
</tr>
<ng-container *ngFor="let row of model.getRows(); index as rowIndex; trackBy: trackRowBy">
<sv-ng-multipletext-row [model]="row" [question]="model"></sv-ng-multipletext-row>
</ng-container>
</tbody>
</table>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export class MultipleTextComponent extends QuestionAngular<QuestionMultipleTextM
trackRowBy = (index: number): string => {
return this.model.inputId + "rowkey" + index;
}
trackItemBy (_: number, item: MultipleTextItemModel): string {
return "item" + item.editor.id;
}
}

AngularComponentFactory.Instance.registerComponent("multipletext-question", MultipleTextComponent);
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
import { MultipleTextItemModel, QuestionMultipleTextModel, QuestionTextModel } from "survey-core";
import { Component, Input } from "@angular/core";
import { MultipleTextCell, MultipleTextItemModel, QuestionMultipleTextModel, QuestionTextModel } from "survey-core";
import { Component, DoCheck, Input, OnDestroy } from "@angular/core";
import { BaseAngular } from "../base-angular";

@Component({
selector: "'[sv-ng-multipletext-item]'",
templateUrl: "./mutlipletextitem.component.html"
})
export class MultipleTextItemComponent extends BaseAngular<QuestionTextModel> {
export class MultipleTextItemComponent extends BaseAngular<QuestionTextModel> implements DoCheck, OnDestroy {
@Input() question!: QuestionMultipleTextModel;
@Input() model!: MultipleTextItemModel;
@Input() model!: MultipleTextCell;
protected getModel(): QuestionTextModel {
return this.model.editor;
if(!this.model.isErrorsCell) {
return this.model.item.editor;
}
return null as any;
}
public get item(): MultipleTextItemModel {
return this.model.item;
}
public get editor(): QuestionTextModel {
return this.model.item.editor;
}
override ngDoCheck(): void {
super.ngDoCheck();
if(this.model.isErrorsCell) {
this.editor.registerFunctionOnPropertyValueChanged("errors", () => {
this.update();
}, "__ngSubscription")
}
}
override ngOnDestroy(): void {
super.ngOnDestroy();
if(this.model.isErrorsCell) {
this.editor.unRegisterFunctionOnPropertyValueChanged("errors", "__ngSubscription")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ng-template #template>
<tr [class]="question.cssClasses.row" *ngIf="model.isVisible">
<ng-container *ngFor="let cell of model.cells; trackBy: trackItemBy">
<td [class]="cell.className" [question]="question" [model]="cell" sv-ng-multipletext-item></td>
</ng-container>
</tr>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MultipleTextCell, MultipleTextItemModel, MutlipleTextRow, QuestionMultipleTextModel, QuestionTextModel } from "survey-core";
import { Component, Input } from "@angular/core";
import { BaseAngular } from "../base-angular";

@Component({
selector: "sv-ng-multipletext-row",
templateUrl: "./multipletextrow.component.html",
styleUrls: ["../hide-host.scss"]
})
export class MultipleTextRowComponent extends BaseAngular<MutlipleTextRow> {
@Input() question!: QuestionMultipleTextModel;
@Input() model!: MutlipleTextRow;
protected getModel(): MutlipleTextRow {
return this.model;
}
trackItemBy (_: number, cell: MultipleTextCell): string {
return "item" + cell.item.editor.id;
}
}
Loading

0 comments on commit 2704901

Please sign in to comment.