File

projects/netgrif-components-core/src/lib/data-fields/date-time-field/models/date-time-field.ts

Extends

AbstractTimeInstanceField

Index

Properties
Methods

Constructor

constructor(stringId: string, title: string, value: Moment, behavior: Behavior, placeholder?: string, description?: string, layout?: Layout, validations?: Array<Validation>, component?: Component, parentTaskId?: string)
Parameters :
Name Type Optional
stringId string No
title string No
value Moment No
behavior Behavior No
placeholder string Yes
description string Yes
layout Layout Yes
validations Array<Validation> Yes
component Component Yes
parentTaskId string Yes

Properties

Public max
Type : Moment
Public min
Type : Moment
Protected _blockSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:71
Protected _formControlValueSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:73
Protected _initializedSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:103

Stores the last subscription to the _initialized$ Stream, to prevent multiple block events from executing at the same time

Protected _localLayout
Type : Layout
Inherited from DataField
Defined in DataField:115

Stores a copy of the fields layout, that can be modified by the layouting algorithm as needed without affecting the base configuration.

Protected _myValueSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:74
Protected _touchSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:72
Protected _updateSubscription
Type : Subscription
Inherited from DataField
Defined in DataField:70
Protected _validators
Type : Array<ValidatorFn>
Inherited from DataField
Defined in DataField:97

Validators resolved from field validations

Protected layoutSubject
Type : BehaviorSubject<Layout>
Inherited from DataField
Defined in DataField:120

Listens for layout changes

Public Optional validations
Type : Array<Validation>
Inherited from DataField
Defined in DataField:152

Methods

Public getTypedComponentType
getTypedComponentType()
Inherited from DataField
Defined in DataField:15
Returns : string
Protected valueEquality
valueEquality(a: Moment, b: Moment)
Inherited from DataField
Defined in DataField:19
Parameters :
Name Type Optional
a Moment No
b Moment No
Returns : boolean
Static isEqual
isEqual(a: Moment, b: Moment, granularity?: moment.unitOfTime.StartOf)
Parameters :
Name Type Optional
a Moment No
b Moment No
granularity moment.unitOfTime.StartOf Yes
Returns : boolean
Static parseDate
parseDate(date: string)

Parse date from string: date is string 'past' - return string 'past' date is string 'future' - return string 'future' date is string 'today'/'now' - return moment instance of current date/time date is string build by combination of 'today'/'now'+/-ISO8601 (eg. today-P1DT1H) - return parsed moment instance of date date is string of specific date - return moment instance of this specific date

Parameters :
Name Type Optional Description
date string No
  • string that should be parsed
Returns : any
Protected resolveValidations
resolveValidations()
Inherited from DataField
Defined in DataField:64
Returns : Array<ValidatorFn>
Protected validBetween
validBetween(first: Moment, second: Moment)
Parameters :
Name Type Optional
first Moment No
second Moment No
Returns : ValidatorFn
Protected validFromPast
validFromPast(range: Moment)
Parameters :
Name Type Optional
range Moment No
Returns : ValidatorFn
Protected validToFuture
validToFuture(range: Moment)
Parameters :
Name Type Optional
range Moment No
Returns : ValidatorFn
Protected validWeekend
validWeekend(fc: FormControl)
Parameters :
Name Type Optional
fc FormControl No
Returns : { validWeekend: boolean; }
Protected validWorkday
validWorkday(fc: FormControl)
Parameters :
Name Type Optional
fc FormControl No
Returns : { validWorkday: boolean; }
Protected _determineFormControlValidity
_determineFormControlValidity(formControl: FormControl)
Inherited from DataField
Defined in DataField:490

Computes whether the FormControl si valid.

Parameters :
Name Type Optional Description
formControl FormControl No

check form control

Returns : boolean
Public applyChange
applyChange(change: Change)
Inherited from DataField
Defined in DataField:555

Updates the state of this data field model object.

Also see ChangedFields.

Parameters :
Name Type Optional Description
change Change No
  • object describing the changes - returned from backend

Also see {

Returns : void
Protected calculateValidity
calculateValidity(forValidRequired: boolean, formControl: FormControl)
Inherited from DataField
Defined in DataField:598
Parameters :
Name Type Optional
forValidRequired boolean No
formControl FormControl No
Returns : boolean
Public clearValidators
clearValidators()
Inherited from DataField
Defined in DataField:530
Returns : void
Public componentChange$
componentChange$()
Inherited from DataField
Defined in DataField:307
Public destroy
destroy()
Inherited from DataField
Defined in DataField:393
Returns : void
Public disconnectFormControl
disconnectFormControl()
Inherited from DataField
Defined in DataField:433
Returns : void
Public focus
focus()
Inherited from DataField
Defined in DataField:357
Returns : void
Public getComponentType
getComponentType()
Inherited from DataField
Defined in DataField:387

This function resolve type of component for HTML

Returns : string

type of component in string

Public getUpdateOnStrategy
getUpdateOnStrategy()
Inherited from DataField
Defined in DataField:379
Returns : UpdateOnStrategy
Public isInvalid
isInvalid(formControl: FormControl)
Inherited from DataField
Defined in DataField:615
Parameters :
Name Type Optional
formControl FormControl No
Returns : boolean
Public registerFormControl
registerFormControl(formControl: FormControl)
Inherited from DataField
Defined in DataField:403
Parameters :
Name Type Optional
formControl FormControl No
Returns : void
Public replaceValidations
replaceValidations(validations: Array<Validation>)
Inherited from DataField
Defined in DataField:525
Parameters :
Name Type Optional
validations Array<Validation> No
Returns : void
Public resetLocalLayout
resetLocalLayout()
Inherited from DataField
Defined in DataField:622

Copies the layout settings into the local layout.

Returns : void
Public resolveAppearance
resolveAppearance(config: ConfigurationService)
Inherited from DataField
Defined in DataField:571
Parameters :
Name Type Optional
config ConfigurationService No
Returns : void
Protected resolveFormControlValidators
resolveFormControlValidators()
Inherited from DataField
Defined in DataField:506

Creates Validator objects based on field behavior. Only the required behavior is resolved by default. Required is resolved as Validators.required. If you need to resolve additional Validators or need a different resolution for the required Validator override this method.

See Behavior for information about data field behavior.

See ValidatorFn and Validators for information about Validators.

Alternatively see Form Validation guide from Angular.

Returns : Array<ValidatorFn>
Public resolvePrevValue
resolvePrevValue(value: T)
Inherited from DataField
Defined in DataField:591
Parameters :
Name Type Optional
value T No
Returns : void
Public revertToPreviousValue
revertToPreviousValue()
Inherited from DataField
Defined in DataField:311
Returns : void
Protected subscribeToInnerSubjects
subscribeToInnerSubjects(formControl: FormControl)
Inherited from DataField
Defined in DataField:458
Parameters :
Name Type Optional
formControl FormControl No
Returns : void
Public update
update()
Inherited from DataField
Defined in DataField:341
Returns : void
Protected updateFormControlState
updateFormControlState(formControl: FormControl)
Inherited from DataField
Defined in DataField:452
Parameters :
Name Type Optional
formControl FormControl No
Returns : void
Public valueChanges
valueChanges()
Inherited from DataField
Defined in DataField:345
Returns : Observable<T>
Public valueWithoutChange
valueWithoutChange(value: T)
Inherited from DataField
Defined in DataField:235
Parameters :
Name Type Optional
value T No
Returns : void
import {Behavior} from '../../models/behavior';
import {Moment} from 'moment';
import {AbstractTimeInstanceField} from '../../time-instance-abstract-field/models/abstract-time-instance-field';
import {Layout} from '../../models/layout';
import {Validation} from '../../models/validation';
import {Component, ComponentPrefixes} from '../../models/component';

export class DateTimeField extends AbstractTimeInstanceField {

    constructor(stringId: string, title: string, value: Moment, behavior: Behavior, placeholder?: string,
                description?: string, layout?: Layout, validations?: Array<Validation>, component?: Component, parentTaskId?: string) {
        super(stringId, title, value, behavior, placeholder, description, layout, validations, component, parentTaskId);
    }

    public getTypedComponentType(): string {
        return ComponentPrefixes.DATE_TIME + this.getComponentType();
    }

    protected valueEquality(a: Moment, b: Moment): boolean {
        return AbstractTimeInstanceField.isEqual(a, b, 'minute');
    }
}

result-matching ""

    No results matching ""