File

projects/wms-framework/src/lib/models/controls/DataGridColumnModel.ts

Description

Model class to represent DataGridColumn component

Extends

DependencyObject

Index

Properties
Methods
Accessors

Properties

Private _minWidth
Type : number

Backing field for MinWidth property.

Public ActualWidth
Type : number
Default value : 0

Gets the current width of the column in pixels.

Public CalculatedWidth
Type : string
Default value : '0'

Resulting width after autosize calculations

Public CanUserReorder
Type : boolean
Decorators :
@Dependency(DataGridColumnModel.CanUserReorderProperty)

Indicates whether the user can change the column display position by dragging the column header.

Static CanUserReorderProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'CanUserReorder', true, null )

CanUserReorder dependency property

Public CanUserResize
Type : boolean
Decorators :
@Dependency(DataGridColumnModel.CanUserResizeProperty)

Indicates whether the user can adjust the column width using the mouse.

Static CanUserResizeProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'CanUserResize', true, null )

CanUserResize dependency property

Public CanUserSort
Type : boolean
Decorators :
@Dependency(DataGridColumnModel.CanUserSortProperty)

Indicates whether the user can sort the column by clicking the column header.

Static CanUserSortProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'CanUserSort', true, null )

CanUserSort dependency property

Public Header
Type : any
Decorators :
@Dependency(DataGridColumnModel.HeaderProperty)

Gets or sets the content of the column header.

Static HeaderProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'Header', null, null )

Header dependency property

Public HeaderStyle
Type : RuntimeStyleInfo

Gets or sets the HeaderStyle

Public isReadOnly
Type : boolean
Decorators :
@Dependency(DataGridColumnModel.isReadOnlyProperty)

Boolean property that allows the edition mode

Static isReadOnlyProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'isReadOnly', false, null )

isReadOnly dependency property

Public MaxWidth
Type : any
Decorators :
@Dependency(DataGridColumnModel.MaxWidthProperty)

MaxWidthProperty

Static MaxWidthProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'MaxWidth', null, null )

MaxWidthProperty

Public ParentGrid
Type : DataGridModel
Default value : null

Parent DataGrid model

Public SortMemberPath
Type : string
Decorators :
@Dependency(DataGridColumnModel.SortMemberPathProperty)

Indicates the member to sort by.

Static SortMemberPathProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'SortMemberPath', null, null )

SortMemberPath dependency property

Public Visibility
Type : boolean
Decorators :
@Dependency(DataGridColumnModel.VisibilityProperty)

Indicates a column visibility mode.

Static VisibilityProperty
Type : DependencyProperty
Default value : new DependencyProperty( 'Visibility', true, null )

VisibilityProperty

Public Width
Type : DataGridLengthModel

Gets or sets the column width or an automatic sizing mode.

Protected bindingExpressions
Default value : new SimpleDictionary< string, BindingExpression >()
Inherited from DependencyObject
Public BindingValidationError
Default value : new SubscriptionEvent< (sender: any, e: BindingValidationErrorEventArgs) => void >()
Inherited from DependencyObject

Event for validation errors

Public change
Type : SubscriptionEvent<void>
Default value : new SubscriptionEvent()
Inherited from DependencyObject

Infrastructure event for notifying event changes

Public Dispatcher
Type : Dispatcher
Default value : Dispatcher.GetDispatcher()
Inherited from DependencyObject
isEnableSetPropertiesRegistry
Type : boolean
Default value : true
Inherited from DependencyObject

Flag which indicates if the dependency property set mechanism is enable

Public IsInitializingBindings
Type : boolean
Default value : false
Inherited from DependencyObject

Property to determine if bindings are being initialized

previousValidationMessage
Type : string
Default value : ''
Inherited from DependencyObject
Protected properties
Type : object
Default value : {}
Inherited from DependencyObject
Private setPropertiesRegistry
Type : Map<string | boolean>
Default value : new Map()
Inherited from DependencyObject

Registry with dependencies properties which has been set

validationerr
Default value : false
Inherited from DependencyObject
validationMessagesStack
Type : Array<>
Default value : []
Inherited from DependencyObject

Keeps a queue of validation messages registered on the current Dependency Object

Methods

Private addRelatedSubscriptionIfRequired
addRelatedSubscriptionIfRequired(event: SubscriptionEvent<any>, theHandler: any, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
event SubscriptionEvent<any> No
theHandler any No
bindingExpression BindingExpression No
Returns : void
Private addSubscriptionForTwoWayBindings
addSubscriptionForTwoWayBindings(dependencyProperty: DependencyProperty, binding: Binding, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding Binding No
bindingExpression BindingExpression No
Returns : void
addsValidationMessage
addsValidationMessage(propKey: Binding | string, message: string)
Inherited from DependencyObject

Adds a new validation message associated to a binding or a property name

Parameters :
Name Type Optional
propKey Binding | string No
message string No
Returns : void
Private beginSubscribeToMultiPropertyPathChanges
beginSubscribeToMultiPropertyPathChanges(context: any, binding: Binding, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
context any No
binding Binding No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
Returns : void
Private checkForSubscriptoinToDataErrorInfo
checkForSubscriptoinToDataErrorInfo(currentContext: any, binding: Binding, propertyToSubscribe: string, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
binding Binding No
propertyToSubscribe string No
bindingExpression BindingExpression No
Returns : void
Public clearValue
clearValue(property: DependencyProperty)
Inherited from DependencyObject

Clears the dependency property value

Parameters :
Name Type Optional
property DependencyProperty No
Returns : void
Equals
Equals(obj: any)
Inherited from DependencyObject

Compares this dependency object agains another object.

Parameters :
Name Type Optional
obj any No
Returns : boolean

{boolean}

GetChild
GetChild(idx: number)
Inherited from DependencyObject

Gets the child element at the index position

Parameters :
Name Type Optional
idx number No
Returns : DependencyObject

{DependencyObject}

GetChildrenCount
GetChildrenCount()
Inherited from DependencyObject

Method o know the amount of children the parent has

Returns : number

{number}

GetHashCode
GetHashCode()
Inherited from DependencyObject

Gets a hash code for this dependency object.

Returns : number

{number}

Public getValue
getValue(property: DependencyProperty)
Inherited from DependencyObject

Gets the value of a dependency property

Parameters :
Name Type Optional
property DependencyProperty No
Returns : any
Private handleErrorsOnContext
handleErrorsOnContext(errorCtxt: INotifyDataErrorInfo, args: DataErrorsChangedEventArgs)
Inherited from DependencyObject

Check and register possible errors in an error context

Parameters :
Name Type Optional
errorCtxt INotifyDataErrorInfo No
args DataErrorsChangedEventArgs No
Returns : void
Public IsPropertySet
IsPropertySet(propertyName: string)
Inherited from DependencyObject

Indicates if the property has been already set.

Parameters :
Name Type Optional
propertyName string No
Returns : any
Private performDataErrorValidationIfRequired
performDataErrorValidationIfRequired(binding: Binding, theBindingContext: any)
Inherited from DependencyObject

Performs validation on model if the model implementes IDataErrorINfo

Parameters :
Name Type Optional
binding Binding No
theBindingContext any No
Returns : void
Private performRemoveValidationIfInValidationError
performRemoveValidationIfInValidationError(binding: Binding)
Inherited from DependencyObject

Performs the remove validation if the InValidationError is true

Parameters :
Name Type Optional
binding Binding No
Returns : void
Public performTargetObjectBindingUpdate
performTargetObjectBindingUpdate(dependencyProperty: DependencyProperty, binding: Binding)
Inherited from DependencyObject

Updates the target object value associated to the binding.

Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding Binding No
Returns : void
Private preprocessValue
preprocessValue(property: DependencyProperty, value: any)
Inherited from DependencyObject

Preprocess value to be set to dependency property

Parameters :
Name Type Optional
property DependencyProperty No
value any No
Returns : any
Private recreateSubscriptionsForMultiPropertyBindingPath
recreateSubscriptionsForMultiPropertyBindingPath(currentContext: any, outerContext: any, properties: string[], propertyIndex: number, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression, subscriptionsForCurrentBindingPath: Array<>)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
outerContext any No
properties string[] No
propertyIndex number No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
subscriptionsForCurrentBindingPath Array<> No
Returns : void
Private registerSetPropertyIfRequired
registerSetPropertyIfRequired(name: string)
Inherited from DependencyObject

Register set property if required

Parameters :
Name Type Optional
name string No
Returns : void
Private removeSubscriptionsForMultiPropertyBindingPath
removeSubscriptionsForMultiPropertyBindingPath(subscriptionsForCurrentBindingPath: [], propertyIndex: number)
Inherited from DependencyObject
Parameters :
Name Type Optional
subscriptionsForCurrentBindingPath [] No
propertyIndex number No
Returns : void
removeValidationMessage
removeValidationMessage(propKey: Binding | string)
Inherited from DependencyObject

Removes a validation message associated to a binding or a property name

Parameters :
Name Type Optional
propKey Binding | string No
Returns : void
SetBinding
SetBinding(dependencyProperty: DependencyProperty, binding: Binding)
Inherited from DependencyObject

Sets a binding to the specified property at runtime

Parameters :
Name Type Optional Description
dependencyProperty DependencyProperty No

property to bind

binding Binding No

binding object

Returns : void
Public setValue
setValue(property: DependencyProperty, value: any)
Inherited from DependencyObject

Sets the value for a dependency property

Parameters :
Name Type Optional
property DependencyProperty No
value any No
Returns : void
Public setValueForScopedRegion
setValueForScopedRegion(property: DependencyProperty, value: any, scopedRegionManager: IRegionManager)
Inherited from DependencyObject

Sets the value for a dependency property. This is a workaround to support Scoped Region Managers. A research is required to find out the way to get the application region Manager when scoped region managers are used (when creating the DelayedRegionBehavior, the correct scoped region manager must be passed as an argument).

Parameters :
Name Type Optional
property DependencyProperty No
value any No
scopedRegionManager IRegionManager No
Returns : void
Protected shouldPreventDefaultSourceUpdate
shouldPreventDefaultSourceUpdate(dependencyProperty: DependencyProperty, binding: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
dependencyProperty DependencyProperty No
binding BindingExpression No
Returns : boolean
Private subscribeToBindingPathChanges
subscribeToBindingPathChanges(context: any, binding: Binding, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
context any No
binding Binding No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
Returns : void
Private subscribeToErrorsChangedInModel
subscribeToErrorsChangedInModel(errorCtxt: INotifyDataErrorInfo, propertyToSubscribe: string, bindingExpression: BindingExpression)
Inherited from DependencyObject
Parameters :
Name Type Optional
errorCtxt INotifyDataErrorInfo No
propertyToSubscribe string No
bindingExpression BindingExpression No
Returns : void
Private subscribeToPropertyChanges
subscribeToPropertyChanges(currentContext: any, outerContext: any, properties: string[], propertyIndex: number, dependencyProperty: DependencyProperty, bindingExpression: BindingExpression, subscriptionsForCurrentBindingPath: Array<>)
Inherited from DependencyObject
Parameters :
Name Type Optional
currentContext any No
outerContext any No
properties string[] No
propertyIndex number No
dependencyProperty DependencyProperty No
bindingExpression BindingExpression No
subscriptionsForCurrentBindingPath Array<> No
Returns : void
Private updateSourceOfBinding
updateSourceOfBinding(binding: Binding, outerContext: any, dependencyProperty: DependencyProperty)
Inherited from DependencyObject

Updates the source of a binding

Parameters :
Name Type Optional
binding Binding No
outerContext any No
dependencyProperty DependencyProperty No
Returns : void

Accessors

WidthResolved
getWidthResolved()

Gets the resolved grid column width

ActualMinWidth
getActualMinWidth()

Gets the actual minimum width (in pixels) for this column. This value uses the parent grid MinColumnWidth if MinWidth is not set for this column.

Returns : number
MinWidth
getMinWidth()

Gets the minimum width (in pixels) for this column.

Returns : number
setMinWidth(value: number)

Sets the minimum width (in pixels) for this column.

Parameters :
Name Type Optional
value number No
Returns : void
import { DependencyProperty } from '../../basecomponentmodel/DependencyProperty';
import { Dependency } from '../../basecomponentmodel/Dependency';
import { DependencyObject } from '../../basecomponentmodel/DependencyObject';
import { DataGridLengthModel } from './DataGridLengthModel';
import type { DataGridModel } from './DataGridModel';
import { RuntimeStyleInfo } from '../../basecomponentmodel/RuntimeStyleInfo';
import { DataGridLengthUnitType } from './DataGridLengthUnitType';

/**
 * Model class to represent DataGridColumn component
 *
 * @export
 * @class DataGridColumnModel
 * @extends {DependencyObject}
 * @wType System.Windows.Controls.DataGridColumn
 */
export class DataGridColumnModel extends DependencyObject {
  /**
   * CanUserResize dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static CanUserResizeProperty: DependencyProperty = new DependencyProperty(
    'CanUserResize',
    true,
    null
  );

  /**
   * CanUserReorder dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static CanUserReorderProperty: DependencyProperty = new DependencyProperty(
    'CanUserReorder',
    true,
    null
  );

  /**
   * CanUserSort dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static CanUserSortProperty: DependencyProperty = new DependencyProperty(
    'CanUserSort',
    true,
    null
  );

  /**
   * Header dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static HeaderProperty: DependencyProperty = new DependencyProperty(
    'Header',
    null,
    null
  );

  /**
   * isReadOnly dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   * @wProperty IsReadOnlyProperty
   */
  static isReadOnlyProperty: DependencyProperty = new DependencyProperty(
    'isReadOnly',
    false,
    null
  );

  /**
   * SortMemberPath dependency property
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static SortMemberPathProperty: DependencyProperty = new DependencyProperty(
    'SortMemberPath',
    null,
    null
  );

  /**
   * MaxWidthProperty
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static MaxWidthProperty: DependencyProperty = new DependencyProperty(
    'MaxWidth',
    null,
    null
  );

  /**
   * VisibilityProperty
   *
   * @static
   * @type {DependencyProperty}
   * @memberof DataGridColumnModel
   */
  static VisibilityProperty: DependencyProperty = new DependencyProperty(
    'Visibility',
    true,
    null
  );

  /**
   * Backing field for `MinWidth` property.
   *
   * @private
   * @type {number}
   * @memberof DataGridColumnModel
   */
  private _minWidth: number; // eslint-disable-line @typescript-eslint/naming-convention

  /**
   * Resulting width after autosize calculations
   *
   * @type {string}
   * @memberof DataGridColumnModel
   * @wIgnore
   */
  public CalculatedWidth: string = '0';

  /**
   * Gets or sets the content of the column header.
   *
   * @type {any}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.HeaderProperty)
  public Header: any;

  /**
   * Gets or sets the HeaderStyle
   *
   * @type {Style}
   * @memberof DataGridColumnModel
   */
  public HeaderStyle: RuntimeStyleInfo;

  /**
   * Gets or sets the column width or an automatic sizing mode.
   *
   * @type {DataGridLengthModel}
   * @memberof DataGridColumnModel
   */
  public Width: DataGridLengthModel;

  /**
   * MaxWidthProperty
   *
   * @type {*}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.MaxWidthProperty)
  public MaxWidth: any;

  /**
   * Gets the current width of the column in pixels.
   *
   * @type {number}
   * @memberof DataGridColumnModel
   */
  public ActualWidth: number = 0;

  /**
   * Indicates whether the user can adjust the column width using the mouse.
   *
   * @type {boolean}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.CanUserResizeProperty)
  public CanUserResize: boolean;

  /**
   * Boolean property that allows the edition mode
   *
   * @type {boolean}
   * @memberof DataGridColumnModel
   * @wProperty IsReadOnly
   */
  @Dependency(DataGridColumnModel.isReadOnlyProperty)
  public isReadOnly: boolean;

  /**
   * Indicates whether the user can change the column display position by dragging the column header.
   *
   * @type {boolean}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.CanUserReorderProperty)
  public CanUserReorder: boolean;

  /**
   * Indicates whether the user can sort the column by clicking the column header.
   *
   * @type {boolean}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.CanUserSortProperty)
  public CanUserSort: boolean;

  /**
   * Indicates the member to sort by.
   *
   * @type {string}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.SortMemberPathProperty)
  public SortMemberPath: string;

  /**
   * Indicates a column visibility mode.
   *
   * @type {boolean}
   * @memberof DataGridColumnModel
   */
  @Dependency(DataGridColumnModel.VisibilityProperty)
  public Visibility: boolean;

  /**
   *  Parent DataGrid model
   *
   * @type {DataGridModel}
   * @memberof DataGridColumnModel
   * @wIgnore
   */
  public ParentGrid: DataGridModel = null;

  /**
   * Gets the resolved grid column width
   *
   * @readonly
   * @returns {DataGridLengthModel}
   * @memberof DataGridColumnModel
   * @wIgnore
   */
  public get WidthResolved(): DataGridLengthModel {
    // differs from xam-grid original implementation
    return !this.Width
      ? new DataGridLengthModel(0, DataGridLengthUnitType.Auto)
      : this.Width;
  }

  /**
   * Gets the actual minimum width (in pixels) for this column.
   * This value uses the parent grid `MinColumnWidth` if `MinWidth`
   * is not set for this column.
   *
   * @readonly
   * @type {number}
   * @memberof DataGridColumnModel
   * @wIgnore
   */
  public get ActualMinWidth(): number {
    return this._minWidth ?? this.ParentGrid?.MinColumnWidth ?? 0;
  }

  /**
   * Gets the minimum width (in pixels) for this column.
   *
   * @type {number}
   * @memberof DataGridColumnModel
   */
  public get MinWidth(): number {
    return this._minWidth ?? 0;
  }

  /**
   * Sets the minimum width (in pixels) for this column.
   *
   * @memberof DataGridColumnModel
   */
  public set MinWidth(value: number) {
    this._minWidth = value;
  }
}

result-matching ""

    No results matching ""