@infomaximum/widget-sdk 4.1.0 → 4.2.1

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 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
- isReadonly: boolean;
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 IScripField {
500
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
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 удалить после выполнения BI-13602, задача BI-13650 */
524
+ /** @deprecated */
509
525
  guid: string;
510
526
  name: string;
511
- fields: IScripField[];
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
- processes: Map<string, IWidgetProcess>;
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
- /** @deprecated удалить после окончания поддержки миграций BI-13650 */
543
- workspaceGroupNameById: Map<number, string>;
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
- reportName: string;
552
- /** Режим отображения виджета */
553
- displayMode: TDisplayMode;
554
- scripts: Map<string, IActionScript>;
583
+ /** Процессы из модели данных */
584
+ processes: Map<string, IWidgetProcess>;
585
+ /** Имена таблиц из модели данных */
555
586
  tables: Set<string>;
556
- filtrationMode: TFiltrationMode;
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 {
@@ -739,16 +769,6 @@ interface IActionUpdateVariable extends IActionCommon {
739
769
  type: EActionTypes.UPDATE_VARIABLE;
740
770
  variables: TActionOnClickParameter[];
741
771
  }
742
- type TActionOpenViewMode = {
743
- mode: EViewMode.GENERATED_BY_SCRIPT;
744
- scriptKey: string;
745
- parameters: TActionOnClickParameter[];
746
- displayName: string;
747
- } | {
748
- mode: EViewMode.EXISTED_VIEW;
749
- viewKey: string;
750
- parameters: TActionOnClickParameter[];
751
- };
752
772
  type TActionOpenIn = {
753
773
  openIn: EViewOpenIn.DRAWER_WINDOW;
754
774
  alignment: EDrawerPlacement;
@@ -762,9 +782,23 @@ type TActionOpenIn = {
762
782
  } | {
763
783
  openIn: EViewOpenIn.CURRENT_WINDOW;
764
784
  };
765
- type TActionOpenView = {
785
+ type TActionOpenView = IActionCommon & {
766
786
  type: EActionTypes.OPEN_VIEW;
767
- } & TActionOpenViewMode & TActionOpenIn & IActionCommon;
787
+ } & (({
788
+ mode: EViewMode.GENERATED_BY_SCRIPT;
789
+ scriptKey: string;
790
+ parameters: TActionOnClickParameter[];
791
+ displayName: string;
792
+ } & TActionOpenIn) | ({
793
+ mode: EViewMode.EXISTED_VIEW;
794
+ viewKey: string;
795
+ parameters: TActionOnClickParameter[];
796
+ } & TActionOpenIn) | ({
797
+ mode: EViewMode.EMPTY;
798
+ placeholderName: string;
799
+ } & Extract<TActionOpenIn, {
800
+ openIn: EViewOpenIn.PLACEHOLDER;
801
+ }>));
768
802
  type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
769
803
  interface IWidgetAction extends IActionCommon {
770
804
  filters: TExtendedFormulaFilterValue[];
@@ -775,6 +809,11 @@ interface IWidgetAction extends IActionCommon {
775
809
  description: string;
776
810
  }
777
811
  type TAction = TActionsOnClick | IWidgetAction;
812
+ type TActionValidator = (action: TAction) => boolean;
813
+ /**
814
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
815
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
816
+ */
778
817
  declare const isExecuteScriptActionValid: (action: Extract<TAction, {
779
818
  type: EActionTypes.EXECUTE_SCRIPT;
780
819
  }>, { scripts, tables, variables, systemVariables, }: Pick<IGlobalContext, "scripts" | "tables" | "variables" | "systemVariables">) => boolean;
@@ -862,12 +901,12 @@ declare enum ESortingValueModes {
862
901
  }
863
902
  interface ICommonState {
864
903
  name: string;
865
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
904
+ /** @deprecated */
866
905
  guid: string;
867
906
  }
868
907
  interface ICommonMeasures {
869
908
  name: string;
870
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
909
+ /** @deprecated */
871
910
  guid: string;
872
911
  formula: string;
873
912
  }
@@ -955,7 +994,7 @@ type TWidgetVariable = {
955
994
  defaultValue: string;
956
995
  /** Тип данных */
957
996
  dataType: ESimpleDataType;
958
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
997
+ /** @deprecated */
959
998
  guid: string;
960
999
  } | {
961
1000
  /** Тип переменной */
@@ -972,7 +1011,7 @@ type TWidgetVariable = {
972
1011
  dataType: ESimpleDataType.STRING;
973
1012
  /** Множественный выбор */
974
1013
  multipleChoice: boolean;
975
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
1014
+ /** @deprecated */
976
1015
  guid: string;
977
1016
  } | {
978
1017
  /** Тип переменной */
@@ -991,7 +1030,7 @@ type TWidgetVariable = {
991
1030
  multipleChoice: boolean;
992
1031
  /** Фильтры */
993
1032
  filters: TExtendedFormulaFilterValue[];
994
- /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
1033
+ /** @deprecated */
995
1034
  guid: string;
996
1035
  };
997
1036
  declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
@@ -1238,12 +1277,53 @@ declare const escapeSpecialCharacters: (formula: string) => string;
1238
1277
  /** Удалить из строки символы экранирования */
1239
1278
  declare function unescapeSpecialCharacters(str: string): string;
1240
1279
 
1280
+ /** Фабрика вычислителей */
1241
1281
  interface ICalculatorFactory {
1282
+ /**
1283
+ * Общий вычислитель.
1284
+ * Вычисляет любое(ограничено только ClickHouse) количество разрезов и мер.
1285
+ * Количество строк ограничивается переданным лимитом.
1286
+ *
1287
+ * Подходит для большинства задач, где требуется сделать одну или несколько группировок
1288
+ * и при необходимости посчитать показатель по каждой группе.
1289
+ */
1242
1290
  general: () => IGeneralCalculator;
1291
+ /**
1292
+ * Вычислитель с двумя лимитами.
1293
+ * Для работы требует ровно 2 разреза(для каждого из которых указывается свой лимит) и
1294
+ * любое количеством мер.
1295
+ *
1296
+ * Используется для отображения данных в виде двумерных матриц со значениями разрезов на осях.
1297
+ */
1298
+ twoLimits: () => ITwoLimitsCalculator;
1299
+ /**
1300
+ * Вычислитель круговой диаграммы.
1301
+ * Для работы требует ровно 1 разрез и 1 меру.
1302
+ *
1303
+ * В отличие от других вычислителей, считает итог по мере как сумму значений по всем строкам,
1304
+ * а не как меру по всему объему данных. Такая особенность необходима для расчета
1305
+ * размера оставшегося сектора круговой диаграммы.
1306
+ */
1243
1307
  pie: () => IPieCalculator;
1308
+ /**
1309
+ * Вычислитель, предназначенный для вычисления графа по переданному процессу.
1310
+ * Возвращает информацию о событиях процесса и связях(переходах) между ними.
1311
+ *
1312
+ * Может вычислять любое количество мер, отдельно для событий и переходов.
1313
+ */
1244
1314
  processGraph: () => IProcessGraphCalculator;
1315
+ /**
1316
+ * Вычислитель гистограммы.
1317
+ * Вычисляет "корзины" для переданного разреза.
1318
+ */
1245
1319
  histogram: () => IHistogramCalculator;
1246
- twoLimits: () => ITwoLimitsCalculator;
1320
+ /**
1321
+ * Вычислитель типа для разрезов и мер.
1322
+ * Принимает любое количество разрезов и мер.
1323
+ *
1324
+ * Под капотом использует general-вычислитель, оборачивая формулы в toTypeName, поэтому
1325
+ * все переданные формулы должны использовать связанные таблицы модели данных.
1326
+ */
1247
1327
  type: () => ITypeCalculator;
1248
1328
  }
1249
1329
 
@@ -1354,7 +1434,14 @@ type TAddButton = {
1354
1434
  };
1355
1435
  interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
1356
1436
  }
1357
- /** Конфигурация набора групп */
1437
+ /**
1438
+ * Конфигурация набора групп настроек.
1439
+ *
1440
+ * Набор групп, как правило, представлен в настройках виджета в виде массива объектов.
1441
+ * Каждый объект в массиве - это группа настроек.
1442
+ *
1443
+ * Группа отображается в виде раскрываемой плашки, может представлять из себя разрез, меру, процесс и др.
1444
+ */
1358
1445
  interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
1359
1446
  /** Заголовок */
1360
1447
  title: string;
@@ -1362,49 +1449,59 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
1362
1449
  maxCount: number;
1363
1450
  /** Описание доступа к настройкам групп */
1364
1451
  accessor: TRecordAccessor<Settings, GroupSettings[]>;
1365
- /** Получить тип индикатора */
1366
- getType?: (settings: IInitialSettings) => EWidgetIndicatorType;
1367
- /** Кнопки добавления группы в набор */
1452
+ /** Конфигурация кнопок добавления группы в набор */
1368
1453
  addButtons: TAddButton[];
1369
- /** Создать элементы управления внутри группы (для вкладки настроек данных) */
1454
+ /** Получить название, отображаемое на плашке (по умолчанию используется поле name из группы) */
1455
+ getGroupTitle?(group: IGroupSettings): string;
1456
+ /**
1457
+ * Получить тип показателя для группы, если группа описывает системный показатель.
1458
+ *
1459
+ * Тип будет использоваться для:
1460
+ * - отображения иконки показателя на плашке.
1461
+ * - предустановленного мета-описания показателя.
1462
+ */
1463
+ getType?: (settings: IInitialSettings) => EWidgetIndicatorType;
1464
+ /** Создать конфигурацию группы для вкладки настроек данных */
1370
1465
  createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1371
- /** Создать элементы управления внутри группы (для вкладки настроек отображения) */
1466
+ /** Создать конфигурацию группы для вкладки настроек отображения */
1372
1467
  createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1373
- /** Получить название для плашки */
1374
- getGroupTitle?(group: IGroupSettings): string;
1375
- /** Валидная ли группа */
1376
- isValid?(group: IGroupSettings): boolean;
1377
- /** Находится ли группа в состоянии загрузки */
1468
+ /** Находится ли группа в состоянии загрузки (по умолчанию false) */
1378
1469
  isLoading?(group: IGroupSettings): boolean;
1379
- /** Можно ли удалять группу по умолчанию true */
1470
+ /** Является ли группа валидной (по умолчанию true) */
1471
+ isValid?(group: IGroupSettings): boolean;
1472
+ /** Можно ли удалить группу (по умолчанию true) */
1380
1473
  isRemovable?(group: IGroupSettings): boolean;
1381
- /** Можно ли сортировать группу по умолчанию true */
1474
+ /** Можно ли менять порядок групп (по умолчанию true) */
1382
1475
  isDraggable?: boolean;
1383
- /** Опциональный верхний отступ для группы */
1476
+ /** Кастомный верхний отступ для набора групп */
1384
1477
  marginTop?: number;
1385
1478
  }
1386
- /** Конфигурация левой панели */
1479
+ /** Конфигурация панели настроек виджета */
1387
1480
  interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
1388
- /** Добавить заголовок для виджета */
1481
+ /** Добавить поле настройки заголовка */
1389
1482
  useTitle?: boolean;
1390
- /** Добавить описание для виджета */
1483
+ /** Добавить поле настройки описания */
1391
1484
  useMarkdown?: boolean;
1392
- /** Конфигурация настроек данных виджета */
1485
+ /** Конфигурация вкладки настроек данных */
1393
1486
  dataRecords?: TWidgetLevelRecord<Settings>[];
1394
- /** Конфигурация настроек отображения виджета */
1487
+ /** Конфигурация вкладки настроек отображения */
1395
1488
  displayRecords?: TWidgetLevelRecord<Settings>[];
1396
- /** Конфигурации наборов групп */
1489
+ /**
1490
+ * Конфигурация наборов(каждый набор по своему ключу) с группами настроек.
1491
+ * Описанный набор групп можно вставить по ключу в нужное место внутри dataRecords и displayRecords.
1492
+ */
1397
1493
  groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
1398
- /** Добавить вкладку с действиями (по умолчанию false) */
1494
+ /** Добавить вкладку с настройками действий (по умолчанию false) */
1399
1495
  useActions?: boolean;
1400
- /** Добавить вкладку с фильтрацией (по умолчанию true) */
1496
+ /** Добавить вкладку с настройками фильтрации (по умолчанию true) */
1401
1497
  useFiltration?: boolean;
1402
- /** Конфигурация настроек фильтров */
1498
+ /** Конфигурация вкладки настроек фильтрации */
1403
1499
  filtrationRecords?: Exclude<TWidgetLevelRecord<Settings>, IGroupSetRecord>[];
1404
- /** Режимы фильтрации */
1500
+ /** Доступные для выбора режимы фильтрации (во вкладке настроек фильтрации) */
1405
1501
  filtrationModes?: EWidgetFilterMode[];
1406
1502
  }
1407
1503
  interface IWidgetProcess {
1504
+ /** @deprecated */
1408
1505
  guid: string;
1409
1506
  /** Имя процесса */
1410
1507
  name: string;
@@ -1429,7 +1526,13 @@ interface IWidgetProcess {
1429
1526
  interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
1430
1527
  }
1431
1528
  interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1432
- (context: IGlobalContext, panelSettings: Settings, calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
1529
+ (
1530
+ /** Глобальный контекст */
1531
+ context: IGlobalContext,
1532
+ /** Настройки виджета */
1533
+ settings: Settings,
1534
+ /** Фабрика вычислителей */
1535
+ calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
1433
1536
  }
1434
1537
  declare enum ESystemRecordKey {
1435
1538
  formatting = "formatting"
@@ -1469,16 +1572,24 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1469
1572
  }
1470
1573
 
1471
1574
  type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
1575
+ /**
1576
+ * Событие мыши, по которому пользователь открыл меню.
1577
+ * Используется для автоматического определения позиции меню.
1578
+ */
1472
1579
  event?: MouseEvent;
1473
- placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
1474
- positionOrigin?: "frame" | "workArea" | HTMLElement;
1475
- boundingContainer?: HTMLElement;
1580
+ /** Явно указанная позиция меню */
1476
1581
  position?: {
1477
1582
  unitX?: TContextMenuPositionUnit;
1478
1583
  unitY?: TContextMenuPositionUnit;
1479
1584
  x?: number;
1480
1585
  y?: number;
1481
1586
  };
1587
+ /** Относительно чего позиционируется меню */
1588
+ positionOrigin?: "frame" | "workArea" | HTMLElement;
1589
+ /** Каким элементом ограничено расположение меню */
1590
+ boundingContainer?: HTMLElement;
1591
+ /** Положение меню относительно его позиции */
1592
+ placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
1482
1593
  };
1483
1594
  type TContextMenuPositionUnit = "%" | "px";
1484
1595
  type TContextMenuList = {
@@ -1530,14 +1641,20 @@ interface IViewInputValue {
1530
1641
  dataType: ESimpleDataType;
1531
1642
  }
1532
1643
  interface IViewContext {
1644
+ /** Пользовательские переменные уровня образа */
1533
1645
  variables: Map<string, IViewInputValue>;
1534
1646
  }
1535
1647
 
1536
1648
  type TLaunchActionParams = {
1649
+ /** Запускаемое действие */
1537
1650
  action: TAction;
1651
+ /** Callback, вызываемый при успешном запуске действия */
1538
1652
  onSuccess: () => void;
1539
- filters: ICalculatorFilter[];
1653
+ /** Требуется ли подтверждение о запуске (откроется модальное окно) */
1540
1654
  needConfirmation?: boolean;
1655
+ /** Фильтрация для способов ввода COLUMN и FORMULA */
1656
+ filters: ICalculatorFilter[];
1657
+ /** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
1541
1658
  eventNames?: [string] | [string, string];
1542
1659
  };
1543
1660
  type TWidgetContainer = {
@@ -1551,48 +1668,68 @@ interface IWidgetPersistValue<T extends object = object> {
1551
1668
  set(value: T | null): void;
1552
1669
  }
1553
1670
  interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1554
- /** guid виджета */
1671
+ /** @deprecated в качестве guid используется ключ виджета(уникален в рамках образа для каждого экземпляра виджета) */
1555
1672
  guid: string;
1556
1673
  /** Настройки виджета */
1557
1674
  settings: WidgetSettings;
1675
+ /** Фабрика для создания вычислителей */
1676
+ calculatorFactory: ICalculatorFactory;
1558
1677
  /** Объект для взаимодействия с фильтрацией */
1559
1678
  filtration: IWidgetFiltration;
1560
- /** Функция для подписки на расфокусировку виджета */
1561
- subscribeOnFocusOut(subscriber: () => void): void;
1562
- /** Захватить фокус: остальные виджеты будут оповещены о расфокусировке */
1563
- captureFocus(): void;
1564
- /** Фабрика вычислителей. */
1565
- calculatorFactory: ICalculatorFactory;
1679
+ /** Объект для работы с контейнером виджета */
1680
+ widgetContainer: TWidgetContainer;
1566
1681
  /**
1567
- * Корневой контейнер отчета.
1568
- * Служит для возможности использования портала внутри виджетов.
1682
+ * Прокручиваемая область, отображающая образ с виджетами.
1683
+ * Служит пространством для размещения и просмотра виджетов как единого документа.
1569
1684
  */
1570
1685
  rootViewContainer: HTMLDivElement;
1686
+ /** Функция для управления контекстными меню */
1687
+ setContextMenu: (key: string, value: TContextMenu | null) => void;
1571
1688
  /** Объект для управления плейсхолдером */
1572
1689
  placeholder: IWidgetPlaceholderController;
1573
1690
  /** Объект для получения значений плейсхолдера */
1574
1691
  placeholderValues: IWidgetPlaceholderValues;
1692
+ /** Функция для подписки на расфокусировку виджета (например, при фокусировке на другом виджете) */
1693
+ subscribeOnFocusOut(subscriber: () => void): void;
1694
+ /** Функция для захвата фокуса виджетом: остальные виджеты будут оповещены о расфокусировке */
1695
+ captureFocus(): void;
1575
1696
  /** Глобальный контекст. Содержит информацию из отчета, пространства и платформы системы */
1576
1697
  globalContext: IGlobalContext;
1577
1698
  /** Контекст образа */
1578
1699
  viewContext: IViewContext;
1579
- /** Данные о контейнере виджета */
1580
- widgetContainer: TWidgetContainer;
1581
- /** Запуск действия */
1700
+ /** Функция для запуска действия */
1582
1701
  launchAction(params: TLaunchActionParams): void;
1583
- /** Значение, сохраняемое в localStorage и URL */
1702
+ /** Функция валидации действия */
1703
+ actionValidator: TActionValidator;
1704
+ /** Аксессор для persist-значения виджета, хранимого в localStorage и URL */
1584
1705
  persistValue: IWidgetPersistValue;
1585
- /** функция для управления контекстными меню */
1586
- setContextMenu: (key: string, value: TContextMenu | null) => void;
1706
+ }
1707
+ /** Манифест виджета */
1708
+ interface IWidgetManifest {
1709
+ /** Уникальный идентификатор формата uuid */
1710
+ uuid: string;
1711
+ /** Локализация названия */
1712
+ name: Partial<{
1713
+ ru: string;
1714
+ en: string;
1715
+ }>;
1716
+ /** Мажорная версия widget-sdk, использованная при разработке виджета */
1717
+ sdk_version: number;
1718
+ /** Путь до js-файла, который является входной точкой виджета */
1719
+ entry: string;
1720
+ /** Путь до иконки(svg или png) */
1721
+ icon?: string;
1722
+ /** Находится ли виджет на beta-стадии разработки */
1723
+ is_beta?: boolean;
1587
1724
  }
1588
1725
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1589
- /** манифест виджета */
1590
- manifest: Record<string, any>;
1726
+ /** Манифест виджета */
1727
+ manifest: Partial<IWidgetManifest>;
1591
1728
  /** body DOM элемент родительского приложения */
1592
1729
  bodyElement: HTMLBodyElement;
1593
- /** Форматирование */
1730
+ /** Объект для форматирования значений */
1594
1731
  formatting: IWidgetFormatting;
1595
- /** Получить ресурс виджета по имени файла */
1732
+ /** Функция для получения ресурса виджета по имени файла */
1596
1733
  getWidgetAsset: (fileName: string) => Promise<Blob | null>;
1597
1734
  }
1598
1735
  interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
@@ -1753,7 +1890,7 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
1753
1890
  declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
1754
1891
 
1755
1892
  type TDefineWidgetOptions = {
1756
- manifest?: Record<string, unknown>;
1893
+ manifest?: IWidgetManifest;
1757
1894
  };
1758
1895
  declare global {
1759
1896
  interface Infomaximum {
@@ -1764,4 +1901,4 @@ declare global {
1764
1901
  }
1765
1902
  }
1766
1903
 
1767
- 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 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 };
1904
+ 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, 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 };
package/dist/index.esm.js CHANGED
@@ -40,6 +40,10 @@ var EDrawerPlacement;
40
40
  EDrawerPlacement["LEFT"] = "LEFT";
41
41
  EDrawerPlacement["RIGHT"] = "RIGHT";
42
42
  })(EDrawerPlacement || (EDrawerPlacement = {}));
43
+ /**
44
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
45
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
46
+ */
43
47
  var isExecuteScriptActionValid = function (action, _a) {
44
48
  var _b;
45
49
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables, systemVariables = _a.systemVariables;
package/dist/index.js CHANGED
@@ -41,6 +41,10 @@ exports.EDrawerPlacement = void 0;
41
41
  EDrawerPlacement["LEFT"] = "LEFT";
42
42
  EDrawerPlacement["RIGHT"] = "RIGHT";
43
43
  })(exports.EDrawerPlacement || (exports.EDrawerPlacement = {}));
44
+ /**
45
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
46
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
47
+ */
44
48
  var isExecuteScriptActionValid = function (action, _a) {
45
49
  var _b;
46
50
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables, systemVariables = _a.systemVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "4.1.0",
3
+ "version": "4.2.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",