mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-24 18:04:39 -05:00
![dependabot[bot]](/assets/img/avatar_default.png)
* Chore(deps-dev): Bump the frontend-angular-dependencies group Bumps the frontend-angular-dependencies group in /src-ui with 5 updates: | Package | From | To | | --- | --- | --- | | [@angular-eslint/builder](https://github.com/angular-eslint/angular-eslint/tree/HEAD/packages/builder) | `19.1.0` | `19.2.0` | | [@angular-eslint/eslint-plugin](https://github.com/angular-eslint/angular-eslint/tree/HEAD/packages/eslint-plugin) | `19.1.0` | `19.2.0` | | [@angular-eslint/eslint-plugin-template](https://github.com/angular-eslint/angular-eslint/tree/HEAD/packages/eslint-plugin-template) | `19.1.0` | `19.2.0` | | [@angular-eslint/schematics](https://github.com/angular-eslint/angular-eslint/tree/HEAD/packages/schematics) | `19.1.0` | `19.2.0` | | [@angular-eslint/template-parser](https://github.com/angular-eslint/angular-eslint/tree/HEAD/packages/template-parser) | `19.1.0` | `19.2.0` | Updates `@angular-eslint/builder` from 19.1.0 to 19.2.0 - [Release notes](https://github.com/angular-eslint/angular-eslint/releases) - [Changelog](https://github.com/angular-eslint/angular-eslint/blob/main/packages/builder/CHANGELOG.md) - [Commits](https://github.com/angular-eslint/angular-eslint/commits/v19.2.0/packages/builder) Updates `@angular-eslint/eslint-plugin` from 19.1.0 to 19.2.0 - [Release notes](https://github.com/angular-eslint/angular-eslint/releases) - [Changelog](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/angular-eslint/angular-eslint/commits/v19.2.0/packages/eslint-plugin) Updates `@angular-eslint/eslint-plugin-template` from 19.1.0 to 19.2.0 - [Release notes](https://github.com/angular-eslint/angular-eslint/releases) - [Changelog](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/CHANGELOG.md) - [Commits](https://github.com/angular-eslint/angular-eslint/commits/v19.2.0/packages/eslint-plugin-template) Updates `@angular-eslint/schematics` from 19.1.0 to 19.2.0 - [Release notes](https://github.com/angular-eslint/angular-eslint/releases) - [Changelog](https://github.com/angular-eslint/angular-eslint/blob/main/packages/schematics/CHANGELOG.md) - [Commits](https://github.com/angular-eslint/angular-eslint/commits/v19.2.0/packages/schematics) Updates `@angular-eslint/template-parser` from 19.1.0 to 19.2.0 - [Release notes](https://github.com/angular-eslint/angular-eslint/releases) - [Changelog](https://github.com/angular-eslint/angular-eslint/blob/main/packages/template-parser/CHANGELOG.md) - [Commits](https://github.com/angular-eslint/angular-eslint/commits/v19.2.0/packages/template-parser) --- updated-dependencies: - dependency-name: "@angular-eslint/builder" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: frontend-angular-dependencies - dependency-name: "@angular-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: frontend-angular-dependencies - dependency-name: "@angular-eslint/eslint-plugin-template" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: frontend-angular-dependencies - dependency-name: "@angular-eslint/schematics" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: frontend-angular-dependencies - dependency-name: "@angular-eslint/template-parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: frontend-angular-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * Fix lint error on toast close output name --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import { Clipboard } from '@angular/cdk/clipboard'
|
|
import { DecimalPipe } from '@angular/common'
|
|
import { Component, EventEmitter, Input, Output } from '@angular/core'
|
|
import {
|
|
NgbProgressbarModule,
|
|
NgbToastModule,
|
|
} from '@ng-bootstrap/ng-bootstrap'
|
|
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
|
import { interval, take } from 'rxjs'
|
|
import { Toast } from 'src/app/services/toast.service'
|
|
|
|
@Component({
|
|
selector: 'pngx-toast',
|
|
imports: [
|
|
DecimalPipe,
|
|
NgbToastModule,
|
|
NgbProgressbarModule,
|
|
NgxBootstrapIconsModule,
|
|
],
|
|
templateUrl: './toast.component.html',
|
|
styleUrl: './toast.component.scss',
|
|
})
|
|
export class ToastComponent {
|
|
@Input() toast: Toast
|
|
|
|
@Input() autohide: boolean = true
|
|
|
|
@Output() hidden: EventEmitter<Toast> = new EventEmitter<Toast>()
|
|
|
|
@Output() closed: EventEmitter<Toast> = new EventEmitter<Toast>()
|
|
|
|
public copied: boolean = false
|
|
|
|
constructor(private clipboard: Clipboard) {}
|
|
|
|
onShown(toast: Toast) {
|
|
if (!this.autohide) return
|
|
|
|
const refreshInterval = 150
|
|
const delay = toast.delay - 500 // for fade animation
|
|
|
|
interval(refreshInterval)
|
|
.pipe(take(Math.round(delay / refreshInterval)))
|
|
.subscribe((count) => {
|
|
toast.delayRemaining = Math.max(
|
|
0,
|
|
delay - refreshInterval * (count + 1)
|
|
)
|
|
})
|
|
}
|
|
|
|
public isDetailedError(error: any): boolean {
|
|
return (
|
|
typeof error === 'object' &&
|
|
'status' in error &&
|
|
'statusText' in error &&
|
|
'url' in error &&
|
|
'message' in error &&
|
|
'error' in error
|
|
)
|
|
}
|
|
|
|
public copyError(error: any) {
|
|
this.clipboard.copy(JSON.stringify(error))
|
|
this.copied = true
|
|
setTimeout(() => {
|
|
this.copied = false
|
|
}, 3000)
|
|
}
|
|
|
|
getErrorText(error: any) {
|
|
let text: string = error.error?.detail ?? error.error ?? ''
|
|
if (typeof text === 'object') text = JSON.stringify(text)
|
|
return `${text.slice(0, 200)}${text.length > 200 ? '...' : ''}`
|
|
}
|
|
}
|