-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added dbxSearchableTextFieldComponent
- Added dbxSearchableTextFieldComponent - Added dbxSearchableChipFieldComponent
- Loading branch information
Showing
29 changed files
with
664 additions
and
179 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Milliseconds } from './../../../../util/src/lib/date/date'; | ||
import { timeHasExpired } from '@dereekb/date'; | ||
import { DateOrUnixDateTimeNumber } from "@dereekb/util"; | ||
import { filter, map, MonoTypeOperatorFunction, Observable, OperatorFunction, skipUntil, skipWhile, switchMap, takeWhile } from "rxjs"; | ||
import { hasExpired, toExpires, Expires } from "./expires"; | ||
|
||
/** | ||
* Creates a new Expires object at the current time on emission that will expire in the set amount of time. | ||
* | ||
* @param expiresIn | ||
* @returns | ||
*/ | ||
export function toExpiration<T>(expiresIn: number): OperatorFunction<T, Expires> { | ||
return map(_ => toExpires(new Date(), expiresIn)); | ||
} | ||
|
||
/** | ||
* Filters further emissions once the input is expired. | ||
*/ | ||
export function skipExpired<T extends Expires>(): MonoTypeOperatorFunction<T> { | ||
return filter(expires => !hasExpired(expires)); | ||
} | ||
|
||
/** | ||
* Skips the input date or timenumber until expiration occurs. | ||
*/ | ||
export function skipUntilExpiration(expiresIn?: number): MonoTypeOperatorFunction<DateOrUnixDateTimeNumber> { | ||
return filter(x => timeHasExpired(x, expiresIn)); | ||
} | ||
|
||
/** | ||
* Skips the input date or timenumber after expiration occurs. | ||
*/ | ||
export function skipAfterExpiration(expiresIn?: number): MonoTypeOperatorFunction<DateOrUnixDateTimeNumber> { | ||
return filter(x => !timeHasExpired(x, expiresIn)); | ||
} | ||
|
||
/** | ||
* Skips emissions until time since the last emission from the watch observable has elapsed. | ||
*/ | ||
export function skipUntilTimeElapsedAfterLastEmission<T>(watch: Observable<any>, takeFor: Milliseconds): MonoTypeOperatorFunction<T> { | ||
return (observable: Observable<T>) => { | ||
return watch.pipe( | ||
switchMap(() => { | ||
const expires = toExpires(new Date(), takeFor); | ||
return observable.pipe(takeWhile(_ => !hasExpired(expires))); | ||
}) | ||
); | ||
}; | ||
} | ||
|
||
/** | ||
* Takes emissions until time since the last emission from the watch observable has elapsed. | ||
*/ | ||
export function takeAfterTimeElapsedSinceLastEmission<T>(watch: Observable<any>, skipFor: Milliseconds): MonoTypeOperatorFunction<T> { | ||
return (observable: Observable<T>) => { | ||
return watch.pipe( | ||
switchMap(() => { | ||
const expires = toExpires(new Date(), skipFor); | ||
return observable.pipe(skipWhile(_ => !hasExpired(expires))); | ||
}) | ||
); | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './expires'; | ||
export * from './expires.rxjs'; |
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
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,4 +1,4 @@ | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
export const DEFAULT_STORAGE_OBJECT_TOKEN = new InjectionToken('DEFAULT_STORAGE_OBJECT'); | ||
export const DEFAULT_STORAGE_ACCESSOR_FACTORY_TOKEN = new InjectionToken('DEFAULT_STORAGE_ACCESSOR_FACTORY'); | ||
export const DEFAULT_STORAGE_OBJECT_TOKEN = new InjectionToken('DBX_UTIL_DEFAULT_STORAGE_OBJECT'); | ||
export const DEFAULT_STORAGE_ACCESSOR_FACTORY_TOKEN = new InjectionToken('DBX_UTIL_DEFAULT_STORAGE_ACCESSOR_FACTORY'); |
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.