idea-toolbox
Version:
IDEA's utility functions
69 lines (68 loc) • 2 kB
TypeScript
import { Resource } from './resource.model';
import { CustomFieldMeta } from './customFieldMeta.model';
import { Label } from './label.model';
import { Languages } from './languages.model';
/**
* A custom section meta containing any number of custom fields meta.
*/
export declare class CustomSectionMeta extends Resource {
/**
* The name of the section. Support to multilanguage. Optional.
*/
name?: Label;
/**
* The description of the section. Support to multilanguage. Optional.
*/
description?: Label;
/**
* Ordered list of the fields (names) to expect in the section.
* Example: `['name', 'surname', ...]`.
*/
fieldsLegend: string[];
/**
* Object containg attributes of type CustomFieldMeta; e.g.
* ```
* fields.name: CustomFieldMeta;
* fields.surname: CustomFieldMeta;
* ...
* ```
*/
fields: CustomFieldsMeta;
/**
* Matrix that sets the way the section is shown in the template; when null, a section won't be shown in the template.
* Optional.
*
* Example, with f1, f2, etc. as fields names,
* ```
* [ ['f1'], ['f2','f3','f7'], ['f5','f8'] ]
* ```
* becomes:
* ```
* [ f1 ]
* [ f2 | f3 | f7 ]
* [ f5 | f8 ]
* ```
*/
displayTemplate?: string[][];
load(x: any, languages: Languages): void;
validate(languages: Languages): string[];
/**
* Set the default values of the specified fields.
*/
setFieldsDefaultValues(): any;
/**
* Load the values of the specified fields.
* @param newFields the values to set in the fields
*/
loadFields(newFields: any): any;
/**
* Validate the fields and return an array with errors, if any.
*/
validateFields(fields: any): string[];
}
/**
* Dynamic object that supports only _key -> values_ of type CustomFieldMeta.
*/
export interface CustomFieldsMeta {
[index: string]: CustomFieldMeta;
}