@itwin/presentation-common
Version:
Common pieces for iModel.js presentation packages
127 lines • 3.68 kB
TypeScript
/** @packageDocumentation
* @module Core
*/
import { CompressedId64Set, Id64String } from "@itwin/core-bentley";
/**
* Possible variable value types
* @public
*/
export declare enum VariableValueTypes {
/** Integer value */
Int = "int",
/** Array of integer values */
IntArray = "int[]",
/** Boolean value */
Bool = "bool",
/** String value */
String = "string",
/** Id64String value */
Id64 = "id64",
/** Array of Id64String values */
Id64Array = "id64[]"
}
/**
* Union of all supported variable value types
* @public
*/
export type VariableValue = boolean | string | number | number[] | Id64String | Id64String[];
/**
* JSON representation of [[VariableValue]]
* @public
*/
export type VariableValueJSON = boolean | string | number | number[] | Id64String | Id64String[] | CompressedId64Set;
/**
* Base data structure for representing ruleset variables.
* @public
*/
export interface RulesetVariableBase {
id: string;
type: VariableValueTypes;
value: VariableValue;
}
/**
* Data structure for representing boolean ruleset variables.
* @public
*/
export interface BooleanRulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.Bool;
value: boolean;
}
/**
* Data structure for representing string ruleset variables.
* @public
*/
export interface StringRulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.String;
value: string;
}
/**
* Data structure for representing int ruleset variables.
* @public
*/
export interface IntRulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.Int;
value: number;
}
/**
* Data structure for representing int array ruleset variables.
* @public
*/
export interface IntsRulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.IntArray;
value: number[];
}
/**
* Data structure for representing ID ruleset variables.
* @public
*/
export interface Id64RulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.Id64;
value: Id64String;
}
/**
* Data structure for representing ID array ruleset variables.
* @public
*/
export interface Id64sRulesetVariable extends RulesetVariableBase {
type: VariableValueTypes.Id64Array;
value: Id64String[];
}
/**
* Data structure for representing ruleset variables.
* @public
*/
export type RulesetVariable = BooleanRulesetVariable | StringRulesetVariable | IntRulesetVariable | IntsRulesetVariable | Id64RulesetVariable | Id64sRulesetVariable;
/**
* JSON representation of [[RulesetVariableBase]].
* @public
*/
export interface RulesetVariableBaseJSON {
id: string;
type: VariableValueTypes;
value: VariableValueJSON;
}
/**
* JSON representation of [[Id64sRulesetVariable]].
* @public
*/
export interface Id64sRulesetVariableJSON extends RulesetVariableBaseJSON {
type: VariableValueTypes.Id64Array;
value: Id64String[] | CompressedId64Set;
}
/**
* JSON representation of [[RulesetVariable]].
* @public
*/
export type RulesetVariableJSON = BooleanRulesetVariable | StringRulesetVariable | IntRulesetVariable | IntsRulesetVariable | Id64RulesetVariable | Id64sRulesetVariableJSON;
/** @public */
export declare namespace RulesetVariable {
/**
* Serialize given RulesetVariable to JSON.
* Note: In case of [[Id64sRulesetVariable]], this method expects IDs are sorted. See [[OrderedId64Iterable.sortArray]].
*/
function toJSON(variable: RulesetVariable): RulesetVariableJSON;
/** Deserialize [[RulesetVariable]] from JSON. */
function fromJSON(json: RulesetVariableJSON): RulesetVariable;
}
//# sourceMappingURL=RulesetVariables.d.ts.map