@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.
Files changed (141) hide show
  1. package/dist/bundles/easyquery.core.js +9503 -9336
  2. package/dist/bundles/easyquery.core.js.map +1 -1
  3. package/dist/bundles/easyquery.core.min.js +1 -1
  4. package/dist/bundles/easyquery.core.min.js.map +1 -1
  5. package/dist/lib/common/eq_services.d.ts +56 -56
  6. package/dist/lib/common/eq_services.js +159 -159
  7. package/dist/lib/common/query_param.d.ts +25 -25
  8. package/dist/lib/common/query_param.js +1 -0
  9. package/dist/lib/common/tree.d.ts +10 -10
  10. package/dist/lib/common/tree.js +57 -57
  11. package/dist/lib/data/eq_aggr_container.d.ts +24 -24
  12. package/dist/lib/data/eq_aggr_container.js +108 -108
  13. package/dist/lib/data/eq_aggr_container.js.map +1 -1
  14. package/dist/lib/data/eq_data_loader.d.ts +8 -8
  15. package/dist/lib/data/eq_data_loader.js +49 -49
  16. package/dist/lib/data/eq_data_loader.js.map +1 -1
  17. package/dist/lib/data/google_data_converter.d.ts +82 -82
  18. package/dist/lib/data/google_data_converter.js +173 -173
  19. package/dist/lib/data/google_data_converter.js.map +1 -1
  20. package/dist/lib/dm/aggr_function.d.ts +27 -27
  21. package/dist/lib/dm/aggr_function.js +42 -42
  22. package/dist/lib/dm/data_model.d.ts +330 -330
  23. package/dist/lib/dm/data_model.js +934 -932
  24. package/dist/lib/dm/data_model.js.map +1 -1
  25. package/dist/lib/dm/dto/af_data.d.ts +16 -16
  26. package/dist/lib/dm/dto/af_data.js +1 -0
  27. package/dist/lib/dm/dto/dm_data.d.ts +34 -34
  28. package/dist/lib/dm/dto/dm_data.js +1 -0
  29. package/dist/lib/dm/dto/entity_data.d.ts +37 -37
  30. package/dist/lib/dm/dto/entity_data.js +1 -0
  31. package/dist/lib/dm/dto/operator_data.d.ts +44 -44
  32. package/dist/lib/dm/dto/operator_data.js +1 -0
  33. package/dist/lib/dm/dto/ve_data.d.ts +10 -10
  34. package/dist/lib/dm/dto/ve_data.js +1 -0
  35. package/dist/lib/dm/entity.d.ts +71 -71
  36. package/dist/lib/dm/entity.js +90 -88
  37. package/dist/lib/dm/entity.js.map +1 -1
  38. package/dist/lib/dm/link.d.ts +7 -7
  39. package/dist/lib/dm/link.js +1 -0
  40. package/dist/lib/dm/operator.d.ts +80 -80
  41. package/dist/lib/dm/operator.js +93 -93
  42. package/dist/lib/dm/value_editor.d.ts +16 -16
  43. package/dist/lib/dm/value_editor.js +43 -41
  44. package/dist/lib/dm/value_editor.js.map +1 -1
  45. package/dist/lib/eqs/eqs_data_fetcher.d.ts +7 -7
  46. package/dist/lib/eqs/eqs_data_fetcher.js +36 -36
  47. package/dist/lib/eqs/eqs_exporter.d.ts +10 -10
  48. package/dist/lib/eqs/eqs_exporter.js +59 -54
  49. package/dist/lib/eqs/eqs_exporter.js.map +1 -1
  50. package/dist/lib/eqs/eqs_model_loader.d.ts +7 -7
  51. package/dist/lib/eqs/eqs_model_loader.js +42 -40
  52. package/dist/lib/eqs/eqs_model_loader.js.map +1 -1
  53. package/dist/lib/eqs/eqs_query_file_loader.d.ts +9 -9
  54. package/dist/lib/eqs/eqs_query_file_loader.js +54 -54
  55. package/dist/lib/eqs/eqs_query_synchronizer.d.ts +7 -7
  56. package/dist/lib/eqs/eqs_query_synchronizer.js +23 -23
  57. package/dist/lib/eqs/eqs_value_list_resolver.d.ts +7 -7
  58. package/dist/lib/eqs/eqs_value_list_resolver.js +28 -28
  59. package/dist/lib/export/exporter.d.ts +19 -16
  60. package/dist/lib/export/exporter.js +6 -0
  61. package/dist/lib/export/exporter.js.map +1 -1
  62. package/dist/lib/i18n/text_resources.d.ts +1 -1
  63. package/dist/lib/i18n/text_resources.js +26 -26
  64. package/dist/lib/i18n/text_resources.js.map +1 -1
  65. package/dist/lib/main/action.d.ts +13 -13
  66. package/dist/lib/main/action.js +5 -5
  67. package/dist/lib/main/context.d.ts +345 -342
  68. package/dist/lib/main/context.js +1457 -1439
  69. package/dist/lib/main/context.js.map +1 -1
  70. package/dist/lib/main/context_options.d.ts +146 -145
  71. package/dist/lib/main/context_options.js +1 -0
  72. package/dist/lib/main/data_fetcher.d.ts +46 -46
  73. package/dist/lib/main/data_fetcher.js +1 -0
  74. package/dist/lib/main/eq_actions.d.ts +14 -14
  75. package/dist/lib/main/eq_actions.js +15 -15
  76. package/dist/lib/main/list_cache.d.ts +8 -8
  77. package/dist/lib/main/list_cache.js +1 -0
  78. package/dist/lib/main/model_loader.d.ts +21 -21
  79. package/dist/lib/main/model_loader.js +32 -32
  80. package/dist/lib/main/model_storage.d.ts +13 -13
  81. package/dist/lib/main/model_storage.js +17 -17
  82. package/dist/lib/main/query_file_loader.d.ts +15 -15
  83. package/dist/lib/main/query_file_loader.js +1 -0
  84. package/dist/lib/main/query_storage.d.ts +58 -58
  85. package/dist/lib/main/query_storage.js +124 -124
  86. package/dist/lib/main/query_synchronizer.d.ts +9 -9
  87. package/dist/lib/main/query_synchronizer.js +1 -0
  88. package/dist/lib/main/value_list_resolver.d.ts +18 -18
  89. package/dist/lib/main/value_list_resolver.js +1 -0
  90. package/dist/lib/main/widget.d.ts +74 -74
  91. package/dist/lib/main/widget.js +101 -101
  92. package/dist/lib/public_api.d.ts +58 -58
  93. package/dist/lib/public_api.js +59 -42
  94. package/dist/lib/public_api.js.map +1 -1
  95. package/dist/lib/query/condition.d.ts +97 -97
  96. package/dist/lib/query/condition.js +331 -331
  97. package/dist/lib/query/descriptors.d.ts +36 -36
  98. package/dist/lib/query/descriptors.js +1 -0
  99. package/dist/lib/query/dto/condition_data.d.ts +38 -38
  100. package/dist/lib/query/dto/condition_data.js +1 -0
  101. package/dist/lib/query/dto/expression_data.d.ts +32 -32
  102. package/dist/lib/query/dto/expression_data.js +1 -0
  103. package/dist/lib/query/dto/query_column_data.d.ts +28 -28
  104. package/dist/lib/query/dto/query_column_data.js +1 -0
  105. package/dist/lib/query/dto/query_data.d.ts +27 -27
  106. package/dist/lib/query/dto/query_data.js +1 -0
  107. package/dist/lib/query/expression.d.ts +69 -69
  108. package/dist/lib/query/expression.js +202 -202
  109. package/dist/lib/query/query.d.ts +415 -410
  110. package/dist/lib/query/query.js +1467 -1391
  111. package/dist/lib/query/query.js.map +1 -1
  112. package/dist/lib/query/query_column.d.ts +74 -70
  113. package/dist/lib/query/query_column.js +204 -157
  114. package/dist/lib/query/query_column.js.map +1 -1
  115. package/dist/lib/query/query_events.d.ts +29 -29
  116. package/dist/lib/query/query_events.js +19 -19
  117. package/dist/lib/types/cond_part.d.ts +6 -6
  118. package/dist/lib/types/cond_part.js +7 -7
  119. package/dist/lib/types/cond_tag.d.ts +12 -12
  120. package/dist/lib/types/cond_tag.js +13 -13
  121. package/dist/lib/types/data_kind.d.ts +15 -15
  122. package/dist/lib/types/data_kind.js +16 -16
  123. package/dist/lib/types/eq_editor_tag.d.ts +17 -17
  124. package/dist/lib/types/eq_editor_tag.js +20 -20
  125. package/dist/lib/types/expr_tag.d.ts +19 -19
  126. package/dist/lib/types/expr_tag.js +20 -20
  127. package/dist/lib/types/link_type.d.ts +17 -17
  128. package/dist/lib/types/link_type.js +18 -18
  129. package/dist/lib/types/widget_group.d.ts +17 -17
  130. package/dist/lib/types/widget_group.js +18 -18
  131. package/dist/lib/utils/constants.d.ts +36 -36
  132. package/dist/lib/utils/constants.js +50 -50
  133. package/dist/lib/utils/format_parser.d.ts +40 -40
  134. package/dist/lib/utils/format_parser.js +87 -87
  135. package/dist/lib/utils/utils.d.ts +34 -34
  136. package/dist/lib/utils/utils.js +102 -102
  137. package/dist/lib/utils/version_info.d.ts +9 -9
  138. package/dist/lib/utils/version_info.js +12 -12
  139. package/dist/lib/utils/version_info.js.map +1 -1
  140. package/package.json +16 -16
  141. package/webpack.config.js +6 -5
@@ -1,342 +1,345 @@
1
- import { EasyDataTable } from '@easydata/core';
2
- import { i18n } from '@easydata/core';
3
- import { EqServiceProvider } from '../common/eq_services';
4
- import { DataModel } from '../dm/data_model';
5
- import { Query } from '../query/query';
6
- import { Widget } from './widget';
7
- import { ContextExportResultOptions, ContextFetchDataOptions, ContextGetQueryFileOptions, ContextLoadModelOptions, ContextLoadQueryListOptions, ContextLoadQueryOptions, ContextLoadValueListOptions, ContextNewQueryOptions, ContextRemoveQueryOptions, ContextSaveQueryOptions, ContextSyncQueryOptions, ContextUploadQueryFileOptions, EqContextOptions } from './context_options';
8
- import { ExternalListCache } from './list_cache';
9
- import { ActionStatus } from './action';
10
- import { QueryData } from '../query/dto/query_data';
11
- import { ModelPlainData } from '../dm/dto/dm_data';
12
- import { WidgetGroup } from '../types/widget_group';
13
- import { EqExporter } from '../export/exporter';
14
- import { EasyQueryDataLoader } from '../data/eq_data_loader';
15
- declare type EqExporterResolver = (context: EqContext) => EqExporter;
16
- /**
17
- * Encapsulates all information about EasyQuery components on some webpage
18
- * and provides some basic operation over those components
19
- * Each context includes the following main components:
20
- * - one data model,
21
- * - one query,
22
- * - one result set
23
- * - several UI widgets.
24
- */
25
- export declare class EqContext {
26
- private servicesInitialized;
27
- private eqServices;
28
- private internalListCache;
29
- private externalListCache?;
30
- private dataModel;
31
- defaultModelId?: string;
32
- private query;
33
- defaultQueryId?: string;
34
- initialQuery?: QueryData;
35
- resultTable: EasyDataTable;
36
- dataLoader: EasyQueryDataLoader;
37
- resultContent?: string;
38
- resultStatement?: string;
39
- private widgets;
40
- private eventEmitter;
41
- private errorHandlerId;
42
- clientListRequestHandler: (data: any, callback: (list: any) => void) => boolean;
43
- loadModelOnStart: boolean;
44
- loadQueryOnStart: boolean;
45
- private exporters;
46
- private endpoints;
47
- useStoredQueryOnFetch: boolean;
48
- debugMode: boolean;
49
- private _backendInfo;
50
- /**
51
- * Tuners.
52
- * Each tuner is a function which are called before sending a request to the server
53
- */
54
- private beforeLoadModel?;
55
- private beforeSyncQuery?;
56
- private beforeLoadQuery?;
57
- private beforeFetchData?;
58
- private beforeExportResult?;
59
- private afterGroupFetch?;
60
- constructor();
61
- getServices(): EqServiceProvider;
62
- registerExporter(format: string, resolver: EqExporterResolver): void;
63
- registerServerExporter(format: string, responseType: XMLHttpRequestResponseType): void;
64
- getExporter(format: string): EqExporter | null;
65
- getExportFormats(): string[];
66
- addDefaultExporters(): void;
67
- private endpointVarsRegex;
68
- resolveEndpoint(endpointKey: EqEndpointKey, options?: any): string;
69
- setEndpoint(key: EqEndpointKey, value: string): void;
70
- setEnpointIfNotExist(key: EqEndpointKey, value: string): void;
71
- private setDefaultEndpoints;
72
- private elasticPaging;
73
- initStart(): void;
74
- /**
75
- * Initializes the context
76
- * @param options
77
- */
78
- init(options?: EqContextOptions): void;
79
- get backendInfo(): EqBackendInfo;
80
- /**
81
- * Sets endpoint for all EasyQuery actions. Should be called before `init` and
82
- * `useEnterprise` methods
83
- * @param endpoint
84
- * @example
85
- * ```
86
- * view.getContext()
87
- * .useEndpoint('/api/easyquery')
88
- * .useEnterprise(function () {
89
- * view.init();
90
- * });
91
- * ```
92
- */
93
- useEndpoint(endpoint: string): EqContext;
94
- /**
95
- * Allows to specify the type of backend service.
96
- *
97
- * @param backendInfo - the structure that contains information about the app used on the backend
98
- * Possible values for `ptag` property: 'EQN-ANC' - ASP.NET Core or 'EQN-ASP' - for ASP.NET 4 backend
99
- */
100
- useBackend(backendInfo: EqBackendInfo): EqContext;
101
- /**
102
- * Add a new widget to the context.
103
- * After that the widget will start to receive messages from other context components.
104
- * @param widget
105
- */
106
- addWidget(widget: Widget): void;
107
- /**
108
- * Returns all widgets with current type.
109
- * @param widgetType The widget type
110
- */
111
- getAllWidgetsByType(widgetType: string): Widget[];
112
- /**
113
- * Returns first registerd widget with current type
114
- * @param widgetType The widget type
115
- */
116
- getWidgetByType(widgetType: string): Widget | null;
117
- /**
118
- * This method is called automatically when some change was made either in context's data model or query
119
- * @param groups
120
- */
121
- refreshWidgets(groups?: WidgetGroup): void;
122
- /**
123
- * Register a new handler for 'query changed' event
124
- * @param callback
125
- */
126
- addQueryChangedCallback(callback: any): void;
127
- /**
128
- * Removes the function from the list of registerd handlers for 'query changed' event
129
- * @param callback
130
- */
131
- removeQueryChangedCallback(callback: any): void;
132
- /**
133
- * Creates a new query object using the current instance of EqServices
134
- */
135
- createQuery(): Query;
136
- /**
137
- * Gets the current query
138
- */
139
- getQuery(): Query;
140
- /**
141
- * Gets the current data model
142
- */
143
- getModel(): DataModel;
144
- /**
145
- * Sets the content of the current data model
146
- */
147
- loadModelFromData(modelPlainData: ModelPlainData): void;
148
- /**
149
- * Sets the ID of the default model
150
- * @param modelId
151
- */
152
- setDefaultModelId(modelId: string): void;
153
- /**
154
- * Notifies context components about starting of some long process (e.g. model loading)
155
- * This method raises onProcessStart event in the context and all its widgets
156
- * @param message
157
- * @param groups
158
- */
159
- startProcess(message: ActionStatus, groups?: WidgetGroup): void;
160
- /**
161
- * Notifies all context components about the finishing of some long process
162
- * @param status
163
- * @param groups
164
- */
165
- endProcess(status: ActionStatus, groups?: WidgetGroup): void;
166
- /**
167
- * Throws the error passed in the function parameter.
168
- * If onError event handler is defined - we call that method.
169
- * Otherwise - just place the error message to the browser console.
170
- * @param error
171
- */
172
- throwError(status: ActionStatus): void;
173
- /**
174
- * If `defaultModelId` property is define - this method calls `loadModel` function in the broker
175
- * to load the model with such ID.
176
- */
177
- loadDefaultModel(): void;
178
- /**
179
- * Clears the content of the current query
180
- */
181
- clearQuery(): void;
182
- /**
183
- * Clears all query results (the data set and the statement, if any)
184
- */
185
- clearResult(): void;
186
- /**
187
- * Sets the external 'list cache' provider - an object which implements `ExternalListCache` inteface
188
- * @param cache
189
- */
190
- setExternalListCache(cache: ExternalListCache): void;
191
- private getListFromCache;
192
- private getListCacheKey;
193
- private addListToCache;
194
- /**
195
- * Clears the current list cache.
196
- */
197
- resetListCache(): void;
198
- /**
199
- * Gets the handler for 'GetList' requests
200
- */
201
- getListRequestHandler(): any;
202
- private _predefinedListRequestHandlers;
203
- private _listRequestHandler;
204
- /**
205
- * Adds the translations of the EasyQuery messages for some locale
206
- * @param locale - the ISO code of the locale (like `en` or `uk`)
207
- * @param localeInfo - Locale settings and translations of EasyQuery texts and messages.
208
- * We expected an object with the struture of LocaleInfo interface here.
209
- */
210
- addLocale(locale: string, localeInfo: i18n.LocaleInfo): void;
211
- /**
212
- * Adds event listener for event type.
213
- * @param eventType The event type
214
- * @param handler The handler for event
215
- */
216
- addEventListener(eventType: 'ready' | 'loadModel' | 'initialModelLoad' | 'loadQuery' | 'syncQuery' | 'fetchData' | 'exportResult', handler: (context: EqContext) => void): string;
217
- addEventListener(eventType: 'processStart' | 'processEnd', handler: (context: EqContext, status: ActionStatus) => void): string;
218
- addEventListener(eventType: 'error', handler: (context: EqContext, status: ActionStatus) => void): string;
219
- /**
220
- * Remove event handler for event type .
221
- * @param eventType The event type.
222
- * @param handlerId The handler id.
223
- */
224
- removeEventListener(eventType: string, handlerId: string): void;
225
- /**
226
- * Fires event.
227
- * @param eventType The event type.
228
- */
229
- fireEvent(eventType: 'ready' | 'loadModel' | 'initialModelLoad' | 'loadQuery' | 'syncQuery' | 'fetchData' | 'exportResult'): any;
230
- fireEvent(eventType: 'processStart' | 'processEnd', data: ActionStatus): any;
231
- fireEvent(eventType: 'error', data: Error): any;
232
- private baseEndpoint;
233
- getBaseEndpoint(): string;
234
- /**
235
- * Sends a `loadValueList` requesthe server and processes the response.
236
- * @param options A map of options to pass to `loadValueList` function.
237
- */
238
- loadValueList(options?: ContextLoadValueListOptions): void;
239
- /**
240
- * Starts the process of the model loading.
241
- * This method can initiate a request to EasyQueryServer backend or get the model from OData or GraphQL endpoint
242
- * The content of the `options` parameter depends on concrete loader implementation.
243
- * @param options A map of options to pass to `loadModel` function (can be ommited)
244
- * @example
245
- * context.loadModel()
246
- * .then(model => {
247
- * alert("Model loaded!");
248
- * });
249
- */
250
- loadModel(options?: ContextLoadModelOptions): Promise<DataModel>;
251
- callWhenModelLoaded(callFunc: any): void;
252
- /**
253
- * Loads the query
254
- * @param options
255
- * The content of the `options` parameter depends on `QueryStorage` implementation.
256
- * Usually it contains `success`, `error` callbacks and `queryId` property of the query to load.
257
- * @example
258
- * context.loadQuery({
259
- * queryId: "query-id"
260
- * });
261
- */
262
- loadQuery(options?: ContextLoadQueryOptions): void;
263
- /**
264
- * Loads the list of queries available for the current user.
265
- * @param options
266
- * The content of the `options` parameter depends on `QueryStorage` implementation.
267
- * Usually it contains `success`, `error` callbacks
268
- */
269
- loadQueryList(options?: ContextLoadQueryListOptions): void;
270
- protected startQueryListLoading(options?: ContextLoadQueryListOptions): void;
271
- /**
272
- * Creates a new query and returns its content back to the client-side.
273
- * @param options
274
- * The content of the `options` parameter depends on `QueryStorage` implementation.
275
- * Usually it contains `success`, `error` callbacks and `silent` option
276
- * @example
277
- * context.newQuery({
278
- * silent: true
279
- * });
280
- */
281
- newQuery(options?: ContextNewQueryOptions): Query;
282
- /**
283
- * Saves the current query to some storage on the server-side.
284
- * @param options
285
- * The content of the `options` parameter depends on `QueryStorage` implementation.
286
- * Usually it contains `success` and `error` callbacks
287
- */
288
- saveQuery(options?: ContextSaveQueryOptions): void;
289
- /**
290
- * Removes the current query from some storage on the server-side.
291
- * @param options
292
- * The content of the `options` parameter depends on `QueryStorage` implementation.
293
- * Usually it contains `success` and `error` callbacks
294
- */
295
- removeQuery(options?: ContextRemoveQueryOptions): void;
296
- /**
297
- * Syncronizes the current query.
298
- * @param options
299
- * The content of the `options` parameter depends on `QuerySyncronizer` implementation.
300
- * Usually it contains `success` and `error` callbacks
301
- */
302
- syncQuery(options?: ContextSyncQueryOptions): void;
303
- /**
304
- * Fetches the data (usuall by executing current query) and processes the result.
305
- * @param options
306
- * The `options` parameter in addition to the options defined in FetchDataOptions structure may also contain `success` and `error` callbacks.
307
- * @example
308
- * context.fetchData({ success: function(result) {
309
- * //do whatever you want with the result
310
- * }})
311
- *
312
- */
313
- fetchData(options?: ContextFetchDataOptions): void;
314
- getQueryFile(options?: ContextGetQueryFileOptions): void;
315
- uploadQueryFile(options?: ContextUploadQueryFileOptions): void;
316
- fetchDataChunk(options?: ContextFetchDataOptions): void;
317
- protected onResultTableUpdate(): void;
318
- /**
319
- * Fetches the data for a drill-down query (if defined) and processes the result.
320
- * @param options
321
- */
322
- fetchDrillDownData(options: ContextFetchDataOptions): void;
323
- /**
324
- * Fetches the data for defined by this context and exports them to the specified format.
325
- * @param options
326
- * The content of the `options` parameter depends on `EqExporter` implementation.
327
- * Usually it contains `format` property which defines the format of the exported data (e.g. `csv`),
328
- * and `success` and `error` callbacks
329
- * @example
330
- * context.exportResult({
331
- * format: csv
332
- * });
333
- *
334
- */
335
- exportResult(options?: ContextExportResultOptions): void;
336
- }
337
- declare type EqEndpointKey = 'GetModel' | 'GetQuery' | 'SaveQuery' | 'NewQuery' | 'RemoveQuery' | 'GetQueryList' | 'SyncQuery' | 'FetchData' | 'GetValueList' | 'ExportResult' | 'GetQueryFile' | 'UploadQueryFile';
338
- export interface EqBackendInfo {
339
- type?: string;
340
- subType?: string;
341
- }
342
- export {};
1
+ import { EasyDataTable } from '@easydata/core';
2
+ import { i18n } from '@easydata/core';
3
+ import { EqServiceProvider } from '../common/eq_services';
4
+ import { DataModel } from '../dm/data_model';
5
+ import { Query } from '../query/query';
6
+ import { Widget } from './widget';
7
+ import { ContextExportResultOptions, ContextFetchDataOptions, ContextGetQueryFileOptions, ContextLoadModelOptions, ContextLoadQueryListOptions, ContextLoadQueryOptions, ContextLoadValueListOptions, ContextNewQueryOptions, ContextRemoveQueryOptions, ContextSaveQueryOptions, ContextSyncQueryOptions, ContextUploadQueryFileOptions, EqContextOptions } from './context_options';
8
+ import { ExternalListCache } from './list_cache';
9
+ import { ActionStatus } from './action';
10
+ import { QueryData } from '../query/dto/query_data';
11
+ import { ModelPlainData } from '../dm/dto/dm_data';
12
+ import { WidgetGroup } from '../types/widget_group';
13
+ import { EqExporter } from '../export/exporter';
14
+ import { EasyQueryDataLoader } from '../data/eq_data_loader';
15
+ type EqExporterResolver = (context: EqContext) => EqExporter;
16
+ /**
17
+ * Encapsulates all information about EasyQuery components on some webpage
18
+ * and provides some basic operation over those components
19
+ * Each context includes the following main components:
20
+ * - one data model,
21
+ * - one query,
22
+ * - one result set
23
+ * - several UI widgets.
24
+ */
25
+ export declare class EqContext {
26
+ options: EqContextOptions;
27
+ private servicesInitialized;
28
+ private eqServices;
29
+ private internalListCache;
30
+ private externalListCache?;
31
+ private dataModel;
32
+ defaultModelId?: string;
33
+ private query;
34
+ defaultQueryId?: string;
35
+ initialQuery?: QueryData;
36
+ resultTable: EasyDataTable;
37
+ dataLoader: EasyQueryDataLoader;
38
+ resultContent?: string;
39
+ resultStatement?: string;
40
+ private widgets;
41
+ private eventEmitter;
42
+ private errorHandlerId;
43
+ clientListRequestHandler: (data: any, callback: (list: any) => void) => boolean;
44
+ loadModelOnStart: boolean;
45
+ loadQueryOnStart: boolean;
46
+ private exporters;
47
+ private endpoints;
48
+ useStoredQueryOnFetch: boolean;
49
+ debugMode: boolean;
50
+ private _backendInfo;
51
+ /**
52
+ * Tuners.
53
+ * Each tuner is a function which are called before sending a request to the server
54
+ */
55
+ private beforeLoadModel?;
56
+ private beforeSyncQuery?;
57
+ private beforeLoadQuery?;
58
+ private beforeFetchData?;
59
+ private beforeExportResult?;
60
+ private afterGroupFetch?;
61
+ constructor();
62
+ getServices(): EqServiceProvider;
63
+ registerExporter(format: string, resolver: EqExporterResolver): void;
64
+ registerServerExporter(format: string, responseType: XMLHttpRequestResponseType): void;
65
+ getExporter(format: string): EqExporter | null;
66
+ getExportFormats(): string[];
67
+ addDefaultExporters(): void;
68
+ private endpointVarsRegex;
69
+ resolveEndpoint(endpointKey: EqEndpointKey, options?: any): string;
70
+ setEndpoint(key: EqEndpointKey, value: string): void;
71
+ setEnpointIfNotExist(key: EqEndpointKey, value: string): void;
72
+ private setDefaultEndpoints;
73
+ private elasticPaging;
74
+ initStart(): void;
75
+ /**
76
+ * Initializes the context
77
+ * @param options
78
+ */
79
+ init(options?: EqContextOptions): void;
80
+ private setOptions;
81
+ get backendInfo(): EqBackendInfo;
82
+ /**
83
+ * Sets endpoint for all EasyQuery actions. Should be called before `init` and
84
+ * `useEnterprise` methods
85
+ * @param endpoint
86
+ * @example
87
+ * ```
88
+ * view.getContext()
89
+ * .useEndpoint('/api/easyquery')
90
+ * .useEnterprise(function () {
91
+ * view.init();
92
+ * });
93
+ * ```
94
+ */
95
+ useEndpoint(endpoint: string): EqContext;
96
+ /**
97
+ * Allows to specify the type of backend service.
98
+ *
99
+ * @param backendInfo - the structure that contains information about the app used on the backend
100
+ * Possible values for `ptag` property: 'EQN-ANC' - ASP.NET Core or 'EQN-ASP' - for ASP.NET 4 backend
101
+ */
102
+ useBackend(backendInfo: EqBackendInfo): EqContext;
103
+ /**
104
+ * Add a new widget to the context.
105
+ * After that the widget will start to receive messages from other context components.
106
+ * @param widget
107
+ */
108
+ addWidget(widget: Widget): void;
109
+ /**
110
+ * Returns all widgets with current type.
111
+ * @param widgetType The widget type
112
+ */
113
+ getAllWidgetsByType(widgetType: string): Widget[];
114
+ /**
115
+ * Returns first registerd widget with current type
116
+ * @param widgetType The widget type
117
+ */
118
+ getWidgetByType(widgetType: string): Widget | null;
119
+ /**
120
+ * This method is called automatically when some change was made either in context's data model or query
121
+ * @param groups
122
+ */
123
+ refreshWidgets(groups?: WidgetGroup): void;
124
+ /**
125
+ * Register a new handler for 'query changed' event
126
+ * @param callback
127
+ */
128
+ addQueryChangedCallback(callback: any): void;
129
+ /**
130
+ * Removes the function from the list of registerd handlers for 'query changed' event
131
+ * @param callback
132
+ */
133
+ removeQueryChangedCallback(callback: any): void;
134
+ /**
135
+ * Creates a new query object using the current instance of EqServices
136
+ */
137
+ createQuery(): Query;
138
+ /**
139
+ * Gets the current query
140
+ */
141
+ getQuery(): Query;
142
+ /**
143
+ * Gets the current data model
144
+ */
145
+ getModel(): DataModel;
146
+ /**
147
+ * Sets the content of the current data model
148
+ */
149
+ loadModelFromData(modelPlainData: ModelPlainData): void;
150
+ /**
151
+ * Sets the ID of the default model
152
+ * @param modelId
153
+ */
154
+ setDefaultModelId(modelId: string): void;
155
+ /**
156
+ * Notifies context components about starting of some long process (e.g. model loading)
157
+ * This method raises onProcessStart event in the context and all its widgets
158
+ * @param message
159
+ * @param groups
160
+ */
161
+ startProcess(message: ActionStatus, groups?: WidgetGroup): void;
162
+ /**
163
+ * Notifies all context components about the finishing of some long process
164
+ * @param status
165
+ * @param groups
166
+ */
167
+ endProcess(status: ActionStatus, groups?: WidgetGroup): void;
168
+ /**
169
+ * Throws the error passed in the function parameter.
170
+ * If onError event handler is defined - we call that method.
171
+ * Otherwise - just place the error message to the browser console.
172
+ * @param error
173
+ */
174
+ throwError(status: ActionStatus): void;
175
+ /**
176
+ * If `defaultModelId` property is define - this method calls `loadModel` function in the broker
177
+ * to load the model with such ID.
178
+ */
179
+ loadDefaultModel(): void;
180
+ /**
181
+ * Clears the content of the current query
182
+ */
183
+ clearQuery(): void;
184
+ /**
185
+ * Clears all query results (the data set and the statement, if any)
186
+ */
187
+ clearResult(): void;
188
+ /**
189
+ * Sets the external 'list cache' provider - an object which implements `ExternalListCache` inteface
190
+ * @param cache
191
+ */
192
+ setExternalListCache(cache: ExternalListCache): void;
193
+ private getListFromCache;
194
+ private getListCacheKey;
195
+ private addListToCache;
196
+ /**
197
+ * Clears the current list cache.
198
+ */
199
+ resetListCache(): void;
200
+ /**
201
+ * Gets the handler for 'GetList' requests
202
+ */
203
+ getListRequestHandler(): any;
204
+ private _predefinedListRequestHandlers;
205
+ private _listRequestHandler;
206
+ /**
207
+ * Adds the translations of the EasyQuery messages for some locale
208
+ * @param locale - the ISO code of the locale (like `en` or `uk`)
209
+ * @param localeInfo - Locale settings and translations of EasyQuery texts and messages.
210
+ * We expected an object with the struture of LocaleInfo interface here.
211
+ */
212
+ addLocale(locale: string, localeInfo: i18n.LocaleInfo): void;
213
+ /**
214
+ * Adds event listener for event type.
215
+ * @param eventType The event type
216
+ * @param handler The handler for event
217
+ */
218
+ addEventListener(eventType: 'ready' | 'loadModel' | 'initialModelLoad' | 'loadQuery' | 'syncQuery' | 'fetchData' | 'exportResult', handler: (context: EqContext) => void): string;
219
+ addEventListener(eventType: 'processStart' | 'processEnd', handler: (context: EqContext, status: ActionStatus) => void): string;
220
+ addEventListener(eventType: 'error', handler: (context: EqContext, status: ActionStatus) => void): string;
221
+ /**
222
+ * Remove event handler for event type .
223
+ * @param eventType The event type.
224
+ * @param handlerId The handler id.
225
+ */
226
+ removeEventListener(eventType: string, handlerId: string): void;
227
+ /**
228
+ * Fires event.
229
+ * @param eventType The event type.
230
+ */
231
+ fireEvent(eventType: 'ready' | 'loadModel' | 'initialModelLoad' | 'loadQuery' | 'syncQuery' | 'fetchData' | 'exportResult'): any;
232
+ fireEvent(eventType: 'processStart' | 'processEnd', data: ActionStatus): any;
233
+ fireEvent(eventType: 'error', data: Error): any;
234
+ private baseEndpoint;
235
+ getBaseEndpoint(): string;
236
+ /**
237
+ * Sends a `loadValueList` requesthe server and processes the response.
238
+ * @param options A map of options to pass to `loadValueList` function.
239
+ */
240
+ loadValueList(options?: ContextLoadValueListOptions): void;
241
+ /**
242
+ * Starts the process of the model loading.
243
+ * This method can initiate a request to EasyQueryServer backend or get the model from OData or GraphQL endpoint
244
+ * The content of the `options` parameter depends on concrete loader implementation.
245
+ * @param options A map of options to pass to `loadModel` function (can be ommited)
246
+ * @example
247
+ * context.loadModel()
248
+ * .then(model => {
249
+ * alert("Model loaded!");
250
+ * });
251
+ */
252
+ loadModel(options?: ContextLoadModelOptions): Promise<DataModel>;
253
+ callWhenModelLoaded(callFunc: any): void;
254
+ /**
255
+ * Loads the query
256
+ * @param options
257
+ * The content of the `options` parameter depends on `QueryStorage` implementation.
258
+ * Usually it contains `success`, `error` callbacks and `queryId` property of the query to load.
259
+ * @example
260
+ * context.loadQuery({
261
+ * queryId: "query-id"
262
+ * });
263
+ */
264
+ loadQuery(options?: ContextLoadQueryOptions): void;
265
+ /**
266
+ * Loads the list of queries available for the current user.
267
+ * @param options
268
+ * The content of the `options` parameter depends on `QueryStorage` implementation.
269
+ * Usually it contains `success`, `error` callbacks
270
+ */
271
+ loadQueryList(options?: ContextLoadQueryListOptions): void;
272
+ protected startQueryListLoading(options?: ContextLoadQueryListOptions): void;
273
+ /**
274
+ * Creates a new query and returns its content back to the client-side.
275
+ * @param options
276
+ * The content of the `options` parameter depends on `QueryStorage` implementation.
277
+ * Usually it contains `success`, `error` callbacks and `silent` option
278
+ * @example
279
+ * context.newQuery({
280
+ * silent: true
281
+ * });
282
+ */
283
+ newQuery(options?: ContextNewQueryOptions): Query;
284
+ /**
285
+ * Saves the current query to some storage on the server-side.
286
+ * @param options
287
+ * The content of the `options` parameter depends on `QueryStorage` implementation.
288
+ * Usually it contains `success` and `error` callbacks
289
+ */
290
+ saveQuery(options?: ContextSaveQueryOptions): void;
291
+ /**
292
+ * Removes the current query from some storage on the server-side.
293
+ * @param options
294
+ * The content of the `options` parameter depends on `QueryStorage` implementation.
295
+ * Usually it contains `success` and `error` callbacks
296
+ */
297
+ removeQuery(options?: ContextRemoveQueryOptions): void;
298
+ /**
299
+ * Syncronizes the current query.
300
+ * @param options
301
+ * The content of the `options` parameter depends on `QuerySyncronizer` implementation.
302
+ * Usually it contains `success` and `error` callbacks
303
+ */
304
+ syncQuery(options?: ContextSyncQueryOptions): void;
305
+ /**
306
+ * Fetches the data (usuall by executing current query) and processes the result.
307
+ * @param options
308
+ * The `options` parameter in addition to the options defined in FetchDataOptions structure may also contain `success` and `error` callbacks.
309
+ * @example
310
+ * context.fetchData({ success: function(result) {
311
+ * //do whatever you want with the result
312
+ * }})
313
+ *
314
+ */
315
+ fetchData(options?: ContextFetchDataOptions): void;
316
+ getQueryFile(options?: ContextGetQueryFileOptions): void;
317
+ uploadQueryFile(options?: ContextUploadQueryFileOptions): void;
318
+ fetchDataChunk(options?: ContextFetchDataOptions): void;
319
+ protected onResultTableUpdate(): void;
320
+ /**
321
+ * Fetches the data for a drill-down query (if defined) and processes the result.
322
+ * @param options
323
+ */
324
+ fetchDrillDownData(options: ContextFetchDataOptions): void;
325
+ /**
326
+ * Fetches the data for defined by this context and exports them to the specified format.
327
+ * @param options
328
+ * The content of the `options` parameter depends on `EqExporter` implementation.
329
+ * Usually it contains `format` property which defines the format of the exported data (e.g. `csv`),
330
+ * and `success` and `error` callbacks
331
+ * @example
332
+ * context.exportResult({
333
+ * format: csv
334
+ * });
335
+ *
336
+ */
337
+ exportResult(options?: ContextExportResultOptions): void;
338
+ private limitCustomSqlColumns;
339
+ }
340
+ type EqEndpointKey = 'GetModel' | 'GetQuery' | 'SaveQuery' | 'NewQuery' | 'RemoveQuery' | 'GetQueryList' | 'SyncQuery' | 'FetchData' | 'GetValueList' | 'ExportResult' | 'GetQueryFile' | 'UploadQueryFile';
341
+ export interface EqBackendInfo {
342
+ type?: string;
343
+ subType?: string;
344
+ }
345
+ export {};