-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement animation for file's preview pages (#7785)
* Implement list animation for file question * Enable animation when swithing page while deleting item * Refactor + unit tests * Fix other themes and markup tests * Implement in Vue3 * Implement in Angular * Implement in React * Implement in Vue2 * Use animationsEnabled flag in file question's animation * Fix knockout build * Fix vr tests * Fix react build * Implement animation via the new approach * Fix markup tests * Add more unit tests * Try to fix vr tests * Fix angular markup tests + run id changes after init survey in markup tests * Fix after merge + implement new behavior for AfterRerender event in Vue3 * Revert index.js * Fix unit tests
- Loading branch information
Showing
43 changed files
with
1,284 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/survey-angular-ui/src/components/file/file-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<ng-template #template> | ||
<span [class]="question.cssClasses.previewItem" (click)="question.doDownloadFileFromContainer($event)"> | ||
<div *ngIf="item.name && question.cssClasses.fileSign" [class]="question.cssClasses.fileSign"> | ||
<a (click)="question.doDownloadFile($event, item)" [attr.href]="item.content | safeUrl" | ||
[attr.title]="item.name" [attr.download]="item.name" [style.width]="question.imageWidth">{{ | ||
item.name | ||
}}</a> | ||
</div> | ||
<div [class]="question.getImageWrapperCss(item)"> | ||
<img *ngIf="question.canPreviewImage(item)" [attr.src]="item.content | safeUrl" | ||
[style.height]="question.imageHeight" [style.width]="question.imageWidth" alt="File preview" /> | ||
<svg *ngIf="question.defaultImage(item)" [iconName]="question.cssClasses.defaultImageIconId" | ||
[partCss]="question.cssClasses.defaultImage" [size]="'auto'" sv-ng-svg-icon></svg> | ||
<div *ngIf="item.name && !question.isReadOnly" [class]="question.getRemoveButtonCss()" | ||
(click)="question.doRemoveFile(item, $event)"> | ||
<span [class]="question.cssClasses.removeFile">{{ question.removeFileCaption }}</span> | ||
<svg *ngIf="question.cssClasses.removeFileSvgIconId" [title]="question.removeFileCaption" | ||
[partCss]="question.cssClasses.removeFileSvg" [iconName]="question.cssClasses.removeFileSvgIconId" | ||
[size]="'auto'" sv-ng-svg-icon></svg> | ||
</div> | ||
</div> | ||
<div *ngIf="item.name && question.cssClasses.fileSignBottom" [class]="question.cssClasses.fileSignBottom"> | ||
<a (click)="question.doDownloadFile($event, item)" [attr.href]="item.content | safeUrl" | ||
[attr.title]="item.name" [attr.download]="item.name" [style.width]="question.imageWidth">{{ | ||
item.name | ||
}}</a> | ||
</div> | ||
</span> | ||
</ng-template> |
13 changes: 13 additions & 0 deletions
13
packages/survey-angular-ui/src/components/file/file-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { EmbeddedViewContentComponent } from "src/embedded-view-content.component"; | ||
import { QuestionFileModel } from "survey-core"; | ||
|
||
@Component({ | ||
templateUrl: "./file-item.component.html", | ||
selector: "sv-ng-file-item", | ||
styleUrls: ["../../hide-host.scss"] | ||
}) | ||
export class FileItemComponent extends EmbeddedViewContentComponent { | ||
@Input() item!: any; | ||
@Input() question!: QuestionFileModel; | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/survey-angular-ui/src/components/file/file-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<ng-template #template> | ||
<div [class]="page.css" [attr.id]="page.id"> | ||
<ng-container *ngFor="let item of page.items"> | ||
<sv-ng-file-item [item]="item" [question]="question"></sv-ng-file-item> | ||
</ng-container> | ||
</div> | ||
</ng-template> |
16 changes: 16 additions & 0 deletions
16
packages/survey-angular-ui/src/components/file/file-page.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { BaseAngular } from "src/base-angular"; | ||
import { QuestionFileModel, QuestionFilePage } from "survey-core"; | ||
|
||
@Component({ | ||
templateUrl: "./file-page.component.html", | ||
selector: "sv-ng-file-page", | ||
styleUrls: ["../../hide-host.scss"] | ||
}) | ||
export class FilePageComponent extends BaseAngular<QuestionFilePage> { | ||
@Input() page!: QuestionFilePage; | ||
@Input() question!: QuestionFileModel; | ||
protected override getModel() { | ||
return this.page; | ||
} | ||
} |
36 changes: 6 additions & 30 deletions
36
packages/survey-angular-ui/src/components/file/file-preview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
<ng-template #template> | ||
<ng-container *ngIf="question.showPreviewContainer"> | ||
<div [class]="question.cssClasses.fileList || undefined"> | ||
<span *ngFor="let val of question.previewValue; index as index; trackBy: trackFilesFn" | ||
[visible]="val && question.isPreviewVisible(index)" [class]="question.cssClasses.previewItem" | ||
(click)="question.doDownloadFileFromContainer($event)"> | ||
<div *ngIf="val.name && question.cssClasses.fileSign" [class]="question.cssClasses.fileSign"> | ||
<a (click)="question.doDownloadFile($event, val)" [attr.href]="val.content | safeUrl" | ||
[attr.title]="val.name" [attr.download]="val.name" [style.width]="question.imageWidth">{{ | ||
val.name | ||
}}</a> | ||
</div> | ||
<div [class]="question.getImageWrapperCss(val)"> | ||
<img *ngIf="question.canPreviewImage(val)" [attr.src]="val.content | safeUrl" | ||
[style.height]="question.imageHeight" [style.width]="question.imageWidth" alt="File preview" /> | ||
<svg *ngIf="question.defaultImage(val)" [iconName]="question.cssClasses.defaultImageIconId" | ||
[partCss]="question.cssClasses.defaultImage" [size]="'auto'" sv-ng-svg-icon></svg> | ||
<div *ngIf="val.name && !question.isReadOnly" [class]="question.getRemoveButtonCss()" | ||
(click)="question.doRemoveFile(val, $event)"> | ||
<span [class]="question.cssClasses.removeFile">{{ question.removeFileCaption }}</span> | ||
<svg *ngIf="question.cssClasses.removeFileSvgIconId" [title]="question.removeFileCaption" | ||
[partCss]="question.cssClasses.removeFileSvg" | ||
[iconName]="question.cssClasses.removeFileSvgIconId" [size]="'auto'" sv-ng-svg-icon></svg> | ||
</div> | ||
</div> | ||
<div *ngIf="val.name && question.cssClasses.fileSignBottom" | ||
[class]="question.cssClasses.fileSignBottom"> | ||
<a (click)="question.doDownloadFile($event, val)" [attr.href]="val.content | safeUrl" | ||
[attr.title]="val.name" [attr.download]="val.name" [style.width]="question.imageWidth">{{ | ||
val.name | ||
}}</a> | ||
</div> | ||
</span> | ||
<ng-container *ngIf="question.supportFileNavigator"> | ||
<sv-ng-file-page *ngFor="let page of question.renderedPages; trackBy: trackPagesFn" [page]="page" [question]="question"></sv-ng-file-page> | ||
</ng-container> | ||
<ng-container *ngIf="!question.supportFileNavigator"> | ||
<sv-ng-file-item *ngFor="let item of question.previewValue" [item]="item" [question]="question"></sv-ng-file-item> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.