@infomaximum/widget-sdk 4.2.0 → 4.3.0
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/index.d.ts +223 -88
- package/dist/index.esm.js +29 -32
- package/dist/index.js +30 -31
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,11 +44,13 @@ declare enum EControlType {
|
|
|
44
44
|
}
|
|
45
45
|
/** Конфигурация элемента управления настройкой */
|
|
46
46
|
interface IControlRecord<Settings extends object, Value, ControlType = EControlType> {
|
|
47
|
+
/** Ключ, должен быть уникальным в рамках одного уровня вложенности */
|
|
47
48
|
key: string;
|
|
48
|
-
/** Локализация заголовка
|
|
49
|
+
/** Локализация заголовка */
|
|
49
50
|
title?: string;
|
|
50
|
-
/** Тип используемого элемента управления
|
|
51
|
+
/** Тип используемого элемента управления из предложенных системой */
|
|
51
52
|
type: ControlType | string;
|
|
53
|
+
/** Кастомный верхний отступ */
|
|
52
54
|
marginTop?: number;
|
|
53
55
|
/** Объект дополнительных параметров элемента управления */
|
|
54
56
|
props?: object | ((settings: Settings) => object);
|
|
@@ -56,9 +58,15 @@ interface IControlRecord<Settings extends object, Value, ControlType = EControlT
|
|
|
56
58
|
accessor: TRecordAccessor<Settings, Value>;
|
|
57
59
|
/**
|
|
58
60
|
* Рекурсивное определение мета-описания, в элемент управления будет передана функция dive
|
|
59
|
-
* для
|
|
61
|
+
* для перехода в указанное мета-описание.
|
|
62
|
+
*
|
|
63
|
+
* Возможность работает только для элемента управления EControlType.tagSet.
|
|
60
64
|
*/
|
|
61
65
|
description?: IDivePanelDescription<Settings>;
|
|
66
|
+
/**
|
|
67
|
+
* Предикат, позволяющий скрыть элемент управления.
|
|
68
|
+
* Предоставлен для удобства разработки. Скрыть элемент можно и условно добавляя его в мета-описание.
|
|
69
|
+
*/
|
|
62
70
|
shouldDisplay?: IDisplayPredicate<Settings>;
|
|
63
71
|
}
|
|
64
72
|
|
|
@@ -421,18 +429,26 @@ interface IStagesFilterValue {
|
|
|
421
429
|
}
|
|
422
430
|
type TWidgetFilterValue = IFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
|
|
423
431
|
interface IWidgetFilter {
|
|
424
|
-
|
|
432
|
+
/** Значение фильтра */
|
|
425
433
|
filterValue: TWidgetFilterValue;
|
|
434
|
+
/** Значение фильтра, подготовленное для передачи в вычислитель */
|
|
426
435
|
preparedFilterValue: ICalculatorFilter;
|
|
436
|
+
/** Информация о возможности менять фильтр из виджета */
|
|
437
|
+
isReadonly: boolean;
|
|
427
438
|
}
|
|
428
439
|
interface IWidgetFiltration {
|
|
429
|
-
/**
|
|
430
|
-
preparedFilterValues: ICalculatorFilter[];
|
|
440
|
+
/** Информация о внешних фильтрах виджета */
|
|
431
441
|
filters: IWidgetFilter[];
|
|
442
|
+
/**
|
|
443
|
+
* Значения внешних фильтров виджета, подготовленные для передачи в вычислитель.
|
|
444
|
+
* Использует данные из filters, но предоставлено отдельным полем для удобства разработки.
|
|
445
|
+
*/
|
|
446
|
+
preparedFilterValues: ICalculatorFilter[];
|
|
432
447
|
/** Добавить фильтр по формуле */
|
|
433
448
|
addFormulaFilter(value: TSelectivePartial<IFormulaFilterValue, "format" | "formValues">): void;
|
|
434
449
|
/** Удалить фильтр по формуле */
|
|
435
450
|
removeFormulaFilter(formula: string): void;
|
|
451
|
+
/** Добавить процессный фильтр */
|
|
436
452
|
addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
|
|
437
453
|
/** Добавить фильтр по этапам */
|
|
438
454
|
addStagesFilter(value: Omit<IStagesFilterValue, "widgetKey">): void;
|
|
@@ -496,8 +512,8 @@ interface IWidgetTableColumn {
|
|
|
496
512
|
/** Тип данных колонки */
|
|
497
513
|
dataType: ESimpleDataType;
|
|
498
514
|
}
|
|
499
|
-
interface
|
|
500
|
-
/** @deprecated
|
|
515
|
+
interface IScriptField {
|
|
516
|
+
/** @deprecated */
|
|
501
517
|
guid: string;
|
|
502
518
|
name: string;
|
|
503
519
|
dataType: ESimpleDataType;
|
|
@@ -505,10 +521,10 @@ interface IScripField {
|
|
|
505
521
|
}
|
|
506
522
|
interface IActionScript {
|
|
507
523
|
key: string;
|
|
508
|
-
/** @deprecated
|
|
524
|
+
/** @deprecated */
|
|
509
525
|
guid: string;
|
|
510
526
|
name: string;
|
|
511
|
-
fields:
|
|
527
|
+
fields: IScriptField[];
|
|
512
528
|
}
|
|
513
529
|
interface IWidgetTable {
|
|
514
530
|
/** Имя таблицы */
|
|
@@ -517,7 +533,7 @@ interface IWidgetTable {
|
|
|
517
533
|
columns: Map<string, IWidgetTableColumn>;
|
|
518
534
|
}
|
|
519
535
|
/**
|
|
520
|
-
* simplified - упрощенный для работы фильтрации в
|
|
536
|
+
* simplified - упрощенный (для работы фильтрации в образах, открытых в модальном/боковом окне)
|
|
521
537
|
*
|
|
522
538
|
* full - полный
|
|
523
539
|
*/
|
|
@@ -532,32 +548,46 @@ interface IDisplayRule {
|
|
|
532
548
|
color: TColor;
|
|
533
549
|
}
|
|
534
550
|
interface IGlobalContext {
|
|
535
|
-
/**
|
|
551
|
+
/** Используемый язык системы */
|
|
536
552
|
language: ELanguages;
|
|
537
|
-
|
|
553
|
+
/** Имя отчета */
|
|
554
|
+
reportName: string;
|
|
555
|
+
/** Имена образов по их ключу(в текущем отчете) */
|
|
556
|
+
viewNameByKey: Map<string, string>;
|
|
557
|
+
/** Режим отображения виджетов */
|
|
558
|
+
displayMode: TDisplayMode;
|
|
559
|
+
/** Режим фильтрации виджетов */
|
|
560
|
+
filtrationMode: TFiltrationMode;
|
|
561
|
+
/** @deprecated имя группы пространства по ее id */
|
|
562
|
+
workspaceGroupNameById: Map<number, string>;
|
|
563
|
+
/** Меры уровня отчета */
|
|
538
564
|
reportMeasures: TNullable<Map<string, ICommonMeasures>>;
|
|
565
|
+
/** Меры уровня пространства(из модели данных) */
|
|
539
566
|
workspaceMeasures: TNullable<Map<string, Map<string, ICommonMeasures>>>;
|
|
567
|
+
/** Разрезы уровня отчета */
|
|
540
568
|
reportDimensions: TNullable<Map<string, ICommonDimensions>>;
|
|
569
|
+
/** Разрезы уровня пространства(из модели данных) */
|
|
541
570
|
workspaceDimensions: TNullable<Map<string, Map<string, ICommonDimensions>>>;
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
/**
|
|
571
|
+
/** Правила отображения уровня */
|
|
572
|
+
reportDisplayRules: Map<string, IDisplayRule>;
|
|
573
|
+
/** Правила отображения уровня пространства(из модели данных) */
|
|
574
|
+
workspaceDisplayRules: Map<string, Map<string, IDisplayRule>>;
|
|
575
|
+
/** Пользовательские переменные уровня отчета */
|
|
545
576
|
variables: Map<string, TWidgetVariable>;
|
|
577
|
+
/** Метод установки значения пользовательской переменной уровня отчета */
|
|
578
|
+
setVariableValue(name: string, value: TNullable<string> | string[]): void;
|
|
546
579
|
/** Системные переменные */
|
|
547
580
|
systemVariables: Map<string, TSystemVariable>;
|
|
548
|
-
/**
|
|
549
|
-
setVariableValue(name: string, value: TNullable<string> | string[]): void;
|
|
581
|
+
/** Состояния(название сущности) отчета */
|
|
550
582
|
states: Map<string, ICommonState>;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
scripts: Map<string, IActionScript>;
|
|
583
|
+
/** Процессы из модели данных */
|
|
584
|
+
processes: Map<string, IWidgetProcess>;
|
|
585
|
+
/** Имена таблиц из модели данных */
|
|
555
586
|
tables: Set<string>;
|
|
556
|
-
|
|
557
|
-
reportDisplayRules: Map<string, IDisplayRule>;
|
|
558
|
-
workspaceDisplayRules: Map<string, Map<string, IDisplayRule>>;
|
|
559
|
-
viewNameByKey: Map<string, string>;
|
|
587
|
+
/** Функция для запроса информации о колонках таблицы из модели данных */
|
|
560
588
|
fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
|
|
589
|
+
/** Скрипты, доступные для запуска из отчета */
|
|
590
|
+
scripts: Map<string, IActionScript>;
|
|
561
591
|
}
|
|
562
592
|
|
|
563
593
|
declare enum EColorMode {
|
|
@@ -777,6 +807,9 @@ interface IWidgetAction extends IActionCommon {
|
|
|
777
807
|
scriptKey: string;
|
|
778
808
|
updateDashboard: boolean;
|
|
779
809
|
description: string;
|
|
810
|
+
blockingCondition: {
|
|
811
|
+
formula: string;
|
|
812
|
+
};
|
|
780
813
|
}
|
|
781
814
|
type TAction = TActionsOnClick | IWidgetAction;
|
|
782
815
|
type TActionValidator = (action: TAction) => boolean;
|
|
@@ -871,12 +904,12 @@ declare enum ESortingValueModes {
|
|
|
871
904
|
}
|
|
872
905
|
interface ICommonState {
|
|
873
906
|
name: string;
|
|
874
|
-
/** @deprecated
|
|
907
|
+
/** @deprecated */
|
|
875
908
|
guid: string;
|
|
876
909
|
}
|
|
877
910
|
interface ICommonMeasures {
|
|
878
911
|
name: string;
|
|
879
|
-
/** @deprecated
|
|
912
|
+
/** @deprecated */
|
|
880
913
|
guid: string;
|
|
881
914
|
formula: string;
|
|
882
915
|
}
|
|
@@ -964,7 +997,7 @@ type TWidgetVariable = {
|
|
|
964
997
|
defaultValue: string;
|
|
965
998
|
/** Тип данных */
|
|
966
999
|
dataType: ESimpleDataType;
|
|
967
|
-
/** @deprecated
|
|
1000
|
+
/** @deprecated */
|
|
968
1001
|
guid: string;
|
|
969
1002
|
} | {
|
|
970
1003
|
/** Тип переменной */
|
|
@@ -981,7 +1014,7 @@ type TWidgetVariable = {
|
|
|
981
1014
|
dataType: ESimpleDataType.STRING;
|
|
982
1015
|
/** Множественный выбор */
|
|
983
1016
|
multipleChoice: boolean;
|
|
984
|
-
/** @deprecated
|
|
1017
|
+
/** @deprecated */
|
|
985
1018
|
guid: string;
|
|
986
1019
|
} | {
|
|
987
1020
|
/** Тип переменной */
|
|
@@ -1000,7 +1033,7 @@ type TWidgetVariable = {
|
|
|
1000
1033
|
multipleChoice: boolean;
|
|
1001
1034
|
/** Фильтры */
|
|
1002
1035
|
filters: TExtendedFormulaFilterValue[];
|
|
1003
|
-
/** @deprecated
|
|
1036
|
+
/** @deprecated */
|
|
1004
1037
|
guid: string;
|
|
1005
1038
|
};
|
|
1006
1039
|
declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
|
|
@@ -1208,17 +1241,23 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
|
|
|
1208
1241
|
/** Конвертировать показатели процессных событий виджета во входы для вычислителя */
|
|
1209
1242
|
declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1210
1243
|
|
|
1244
|
+
interface IGetDefaultSortOrders {
|
|
1245
|
+
sortOrders: ISortOrder[];
|
|
1246
|
+
dimensions: IWidgetDimension[];
|
|
1247
|
+
measures: IWidgetMeasure[];
|
|
1248
|
+
}
|
|
1249
|
+
declare const getDefaultSortOrders: ({ sortOrders, dimensions, measures, }: IGetDefaultSortOrders) => ISortOrder[];
|
|
1211
1250
|
/** Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя */
|
|
1212
1251
|
interface IMapSortingToInputsParams<Settings, Indicator> {
|
|
1213
1252
|
settings: Settings;
|
|
1214
1253
|
variables: Map<string, TWidgetVariable>;
|
|
1215
1254
|
filters: ICalculatorFilter[];
|
|
1216
1255
|
getIndicatorType(key: string, indicator: Indicator): EWidgetIndicatorType.DIMENSION | EWidgetIndicatorType.MEASURE;
|
|
1217
|
-
/** При отсутствии сортировки использовать предустановленную сортировку(на основе sortableIndicatorsKeys) */
|
|
1218
|
-
withDefaultSortOrder?: boolean;
|
|
1219
|
-
sortableIndicatorsKeys?: Readonly<StringKeyOf<Settings>[]>;
|
|
1220
1256
|
}
|
|
1221
|
-
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType,
|
|
1257
|
+
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType, }: IMapSortingToInputsParams<Settings, Indicator>): ISortOrder[];
|
|
1258
|
+
interface IPrepareSortOrdersParams<Settings, Indicator> extends IMapSortingToInputsParams<Settings, Indicator>, Pick<IGetDefaultSortOrders, "dimensions" | "measures"> {
|
|
1259
|
+
}
|
|
1260
|
+
declare function prepareSortOrders<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ dimensions, measures, ...rest }: IPrepareSortOrdersParams<Settings, Indicator>): ISortOrder[];
|
|
1222
1261
|
|
|
1223
1262
|
/**
|
|
1224
1263
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1247,12 +1286,53 @@ declare const escapeSpecialCharacters: (formula: string) => string;
|
|
|
1247
1286
|
/** Удалить из строки символы экранирования */
|
|
1248
1287
|
declare function unescapeSpecialCharacters(str: string): string;
|
|
1249
1288
|
|
|
1289
|
+
/** Фабрика вычислителей */
|
|
1250
1290
|
interface ICalculatorFactory {
|
|
1291
|
+
/**
|
|
1292
|
+
* Общий вычислитель.
|
|
1293
|
+
* Вычисляет любое(ограничено только ClickHouse) количество разрезов и мер.
|
|
1294
|
+
* Количество строк ограничивается переданным лимитом.
|
|
1295
|
+
*
|
|
1296
|
+
* Подходит для большинства задач, где требуется сделать одну или несколько группировок
|
|
1297
|
+
* и при необходимости посчитать показатель по каждой группе.
|
|
1298
|
+
*/
|
|
1251
1299
|
general: () => IGeneralCalculator;
|
|
1300
|
+
/**
|
|
1301
|
+
* Вычислитель с двумя лимитами.
|
|
1302
|
+
* Для работы требует ровно 2 разреза(для каждого из которых указывается свой лимит) и
|
|
1303
|
+
* любое количеством мер.
|
|
1304
|
+
*
|
|
1305
|
+
* Используется для отображения данных в виде двумерных матриц со значениями разрезов на осях.
|
|
1306
|
+
*/
|
|
1307
|
+
twoLimits: () => ITwoLimitsCalculator;
|
|
1308
|
+
/**
|
|
1309
|
+
* Вычислитель круговой диаграммы.
|
|
1310
|
+
* Для работы требует ровно 1 разрез и 1 меру.
|
|
1311
|
+
*
|
|
1312
|
+
* В отличие от других вычислителей, считает итог по мере как сумму значений по всем строкам,
|
|
1313
|
+
* а не как меру по всему объему данных. Такая особенность необходима для расчета
|
|
1314
|
+
* размера оставшегося сектора круговой диаграммы.
|
|
1315
|
+
*/
|
|
1252
1316
|
pie: () => IPieCalculator;
|
|
1317
|
+
/**
|
|
1318
|
+
* Вычислитель, предназначенный для вычисления графа по переданному процессу.
|
|
1319
|
+
* Возвращает информацию о событиях процесса и связях(переходах) между ними.
|
|
1320
|
+
*
|
|
1321
|
+
* Может вычислять любое количество мер, отдельно для событий и переходов.
|
|
1322
|
+
*/
|
|
1253
1323
|
processGraph: () => IProcessGraphCalculator;
|
|
1324
|
+
/**
|
|
1325
|
+
* Вычислитель гистограммы.
|
|
1326
|
+
* Вычисляет "корзины" для переданного разреза.
|
|
1327
|
+
*/
|
|
1254
1328
|
histogram: () => IHistogramCalculator;
|
|
1255
|
-
|
|
1329
|
+
/**
|
|
1330
|
+
* Вычислитель типа для разрезов и мер.
|
|
1331
|
+
* Принимает любое количество разрезов и мер.
|
|
1332
|
+
*
|
|
1333
|
+
* Под капотом использует general-вычислитель, оборачивая формулы в toTypeName, поэтому
|
|
1334
|
+
* все переданные формулы должны использовать связанные таблицы модели данных.
|
|
1335
|
+
*/
|
|
1256
1336
|
type: () => ITypeCalculator;
|
|
1257
1337
|
}
|
|
1258
1338
|
|
|
@@ -1363,7 +1443,14 @@ type TAddButton = {
|
|
|
1363
1443
|
};
|
|
1364
1444
|
interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
|
|
1365
1445
|
}
|
|
1366
|
-
/**
|
|
1446
|
+
/**
|
|
1447
|
+
* Конфигурация набора групп настроек.
|
|
1448
|
+
*
|
|
1449
|
+
* Набор групп, как правило, представлен в настройках виджета в виде массива объектов.
|
|
1450
|
+
* Каждый объект в массиве - это группа настроек.
|
|
1451
|
+
*
|
|
1452
|
+
* Группа отображается в виде раскрываемой плашки, может представлять из себя разрез, меру, процесс и др.
|
|
1453
|
+
*/
|
|
1367
1454
|
interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
|
|
1368
1455
|
/** Заголовок */
|
|
1369
1456
|
title: string;
|
|
@@ -1371,49 +1458,59 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
1371
1458
|
maxCount: number;
|
|
1372
1459
|
/** Описание доступа к настройкам групп */
|
|
1373
1460
|
accessor: TRecordAccessor<Settings, GroupSettings[]>;
|
|
1374
|
-
/**
|
|
1375
|
-
getType?: (settings: IInitialSettings) => EWidgetIndicatorType;
|
|
1376
|
-
/** Кнопки добавления группы в набор */
|
|
1461
|
+
/** Конфигурация кнопок добавления группы в набор */
|
|
1377
1462
|
addButtons: TAddButton[];
|
|
1378
|
-
/**
|
|
1463
|
+
/** Получить название, отображаемое на плашке (по умолчанию используется поле name из группы) */
|
|
1464
|
+
getGroupTitle?(group: IGroupSettings): string;
|
|
1465
|
+
/**
|
|
1466
|
+
* Получить тип показателя для группы, если группа описывает системный показатель.
|
|
1467
|
+
*
|
|
1468
|
+
* Тип будет использоваться для:
|
|
1469
|
+
* - отображения иконки показателя на плашке.
|
|
1470
|
+
* - предустановленного мета-описания показателя.
|
|
1471
|
+
*/
|
|
1472
|
+
getType?: (settings: IInitialSettings) => EWidgetIndicatorType;
|
|
1473
|
+
/** Создать конфигурацию группы для вкладки настроек данных */
|
|
1379
1474
|
createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1380
|
-
/** Создать
|
|
1475
|
+
/** Создать конфигурацию группы для вкладки настроек отображения */
|
|
1381
1476
|
createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1382
|
-
/**
|
|
1383
|
-
getGroupTitle?(group: IGroupSettings): string;
|
|
1384
|
-
/** Валидная ли группа */
|
|
1385
|
-
isValid?(group: IGroupSettings): boolean;
|
|
1386
|
-
/** Находится ли группа в состоянии загрузки */
|
|
1477
|
+
/** Находится ли группа в состоянии загрузки (по умолчанию false) */
|
|
1387
1478
|
isLoading?(group: IGroupSettings): boolean;
|
|
1388
|
-
/**
|
|
1479
|
+
/** Является ли группа валидной (по умолчанию true) */
|
|
1480
|
+
isValid?(group: IGroupSettings): boolean;
|
|
1481
|
+
/** Можно ли удалить группу (по умолчанию true) */
|
|
1389
1482
|
isRemovable?(group: IGroupSettings): boolean;
|
|
1390
|
-
/** Можно ли
|
|
1483
|
+
/** Можно ли менять порядок групп (по умолчанию true) */
|
|
1391
1484
|
isDraggable?: boolean;
|
|
1392
|
-
/**
|
|
1485
|
+
/** Кастомный верхний отступ для набора групп */
|
|
1393
1486
|
marginTop?: number;
|
|
1394
1487
|
}
|
|
1395
|
-
/** Конфигурация
|
|
1488
|
+
/** Конфигурация панели настроек виджета */
|
|
1396
1489
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
1397
|
-
/** Добавить
|
|
1490
|
+
/** Добавить поле настройки заголовка */
|
|
1398
1491
|
useTitle?: boolean;
|
|
1399
|
-
/** Добавить
|
|
1492
|
+
/** Добавить поле настройки описания */
|
|
1400
1493
|
useMarkdown?: boolean;
|
|
1401
|
-
/** Конфигурация настроек данных
|
|
1494
|
+
/** Конфигурация вкладки настроек данных */
|
|
1402
1495
|
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
1403
|
-
/** Конфигурация настроек отображения
|
|
1496
|
+
/** Конфигурация вкладки настроек отображения */
|
|
1404
1497
|
displayRecords?: TWidgetLevelRecord<Settings>[];
|
|
1405
|
-
/**
|
|
1498
|
+
/**
|
|
1499
|
+
* Конфигурация наборов(каждый набор по своему ключу) с группами настроек.
|
|
1500
|
+
* Описанный набор групп можно вставить по ключу в нужное место внутри dataRecords и displayRecords.
|
|
1501
|
+
*/
|
|
1406
1502
|
groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
|
|
1407
|
-
/** Добавить вкладку с
|
|
1503
|
+
/** Добавить вкладку с настройками действий (по умолчанию false) */
|
|
1408
1504
|
useActions?: boolean;
|
|
1409
|
-
/** Добавить вкладку с
|
|
1505
|
+
/** Добавить вкладку с настройками фильтрации (по умолчанию true) */
|
|
1410
1506
|
useFiltration?: boolean;
|
|
1411
|
-
/** Конфигурация настроек
|
|
1507
|
+
/** Конфигурация вкладки настроек фильтрации */
|
|
1412
1508
|
filtrationRecords?: Exclude<TWidgetLevelRecord<Settings>, IGroupSetRecord>[];
|
|
1413
|
-
/**
|
|
1509
|
+
/** Доступные для выбора режимы фильтрации (во вкладке настроек фильтрации) */
|
|
1414
1510
|
filtrationModes?: EWidgetFilterMode[];
|
|
1415
1511
|
}
|
|
1416
1512
|
interface IWidgetProcess {
|
|
1513
|
+
/** @deprecated */
|
|
1417
1514
|
guid: string;
|
|
1418
1515
|
/** Имя процесса */
|
|
1419
1516
|
name: string;
|
|
@@ -1438,7 +1535,13 @@ interface IWidgetProcess {
|
|
|
1438
1535
|
interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
|
|
1439
1536
|
}
|
|
1440
1537
|
interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
|
|
1441
|
-
(
|
|
1538
|
+
(
|
|
1539
|
+
/** Глобальный контекст */
|
|
1540
|
+
context: IGlobalContext,
|
|
1541
|
+
/** Настройки виджета */
|
|
1542
|
+
settings: Settings,
|
|
1543
|
+
/** Фабрика вычислителей */
|
|
1544
|
+
calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
|
|
1442
1545
|
}
|
|
1443
1546
|
declare enum ESystemRecordKey {
|
|
1444
1547
|
formatting = "formatting"
|
|
@@ -1478,16 +1581,24 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
|
|
|
1478
1581
|
}
|
|
1479
1582
|
|
|
1480
1583
|
type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
|
|
1584
|
+
/**
|
|
1585
|
+
* Событие мыши, по которому пользователь открыл меню.
|
|
1586
|
+
* Используется для автоматического определения позиции меню.
|
|
1587
|
+
*/
|
|
1481
1588
|
event?: MouseEvent;
|
|
1482
|
-
|
|
1483
|
-
positionOrigin?: "frame" | "workArea" | HTMLElement;
|
|
1484
|
-
boundingContainer?: HTMLElement;
|
|
1589
|
+
/** Явно указанная позиция меню */
|
|
1485
1590
|
position?: {
|
|
1486
1591
|
unitX?: TContextMenuPositionUnit;
|
|
1487
1592
|
unitY?: TContextMenuPositionUnit;
|
|
1488
1593
|
x?: number;
|
|
1489
1594
|
y?: number;
|
|
1490
1595
|
};
|
|
1596
|
+
/** Относительно чего позиционируется меню */
|
|
1597
|
+
positionOrigin?: "frame" | "workArea" | HTMLElement;
|
|
1598
|
+
/** Каким элементом ограничено расположение меню */
|
|
1599
|
+
boundingContainer?: HTMLElement;
|
|
1600
|
+
/** Положение меню относительно его позиции */
|
|
1601
|
+
placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
|
|
1491
1602
|
};
|
|
1492
1603
|
type TContextMenuPositionUnit = "%" | "px";
|
|
1493
1604
|
type TContextMenuList = {
|
|
@@ -1539,14 +1650,20 @@ interface IViewInputValue {
|
|
|
1539
1650
|
dataType: ESimpleDataType;
|
|
1540
1651
|
}
|
|
1541
1652
|
interface IViewContext {
|
|
1653
|
+
/** Пользовательские переменные уровня образа */
|
|
1542
1654
|
variables: Map<string, IViewInputValue>;
|
|
1543
1655
|
}
|
|
1544
1656
|
|
|
1545
1657
|
type TLaunchActionParams = {
|
|
1658
|
+
/** Запускаемое действие */
|
|
1546
1659
|
action: TAction;
|
|
1660
|
+
/** Callback, вызываемый при успешном запуске действия */
|
|
1547
1661
|
onSuccess: () => void;
|
|
1548
|
-
|
|
1662
|
+
/** Требуется ли подтверждение о запуске (откроется модальное окно) */
|
|
1549
1663
|
needConfirmation?: boolean;
|
|
1664
|
+
/** Фильтрация для способов ввода COLUMN и FORMULA */
|
|
1665
|
+
filters: ICalculatorFilter[];
|
|
1666
|
+
/** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
|
|
1550
1667
|
eventNames?: [string] | [string, string];
|
|
1551
1668
|
};
|
|
1552
1669
|
type TWidgetContainer = {
|
|
@@ -1560,50 +1677,68 @@ interface IWidgetPersistValue<T extends object = object> {
|
|
|
1560
1677
|
set(value: T | null): void;
|
|
1561
1678
|
}
|
|
1562
1679
|
interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
|
|
1563
|
-
/** guid виджета */
|
|
1680
|
+
/** @deprecated в качестве guid используется ключ виджета(уникален в рамках образа для каждого экземпляра виджета) */
|
|
1564
1681
|
guid: string;
|
|
1565
1682
|
/** Настройки виджета */
|
|
1566
1683
|
settings: WidgetSettings;
|
|
1684
|
+
/** Фабрика для создания вычислителей */
|
|
1685
|
+
calculatorFactory: ICalculatorFactory;
|
|
1567
1686
|
/** Объект для взаимодействия с фильтрацией */
|
|
1568
1687
|
filtration: IWidgetFiltration;
|
|
1569
|
-
/**
|
|
1570
|
-
|
|
1571
|
-
/** Захватить фокус: остальные виджеты будут оповещены о расфокусировке */
|
|
1572
|
-
captureFocus(): void;
|
|
1573
|
-
/** Фабрика вычислителей. */
|
|
1574
|
-
calculatorFactory: ICalculatorFactory;
|
|
1688
|
+
/** Объект для работы с контейнером виджета */
|
|
1689
|
+
widgetContainer: TWidgetContainer;
|
|
1575
1690
|
/**
|
|
1576
|
-
*
|
|
1577
|
-
* Служит для
|
|
1691
|
+
* Прокручиваемая область, отображающая образ с виджетами.
|
|
1692
|
+
* Служит пространством для размещения и просмотра виджетов как единого документа.
|
|
1578
1693
|
*/
|
|
1579
1694
|
rootViewContainer: HTMLDivElement;
|
|
1695
|
+
/** Функция для управления контекстными меню */
|
|
1696
|
+
setContextMenu: (key: string, value: TContextMenu | null) => void;
|
|
1580
1697
|
/** Объект для управления плейсхолдером */
|
|
1581
1698
|
placeholder: IWidgetPlaceholderController;
|
|
1582
1699
|
/** Объект для получения значений плейсхолдера */
|
|
1583
1700
|
placeholderValues: IWidgetPlaceholderValues;
|
|
1701
|
+
/** Функция для подписки на расфокусировку виджета (например, при фокусировке на другом виджете) */
|
|
1702
|
+
subscribeOnFocusOut(subscriber: () => void): void;
|
|
1703
|
+
/** Функция для захвата фокуса виджетом: остальные виджеты будут оповещены о расфокусировке */
|
|
1704
|
+
captureFocus(): void;
|
|
1584
1705
|
/** Глобальный контекст. Содержит информацию из отчета, пространства и платформы системы */
|
|
1585
1706
|
globalContext: IGlobalContext;
|
|
1586
1707
|
/** Контекст образа */
|
|
1587
1708
|
viewContext: IViewContext;
|
|
1588
|
-
/**
|
|
1589
|
-
widgetContainer: TWidgetContainer;
|
|
1590
|
-
/** Запуск действия */
|
|
1709
|
+
/** Функция для запуска действия */
|
|
1591
1710
|
launchAction(params: TLaunchActionParams): void;
|
|
1592
|
-
/**
|
|
1593
|
-
persistValue: IWidgetPersistValue;
|
|
1594
|
-
/** функция для управления контекстными меню */
|
|
1595
|
-
setContextMenu: (key: string, value: TContextMenu | null) => void;
|
|
1596
|
-
/** метод валидации действий по клику */
|
|
1711
|
+
/** Функция валидации действия */
|
|
1597
1712
|
actionValidator: TActionValidator;
|
|
1713
|
+
/** Аксессор для persist-значения виджета, хранимого в localStorage и URL */
|
|
1714
|
+
persistValue: IWidgetPersistValue;
|
|
1715
|
+
}
|
|
1716
|
+
/** Манифест виджета */
|
|
1717
|
+
interface IWidgetManifest {
|
|
1718
|
+
/** Уникальный идентификатор формата uuid */
|
|
1719
|
+
uuid: string;
|
|
1720
|
+
/** Локализация названия */
|
|
1721
|
+
name: Partial<{
|
|
1722
|
+
ru: string;
|
|
1723
|
+
en: string;
|
|
1724
|
+
}>;
|
|
1725
|
+
/** Мажорная версия widget-sdk, использованная при разработке виджета */
|
|
1726
|
+
sdk_version: number;
|
|
1727
|
+
/** Путь до js-файла, который является входной точкой виджета */
|
|
1728
|
+
entry: string;
|
|
1729
|
+
/** Путь до иконки(svg или png) */
|
|
1730
|
+
icon?: string;
|
|
1731
|
+
/** Находится ли виджет на beta-стадии разработки */
|
|
1732
|
+
is_beta?: boolean;
|
|
1598
1733
|
}
|
|
1599
1734
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1600
|
-
/**
|
|
1601
|
-
manifest:
|
|
1735
|
+
/** Манифест виджета */
|
|
1736
|
+
manifest: Partial<IWidgetManifest>;
|
|
1602
1737
|
/** body DOM элемент родительского приложения */
|
|
1603
1738
|
bodyElement: HTMLBodyElement;
|
|
1604
|
-
/**
|
|
1739
|
+
/** Объект для форматирования значений */
|
|
1605
1740
|
formatting: IWidgetFormatting;
|
|
1606
|
-
/**
|
|
1741
|
+
/** Функция для получения ресурса виджета по имени файла */
|
|
1607
1742
|
getWidgetAsset: (fileName: string) => Promise<Blob | null>;
|
|
1608
1743
|
}
|
|
1609
1744
|
interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
|
|
@@ -1764,7 +1899,7 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
|
|
|
1764
1899
|
declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
|
|
1765
1900
|
|
|
1766
1901
|
type TDefineWidgetOptions = {
|
|
1767
|
-
manifest?:
|
|
1902
|
+
manifest?: IWidgetManifest;
|
|
1768
1903
|
};
|
|
1769
1904
|
declare global {
|
|
1770
1905
|
interface Infomaximum {
|
|
@@ -1775,4 +1910,4 @@ declare global {
|
|
|
1775
1910
|
}
|
|
1776
1911
|
}
|
|
1777
1912
|
|
|
1778
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAppearanceSettings, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
1913
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAppearanceSettings, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -139,6 +139,18 @@ var __assign = function() {
|
|
|
139
139
|
return __assign.apply(this, arguments);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
function __rest(s, e) {
|
|
143
|
+
var t = {};
|
|
144
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
145
|
+
t[p] = s[p];
|
|
146
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
147
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
148
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
149
|
+
t[p[i]] = s[p[i]];
|
|
150
|
+
}
|
|
151
|
+
return t;
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
143
155
|
var e = new Error(message);
|
|
144
156
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1044,13 +1056,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1044
1056
|
return hierarchyDimensions[0];
|
|
1045
1057
|
}
|
|
1046
1058
|
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1059
|
+
var getDefaultSortOrders = function (_a) {
|
|
1060
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1061
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1062
|
+
if (sortOrders.length > 0 ||
|
|
1063
|
+
dimensions.some(function (dimension) {
|
|
1064
|
+
return dimension.displayCondition &&
|
|
1065
|
+
dimension.displayCondition.mode !== EDisplayConditionMode.DISABLED;
|
|
1066
|
+
})) {
|
|
1067
|
+
return sortOrders;
|
|
1054
1068
|
}
|
|
1055
1069
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1056
1070
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1087,7 +1101,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1087
1101
|
};
|
|
1088
1102
|
function mapSortingToInputs(_a) {
|
|
1089
1103
|
var _b;
|
|
1090
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1104
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1091
1105
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1092
1106
|
var _b;
|
|
1093
1107
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1120,29 +1134,12 @@ function mapSortingToInputs(_a) {
|
|
|
1120
1134
|
direction: direction,
|
|
1121
1135
|
};
|
|
1122
1136
|
});
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
var dimensions = [];
|
|
1130
|
-
var measures = [];
|
|
1131
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
1132
|
-
var indicatorsGroup = settings[key];
|
|
1133
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
1134
|
-
if (getIndicatorType(key, indicator) === EWidgetIndicatorType.DIMENSION) {
|
|
1135
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
1136
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
1137
|
-
: indicator;
|
|
1138
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
1139
|
-
}
|
|
1140
|
-
else {
|
|
1141
|
-
measures.push(indicator);
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
});
|
|
1145
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
1137
|
+
return sortOrder;
|
|
1138
|
+
}
|
|
1139
|
+
function prepareSortOrders(_a) {
|
|
1140
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1141
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1142
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1146
1143
|
}
|
|
1147
1144
|
|
|
1148
1145
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1351,4 +1348,4 @@ var isValidColor = function (color, globalContext) {
|
|
|
1351
1348
|
return true;
|
|
1352
1349
|
};
|
|
1353
1350
|
|
|
1354
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
1351
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.js
CHANGED
|
@@ -140,6 +140,18 @@ var __assign = function() {
|
|
|
140
140
|
return __assign.apply(this, arguments);
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
+
function __rest(s, e) {
|
|
144
|
+
var t = {};
|
|
145
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
146
|
+
t[p] = s[p];
|
|
147
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
148
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
149
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
150
|
+
t[p[i]] = s[p[i]];
|
|
151
|
+
}
|
|
152
|
+
return t;
|
|
153
|
+
}
|
|
154
|
+
|
|
143
155
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
144
156
|
var e = new Error(message);
|
|
145
157
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1045,13 +1057,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1045
1057
|
return hierarchyDimensions[0];
|
|
1046
1058
|
}
|
|
1047
1059
|
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1060
|
+
var getDefaultSortOrders = function (_a) {
|
|
1061
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1062
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1063
|
+
if (sortOrders.length > 0 ||
|
|
1064
|
+
dimensions.some(function (dimension) {
|
|
1065
|
+
return dimension.displayCondition &&
|
|
1066
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
1067
|
+
})) {
|
|
1068
|
+
return sortOrders;
|
|
1055
1069
|
}
|
|
1056
1070
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1057
1071
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1088,7 +1102,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1088
1102
|
};
|
|
1089
1103
|
function mapSortingToInputs(_a) {
|
|
1090
1104
|
var _b;
|
|
1091
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1105
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1092
1106
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1093
1107
|
var _b;
|
|
1094
1108
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1121,29 +1135,12 @@ function mapSortingToInputs(_a) {
|
|
|
1121
1135
|
direction: direction,
|
|
1122
1136
|
};
|
|
1123
1137
|
});
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
}
|
|
1130
|
-
var dimensions = [];
|
|
1131
|
-
var measures = [];
|
|
1132
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
1133
|
-
var indicatorsGroup = settings[key];
|
|
1134
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
1135
|
-
if (getIndicatorType(key, indicator) === exports.EWidgetIndicatorType.DIMENSION) {
|
|
1136
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
1137
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
1138
|
-
: indicator;
|
|
1139
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
1140
|
-
}
|
|
1141
|
-
else {
|
|
1142
|
-
measures.push(indicator);
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
});
|
|
1146
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
1138
|
+
return sortOrder;
|
|
1139
|
+
}
|
|
1140
|
+
function prepareSortOrders(_a) {
|
|
1141
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1142
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1143
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1147
1144
|
}
|
|
1148
1145
|
|
|
1149
1146
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1371,6 +1368,7 @@ exports.fillTemplateString = fillTemplateString;
|
|
|
1371
1368
|
exports.formattingConfig = formattingConfig;
|
|
1372
1369
|
exports.formulaFilterMethods = formulaFilterMethods;
|
|
1373
1370
|
exports.generateColumnFormula = generateColumnFormula;
|
|
1371
|
+
exports.getDefaultSortOrders = getDefaultSortOrders;
|
|
1374
1372
|
exports.getDimensionFormula = getDimensionFormula;
|
|
1375
1373
|
exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
1376
1374
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
@@ -1392,6 +1390,7 @@ exports.mapSortingToInputs = mapSortingToInputs;
|
|
|
1392
1390
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1393
1391
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1394
1392
|
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1393
|
+
exports.prepareSortOrders = prepareSortOrders;
|
|
1395
1394
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1396
1395
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1397
1396
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|