/
PropertyEditorsSpecification.ts
133 lines (116 loc) · 3.38 KB
/
PropertyEditorsSpecification.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module PresentationRules
*/
/**
* This specification allows assigning a custom property editor to specific properties.
*
* @see [Property editor specification specification reference documentation page]($docs/presentation/content/PropertyEditorSpecification.md)
* @public
*/
export interface PropertyEditorSpecification {
/**
* Name of the property editor that's going to be used in UI components. This name is carried over to
* [[Field.editor]] and it's up to the UI component to make sure appropriate editor
* is used to edit the property.
*/
editorName: string;
/**
* Parameters for the editor.
* @note At this moment the attribute is not used.
* @public
*/
parameters?: PropertyEditorParameters[];
}
/**
* Parameters for [[PropertyEditorSpecification]]
* @public
*/
export declare type PropertyEditorParameters =
| PropertyEditorJsonParameters
| PropertyEditorMultilineParameters
| PropertyEditorRangeParameters
| PropertyEditorSliderParameters;
/**
* Used for serializing array of [[PropertyEditorParameters]] to JSON
* @public
*/
export enum PropertyEditorParameterTypes {
Json = "Json",
Multiline = "Multiline",
Range = "Range",
Slider = "Slider",
}
/**
* Base interface for [[PropertyEditorParameters]]. Not meant
* to be used directly, see `PropertyEditorParameters`.
* @public
*/
export interface PropertyEditorParametersBase {
/**
* Used for serializing to JSON.
* @see PropertyEditorParameterTypes
*/
paramsType: `${PropertyEditorParameterTypes}`;
}
/**
* Arbitrary JSON parameters for custom property editors
* @public
*/
export interface PropertyEditorJsonParameters extends PropertyEditorParametersBase {
/** Used for serializing to JSON. */
paramsType: "Json";
/** Arbitrary JSON that can be handled by a property editor */
json: any;
}
/**
* Multiline parameters for property editors that support multiline display
* @public
*/
export interface PropertyEditorMultilineParameters extends PropertyEditorParametersBase {
/** Used for serializing to JSON. */
paramsType: "Multiline";
/**
* Number of lines. Defaults to `1`.
*
* @type integer
* @minimum 1
*/
height?: number;
}
/**
* Range parameters for property editors that support ranges
* @public
*/
export interface PropertyEditorRangeParameters extends PropertyEditorParametersBase {
/** Used for serializing to JSON. */
paramsType: "Range";
/** Minimum value of the range. */
min?: number;
/** Maximum value of the range. */
max?: number;
}
/**
* Slider parameters for property editors that support slider display
* @public
*/
export interface PropertyEditorSliderParameters extends PropertyEditorParametersBase {
/** Used for serializing to JSON. */
paramsType: "Slider";
/** Minimum value that can be set. */
min: number;
/** Maximum value that can be set. */
max: number;
/**
* Count of intervals. Defaults to `1`.
*
* @type integer
* @minimum 1
*/
intervalsCount?: number;
/** Is slider vertical. */
isVertical?: boolean;
}