@easyquery/core 7.2.3 → 7.2.4-rc01
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/easyquery.core.js +9503 -9336
- package/dist/bundles/easyquery.core.js.map +1 -1
- package/dist/bundles/easyquery.core.min.js +1 -1
- package/dist/bundles/easyquery.core.min.js.map +1 -1
- package/dist/lib/common/eq_services.d.ts +56 -56
- package/dist/lib/common/eq_services.js +159 -159
- package/dist/lib/common/query_param.d.ts +25 -25
- package/dist/lib/common/query_param.js +1 -0
- package/dist/lib/common/tree.d.ts +10 -10
- package/dist/lib/common/tree.js +57 -57
- package/dist/lib/data/eq_aggr_container.d.ts +24 -24
- package/dist/lib/data/eq_aggr_container.js +108 -108
- package/dist/lib/data/eq_aggr_container.js.map +1 -1
- package/dist/lib/data/eq_data_loader.d.ts +8 -8
- package/dist/lib/data/eq_data_loader.js +49 -49
- package/dist/lib/data/eq_data_loader.js.map +1 -1
- package/dist/lib/data/google_data_converter.d.ts +82 -82
- package/dist/lib/data/google_data_converter.js +173 -173
- package/dist/lib/data/google_data_converter.js.map +1 -1
- package/dist/lib/dm/aggr_function.d.ts +27 -27
- package/dist/lib/dm/aggr_function.js +42 -42
- package/dist/lib/dm/data_model.d.ts +330 -330
- package/dist/lib/dm/data_model.js +934 -932
- package/dist/lib/dm/data_model.js.map +1 -1
- package/dist/lib/dm/dto/af_data.d.ts +16 -16
- package/dist/lib/dm/dto/af_data.js +1 -0
- package/dist/lib/dm/dto/dm_data.d.ts +34 -34
- package/dist/lib/dm/dto/dm_data.js +1 -0
- package/dist/lib/dm/dto/entity_data.d.ts +37 -37
- package/dist/lib/dm/dto/entity_data.js +1 -0
- package/dist/lib/dm/dto/operator_data.d.ts +44 -44
- package/dist/lib/dm/dto/operator_data.js +1 -0
- package/dist/lib/dm/dto/ve_data.d.ts +10 -10
- package/dist/lib/dm/dto/ve_data.js +1 -0
- package/dist/lib/dm/entity.d.ts +71 -71
- package/dist/lib/dm/entity.js +90 -88
- package/dist/lib/dm/entity.js.map +1 -1
- package/dist/lib/dm/link.d.ts +7 -7
- package/dist/lib/dm/link.js +1 -0
- package/dist/lib/dm/operator.d.ts +80 -80
- package/dist/lib/dm/operator.js +93 -93
- package/dist/lib/dm/value_editor.d.ts +16 -16
- package/dist/lib/dm/value_editor.js +43 -41
- package/dist/lib/dm/value_editor.js.map +1 -1
- package/dist/lib/eqs/eqs_data_fetcher.d.ts +7 -7
- package/dist/lib/eqs/eqs_data_fetcher.js +36 -36
- package/dist/lib/eqs/eqs_exporter.d.ts +10 -10
- package/dist/lib/eqs/eqs_exporter.js +59 -54
- package/dist/lib/eqs/eqs_exporter.js.map +1 -1
- package/dist/lib/eqs/eqs_model_loader.d.ts +7 -7
- package/dist/lib/eqs/eqs_model_loader.js +42 -40
- package/dist/lib/eqs/eqs_model_loader.js.map +1 -1
- package/dist/lib/eqs/eqs_query_file_loader.d.ts +9 -9
- package/dist/lib/eqs/eqs_query_file_loader.js +54 -54
- package/dist/lib/eqs/eqs_query_synchronizer.d.ts +7 -7
- package/dist/lib/eqs/eqs_query_synchronizer.js +23 -23
- package/dist/lib/eqs/eqs_value_list_resolver.d.ts +7 -7
- package/dist/lib/eqs/eqs_value_list_resolver.js +28 -28
- package/dist/lib/export/exporter.d.ts +19 -16
- package/dist/lib/export/exporter.js +6 -0
- package/dist/lib/export/exporter.js.map +1 -1
- package/dist/lib/i18n/text_resources.d.ts +1 -1
- package/dist/lib/i18n/text_resources.js +26 -26
- package/dist/lib/i18n/text_resources.js.map +1 -1
- package/dist/lib/main/action.d.ts +13 -13
- package/dist/lib/main/action.js +5 -5
- package/dist/lib/main/context.d.ts +345 -342
- package/dist/lib/main/context.js +1457 -1439
- package/dist/lib/main/context.js.map +1 -1
- package/dist/lib/main/context_options.d.ts +146 -145
- package/dist/lib/main/context_options.js +1 -0
- package/dist/lib/main/data_fetcher.d.ts +46 -46
- package/dist/lib/main/data_fetcher.js +1 -0
- package/dist/lib/main/eq_actions.d.ts +14 -14
- package/dist/lib/main/eq_actions.js +15 -15
- package/dist/lib/main/list_cache.d.ts +8 -8
- package/dist/lib/main/list_cache.js +1 -0
- package/dist/lib/main/model_loader.d.ts +21 -21
- package/dist/lib/main/model_loader.js +32 -32
- package/dist/lib/main/model_storage.d.ts +13 -13
- package/dist/lib/main/model_storage.js +17 -17
- package/dist/lib/main/query_file_loader.d.ts +15 -15
- package/dist/lib/main/query_file_loader.js +1 -0
- package/dist/lib/main/query_storage.d.ts +58 -58
- package/dist/lib/main/query_storage.js +124 -124
- package/dist/lib/main/query_synchronizer.d.ts +9 -9
- package/dist/lib/main/query_synchronizer.js +1 -0
- package/dist/lib/main/value_list_resolver.d.ts +18 -18
- package/dist/lib/main/value_list_resolver.js +1 -0
- package/dist/lib/main/widget.d.ts +74 -74
- package/dist/lib/main/widget.js +101 -101
- package/dist/lib/public_api.d.ts +58 -58
- package/dist/lib/public_api.js +59 -42
- package/dist/lib/public_api.js.map +1 -1
- package/dist/lib/query/condition.d.ts +97 -97
- package/dist/lib/query/condition.js +331 -331
- package/dist/lib/query/descriptors.d.ts +36 -36
- package/dist/lib/query/descriptors.js +1 -0
- package/dist/lib/query/dto/condition_data.d.ts +38 -38
- package/dist/lib/query/dto/condition_data.js +1 -0
- package/dist/lib/query/dto/expression_data.d.ts +32 -32
- package/dist/lib/query/dto/expression_data.js +1 -0
- package/dist/lib/query/dto/query_column_data.d.ts +28 -28
- package/dist/lib/query/dto/query_column_data.js +1 -0
- package/dist/lib/query/dto/query_data.d.ts +27 -27
- package/dist/lib/query/dto/query_data.js +1 -0
- package/dist/lib/query/expression.d.ts +69 -69
- package/dist/lib/query/expression.js +202 -202
- package/dist/lib/query/query.d.ts +415 -410
- package/dist/lib/query/query.js +1467 -1391
- package/dist/lib/query/query.js.map +1 -1
- package/dist/lib/query/query_column.d.ts +74 -70
- package/dist/lib/query/query_column.js +204 -157
- package/dist/lib/query/query_column.js.map +1 -1
- package/dist/lib/query/query_events.d.ts +29 -29
- package/dist/lib/query/query_events.js +19 -19
- package/dist/lib/types/cond_part.d.ts +6 -6
- package/dist/lib/types/cond_part.js +7 -7
- package/dist/lib/types/cond_tag.d.ts +12 -12
- package/dist/lib/types/cond_tag.js +13 -13
- package/dist/lib/types/data_kind.d.ts +15 -15
- package/dist/lib/types/data_kind.js +16 -16
- package/dist/lib/types/eq_editor_tag.d.ts +17 -17
- package/dist/lib/types/eq_editor_tag.js +20 -20
- package/dist/lib/types/expr_tag.d.ts +19 -19
- package/dist/lib/types/expr_tag.js +20 -20
- package/dist/lib/types/link_type.d.ts +17 -17
- package/dist/lib/types/link_type.js +18 -18
- package/dist/lib/types/widget_group.d.ts +17 -17
- package/dist/lib/types/widget_group.js +18 -18
- package/dist/lib/utils/constants.d.ts +36 -36
- package/dist/lib/utils/constants.js +50 -50
- package/dist/lib/utils/format_parser.d.ts +40 -40
- package/dist/lib/utils/format_parser.js +87 -87
- package/dist/lib/utils/utils.d.ts +34 -34
- package/dist/lib/utils/utils.js +102 -102
- package/dist/lib/utils/version_info.d.ts +9 -9
- package/dist/lib/utils/version_info.js +12 -12
- package/dist/lib/utils/version_info.js.map +1 -1
- package/package.json +16 -16
- package/webpack.config.js +6 -5
|
@@ -1,330 +1,330 @@
|
|
|
1
|
-
import { DataType, MetaData, ValueEditor } from '@easydata/core';
|
|
2
|
-
import { AggrFunction } from './aggr_function';
|
|
3
|
-
import { Operator, Operand } from './operator';
|
|
4
|
-
import { Entity, EntityAttr } from './entity';
|
|
5
|
-
import { EqValueEditor } from './value_editor';
|
|
6
|
-
import { Link } from './link';
|
|
7
|
-
import { DataKind } from '../types/data_kind';
|
|
8
|
-
import { Query } from '../query/query';
|
|
9
|
-
import { ModelPlainData } from './dto/dm_data';
|
|
10
|
-
import { Tree } from '../common/tree';
|
|
11
|
-
/**
|
|
12
|
-
* Operator descriptor.
|
|
13
|
-
*/
|
|
14
|
-
export interface OperatorDescriptor {
|
|
15
|
-
id: string;
|
|
16
|
-
expr?: string;
|
|
17
|
-
format: string;
|
|
18
|
-
caption: string;
|
|
19
|
-
paramCount?: number;
|
|
20
|
-
kind?: DataKind;
|
|
21
|
-
appliedTypes?: DataType[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Represents a data model
|
|
25
|
-
*/
|
|
26
|
-
export declare class DataModel extends MetaData {
|
|
27
|
-
/**The list of operators. */
|
|
28
|
-
operators: Operator[];
|
|
29
|
-
/** The root entity. */
|
|
30
|
-
rootEntity: Entity;
|
|
31
|
-
/** The list of aggregate functions. */
|
|
32
|
-
aggrFunctions: AggrFunction[];
|
|
33
|
-
/** The list of value editors. */
|
|
34
|
-
editors: EqValueEditor[];
|
|
35
|
-
/** The list of links. It is used in odata broker. */
|
|
36
|
-
links: Link[];
|
|
37
|
-
private dateMacros;
|
|
38
|
-
private timeMacros;
|
|
39
|
-
protected mainEntity: Entity | null;
|
|
40
|
-
readonly nullAttribute: EntityAttr;
|
|
41
|
-
readonly nullOperator: Operator;
|
|
42
|
-
/** The default constructor. */
|
|
43
|
-
constructor();
|
|
44
|
-
/**
|
|
45
|
-
* Gets the main entity of model
|
|
46
|
-
* @return The main entity.
|
|
47
|
-
*/
|
|
48
|
-
getMainEntity(): Entity;
|
|
49
|
-
/**
|
|
50
|
-
* Loads data model from JSON.
|
|
51
|
-
* @param stringJson The JSON string.
|
|
52
|
-
*/
|
|
53
|
-
loadFromJSON(stringJson: string): void;
|
|
54
|
-
/**
|
|
55
|
-
* Loads data model from its JSON representation object.
|
|
56
|
-
* @param data The JSON representation object.
|
|
57
|
-
*/
|
|
58
|
-
loadFromData(data: ModelPlainData): void;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the data model object.
|
|
61
|
-
* @returns Tha data model.
|
|
62
|
-
*/
|
|
63
|
-
getObject(): DataModel;
|
|
64
|
-
/**
|
|
65
|
-
* Sets data to data model.
|
|
66
|
-
* @param model Its JSON representation object or JSON string.
|
|
67
|
-
*/
|
|
68
|
-
setData(model: ModelPlainData | string): void;
|
|
69
|
-
/**
|
|
70
|
-
* Creates entity.
|
|
71
|
-
* @param parent The parent entity.
|
|
72
|
-
* @returns The Entity.
|
|
73
|
-
*/
|
|
74
|
-
createEntity(parent?: Entity): Entity;
|
|
75
|
-
/**
|
|
76
|
-
* Creates entity attribute.
|
|
77
|
-
* @param parent The parent entity.
|
|
78
|
-
* @returns The entity attribute.
|
|
79
|
-
*/
|
|
80
|
-
createEntityAttr(parent?: Entity): EntityAttr;
|
|
81
|
-
/**
|
|
82
|
-
* Creates new EqValueEditor
|
|
83
|
-
* @returns An instance of EqValueEditor class
|
|
84
|
-
*/
|
|
85
|
-
createValueEditor(): ValueEditor;
|
|
86
|
-
/**
|
|
87
|
-
* Creates query.
|
|
88
|
-
* @returns The Query.
|
|
89
|
-
*/
|
|
90
|
-
createQuery(): Query;
|
|
91
|
-
/**
|
|
92
|
-
* Gets root entity of the data model.
|
|
93
|
-
* @returns The root entity.
|
|
94
|
-
*/
|
|
95
|
-
getRootEntity(): Entity;
|
|
96
|
-
/**
|
|
97
|
-
* Finds editor by its ID.
|
|
98
|
-
* @param editorId The editor ID.
|
|
99
|
-
* @returns The value editor or `null`.
|
|
100
|
-
*/
|
|
101
|
-
getEditorById(editorId: string): EqValueEditor | null;
|
|
102
|
-
/**
|
|
103
|
-
* Gets entity attribute by its ID.
|
|
104
|
-
* This function runs through all attributes inside specified model (it's root entity and all its sub-entities).
|
|
105
|
-
* @param attrId The attribute ID.
|
|
106
|
-
* @returns The attribute or `null`.
|
|
107
|
-
*/
|
|
108
|
-
getAttributeById(attrId: string): EntityAttr | null;
|
|
109
|
-
/**
|
|
110
|
-
* Gets entity attribute by its ID.
|
|
111
|
-
* This function runs through all attributes inside specified model (it's root entity and all its sub-entities).
|
|
112
|
-
* @param attrId The attribute ID.
|
|
113
|
-
* @returns The attribute or `nullAttribute`.
|
|
114
|
-
*/
|
|
115
|
-
getAttributeByIdSafe(attrId: any): EntityAttr;
|
|
116
|
-
/**
|
|
117
|
-
* Checks wether attribute contains such property.
|
|
118
|
-
* @param attrId The attribute ID.
|
|
119
|
-
* @param propName The property name.
|
|
120
|
-
* @returns `true` if the attribute contains the property, otherwise `false`.
|
|
121
|
-
*/
|
|
122
|
-
checkAttrProperty(attrId: string, propName: string): boolean;
|
|
123
|
-
/**
|
|
124
|
-
* Gets entity attribute by its ID.
|
|
125
|
-
* This function runs through all attributes inside specified entity and all its sub-entities.
|
|
126
|
-
* @param entity
|
|
127
|
-
* @param attrId
|
|
128
|
-
* @returns The attribute or `null`.
|
|
129
|
-
*/
|
|
130
|
-
getEntityAttrById(entity: Entity, attrId: string): EntityAttr | null;
|
|
131
|
-
private _listByEntityWithFilter;
|
|
132
|
-
private _listByEntity;
|
|
133
|
-
/**
|
|
134
|
-
* Clears data model.
|
|
135
|
-
*/
|
|
136
|
-
clear(): void;
|
|
137
|
-
/**
|
|
138
|
-
* Add or update an operator.
|
|
139
|
-
* @param desc The operator descriptor.
|
|
140
|
-
* @returns The operator.
|
|
141
|
-
*/
|
|
142
|
-
addOrUpdateOperator(desc: OperatorDescriptor): Operator;
|
|
143
|
-
/**
|
|
144
|
-
* Removes an operator.
|
|
145
|
-
* @param id The id.
|
|
146
|
-
* @param soft If `false` - removes operators from model and attributes. Otherwise only
|
|
147
|
-
* from attributes.
|
|
148
|
-
*/
|
|
149
|
-
removeOperator(id: string, soft?: boolean): void;
|
|
150
|
-
/**
|
|
151
|
-
* Get operators for data type.
|
|
152
|
-
* @param type The data type
|
|
153
|
-
* @return The array of operator ids.
|
|
154
|
-
*/
|
|
155
|
-
getOperatorIdsByDataType(type: DataType): string[];
|
|
156
|
-
/**
|
|
157
|
-
* Builds entities tree used in query.
|
|
158
|
-
* @param query The query.
|
|
159
|
-
*/
|
|
160
|
-
buildQueryPath(query: Query): Tree<Entity>;
|
|
161
|
-
private createTreeNodeFromEntity;
|
|
162
|
-
/**
|
|
163
|
-
* Get Entities used in query.
|
|
164
|
-
* @param query The query.
|
|
165
|
-
*/
|
|
166
|
-
getEntitiesInQuery(query: Query): Entity[];
|
|
167
|
-
findAggrFunctionById(funcId: string): AggrFunction | null;
|
|
168
|
-
private fillEntitiesByCondtionGroup;
|
|
169
|
-
private addEntityByExpression;
|
|
170
|
-
/**
|
|
171
|
-
* Finds link between two entities.
|
|
172
|
-
* @param entityFrom The entity `from`.
|
|
173
|
-
* @param entityTo The entity `to`.
|
|
174
|
-
* @return The link.
|
|
175
|
-
*/
|
|
176
|
-
findLink(entityFrom: Entity, entityTo: Entity): Link | null;
|
|
177
|
-
/**
|
|
178
|
-
* Get links with the entity.
|
|
179
|
-
* @param entity The entity.
|
|
180
|
-
* @return The link.
|
|
181
|
-
*/
|
|
182
|
-
getLinksByEntity(entity: Entity): Link[];
|
|
183
|
-
/**
|
|
184
|
-
* Gets entities tree.
|
|
185
|
-
* @param opts The options.
|
|
186
|
-
* @param filterFunc The filter function.
|
|
187
|
-
* Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
|
|
188
|
-
* @returns The tree of the entities and their attributes according to options and the filter function
|
|
189
|
-
*/
|
|
190
|
-
getEntitiesTree(opts: any, filterFunc?: (ent: Entity, attr: EntityAttr) => boolean): any;
|
|
191
|
-
/**
|
|
192
|
-
* Gets entities tree due to filter.
|
|
193
|
-
* @param filterFunc The filter function.
|
|
194
|
-
* Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
|
|
195
|
-
* @returns The tree of the entities and their attributes according to the filter function
|
|
196
|
-
*/
|
|
197
|
-
getEntitiesTreeWithFilter(filterFunc: any): Entity[];
|
|
198
|
-
/**
|
|
199
|
-
* Finds full entity path by attribute
|
|
200
|
-
* @param attrId The attribute id.
|
|
201
|
-
* @param sep The separator.
|
|
202
|
-
* @returns The path.
|
|
203
|
-
*/
|
|
204
|
-
getFullEntityPathByAttr(attrId: string, sep: string): string;
|
|
205
|
-
/**
|
|
206
|
-
* Finds entity path by attribute
|
|
207
|
-
* @param entity The entity.
|
|
208
|
-
* @param attrId The attribute id.
|
|
209
|
-
* @param sep The separator.
|
|
210
|
-
* @param root The root option.
|
|
211
|
-
* @returns The path.
|
|
212
|
-
*/
|
|
213
|
-
getEntityPathByAttr(entity: Entity, attrId: string, sep: string, root: boolean): string;
|
|
214
|
-
/**
|
|
215
|
-
* Gets the attribute text.
|
|
216
|
-
* @param attr The attribute.
|
|
217
|
-
* @param format The format.
|
|
218
|
-
* @returns Formatted text.
|
|
219
|
-
*/
|
|
220
|
-
getAttributeText(attr: EntityAttr, format: string): string;
|
|
221
|
-
getFirstUICAttr(): EntityAttr;
|
|
222
|
-
/**
|
|
223
|
-
* Gets first `UIC` attribute in specified entity
|
|
224
|
-
* (`UIC` stands for `use in conditions` - so such attribute can be used in conditions)
|
|
225
|
-
* @param entity Entity object to search our attribute in.
|
|
226
|
-
* @returns The entity attribute or `null`
|
|
227
|
-
*/
|
|
228
|
-
private getFirstUICAttrInEntity;
|
|
229
|
-
/**
|
|
230
|
-
* Scans model's entity tree and calls the callback functions for each attribute and entity.
|
|
231
|
-
* @param processAttribute The callback function which is called for each attribute in model's entity tree.
|
|
232
|
-
* The processed attribute is passed in the first function parameter.
|
|
233
|
-
* @param processEntity The callback function which is called for each entity in tree.
|
|
234
|
-
* The processed entity is passed in the first function parameter.
|
|
235
|
-
*/
|
|
236
|
-
runThroughEntities(processAttribute?: (attr: EntityAttr, opts: any) => void, processEntity?: (entity: Entity, opts: any) => void): void;
|
|
237
|
-
/**
|
|
238
|
-
* Finds first attribute by filter.
|
|
239
|
-
* @param filterFunc The filter function. Takes EntityAttr object in parameter and returns boolean
|
|
240
|
-
*/
|
|
241
|
-
getFirstAttributeByFilter(filterFunc: (attr: EntityAttr) => boolean): EntityAttr;
|
|
242
|
-
/**
|
|
243
|
-
* Finds operator in model by its ID.
|
|
244
|
-
* This function runs through all operators inside specified model and returns the one with specified ID.
|
|
245
|
-
* @param operatorId An operator ID.
|
|
246
|
-
* @returns The operator or `null`.
|
|
247
|
-
*/
|
|
248
|
-
findOperatorById(operatorId: string): Operator | null;
|
|
249
|
-
/**
|
|
250
|
-
* Finds operator in model by its ID.
|
|
251
|
-
* his function runs through all operators inside specified model and returns the one with specified ID.
|
|
252
|
-
* @param operatorId Operator ID.
|
|
253
|
-
* @returns The operator or special `NullOperator` object if operator is not found.
|
|
254
|
-
*/
|
|
255
|
-
getOperatorById(operatorId: string): Operator;
|
|
256
|
-
getDefaultOperatorIdForAttr(attr: EntityAttr): string;
|
|
257
|
-
/**
|
|
258
|
-
* Gets caption of the aggregate function.
|
|
259
|
-
* @param funcId The function id.
|
|
260
|
-
* @returns The caption.
|
|
261
|
-
*/
|
|
262
|
-
getAggrFunctionCaption(funcId: string): string;
|
|
263
|
-
/**
|
|
264
|
-
* Gets format of the aggregate function.
|
|
265
|
-
* @param funcId The function id.
|
|
266
|
-
* @returns The caption.
|
|
267
|
-
*/
|
|
268
|
-
getAggrFunctionFormat(funcId: string): string;
|
|
269
|
-
/**
|
|
270
|
-
* Gets default operator for an attribute.
|
|
271
|
-
* @param attr The attribute.
|
|
272
|
-
* @returns The operator.
|
|
273
|
-
*/
|
|
274
|
-
getDefaultOperatorForAttr(attr: EntityAttr): Operator;
|
|
275
|
-
/**
|
|
276
|
-
* Gets operand.
|
|
277
|
-
* @param attr The attribute.
|
|
278
|
-
* @param operator The operator.
|
|
279
|
-
* @param index The index.
|
|
280
|
-
* @returns The operand.
|
|
281
|
-
*/
|
|
282
|
-
getOperand(attr: EntityAttr, operator: Operator, index: number): Operand;
|
|
283
|
-
/**
|
|
284
|
-
* Gets the list of aggegate functions.
|
|
285
|
-
* @returns AN array of aggregate functions.
|
|
286
|
-
*/
|
|
287
|
-
getAggrFunctions(): AggrFunction[];
|
|
288
|
-
/**
|
|
289
|
-
* Checks wether macro value is date.
|
|
290
|
-
* @param macroExpr The macro value.
|
|
291
|
-
* @retruns `true` if the macro value is date, otherwise `false`.
|
|
292
|
-
*/
|
|
293
|
-
isDateMacro(macroExpr: string, macroProcessor?: (macroId: any) => void): boolean;
|
|
294
|
-
/**
|
|
295
|
-
* Checks whether the expression passed in the parameter is an time macro.
|
|
296
|
-
* @param macroExpr The macro expression
|
|
297
|
-
* @retruns `true` if the expression is a time macro (like Now), otherwise `false`.
|
|
298
|
-
*/
|
|
299
|
-
isTimeMacro(macroExpr: string, macroProcessor?: (macroId: any) => void): boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Gets date by its macro value.
|
|
302
|
-
* @param macroExpr The macro value.
|
|
303
|
-
* @returns The date or `null`
|
|
304
|
-
*/
|
|
305
|
-
getDateMacroValue(macroExpr: string): Date | null;
|
|
306
|
-
/**
|
|
307
|
-
* Gets the date value by a macro expression of the expression itself.
|
|
308
|
-
* @param macroExpr The macro value.
|
|
309
|
-
* @returns The date or macro valu.
|
|
310
|
-
*/
|
|
311
|
-
getDateOrMacroValue(macroExpr: string): string | Date;
|
|
312
|
-
/**
|
|
313
|
-
* Gets time by its macro value.
|
|
314
|
-
* @param macroExpr The macro value.
|
|
315
|
-
* @returns The date or `null`.
|
|
316
|
-
*/
|
|
317
|
-
getTimeMacroValue(macroExpr: string): Date | null;
|
|
318
|
-
/**
|
|
319
|
-
* Gets time or macro by macro value.
|
|
320
|
-
* @param macroValue The macro value.
|
|
321
|
-
* @returns The time or macro valu.
|
|
322
|
-
*/
|
|
323
|
-
getTimeOrMacroValue(time: string): string | Date;
|
|
324
|
-
getAllDateMacros(): string[];
|
|
325
|
-
/**
|
|
326
|
-
* Gets all time marcos.
|
|
327
|
-
* @returns The array of marcos
|
|
328
|
-
*/
|
|
329
|
-
getAllTimeMacros(): string[];
|
|
330
|
-
}
|
|
1
|
+
import { DataType, MetaData, ValueEditor } from '@easydata/core';
|
|
2
|
+
import { AggrFunction } from './aggr_function';
|
|
3
|
+
import { Operator, Operand } from './operator';
|
|
4
|
+
import { Entity, EntityAttr } from './entity';
|
|
5
|
+
import { EqValueEditor } from './value_editor';
|
|
6
|
+
import { Link } from './link';
|
|
7
|
+
import { DataKind } from '../types/data_kind';
|
|
8
|
+
import { Query } from '../query/query';
|
|
9
|
+
import { ModelPlainData } from './dto/dm_data';
|
|
10
|
+
import { Tree } from '../common/tree';
|
|
11
|
+
/**
|
|
12
|
+
* Operator descriptor.
|
|
13
|
+
*/
|
|
14
|
+
export interface OperatorDescriptor {
|
|
15
|
+
id: string;
|
|
16
|
+
expr?: string;
|
|
17
|
+
format: string;
|
|
18
|
+
caption: string;
|
|
19
|
+
paramCount?: number;
|
|
20
|
+
kind?: DataKind;
|
|
21
|
+
appliedTypes?: DataType[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Represents a data model
|
|
25
|
+
*/
|
|
26
|
+
export declare class DataModel extends MetaData {
|
|
27
|
+
/**The list of operators. */
|
|
28
|
+
operators: Operator[];
|
|
29
|
+
/** The root entity. */
|
|
30
|
+
rootEntity: Entity;
|
|
31
|
+
/** The list of aggregate functions. */
|
|
32
|
+
aggrFunctions: AggrFunction[];
|
|
33
|
+
/** The list of value editors. */
|
|
34
|
+
editors: EqValueEditor[];
|
|
35
|
+
/** The list of links. It is used in odata broker. */
|
|
36
|
+
links: Link[];
|
|
37
|
+
private dateMacros;
|
|
38
|
+
private timeMacros;
|
|
39
|
+
protected mainEntity: Entity | null;
|
|
40
|
+
readonly nullAttribute: EntityAttr;
|
|
41
|
+
readonly nullOperator: Operator;
|
|
42
|
+
/** The default constructor. */
|
|
43
|
+
constructor();
|
|
44
|
+
/**
|
|
45
|
+
* Gets the main entity of model
|
|
46
|
+
* @return The main entity.
|
|
47
|
+
*/
|
|
48
|
+
getMainEntity(): Entity;
|
|
49
|
+
/**
|
|
50
|
+
* Loads data model from JSON.
|
|
51
|
+
* @param stringJson The JSON string.
|
|
52
|
+
*/
|
|
53
|
+
loadFromJSON(stringJson: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Loads data model from its JSON representation object.
|
|
56
|
+
* @param data The JSON representation object.
|
|
57
|
+
*/
|
|
58
|
+
loadFromData(data: ModelPlainData): void;
|
|
59
|
+
/**
|
|
60
|
+
* Gets the data model object.
|
|
61
|
+
* @returns Tha data model.
|
|
62
|
+
*/
|
|
63
|
+
getObject(): DataModel;
|
|
64
|
+
/**
|
|
65
|
+
* Sets data to data model.
|
|
66
|
+
* @param model Its JSON representation object or JSON string.
|
|
67
|
+
*/
|
|
68
|
+
setData(model: ModelPlainData | string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Creates entity.
|
|
71
|
+
* @param parent The parent entity.
|
|
72
|
+
* @returns The Entity.
|
|
73
|
+
*/
|
|
74
|
+
createEntity(parent?: Entity): Entity;
|
|
75
|
+
/**
|
|
76
|
+
* Creates entity attribute.
|
|
77
|
+
* @param parent The parent entity.
|
|
78
|
+
* @returns The entity attribute.
|
|
79
|
+
*/
|
|
80
|
+
createEntityAttr(parent?: Entity): EntityAttr;
|
|
81
|
+
/**
|
|
82
|
+
* Creates new EqValueEditor
|
|
83
|
+
* @returns An instance of EqValueEditor class
|
|
84
|
+
*/
|
|
85
|
+
createValueEditor(): ValueEditor;
|
|
86
|
+
/**
|
|
87
|
+
* Creates query.
|
|
88
|
+
* @returns The Query.
|
|
89
|
+
*/
|
|
90
|
+
createQuery(): Query;
|
|
91
|
+
/**
|
|
92
|
+
* Gets root entity of the data model.
|
|
93
|
+
* @returns The root entity.
|
|
94
|
+
*/
|
|
95
|
+
getRootEntity(): Entity;
|
|
96
|
+
/**
|
|
97
|
+
* Finds editor by its ID.
|
|
98
|
+
* @param editorId The editor ID.
|
|
99
|
+
* @returns The value editor or `null`.
|
|
100
|
+
*/
|
|
101
|
+
getEditorById(editorId: string): EqValueEditor | null;
|
|
102
|
+
/**
|
|
103
|
+
* Gets entity attribute by its ID.
|
|
104
|
+
* This function runs through all attributes inside specified model (it's root entity and all its sub-entities).
|
|
105
|
+
* @param attrId The attribute ID.
|
|
106
|
+
* @returns The attribute or `null`.
|
|
107
|
+
*/
|
|
108
|
+
getAttributeById(attrId: string): EntityAttr | null;
|
|
109
|
+
/**
|
|
110
|
+
* Gets entity attribute by its ID.
|
|
111
|
+
* This function runs through all attributes inside specified model (it's root entity and all its sub-entities).
|
|
112
|
+
* @param attrId The attribute ID.
|
|
113
|
+
* @returns The attribute or `nullAttribute`.
|
|
114
|
+
*/
|
|
115
|
+
getAttributeByIdSafe(attrId: any): EntityAttr;
|
|
116
|
+
/**
|
|
117
|
+
* Checks wether attribute contains such property.
|
|
118
|
+
* @param attrId The attribute ID.
|
|
119
|
+
* @param propName The property name.
|
|
120
|
+
* @returns `true` if the attribute contains the property, otherwise `false`.
|
|
121
|
+
*/
|
|
122
|
+
checkAttrProperty(attrId: string, propName: string): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Gets entity attribute by its ID.
|
|
125
|
+
* This function runs through all attributes inside specified entity and all its sub-entities.
|
|
126
|
+
* @param entity
|
|
127
|
+
* @param attrId
|
|
128
|
+
* @returns The attribute or `null`.
|
|
129
|
+
*/
|
|
130
|
+
getEntityAttrById(entity: Entity, attrId: string): EntityAttr | null;
|
|
131
|
+
private _listByEntityWithFilter;
|
|
132
|
+
private _listByEntity;
|
|
133
|
+
/**
|
|
134
|
+
* Clears data model.
|
|
135
|
+
*/
|
|
136
|
+
clear(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Add or update an operator.
|
|
139
|
+
* @param desc The operator descriptor.
|
|
140
|
+
* @returns The operator.
|
|
141
|
+
*/
|
|
142
|
+
addOrUpdateOperator(desc: OperatorDescriptor): Operator;
|
|
143
|
+
/**
|
|
144
|
+
* Removes an operator.
|
|
145
|
+
* @param id The id.
|
|
146
|
+
* @param soft If `false` - removes operators from model and attributes. Otherwise only
|
|
147
|
+
* from attributes.
|
|
148
|
+
*/
|
|
149
|
+
removeOperator(id: string, soft?: boolean): void;
|
|
150
|
+
/**
|
|
151
|
+
* Get operators for data type.
|
|
152
|
+
* @param type The data type
|
|
153
|
+
* @return The array of operator ids.
|
|
154
|
+
*/
|
|
155
|
+
getOperatorIdsByDataType(type: DataType): string[];
|
|
156
|
+
/**
|
|
157
|
+
* Builds entities tree used in query.
|
|
158
|
+
* @param query The query.
|
|
159
|
+
*/
|
|
160
|
+
buildQueryPath(query: Query): Tree<Entity>;
|
|
161
|
+
private createTreeNodeFromEntity;
|
|
162
|
+
/**
|
|
163
|
+
* Get Entities used in query.
|
|
164
|
+
* @param query The query.
|
|
165
|
+
*/
|
|
166
|
+
getEntitiesInQuery(query: Query): Entity[];
|
|
167
|
+
findAggrFunctionById(funcId: string): AggrFunction | null;
|
|
168
|
+
private fillEntitiesByCondtionGroup;
|
|
169
|
+
private addEntityByExpression;
|
|
170
|
+
/**
|
|
171
|
+
* Finds link between two entities.
|
|
172
|
+
* @param entityFrom The entity `from`.
|
|
173
|
+
* @param entityTo The entity `to`.
|
|
174
|
+
* @return The link.
|
|
175
|
+
*/
|
|
176
|
+
findLink(entityFrom: Entity, entityTo: Entity): Link | null;
|
|
177
|
+
/**
|
|
178
|
+
* Get links with the entity.
|
|
179
|
+
* @param entity The entity.
|
|
180
|
+
* @return The link.
|
|
181
|
+
*/
|
|
182
|
+
getLinksByEntity(entity: Entity): Link[];
|
|
183
|
+
/**
|
|
184
|
+
* Gets entities tree.
|
|
185
|
+
* @param opts The options.
|
|
186
|
+
* @param filterFunc The filter function.
|
|
187
|
+
* Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
|
|
188
|
+
* @returns The tree of the entities and their attributes according to options and the filter function
|
|
189
|
+
*/
|
|
190
|
+
getEntitiesTree(opts: any, filterFunc?: (ent: Entity, attr: EntityAttr) => boolean): any;
|
|
191
|
+
/**
|
|
192
|
+
* Gets entities tree due to filter.
|
|
193
|
+
* @param filterFunc The filter function.
|
|
194
|
+
* Takes two parameters, Entity and EntityAttr (second parameter will be null for entities), and returns boolean (true if the corresponding entity or attribute).
|
|
195
|
+
* @returns The tree of the entities and their attributes according to the filter function
|
|
196
|
+
*/
|
|
197
|
+
getEntitiesTreeWithFilter(filterFunc: any): Entity[];
|
|
198
|
+
/**
|
|
199
|
+
* Finds full entity path by attribute
|
|
200
|
+
* @param attrId The attribute id.
|
|
201
|
+
* @param sep The separator.
|
|
202
|
+
* @returns The path.
|
|
203
|
+
*/
|
|
204
|
+
getFullEntityPathByAttr(attrId: string, sep: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* Finds entity path by attribute
|
|
207
|
+
* @param entity The entity.
|
|
208
|
+
* @param attrId The attribute id.
|
|
209
|
+
* @param sep The separator.
|
|
210
|
+
* @param root The root option.
|
|
211
|
+
* @returns The path.
|
|
212
|
+
*/
|
|
213
|
+
getEntityPathByAttr(entity: Entity, attrId: string, sep: string, root: boolean): string;
|
|
214
|
+
/**
|
|
215
|
+
* Gets the attribute text.
|
|
216
|
+
* @param attr The attribute.
|
|
217
|
+
* @param format The format.
|
|
218
|
+
* @returns Formatted text.
|
|
219
|
+
*/
|
|
220
|
+
getAttributeText(attr: EntityAttr, format: string): string;
|
|
221
|
+
getFirstUICAttr(): EntityAttr;
|
|
222
|
+
/**
|
|
223
|
+
* Gets first `UIC` attribute in specified entity
|
|
224
|
+
* (`UIC` stands for `use in conditions` - so such attribute can be used in conditions)
|
|
225
|
+
* @param entity Entity object to search our attribute in.
|
|
226
|
+
* @returns The entity attribute or `null`
|
|
227
|
+
*/
|
|
228
|
+
private getFirstUICAttrInEntity;
|
|
229
|
+
/**
|
|
230
|
+
* Scans model's entity tree and calls the callback functions for each attribute and entity.
|
|
231
|
+
* @param processAttribute The callback function which is called for each attribute in model's entity tree.
|
|
232
|
+
* The processed attribute is passed in the first function parameter.
|
|
233
|
+
* @param processEntity The callback function which is called for each entity in tree.
|
|
234
|
+
* The processed entity is passed in the first function parameter.
|
|
235
|
+
*/
|
|
236
|
+
runThroughEntities(processAttribute?: (attr: EntityAttr, opts: any) => void, processEntity?: (entity: Entity, opts: any) => void): void;
|
|
237
|
+
/**
|
|
238
|
+
* Finds first attribute by filter.
|
|
239
|
+
* @param filterFunc The filter function. Takes EntityAttr object in parameter and returns boolean
|
|
240
|
+
*/
|
|
241
|
+
getFirstAttributeByFilter(filterFunc: (attr: EntityAttr) => boolean): EntityAttr;
|
|
242
|
+
/**
|
|
243
|
+
* Finds operator in model by its ID.
|
|
244
|
+
* This function runs through all operators inside specified model and returns the one with specified ID.
|
|
245
|
+
* @param operatorId An operator ID.
|
|
246
|
+
* @returns The operator or `null`.
|
|
247
|
+
*/
|
|
248
|
+
findOperatorById(operatorId: string): Operator | null;
|
|
249
|
+
/**
|
|
250
|
+
* Finds operator in model by its ID.
|
|
251
|
+
* his function runs through all operators inside specified model and returns the one with specified ID.
|
|
252
|
+
* @param operatorId Operator ID.
|
|
253
|
+
* @returns The operator or special `NullOperator` object if operator is not found.
|
|
254
|
+
*/
|
|
255
|
+
getOperatorById(operatorId: string): Operator;
|
|
256
|
+
getDefaultOperatorIdForAttr(attr: EntityAttr): string;
|
|
257
|
+
/**
|
|
258
|
+
* Gets caption of the aggregate function.
|
|
259
|
+
* @param funcId The function id.
|
|
260
|
+
* @returns The caption.
|
|
261
|
+
*/
|
|
262
|
+
getAggrFunctionCaption(funcId: string): string;
|
|
263
|
+
/**
|
|
264
|
+
* Gets format of the aggregate function.
|
|
265
|
+
* @param funcId The function id.
|
|
266
|
+
* @returns The caption.
|
|
267
|
+
*/
|
|
268
|
+
getAggrFunctionFormat(funcId: string): string;
|
|
269
|
+
/**
|
|
270
|
+
* Gets default operator for an attribute.
|
|
271
|
+
* @param attr The attribute.
|
|
272
|
+
* @returns The operator.
|
|
273
|
+
*/
|
|
274
|
+
getDefaultOperatorForAttr(attr: EntityAttr): Operator;
|
|
275
|
+
/**
|
|
276
|
+
* Gets operand.
|
|
277
|
+
* @param attr The attribute.
|
|
278
|
+
* @param operator The operator.
|
|
279
|
+
* @param index The index.
|
|
280
|
+
* @returns The operand.
|
|
281
|
+
*/
|
|
282
|
+
getOperand(attr: EntityAttr, operator: Operator, index: number): Operand;
|
|
283
|
+
/**
|
|
284
|
+
* Gets the list of aggegate functions.
|
|
285
|
+
* @returns AN array of aggregate functions.
|
|
286
|
+
*/
|
|
287
|
+
getAggrFunctions(): AggrFunction[];
|
|
288
|
+
/**
|
|
289
|
+
* Checks wether macro value is date.
|
|
290
|
+
* @param macroExpr The macro value.
|
|
291
|
+
* @retruns `true` if the macro value is date, otherwise `false`.
|
|
292
|
+
*/
|
|
293
|
+
isDateMacro(macroExpr: string, macroProcessor?: (macroId: any) => void): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Checks whether the expression passed in the parameter is an time macro.
|
|
296
|
+
* @param macroExpr The macro expression
|
|
297
|
+
* @retruns `true` if the expression is a time macro (like Now), otherwise `false`.
|
|
298
|
+
*/
|
|
299
|
+
isTimeMacro(macroExpr: string, macroProcessor?: (macroId: any) => void): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Gets date by its macro value.
|
|
302
|
+
* @param macroExpr The macro value.
|
|
303
|
+
* @returns The date or `null`
|
|
304
|
+
*/
|
|
305
|
+
getDateMacroValue(macroExpr: string): Date | null;
|
|
306
|
+
/**
|
|
307
|
+
* Gets the date value by a macro expression of the expression itself.
|
|
308
|
+
* @param macroExpr The macro value.
|
|
309
|
+
* @returns The date or macro valu.
|
|
310
|
+
*/
|
|
311
|
+
getDateOrMacroValue(macroExpr: string): string | Date;
|
|
312
|
+
/**
|
|
313
|
+
* Gets time by its macro value.
|
|
314
|
+
* @param macroExpr The macro value.
|
|
315
|
+
* @returns The date or `null`.
|
|
316
|
+
*/
|
|
317
|
+
getTimeMacroValue(macroExpr: string): Date | null;
|
|
318
|
+
/**
|
|
319
|
+
* Gets time or macro by macro value.
|
|
320
|
+
* @param macroValue The macro value.
|
|
321
|
+
* @returns The time or macro valu.
|
|
322
|
+
*/
|
|
323
|
+
getTimeOrMacroValue(time: string): string | Date;
|
|
324
|
+
getAllDateMacros(): string[];
|
|
325
|
+
/**
|
|
326
|
+
* Gets all time marcos.
|
|
327
|
+
* @returns The array of marcos
|
|
328
|
+
*/
|
|
329
|
+
getAllTimeMacros(): string[];
|
|
330
|
+
}
|