UNPKG

@pilotlab/lux-attributes

Version:

A luxurious user experience framework, developed by your friends at Pilot.

100 lines (71 loc) 3.08 kB
import { INodes } from '@pilotlab/lux-nodes'; import { ProgressTracker } from '@pilotlab/lux-progress'; import { IPromise } from '@pilotlab/lux-result'; import { Signal } from '@pilotlab/lux-signals'; import IAttributeSetReturn from '../interfaces/iAttributeSetReturn'; import { MapList } from '@pilotlab/lux-collections'; import IAttributeChangeOptions from './iAttributeChangeOptions'; import IAttributeCreateOptions from './iAttributeCreateOptions'; import IAttribute from './iAttribute'; import IAttributeUpdateTracker from './iAttributeUpdateTracker'; import IAttributeFactory from './iAttributeFactory'; import AttributeEventArgs from '../attributeEventArgs'; import { DataType } from '../attributeEnums'; export interface IAttributes extends INodes { /*====================================================================* START: Properties *====================================================================*/ create:IAttributeFactory; copy:IAttributes; /*====================================================================* START: Signals *====================================================================*/ saveTriggered:Signal<AttributeEventArgs<any>>; /*====================================================================* START: Methods *====================================================================*/ /** * If an attribute exists at the given path, it will be returned. * Otherwise, a new attribute will first be created with the given * parameters, then returned. */ getOrCreate( path:string, createOptions?:IAttributeCreateOptions, segmentCreateOptions?:IAttributeCreateOptions ):IAttribute; get( path:string, value?:any, dataType?:DataType, label?:string, changeOptions?:IAttributeChangeOptions ):IAttribute; getOnly(paths:string[]):IAttributes; getAll(index?:string, options?:any, filter?:(data:any) => boolean, sort?:(a:any, b:any) => number):IAttributes; set( path:string, value?:any, changeOptions?:IAttributeChangeOptions ):IPromise<IAttributeSetReturn>; deleteByKey( key:string, changeOptions?:IAttributeChangeOptions ):IAttribute; interruptAll():void; toMap(isIncludeDataTypes?:boolean):MapList<string, any>; toObject(isIncludeDataTypes?:boolean, isForceIncludeAll?:boolean):Object; toArray():any[]; toJson(isIncludeDataTypes?:boolean):string; update( data:(IAttributes | Object | string), changeOptions?:IAttributeChangeOptions, progressTracker?:ProgressTracker ):IAttributeUpdateTracker; updateTracked(updateTracker:IAttributeUpdateTracker):void; /*====================================================================* START: Internal *====================================================================*/ internalChanged(args:AttributeEventArgs<IAttribute>):void; } // End interface export default IAttributes;