-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathds-helpers.d.ts
582 lines (406 loc) · 16.4 KB
/
ds-helpers.d.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
import { Observable } from './core/Observable';
import { IUrl } from './core/UrlState/UrlState';
import {tables, IVizelConfigDisplay, IRange, IEntity, IStoplights, IValue, IStoplight, IColorResolver, ITitleResolver, ISubspacePtr, IColorPair, IOptionsProvider, ITreeNode, ITag, IAxis, IPeriodsHelper, IPeriod, IUnit, ILocationCardField, IMetric, ILocationCard, ISpatial, ITaggedEntity, ILocationsHelper, ILocationArea, IPreset} from './defs/bi';
import {IConfigHelper, IDashboard, IDashlet, IDashletsHelper, IDatasetModel, IVizelConfig} from './defs/types';
type IDataSourceStyle = tables.IDataSourceStyle;
// TODO: add limit, sort
export declare class VizelConfigDisplay {
public constructor(dataset: IDatasetModel, raw: tables.IVizelConfigDisplay)
public clone(): VizelConfigDisplay
public hasRange(): boolean
public getRange(): IRange | null
public getSort(): string | null
public getLimit(): number | null
public getSortBy(): string
public getVAxisWidth(): number
public setSort(v: string): void
public disableRange(): void
public getGradient(): string | null
public getStackGroupIndex(e: IEntity): number
public getStoplights(): IStoplights | null
public getStoplight(v: IValue): IStoplight
}
export class VizelConfig implements IVizelConfig {
public readonly dataset: IDatasetModel;
public dataSource: tables.IDataSource;
public view_class: string;
public display: tables.IVizelConfigDisplay;
public controller: any
public title: string;
public description: string;
public legend: { [id: string]: tables.ILegendItem; }
public badValueColor: string;
public goodValueColor: string;
public onClickDataPoint: string | any;
public onClick: string | any;
public cardId: string;
public externalUrl: IUrl;
public dashboardId: string;
public dashId: string;
public normStrategy: string;
public context: any;
public titleContext: string[];
public colorResolver: IColorResolver
public titleResolver: ITitleResolver
// deprecated
public chartStyle: string;
public showLegend: boolean;
public constructor(ds: IDatasetModel, raw?: tables.IRawVizelConfig, view_class?: string)
public getDataset(): IDatasetModel;
/**
* @method
* @description Возвращает тип визеля (значения ключа view_class)
*/
public getVizelType(): string;
/**
* @method
* @description Устанавливает тип визеля (значения ключа view_class)
*/
public setVizelType(vizelType: string):void;
/**
* @method
* @description Возвращает объект subspacePtr
*/
public getSubspacePtr(): ISubspacePtr;
/**
* @method
* @description Отдает склонированый конфиг визеля
*/
public getRaw(): tables.IRawVizelConfig;
/**
* @return {IStoplights}
* @description Возвращает значения из конфига визеля display.stoplights
*/
public getStoplights(): IStoplights | null;
/**
* @param v
* @param vizelType
* @deprecated
* @description Менять напрямую объект.
*/
public getStoplight(v: number, vizelType?: string): IStoplight ;
/**
* @param {string} optionId - имя опции
* @param {any} defaultValue - Зн-ие если опции не найдена.
* @return {boolean | undefined}
* @description Метод ищет эту опцию в конфиги визеля, массив options, если не нашёл ищет в конфиги Датасета
*/
public getOption(optionId: string, defaultValue?: any): boolean | null;
public getOptionCount(optionId: string): number;
/**
* @param optionId
* @param value
* @deprecated
* @description Меняет напрямую объект options, не сигнализирует об обновлении конфига!!
*/
public setOption(optionId: string, value: boolean): void;
/**
* @param {string} optionId - имя опции
* @description Метод ищет опцию в конфиги визеля, в массиве options
*/
public hasOption(optionId: string): boolean;
/**
* @param optionId
* @deprecated
* @description Меняет напрямую объект options, не сигнализирует об обновлении конфига!!
*/
public addOption(optionId: string): boolean;
/**
* @param optionId
* @deprecated
* @description Меняет напрямую объект options, не сигнализирует об обновлении конфига!!
*/
public removeOption(optionId: string): boolean;
/**
* @method
* @return {string | null}
* @description возвращает значение ключа url, в конфиги визеля
*/
public getUrl(): string;
/**
* @method
* @return {string | null}
* @description возвращает значение ключа bgImage, в конфиги визеля
*/
public getBgImage(): string;
/**
* @param key
* @description not implemented
*/
public getProperty(key): any;
/**
* @param key
* @param value
* @description not implemented
*/
public setProperty(key: string, value: any): void;
/**
* @param {IEntity} e - сущность оси
* @param idx
* @description Ищет в dataSource.style объект, axisId[id], в МЛП ( metrics[mId], locations[lId], periods[pId]);
*/
public getLegendItem(e: IEntity, idx?: number): tables.ILegendItem;
/**
* @param {IEntity} e - сущность оси
* @param {number} v
* @param idx
* @description Наследует цвет из colorResolver | ищет цвет в style | выбирает цвет из skin.colorPallete
*/
public getColor(e: IEntity, v: number, idx?: number): string;
/**
* @param {IEntity} e - сущность оси
* @param {number} v
* @param idx
* @description Наследует фон из colorResolver | ищет цвет в style | выбирает цвет из skin.colorPallete
*/
public getBgColor(e: IEntity, v: number, idx?: number): string;
public getColorPair(e: IEntity, v?: IValue, idx?: number): IColorPair;
/**
* @param {IEntity} e - сущность
* @description Ищет title в titleResolver | ищет ключ title в style
*/
public getTitle(e: IEntity): string;
/**
* @param {IEntity} e - сущность
* @description Ищет ключ format в style
*/
public getFormat(e: IEntity): string;
public setTitle(title: string): void;
public getDisplay(): IVizelConfigDisplay;
public getRange(): IRange;
public disableRange(): void;
public serialize(): tables.IRawVizelConfig;
public clone(): IVizelConfig;
}
export class TreeNode<T> implements ITreeNode<T> {
public axisId: string
public id: number | string;
public parent: T
public root: T
public children: T[]
public constructor(parent?: T)
public addChild(child: T): T
public getChildren(): T[]
public getDescendants(): T[]
public getParent(): T
}
export class Tag extends TreeNode<ITag> implements ITag {
public axisId: string;
public id: number | string;
public title: string;
public children: Tag[]
public parent: Tag;
public root: Tag;
public constructor(id: number | string, title?: string, parent?: Tag)
public addChild(child: ITag): ITag
public appendTo(parent: ITag): ITag
// deprecated: use $eid(tag.children, id)
public getChildById(id: string): ITag
}
// keep right order of tags
export class TagGroup extends Tag implements IAxis<ITag> {
public children: Tag[]
public axisId: string;
public entities: ITag[]
public constructor(id: string, title?: string)
public getTag(idx: number): ITag
public addTags(tags: ITag[]): ITag
}
//
// Config Helper
//
export class ConfigHelper implements IConfigHelper {
public constructor(rawConfigs: tables.IConfigItem[], rawDsConfig: any)
public update(rawConfigs: tables.IConfigItem[], rawDsConfig: any): void
public addData(configItems: tables.IConfigItem[]): void
public addHashData(items: any): void
public hasValue(key: string): boolean
public getValue(key: string, defaultValue?: any): any
public getStringValue(key: string, defaultValue?: string): string
public getIntValue(key: string, defaultValue?: number): number
public getFloatValue(key: string, defaultValue?: number): number
public getBoolValue(key: string, defaultValue?: boolean | null): boolean | null
public getEnumValue(key: string, values: string[], defaultValue?: string): string
public getStringArray(key: string, defaultValue?: string[]): string[]
public getIntArray(key: string, defaultValue?: number[]): number[]
public getEnterUrl(schema_name: string): IUrl
}
//
// PeriodsHelper class
//
export class PeriodsHelper extends Observable implements IPeriodsHelper {
public constructor(raws: tables.IPeriodsItem[], startupPeriodType: number)
public update(rawPeriods: tables.IPeriodsItem[], startupPeriodType: number): void
public addPeriods(ps: tables.IPeriodsItem[]): void
private setDefaults(defaultPtId?: number): void
public getPeriodsByTypeId(periodTypeId: number): IPeriod[]
public getPeriodsByDatesAndType(from, to, periodType: number): IPeriod[]
public getAvailablePeriodTypes(): number[]
public getDefaultPeriodType(): number
public getTagGroup(tagGroupName: string): TagGroup
public isFirst(p: IPeriod): boolean
public isLast(p: IPeriod): boolean
}
export class Unit implements IUnit {
public axisId: string
public axis_title: string;
public id: number;
public config: any;
public unit_id: number;
public tiny_title: string;
public title: string;
public value_prefix: string;
public value_suffix: string;
public color: string;
public constructor(d: tables.IUnitsItem)
public update(d: tables.IUnitsItem): void
public toString(): string
public isInteger(): boolean
}
export class TaggedEntity implements ITaggedEntity {
public rawTags: string[]
public constructor()
public getTagByGroupId(tagGroupName: string): ITag
public getTagIdByGroupId(tagGroupName: string): number | string
public getTags(): ITag[]
public getTag(id: string | number): ITag
public addTag(tag: ITag): this
}
export class Metric extends TaggedEntity implements IMetric {
public axisId: string;
public id: string;
public parent_id: string;
public title: string;
public key: string;
public tree_level: number;
public unit_id: number;
public is_text_val: number; // 0 | 1
public config: any;
public is_hidden: number;
public srt: number;
public description: string;
public parentId: string;
public children: Metric[];
public parent: Metric;
public root: Metric;
public unit: Unit;
public color: string;
public constructor(raw: tables.IMetricsItem)
public update(raw: tables.IMetricsItem): void
public setParent(parent: Metric): void
public getParent(): IMetric
public getTitlePath(): string
public getAltTitle(titleType: string): string
}
export class UnitsHelper {
public entities: Unit[]
public constructor(raws: tables.IUnitsItem[])
public update(raws: tables.IUnitsItem[])
}
export class LocationCardFieldsHelper {
public entities: ILocationCardField[];
public constructor(raws: tables.ILocationCardField[], metrics: IMetric[])
public update(raws: tables.ILocationCardField[], metrics: IMetric[])
}
export class LocationCardsHelper {
public entities: ILocationCard[];
public constructor(raws: tables.ILocationCard[], locationCardFields: ILocationCardField[])
public update(raws: tables.ILocationCard[], locationCardFields: ILocationCardField[])
}
export class LocationAreasHelper {
public entities: ISpatial[];
public constructor(raws: tables.ILocationArea[])
public update(raws: tables.ILocationArea[])
}
//
// MetricsHelper class
// organize working with parameters
//
export class MetricsHelper {
public metrics: Metric[];
public constructor(raws: tables.IMetricsItem[], units: Unit[], ch: ConfigHelper)
public update(raws: tables.IMetricsItem[], units: Unit[]): void
protected _rebuildTree(): Metric[]
public getTagGroup(tagGroupName: string): TagGroup
}
export class LocationsHelper implements ILocationsHelper {
public locations: Location[];
public roots: Location[];
public tagAxes: { [axisId: string]: TagGroup };
public constructor(raws: tables.ILocationsItem[], locationCards: ILocationCard[], locationAreas: ILocationArea[])
public update(raws: tables.ILocationsItem[], locationCards: ILocationCard[], locationAreas: ILocationArea[])
protected _rebuildTree(): Location[]
public getTagGroup(tagGroupName: string): TagGroup
}
export class PresetsHelper {
public entities: IPreset[];
public constructor(raws: tables.IPresetsItem[], metrics: IMetric[])
public update(raws: tables.IPresetsItem[], metrics: IMetric[])
}
export class SubspacePtr implements ISubspacePtr {
public readonly koob: string;
public readonly lookupId: string | number;
public readonly dataSource: tables.IDataSource;
public readonly metricsDrilldown: number;
public readonly locationsDrilldown: number;
public readonly disableLoadData: number;
public constructor(dataSource: tables.IDataSource, options?: IOptionsProvider, doSwapXY?: boolean);
// TODO: consider make this method private (it is currently used in model)
public static isTaggedAxisId(axisId: string): boolean
public static extractTaggedAxisId(axisId: string): [string, string]
public getMIds(): string[]
public getLIds(): string[]
public getPIds(): string[] | { start?: string; end?: string; type?: number; qty?: number }
public getPType(): string
public getCombineAxes(): { xAxis: string[], yAxis: string[], zAxis: string[], tags: string[][] }
/**
*
* @param axisName the name of axis ('metrics', 'locations', ... 'tagged-root')
*/
public getAxisEntityIds(axisName: string): string | string[]
public isCombine(): boolean
public getAxesOrder(): string[]
}
export class Dashlet implements IDashlet {
public axisId: string;
public id: string;
public parentId: string;
public title: string;
public description: string;
public layout: string; // V|H|''
public children: Dashlet[];
public legend: any;
public constructor(dataset: IDatasetModel, dashboard: Dashboard, raw: tables.IDashletsItem)
public update(raw: tables.IDashletsItem): void
public getRawVizelConfig(): tables.IRawVizelConfig
public getDataset(): IDatasetModel
public getDashboard(): IDashboard
public getFrame(): tables.IConfigFrame
public getDescription(): string
public isContainer(): boolean
public isRoot(): boolean
public addChild(child: Dashlet): void
}
export class Dashboard implements IDashboard {
public axisId: string;
public id: string;
public stateColor: string;
public title: string;
public config: any;
public topic_id: number;
public constructor(dataset: IDatasetModel, d: tables.IDashboardsItem)
public update(rawDashboard: tables.IDashboardsItem): void
public addDash(raw: tables.IDashletsItem): void
public getDash(dashId: string): Dashlet
public getDashes(): Dashlet[]
public getRootDashes(): Dashlet[]
}
export class DashletsHelper implements IDashletsHelper {
public dashboardTopics: tables.IDashboardTopic[];
public dashboards: Dashboard[];
public constructor(dataset: IDatasetModel, rawDashboards: tables.IDashboardsItem[], rawDashboardTopics: tables.IDashboardTopic[], rawDashlets: tables.IDashletsItem[])
public update(rawDashboards: tables.IDashboardsItem[], rawDashboardTopics: tables.IDashboardTopic[], rawDashlets: tables.IDashletsItem[]): void
public getDash(id: string): Dashlet
public getDashes(): Dashlet[]
public getDashboard(dashboardId: string): Dashboard
}