packages/core/src/lib/item/item-config.interface.ts
An ItemConfig describes an abstract entity with certain properties.
Properties |
classes |
classes:
|
Type : function
|
Optional |
This method can be used to set custom classes based on item contents. Used e.g. in list-items for row class |
fields |
fields:
|
Type : FieldConfig
|
Optional |
The Items field Config |
identifier |
identifier:
|
Type : string
|
Optional |
The Property that is used to identify items from another (e.g. in a selection). |
identifierPattern |
identifierPattern:
|
Type : RegExp
|
Optional |
Pattern of the identifier field. Is used e.g. in the searchbar |
label |
label:
|
Type : string
|
Optional |
The Property that is used to display the item for humans |
onEdit |
onEdit:
|
Type : function
|
Optional |
Callback that is invoked before the item is edited |
onSave |
onSave:
|
Type : function
|
Optional |
Callback that is invoked when the item is saved |
parent |
parent:
|
Type : any
|
Optional |
Contains the parent Instance which inhabits the item. This property is set programmatically and therefore meant to be readonly. |
resolve |
resolve:
|
Type : function
|
Optional |
Custom resolve path function. It can be used e.g. to access subbranches of an Object. |
title |
title:
|
Type : string
|
Optional |
For primitive values only: the title for the item |
type |
type:
|
Type : string
|
Optional |
The type of the Item. It determines how it will be displayed in different contexts |
import { Item } from './item';
import { FieldConfig } from '../config/field-config.interface';
/** An ItemConfig describes an abstract entity with certain properties.*/
export interface ItemConfig<T> {
/** For primitive values only: the title for the item */
title?: string;
/** The Property that is used to identify items from another (e.g. in a selection). */
identifier?: string;
/** Pattern of the identifier field. Is used e.g. in the searchbar */
identifierPattern?: RegExp;
/** The Property that is used to display the item for humans */
label?: string;
/** The Items field Config */
fields?: FieldConfig;
/** The type of the Item. It determines how it will be displayed in different contexts */
type?: string;
/** Custom resolve path function. It can be used e.g. to access subbranches of an Object. */
resolve?: (body: T, item: Item<T>) => any;
/** Contains the parent Instance which inhabits the item. This property is set programmatically and therefore meant to be readonly.*/
parent?: any;
/** Callback that is invoked when the item is saved */
onSave?: (item?: Item<T>, value?: Object) => Promise<T> | T; // TODO rename to save
/** Callback that is invoked before the item is edited */
onEdit?: (value?: T) => Promise<T> | T; // TODO rename to save
/** This method can be used to set custom classes based on item contents. Used e.g. in list-items for row class */
classes?: (item?: Item<T>) => string;
}