@amcharts/amcharts5
Version:
amCharts 5
148 lines • 4.84 kB
TypeScript
import { Entity, IEntityEvents, IEntitySettings, IEntityPrivate } from "../../core/util/Entity";
export interface ISerializerSettings extends IEntitySettings {
/**
* An array of settings to not include in the serialized data.
*/
excludeSettings?: Array<string>;
/**
* An array of settings to include in the serialized data.
*/
includeSettings?: Array<string>;
/**
* Include full values of these settings.
*
* @since 6.4.3
*/
fullSettings?: Array<string>;
/**
* An array of properties to not include in the serialized data.
*
* @since 5.3.2
*/
excludeProperties?: Array<string>;
/**
* An array of properties to include in the serialized data.
*
* @ignore
* @since 5.15.0
*/
includeProperties?: Array<string>;
/**
* Maximum depth of recursion when traversing target object.
*
* @default 2
*/
maxDepth?: number;
/**
* Include states in the output.
*
* @default false
* @since 5.15.0
*/
includeStates?: boolean;
/**
* Include adapters in the output.
*
* @default false
* @since 5.15.0
*/
includeAdapters?: boolean;
/**
* Include events in the output.
*
* @since 5.15.0
* @default false
* @todo implement
* @ignore
*/
includeEvents?: boolean;
/**
* Serialize functions as strings or functions.
*
* @default "function"
*/
functionsAs?: "string" | "function";
}
export interface ISerializerPrivate extends IEntityPrivate {
}
export interface ISerializerEvents extends IEntityEvents {
}
/**
* Provides functionality to serialize charts or individual elements into simple
* objects or JSON.
*
* @see {@link https://www.amcharts.com/docs/v5/concepts/serializing/} for more info
* @since 5.3.0
*/
export declare class Serializer extends Entity {
static className: string;
static classNames: Array<string>;
_settings: ISerializerSettings;
_privateSettings: ISerializerPrivate;
_events: ISerializerEvents;
protected _refs: {
[index: string]: any;
};
/**
* Set while serializing data. A `#` or `@` at the start of a string means a
* reference in a config, so strings are escaped - but most of a data row is
* handed back untouched when parsed, and escaping it there would corrupt it
* a little more on every round trip. `_escapeParsed` puts the escaping back
* in the few places the parser does read values.
*
* @ignore
*/
protected _serializingData: boolean;
/**
* Serializes data, which is values rather than configuration.
*
* @ignore
*/
serializeData(values: Array<any>): unknown;
/**
* Escapes the strings the parser is going to read as references, and only
* those. It walks data the way the parser does: through every array, and
* into an object only when that object is marked `__parse`. Anywhere else a
* string comes back as it was written, so escaping it would leave a stray
* `##` in the data.
*/
private _escapeParsed;
/**
* Serializes target object into a simple object or JSON string.
*
* @param source Target object
* @param depth Current depth
* @param full Serialize object in full (ignoring maxDepth)
* @param forceParse If true, will add __parse to serialized objects
* @return Serialized data
*/
serialize(source: unknown, depth?: number, full?: boolean, forceParse?: boolean): unknown;
/**
* A place for a subclass to add to what an entity serialized to, wherever it
* was reached from.
*
* @ignore
*/
protected _afterEntity(_source: any, _res: any): void;
/**
* Writes out what was styled on an object the library built for itself.
*
* A background an element seeds, a part it configures - the object itself is
* not configuration, so it is not written out on its own account. What
* someone then styled on it is, and would otherwise be lost. It goes out
* without a `type`, so parsing configures the object already there instead of
* replacing it with a new one.
*
* @param source Source object
* @param res Result
* @param written Setting keys already written out in full
* @param depth Current depth
*/
private _processComputedEntities;
private _processAdapters;
private _processStates;
private _filterSettings;
private _escapeRefs;
private _escapeText;
}
//# sourceMappingURL=Serializer.d.ts.map