refactor: use SwiperJS in schedule module

This commit is contained in:
Wieland Schöbl
2021-11-09 17:12:45 +00:00
parent d6cb7e1d3b
commit 523e34f6e4
27 changed files with 771 additions and 421 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 StApps
* Copyright (C) 2021 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -48,6 +48,28 @@ export class ArrayJoinPipe implements PipeTransform {
}
}
@Injectable()
@Pipe({
name: 'entries',
pure: true,
})
export class EntriesPipe implements PipeTransform {
transform<T>(value: Record<string | number | symbol, T>): T[] {
return Object.values(value);
}
}
@Injectable()
@Pipe({
name: 'toUnix',
pure: true,
})
export class ToUnixPipe implements PipeTransform {
transform(value: string | number | Date | null | undefined): number {
return (value instanceof Date ? value : new Date(value ?? 0)).valueOf();
}
}
@Injectable()
@Pipe({
name: 'sentencecase',

View File

@@ -23,6 +23,8 @@ import {
StringSplitPipe,
OpeningHoursPipe,
DurationLocalizedPipe,
ToUnixPipe,
EntriesPipe,
} from './common-string-pipes';
import {
ThingTranslateDefaultParser,
@@ -52,6 +54,8 @@ export interface ThingTranslateModuleConfig {
DateLocalizedFormatPipe,
OpeningHoursPipe,
SentenceCasePipe,
ToUnixPipe,
EntriesPipe,
],
exports: [
ArrayJoinPipe,
@@ -65,6 +69,8 @@ export interface ThingTranslateModuleConfig {
DateLocalizedFormatPipe,
OpeningHoursPipe,
SentenceCasePipe,
ToUnixPipe,
EntriesPipe,
],
})
export class ThingTranslateModule {