Index

dev-kit/src/platform/platform.ts

getPlatform
getPlatform()

Returns the platform/os the user is running on.

Used to align the app's behavior with the user's expectations (e.g. keyboard shortcuts).

Example :
import { getPlatform } from '@talenra/components/dev-kit';
console.log(`running on ${getPlatform()}`);
Returns : TPlatform

dev-kit/src/guid/guid.ts

guid
guid()

Generate and return a random UUID (GUID).

Example :
import { guid } from '@talenra/components/dev-kit';
const identifier: string = guid(); // e.g. '320c9b3b-cb98-44e8-a1cc-a7783882edd4'
Returns : string

rich-text-editor/src/utils/url.utils.ts

isUrlSafe
isUrlSafe(url: string)

Checks if a URL is safe to use (not a dangerous scheme like javascript:)

Parameters :
Name Type Optional Description
url string No

The URL to validate

Returns : boolean

true if the URL is safe, false otherwise

config/src/provide-talenra-base-config.ts

provideTalenraBaseConfig
provideTalenraBaseConfig(...features: undefined)

Factory function that returns a set of environment providers, allowing you to easily configure and initialize the TalenraBaseConfig service with one or more configuration objects at the application's root level.

Parameters :
Name Optional
features No
Returns : EnvironmentProviders

date/src/validators/validate-date.ts

validateDate
validateDate()

Checks whether the date is valid. Only basic validation.

Example :
// Component class
import { validateDate } from '@talenra/components/date';

const form = new FormGroup({
   date: new FormControl('', validateDate())
});
Example :
<!-- Component template -->
<talenra-form-field label="Date">
   <talenra-date formControlName="date"></talenra-date>
   <talenra-form-error [isVisible]="stateForm.get('date')?.touched && stateForm.get('date')?.hasError('invalidDate')"
   </talenra-form-error>
</talenra-form-fiel>
Returns : ValidatorFn

date/src/validators/validate-date-is-in-the-future.ts

validateDateIsInTheFuture
validateDateIsInTheFuture(includesToday: unknown, includeTime: unknown)

Checks whether the date is in the future. Often used in combination with validateDate.

Parameters :
Name Type Optional Default value Description
includesToday unknown No false

If true, the date is considered valid if it is today.

includeTime unknown No false

If true, the time is taken into account for the comparison.

Example :
import { validateDate, validateDateIsInTheFuture } from '@talenra/components/date';

const form = new FormGroup({
date: new FormControl('', [validateDate(), validateDateIsInTheFuture())
});
Example :
<talenra-form-field label="Date">
<talenra-date formControlName="date"></talenra-date>
<talenra-form-error [isVisible]="stateForm.get('date')?.touched && stateForm.get('date')?.hasError('dateIsInThePast')">
The date must be in the future.
</talenra-form-error>
<talenra-form-error [isVisible]="stateForm.get('date')?.touched && stateForm.get('date')?.hasError('invalidDate')">
The date is invalid.
</talenra-form-error>
</talenra-form-field>
Returns : ValidatorFn

date/src/validators/validate-date-is-in-the-past.ts

validateDateIsInThePast
validateDateIsInThePast(includesToday: unknown, includeTime: unknown)

Checks whether the date is in the future.

Parameters :
Name Type Optional Default value Description
includesToday unknown No false

If true, the date is considered valid if it is today.

includeTime unknown No false

If true, the time is taken into account for the comparison.

Example :
// Component class
import { validateDate, validateDateIsInThePast } from '@talenra/components/date';

const form = new FormGroup({
date: new FormControl('', [validateDate(), validateDateIsInThePast())
});
Example :
<!-- Component template -->
<talenra-form-field label="Date">
<talenra-date formControlName="date"></talenra-date>
<talenra-form-error [isVisible]="stateForm.get('date')?.touched && stateForm.get('date')?.hasError('dateIsInTheFuture')">
The date must be in the past.
</talenra-form-error>
<talenra-form-error [isVisible]="stateForm.get('date')?.touched && stateForm.get('date')?.hasError('invalidDate')">
The date is invalid.
</talenra-form-error>
</talenra-form-field>
Returns : ValidatorFn

date/src/validators/validate-start-date-is-before-end-date.ts

validateStartDateIsBeforeEndDate
validateStartDateIsBeforeEndDate(startDateId: string, endDateId: string, allowSameDay: boolean)

Checks if the start date is before the end date.

Parameters :
Name Type Optional Default value Description
startDateId string No

Name of the form-control

endDateId string No

Name of the form-control

allowSameDay boolean No false

Allows the end date to be on the same day as the start date, default is 'false'

Returns : ValidatorFn

Returns a function which in case of an error it returns { invalidDateOrder: true } apart from that null.

date/src/validators/validate-year-is-equal-or-greater.ts

validateYearIsEqualOrGreater
validateYearIsEqualOrGreater(threshold: number)

Checks if a date's year is greater than or equal the threshold's year.

Parameters :
Name Type Optional Description
threshold number No

The minimum year

Returns : ValidatorFn

Returns a function which in case of an error it returns { invalidPeriodStartYear: true } apart from that null.

results matching ""

    No results matching ""