@infomaximum/widget-sdk 4.0.0-beta9 → 4.0.0-next1

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
@@ -4,6 +4,7 @@ export { EFilteringMethodValues } from '@infomaximum/base-filter';
4
4
 
5
5
  type TNullable<T> = T | null | undefined;
6
6
  type valueof<T> = T[keyof T];
7
+ type StringKeyOf<T> = Exclude<keyof T, number | symbol>;
7
8
 
8
9
  declare enum ESimpleDataType {
9
10
  OTHER = "OTHER",
@@ -16,6 +17,10 @@ declare enum ESimpleDataType {
16
17
  BOOLEAN = "BOOLEAN"
17
18
  }
18
19
 
20
+ declare enum EUnitMode {
21
+ PIXEL = "PIXEL",
22
+ PERCENT = "PERCENT"
23
+ }
19
24
  declare enum EControlType {
20
25
  inputNumber = "inputNumber",
21
26
  switch = "switch",
@@ -28,14 +33,13 @@ declare enum EControlType {
28
33
  typedFormula = "typedFormula",
29
34
  inputRange = "inputRange",
30
35
  colorPicker = "colorPicker",
31
- /** @deprecated - удалится в ближайшее время */
32
- filterMode = "filterMode",
33
36
  displayCondition = "displayCondition",
34
37
  eventsColor = "eventsColor",
35
38
  inputMarkdown = "inputMarkdown",
36
39
  filter = "filter",
37
40
  actionOnClick = "actionOnClick",
38
- eventsPicker = "eventsPicker"
41
+ eventsPicker = "eventsPicker",
42
+ size = "size"
39
43
  }
40
44
  /** Конфигурация элемента управления настройкой */
41
45
  interface IControlRecord<Settings extends object, Value, ControlType = EControlType> {
@@ -44,6 +48,7 @@ interface IControlRecord<Settings extends object, Value, ControlType = EControlT
44
48
  title?: string;
45
49
  /** Тип используемого элемента управления настройкой из предложенных нашей системой */
46
50
  type: ControlType | string;
51
+ marginTop?: number;
47
52
  /** Объект дополнительных параметров элемента управления */
48
53
  props?: object | ((settings: Settings) => object);
49
54
  /** Описание доступа к значению настройки */
@@ -84,7 +89,6 @@ interface ICalculatorDimensionOutput extends ICalculatorIndicatorOutput {
84
89
  }
85
90
  interface ICalculatorMeasureInput extends ICalculatorIndicatorInput {
86
91
  mainFormula: string;
87
- /** Временно поддерживается обратная совместимость с форматом { alias: string; formula: string }[] */
88
92
  additionalFormulas?: Map<string, string>;
89
93
  }
90
94
  interface ICalculatorMeasureOutput extends ICalculatorIndicatorOutput {
@@ -158,7 +162,7 @@ declare enum EFormatTypes {
158
162
  }
159
163
  declare enum EFormattingPresets {
160
164
  "AUTO" = "AUTO",
161
- "TUNE" = "TUNE",
165
+ "CUSTOM" = "CUSTOM",
162
166
  "DD/M/YYYY" = "DD/M/YYYY",
163
167
  "DD-MM-YYYY" = "DD-MM-YYYY",
164
168
  "DD-MM-YY" = "DD-MM-YY",
@@ -244,7 +248,7 @@ declare enum EFormattingPresets {
244
248
  "R[-]YY" = "R[-]YY"
245
249
  }
246
250
  interface IWidgetFormatting {
247
- getFormattedValue: (value: string, formatType: EFormatTypes, formatTemplate: TNullable<string>) => string;
251
+ getFormattedValue: (value: string, formatType: EFormatTypes, formatting: EFormattingPresets, formatTemplate: TNullable<string>) => string;
248
252
  }
249
253
 
250
254
  declare enum ELastTimeUnit {
@@ -258,8 +262,8 @@ declare enum EDurationUnit {
258
262
  MINUTES = "MINUTES",
259
263
  SECONDS = "SECONDS"
260
264
  }
261
- declare const mapFormulaFilterToCalculatorInput: (filterValue: IFormulaFilterValue | string) => TNullable<ICalculatorFilter>;
262
- declare const mapFormulaFiltersToInputs: (filters: (string | IFormulaFilterValue)[]) => ICalculatorFilter[];
265
+ declare const mapFormulaFilterToCalculatorInput: (filterValue: TExtendedFormulaFilterValue) => TNullable<ICalculatorFilter>;
266
+ declare const mapFormulaFiltersToInputs: (filters: TExtendedFormulaFilterValue[]) => ICalculatorFilter[];
263
267
 
264
268
  type TSelectivePartial<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
265
269
  declare const formulaFilterMethods: {
@@ -291,18 +295,6 @@ declare enum EProcessFilterNames {
291
295
  /** Длительность перехода */
292
296
  durationOfTransition = "durationOfTransition"
293
297
  }
294
- /** @deprecated необходимо использовать @see {@link IFormulaFilterValue} */
295
- interface IWidgetFormulaFilterValue extends ICalculatorFilter {
296
- /**
297
- * Название фильтра
298
- * @deprecated необходимо использовать @see {@link IWidgetFormulaFilterValue.name}
299
- */
300
- caption?: TNullable<string>;
301
- /** Название фильтра */
302
- name: TNullable<string>;
303
- /** Формат */
304
- format?: EFormatTypes;
305
- }
306
298
  interface IProcessFilterValue {
307
299
  /**
308
300
  * События, доступные при выборе процесса.
@@ -320,17 +312,26 @@ interface IProcessTransitionFilterValue extends IProcessFilterValue {
320
312
  endEventProcessName: string;
321
313
  endEventName: string;
322
314
  }
315
+ interface IClickPosition {
316
+ x: number;
317
+ y: number;
318
+ elementWidth: number;
319
+ elementHeight: number;
320
+ }
321
+ interface IPositionConfig extends IClickPosition {
322
+ type: string;
323
+ }
323
324
  interface IAddPresenceOfEventFilter {
324
- (name: EProcessFilterNames.presenceOfEvent, value: IProcessEventFilterValue): void;
325
+ (name: EProcessFilterNames.presenceOfEvent, value: IProcessEventFilterValue, positionConfig?: IPositionConfig): void;
325
326
  }
326
327
  interface IAddRepetitionOfEventFilter {
327
- (name: EProcessFilterNames.repetitionOfEvent, value: IProcessEventFilterValue): void;
328
+ (name: EProcessFilterNames.repetitionOfEvent, value: IProcessEventFilterValue, positionConfig?: IPositionConfig): void;
328
329
  }
329
330
  interface IAddPresenceOfTransitionFilter {
330
- (name: EProcessFilterNames.presenceOfTransition, value: IProcessTransitionFilterValue): void;
331
+ (name: EProcessFilterNames.presenceOfTransition, value: IProcessTransitionFilterValue, positionConfig?: IPositionConfig): void;
331
332
  }
332
333
  interface IAddDurationOfTransitionFilter {
333
- (name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue): void;
334
+ (name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue, positionConfig?: IPositionConfig): void;
334
335
  }
335
336
  declare enum EFormulaFilterFieldKeys {
336
337
  date = "date",
@@ -369,7 +370,11 @@ interface IFormulaFilterValue {
369
370
  [EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
370
371
  }>;
371
372
  }
373
+ type TExtendedFormulaFilterValue = {
374
+ formula: string;
375
+ } | IFormulaFilterValue;
372
376
  interface IStagesFilterItem {
377
+ id: number;
373
378
  /** Название этапа */
374
379
  name: string;
375
380
  /** Формула фильтра этапа */
@@ -386,6 +391,7 @@ interface IStagesFilterValue {
386
391
  }
387
392
  type TWidgetFilterValue = IFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
388
393
  interface IWidgetFilter {
394
+ isReadonly: boolean;
389
395
  filterValue: TWidgetFilterValue;
390
396
  preparedFilterValue: ICalculatorFilter;
391
397
  }
@@ -394,7 +400,7 @@ interface IWidgetFiltration {
394
400
  preparedFilterValues: ICalculatorFilter[];
395
401
  filters: IWidgetFilter[];
396
402
  /** Добавить фильтр по формуле */
397
- addFormulaFilter(value: IWidgetFormulaFilterValue | TSelectivePartial<IFormulaFilterValue, "format" | "formValues">): void;
403
+ addFormulaFilter(value: TSelectivePartial<IFormulaFilterValue, "format" | "formValues">): void;
398
404
  /** Удалить фильтр по формуле */
399
405
  removeFormulaFilter(formula: string): void;
400
406
  addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
@@ -403,6 +409,7 @@ interface IWidgetFiltration {
403
409
  /** Удалить фильтр по этапам */
404
410
  removeStagesFilter(widgetKey: string): void;
405
411
  }
412
+ declare const isFormulaFilterValue: (value: TExtendedFormulaFilterValue) => value is IFormulaFilterValue;
406
413
 
407
414
  declare enum EWidgetFilterMode {
408
415
  DEFAULT = "DEFAULT",
@@ -417,27 +424,10 @@ type TWidgetFiltering = {
417
424
  ignore: false;
418
425
  mode: EWidgetFilterMode;
419
426
  };
420
- declare enum EColorMode {
421
- FORMULA = "FORMULA",
422
- BASE = "BASE",
423
- GRADIENT = "GRADIENT",
424
- AUTO = "AUTO"
427
+ declare enum EMarkdownDisplayMode {
428
+ NONE = "NONE",
429
+ INDICATOR = "INDICATOR"
425
430
  }
426
- /** Настройка цвета */
427
- type TColor = {
428
- mode: EColorMode.FORMULA;
429
- formula: string;
430
- } | {
431
- mode: EColorMode.BASE;
432
- value?: string;
433
- defaultColor?: string;
434
- } | {
435
- mode: EColorMode.GRADIENT;
436
- startValue: string;
437
- endValue: string;
438
- } | {
439
- mode: EColorMode.AUTO;
440
- };
441
431
  declare enum EDisplayConditionMode {
442
432
  DISABLED = "DISABLED",
443
433
  FORMULA = "FORMULA",
@@ -459,6 +449,301 @@ interface IRange {
459
449
  min?: number;
460
450
  max?: number;
461
451
  }
452
+ declare enum EFontWeight {
453
+ NORMAL = "NORMAL",
454
+ BOLD = "BOLD"
455
+ }
456
+ interface IAppearanceSettings {
457
+ enabled?: boolean;
458
+ horizontalPaddings?: string;
459
+ verticalPaddings?: string;
460
+ cornerRadius?: string;
461
+ }
462
+
463
+ interface IWidgetTableColumn {
464
+ /** Имя колонки */
465
+ name: string;
466
+ /** Тип данных колонки */
467
+ dataType: ESimpleDataType;
468
+ }
469
+ interface IScripField {
470
+ guid: string;
471
+ name: string;
472
+ dataType: ESimpleDataType;
473
+ }
474
+ interface IActionScript {
475
+ key: string;
476
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
477
+ guid: string;
478
+ name: string;
479
+ fields: IScripField[];
480
+ }
481
+ interface IWidgetTable {
482
+ /** Имя таблицы */
483
+ name: string;
484
+ /** Колонки таблицы */
485
+ columns: Map<string, IWidgetTableColumn>;
486
+ }
487
+ /**
488
+ * simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
489
+ *
490
+ * full - полный
491
+ */
492
+ type TFiltrationMode = "simplified" | "full";
493
+ /**
494
+ * preview - упрощенный
495
+ *
496
+ * full - полный
497
+ */
498
+ type TDisplayMode = "preview" | "full";
499
+ interface IDisplayRule {
500
+ color: TColor;
501
+ }
502
+ interface IGlobalContext {
503
+ /** используемый язык в системе */
504
+ language: ELanguages;
505
+ processes: Map<string, IWidgetProcess>;
506
+ reportMeasures: TNullable<Map<string, ICommonMeasures>>;
507
+ workspaceMeasures: TNullable<Map<string, Map<string, ICommonMeasures>>>;
508
+ reportDimensions: TNullable<Map<string, ICommonDimensions>>;
509
+ workspaceDimensions: TNullable<Map<string, Map<string, ICommonDimensions>>>;
510
+ /** @deprecated удалить после окончания поддержки миграций BI-13650 */
511
+ workspaceGroupNameById: Map<number, string>;
512
+ /** Переменные отчета */
513
+ variables: Map<string, TWidgetVariable>;
514
+ /** Метод установки значения переменной отчета */
515
+ setVariableValue(name: string, value: TNullable<string> | string[]): void;
516
+ states: Map<string, ICommonState>;
517
+ reportName: string;
518
+ /** Режим отображения виджета */
519
+ displayMode: TDisplayMode;
520
+ scripts: Map<string, IActionScript>;
521
+ tables: Set<string>;
522
+ filtrationMode: TFiltrationMode;
523
+ reportDisplayRules: Map<string, IDisplayRule>;
524
+ workspaceDisplayRules: Map<string, Map<string, IDisplayRule>>;
525
+ viewNameByKey: Map<string, string>;
526
+ fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
527
+ }
528
+
529
+ declare enum EColorMode {
530
+ /** Окрашивание отключено */
531
+ DISABLED = "DISABLED",
532
+ /** Цвет каждого значения вычисляется по формуле */
533
+ FORMULA = "FORMULA",
534
+ /** Один цвет для всех значений */
535
+ BASE = "BASE",
536
+ /** Окрашивание каждого значения по градиенту относительно минимального и максимального значений */
537
+ GRADIENT = "GRADIENT",
538
+ /** Использовать автоматический цвет: по умолчанию определяется порядковым номером показателя */
539
+ AUTO = "AUTO",
540
+ /** Использовать цвет из правила отображения (в правиле отображения рекурсивно определен цвет) */
541
+ RULE = "RULE",
542
+ /** Задать цвет конкретным значениям разреза */
543
+ VALUES = "VALUES",
544
+ /** Задать цвет конкретным значениям общего разреза. Режим используется только для настроек правила отображения */
545
+ BY_DIMENSION = "BY_DIMENSION"
546
+ }
547
+ type TColorBase = {
548
+ mode: EColorMode.BASE;
549
+ value?: string;
550
+ };
551
+ type TColorRule = {
552
+ mode: EColorMode.RULE;
553
+ formula: string;
554
+ };
555
+ interface IColoredValue {
556
+ value: string;
557
+ color: TColorBase | TColorRule;
558
+ }
559
+ /** Настройка цвета */
560
+ type TColor = {
561
+ mode: EColorMode.FORMULA;
562
+ formula: string;
563
+ } | TColorBase | {
564
+ mode: EColorMode.GRADIENT;
565
+ startValue: string;
566
+ endValue: string;
567
+ classCount?: TNullable<number>;
568
+ } | {
569
+ mode: EColorMode.AUTO;
570
+ } | TColorRule | {
571
+ mode: EColorMode.VALUES;
572
+ items: IColoredValue[];
573
+ } | {
574
+ mode: EColorMode.BY_DIMENSION;
575
+ /** Имя разреза из области видимости правила отображения */
576
+ dimensionName: string;
577
+ items: IColoredValue[];
578
+ } | {
579
+ mode: EColorMode.DISABLED;
580
+ };
581
+ declare const getRuleColor: (ruleFormula: string, globalContext: Pick<IGlobalContext, "reportDisplayRules" | "workspaceDisplayRules">) => TColor | undefined;
582
+ declare const isValidColor: (color: TColor, globalContext: Pick<IGlobalContext, "reportDisplayRules" | "workspaceDisplayRules">) => boolean;
583
+
584
+ interface IAutoIdentifiedArrayItem {
585
+ /**
586
+ * Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
587
+ * Гарантируется уникальность id в пределах settings виджета.
588
+ */
589
+ id: number;
590
+ }
591
+ interface IBaseWidgetSettings {
592
+ title?: string;
593
+ titleSize?: number;
594
+ titleColor?: TColor;
595
+ titleWeight?: EFontWeight;
596
+ stateName?: string | null;
597
+ showMarkdown?: boolean;
598
+ markdownMeasures?: IMarkdownMeasure[];
599
+ markdownText?: string;
600
+ filters?: TExtendedFormulaFilterValue[];
601
+ filterMode?: EWidgetFilterMode;
602
+ ignoreFilters?: boolean;
603
+ sorting?: IWidgetSortingIndicator[];
604
+ actions?: IWidgetAction[];
605
+ displayCondition?: TDisplayCondition;
606
+ displayConditionComment?: string;
607
+ appearance?: IAppearanceSettings;
608
+ }
609
+
610
+ declare enum EWidgetActionInputMethod {
611
+ COLUMN = "COLUMN",
612
+ VARIABLE = "VARIABLE",
613
+ STATIC_LIST = "STATIC_LIST",
614
+ DYNAMIC_LIST = "DYNAMIC_LIST",
615
+ FORMULA = "FORMULA",
616
+ MANUALLY = "MANUALLY",
617
+ EVENT = "EVENT",
618
+ START_EVENT = "START_EVENT",
619
+ FINISH_EVENT = "FINISH_EVENT"
620
+ }
621
+ declare enum EActionTypes {
622
+ OPEN_URL = "OPEN_URL",
623
+ UPDATE_VARIABLE = "UPDATE_VARIABLE",
624
+ EXECUTE_SCRIPT = "EXECUTE_SCRIPT",
625
+ OPEN_VIEW = "OPEN_VIEW"
626
+ }
627
+ declare enum EViewMode {
628
+ EXISTED_VIEW = "EXISTED_VIEW",
629
+ GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT",
630
+ EMPTY = "EMPTY"
631
+ }
632
+ declare enum EViewOpenIn {
633
+ NEW_WINDOW = "NEW_WINDOW",
634
+ CURRENT_WINDOW = "CURRENT_WINDOW",
635
+ PLACEHOLDER = "PLACEHOLDER",
636
+ MODAL_WINDOW = "MODAL_WINDOW",
637
+ DRAWER_WINDOW = "DRAWER_WINDOW"
638
+ }
639
+ declare enum EDrawerPlacement {
640
+ LEFT = "LEFT",
641
+ RIGHT = "RIGHT"
642
+ }
643
+ interface IParameterFromColumn {
644
+ inputMethod: EWidgetActionInputMethod.COLUMN;
645
+ tableName: string;
646
+ columnName: string;
647
+ }
648
+ interface IParameterFromVariable {
649
+ inputMethod: EWidgetActionInputMethod.VARIABLE;
650
+ sourceVariable: string;
651
+ }
652
+ interface IParameterFromFormula {
653
+ inputMethod: EWidgetActionInputMethod.FORMULA;
654
+ formula: string;
655
+ }
656
+ interface IParameterFromEvent {
657
+ inputMethod: EWidgetActionInputMethod.EVENT;
658
+ }
659
+ interface IParameterFromStartEvent {
660
+ inputMethod: EWidgetActionInputMethod.START_EVENT;
661
+ }
662
+ interface IParameterFromEndEvent {
663
+ inputMethod: EWidgetActionInputMethod.FINISH_EVENT;
664
+ }
665
+ interface IParameterFromManualInput {
666
+ inputMethod: EWidgetActionInputMethod.MANUALLY;
667
+ description: string;
668
+ }
669
+ interface IParameterFromStaticList {
670
+ inputMethod: EWidgetActionInputMethod.STATIC_LIST;
671
+ options: string[];
672
+ defaultOptionIndex: number;
673
+ }
674
+ interface IParameterFromDynamicList {
675
+ inputMethod: EWidgetActionInputMethod.DYNAMIC_LIST;
676
+ formula: string;
677
+ defaultValue: string;
678
+ filters: TExtendedFormulaFilterValue[];
679
+ }
680
+ interface IWidgetActionParameterCommon {
681
+ name: string;
682
+ displayName: string;
683
+ isHidden: boolean;
684
+ }
685
+ type TWidgetActionParameter = IWidgetActionParameterCommon & (IParameterFromColumn | IParameterFromVariable | IParameterFromFormula | IParameterFromManualInput | IParameterFromStaticList | IParameterFromDynamicList);
686
+ interface IActionOnClickParameterCommon extends IAutoIdentifiedArrayItem {
687
+ name: string;
688
+ }
689
+ type TActionOnClickParameter = IActionOnClickParameterCommon & (IParameterFromColumn | IParameterFromVariable | IParameterFromFormula | IParameterFromEvent | IParameterFromStartEvent | IParameterFromEndEvent);
690
+ interface IActionCommon extends IAutoIdentifiedArrayItem {
691
+ name: string;
692
+ }
693
+ interface IActionGoToUrl extends IActionCommon {
694
+ type: EActionTypes.OPEN_URL;
695
+ url: string;
696
+ newWindow: boolean;
697
+ }
698
+ interface IActionRunScript extends IActionCommon {
699
+ type: EActionTypes.EXECUTE_SCRIPT;
700
+ parameters: TActionOnClickParameter[];
701
+ scriptKey: string;
702
+ updateDashboard: boolean;
703
+ }
704
+ interface IActionUpdateVariable extends IActionCommon {
705
+ type: EActionTypes.UPDATE_VARIABLE;
706
+ variables: TActionOnClickParameter[];
707
+ }
708
+ type TActionOpenViewMode = {
709
+ mode: EViewMode.GENERATED_BY_SCRIPT;
710
+ scriptKey: string;
711
+ parameters: TActionOnClickParameter[];
712
+ displayName: string;
713
+ } | {
714
+ mode: EViewMode.EXISTED_VIEW;
715
+ viewKey: string;
716
+ parameters: TActionOnClickParameter[];
717
+ };
718
+ type TActionOpenIn = {
719
+ openIn: EViewOpenIn.DRAWER_WINDOW;
720
+ alignment: EDrawerPlacement;
721
+ } | {
722
+ openIn: EViewOpenIn.PLACEHOLDER;
723
+ placeholderName: string;
724
+ } | {
725
+ openIn: EViewOpenIn.NEW_WINDOW;
726
+ } | {
727
+ openIn: EViewOpenIn.MODAL_WINDOW;
728
+ } | {
729
+ openIn: EViewOpenIn.CURRENT_WINDOW;
730
+ };
731
+ type TActionOpenView = {
732
+ type: EActionTypes.OPEN_VIEW;
733
+ } & TActionOpenViewMode & TActionOpenIn & IActionCommon;
734
+ type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
735
+ interface IWidgetAction extends IActionCommon {
736
+ filters: TExtendedFormulaFilterValue[];
737
+ parameters: TWidgetActionParameter[];
738
+ type: EActionTypes.EXECUTE_SCRIPT;
739
+ scriptKey: string;
740
+ updateDashboard: boolean;
741
+ description: string;
742
+ }
743
+ type TAction = TActionsOnClick | IWidgetAction;
744
+ declare const isExecuteScriptActionValid: (action: Extract<TAction, {
745
+ type: EActionTypes.EXECUTE_SCRIPT;
746
+ }>, { scripts, tables, variables }: Pick<IGlobalContext, "scripts" | "tables" | "variables">) => boolean;
462
747
 
463
748
  declare enum ESortDirection {
464
749
  descend = "DESC",
@@ -470,23 +755,15 @@ type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
470
755
  interface ISortOrder {
471
756
  formula: string;
472
757
  direction: TSortDirection;
758
+ displayCondition?: TNullable<string>;
473
759
  }
474
- type TWidgetSortingValueRelatedWidgetMeasure = {
475
- mode: ESortingValueModes.MEASURE_IN_WIDGET;
476
- index: number;
477
- };
478
- type TWidgetSortingValueRelatedWidgetDimension = {
479
- mode: ESortingValueModes.DIMENSION_IN_WIDGET | ESortingValueModes.HIERARCHY;
480
- index: number;
481
- };
482
- type TWidgetSortingValueRelatedWidgetIndicator = TWidgetSortingValueRelatedWidgetMeasure | TWidgetSortingValueRelatedWidgetDimension;
483
760
  type TWidgetSortingValue = {
484
- mode: ESortingValueModes.FORMULA | ESortingValueModes.QUANTITY;
485
- formula: string;
486
- } | TWidgetSortingValueRelatedWidgetIndicator | {
487
- mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
488
- name: string;
761
+ mode: ESortingValueModes.FORMULA;
489
762
  formula: string;
763
+ } | {
764
+ mode: ESortingValueModes.IN_WIDGET;
765
+ group: string;
766
+ index: number;
490
767
  };
491
768
 
492
769
  declare enum EWidgetIndicatorType {
@@ -494,19 +771,13 @@ declare enum EWidgetIndicatorType {
494
771
  EVENT_INDICATOR = "EVENT_INDICATOR",
495
772
  TRANSITION_INDICATOR = "TRANSITION_INDICATOR",
496
773
  DIMENSION = "DIMENSION",
497
- DIMENSION_HIERARCHY = "DIMENSION_HIERARCHY",
498
- VARIABLE = "VARIABLE",
499
- SORTING = "SORTING",
500
- CUSTOM = "CUSTOM"
774
+ SORTING = "SORTING"
501
775
  }
502
776
  declare enum EDbType {
503
777
  CH = "CH",
504
778
  HADOOP = "HADOOP"
505
779
  }
506
- interface IWidgetIndicator {
507
- /** Идентификатор, генерируемый на основе текущего времени */
508
- id: number;
509
- type: EWidgetIndicatorType;
780
+ interface IWidgetIndicator extends IAutoIdentifiedArrayItem {
510
781
  name: string;
511
782
  }
512
783
  type TProcessIndicatorValue = {
@@ -533,10 +804,8 @@ interface IProcessIndicator extends IWidgetIndicator {
533
804
  displayCondition?: TDisplayCondition;
534
805
  }
535
806
  interface IProcessEventIndicator extends IProcessIndicator {
536
- type: EWidgetIndicatorType.EVENT_INDICATOR;
537
807
  }
538
808
  interface IProcessTransitionIndicator extends IProcessIndicator {
539
- type: EWidgetIndicatorType.TRANSITION_INDICATOR;
540
809
  }
541
810
  /** Индикатор для сортировки */
542
811
  interface IWidgetSortingIndicator extends IWidgetIndicator {
@@ -554,20 +823,21 @@ declare enum EWidgetIndicatorValueModes {
554
823
  declare enum ESortingValueModes {
555
824
  /** Сортировка по формуле */
556
825
  FORMULA = "FORMULA",
557
- /** Пункт "Количество" */
558
- QUANTITY = "QUANTITY",
559
- /** @deprecated Для сортировки по иерархии используется режим DIMENSION_IN_WIDGET */
560
- HIERARCHY = "HIERARCHY",
561
- /** Сортировка по мере виджета */
562
- MEASURE_IN_WIDGET = "MEASURE_IN_WIDGET",
563
- /** Сортировка по разрезу(в т.ч. по иерархии) виджета */
564
- DIMENSION_IN_WIDGET = "DIMENSION_IN_WIDGET",
565
- /** Сортировка по мере отчета */
566
- IN_DASHBOARD = "IN_DASHBOARD",
567
- /** Сортировка по мере пространства */
568
- IN_WORKSPACE = "IN_WORKSPACE"
569
- }
570
- interface ICommonColumnIndicator {
826
+ /** Сортировка по показателю(разрезу или мере) виджета */
827
+ IN_WIDGET = "IN_WIDGET"
828
+ }
829
+ interface ICommonState {
830
+ name: string;
831
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
832
+ guid: string;
833
+ }
834
+ interface ICommonMeasures {
835
+ name: string;
836
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
837
+ guid: string;
838
+ formula: string;
839
+ }
840
+ interface ICommonDimensions {
571
841
  name: string;
572
842
  formula: string;
573
843
  }
@@ -597,21 +867,21 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
597
867
  formatting?: EFormattingPresets;
598
868
  formattingTemplate?: string;
599
869
  displayCondition?: TDisplayCondition;
870
+ onClick?: TActionsOnClick[];
600
871
  }
601
- interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
602
- /** Идентификатор, генерируемый на основе текущего времени */
603
- id: number;
604
- type: EWidgetIndicatorType.DIMENSION_HIERARCHY;
872
+ interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> extends IAutoIdentifiedArrayItem {
605
873
  name: string;
606
- dimensions: D[];
874
+ hierarchyDimensions: D[];
607
875
  displayCondition?: TDisplayCondition;
608
876
  }
609
877
  interface IWidgetDimension extends IWidgetColumnIndicator {
610
- type: EWidgetIndicatorType.DIMENSION;
611
878
  hideEmptyValues: boolean;
612
879
  }
613
880
  interface IWidgetMeasure extends IWidgetColumnIndicator {
614
- type: EWidgetIndicatorType.MEASURE;
881
+ }
882
+ interface IMarkdownMeasure extends IWidgetMeasure {
883
+ format: EFormatTypes;
884
+ displaySign: EMarkdownDisplayMode;
615
885
  }
616
886
  /** Тип показателя */
617
887
  declare enum EIndicatorType {
@@ -643,6 +913,8 @@ type TWidgetVariable = {
643
913
  defaultValue: string;
644
914
  /** Тип данных */
645
915
  dataType: ESimpleDataType;
916
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
917
+ guid: string;
646
918
  } | {
647
919
  /** Тип переменной */
648
920
  type: EIndicatorType.STATIC_LIST;
@@ -658,6 +930,8 @@ type TWidgetVariable = {
658
930
  dataType: ESimpleDataType.STRING;
659
931
  /** Множественный выбор */
660
932
  multipleChoice: boolean;
933
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
934
+ guid: string;
661
935
  } | {
662
936
  /** Тип переменной */
663
937
  type: EIndicatorType.DYNAMIC_LIST;
@@ -674,285 +948,49 @@ type TWidgetVariable = {
674
948
  /** Множественный выбор */
675
949
  multipleChoice: boolean;
676
950
  /** Фильтры */
677
- filters: (string | IFormulaFilterValue)[];
951
+ filters: TExtendedFormulaFilterValue[];
952
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
953
+ guid: string;
678
954
  };
679
- declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
955
+ declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
680
956
 
681
- interface IWidgetTableColumn {
682
- /** Имя колонки */
683
- name: string;
684
- /** Тип данных колонки */
685
- dataType: ESimpleDataType;
686
- }
687
- interface IActionScript {
688
- name: string | undefined;
689
- fieldsNames: Set<string>;
957
+ /** Формат входного параметра GeneralCalculator */
958
+ interface IBaseDimensionsAndMeasuresCalculatorInput {
959
+ /** Разрезы */
960
+ dimensions: ICalculatorDimensionInput[];
961
+ /** Меры */
962
+ measures: ICalculatorMeasureInput[];
963
+ /** Фильтры, использующие WHERE */
964
+ filters: ICalculatorFilter[];
965
+ /** Фильтры, использующие HAVING */
966
+ postFilters?: ICalculatorFilter[];
967
+ /** Лимит мер (будут вычислены первые measuresLimit мер, попавшие под условие отображения) */
968
+ measuresLimit?: number;
969
+ /** Лимит разрезов (будут вычислены первые dimensionsLimit разрезов, попавшие под условие отображения) */
970
+ dimensionsLimit?: number;
971
+ /** Удалять ли строки, в которых значения всех мер пустые */
972
+ isHideEmptyMeasures?: boolean;
973
+ /** Сортировка */
974
+ sortOrders?: ISortOrder[];
975
+ /** Формула условия отображения */
976
+ displayConditionFormula?: TNullable<string>;
690
977
  }
691
- interface IWidgetTable {
692
- /** Имя таблицы */
693
- name: string;
694
- /** Колонки таблицы */
695
- columns: Map<string, IWidgetTableColumn>;
978
+ interface IBaseDimensionsAndMeasuresCalculatorOutput {
979
+ dimensions: Map<string, ICalculatorDimensionOutput>;
980
+ measures: Map<string, ICalculatorMeasureOutput>;
981
+ isDisplay: boolean;
982
+ isValuesEmpty: boolean;
696
983
  }
697
- /**
698
- * preview - упрощенный
699
- *
700
- * full - полный
701
- */
702
- type TDisplayMode = "preview" | "full";
703
- interface IWidgetsContext {
704
- /** используемый язык в системе */
705
- language: ELanguages;
706
- processes: Map<string, IWidgetProcess>;
707
- reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
708
- workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
709
- /** Переменные отчета */
710
- variables: Map<string, TWidgetVariable>;
711
- /** Метод установки значения переменной отчета */
712
- setVariableValue(name: string, value: TNullable<string> | string[]): void;
713
- statesNames: Set<string>;
714
- reportName: string;
715
- /**
716
- * режим дашборда
717
- * @deprecated 2401 - необходимо использовать displayMode */
718
- isViewMode: boolean;
719
- /** Режим отображения виджета */
720
- displayMode: TDisplayMode;
721
- /** @deprecated необходимо получать из системной переменной "Login" */
722
- userLogin: string;
723
- scripts: Map<string, IActionScript>;
724
- tables: Set<string>;
984
+ interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
725
985
  }
726
986
 
727
- declare enum EWidgetActionInputMode {
728
- FROM_COLUMN = "FROM_COLUMN",
729
- FROM_VARIABLE = "FROM_VARIABLE",
730
- STATIC_LIST = "STATIC_LIST",
731
- DYNAMIC_LIST = "DYNAMIC_LIST",
732
- FORMULA = "FORMULA",
733
- MANUALLY = "MANUALLY"
734
- }
735
- type TWidgetActionInputValue = {
736
- mode: EWidgetActionInputMode.FROM_COLUMN;
737
- tableName: string;
738
- columnName: string;
739
- } | {
740
- mode: EWidgetActionInputMode.FROM_VARIABLE;
741
- name: string;
742
- } | {
743
- mode: EWidgetActionInputMode.FORMULA;
744
- formula: string;
745
- } | {
746
- mode: EWidgetActionInputMode.MANUALLY;
747
- description: string;
748
- } | {
749
- mode: EWidgetActionInputMode.STATIC_LIST;
750
- options: string[];
751
- defaultOptionIndex: number;
752
- } | {
753
- mode: EWidgetActionInputMode.DYNAMIC_LIST;
754
- formula: string;
755
- defaultValue: string;
756
- };
757
- interface IWidgetActionInput {
758
- name: string;
759
- value: TWidgetActionInputValue;
760
- }
761
- interface IWidgetAction {
762
- id: number;
763
- name: string;
764
- description: string;
765
- filters: (IFormulaFilterValue | string)[];
766
- /** Поле name необходимо, чтобы показать название скрипта, который был удален */
767
- scriptName?: string;
768
- inputs: IWidgetActionInput[];
769
- shouldRefreshWidgetsAfterExecution: boolean;
770
- }
771
- declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
772
-
773
- interface IBaseWidgetSettings {
774
- apiVersion: string;
775
- type: string;
776
- header?: string;
777
- headerSize?: number;
778
- stateName?: string | null;
779
- filters?: (IFormulaFilterValue | string)[];
780
- filterMode?: EWidgetFilterMode;
781
- ignoreFilters?: boolean;
782
- sorting?: IWidgetSortingIndicator[];
783
- actions?: IWidgetAction[];
784
- displayCondition?: TDisplayCondition;
785
- displayConditionComment?: string;
786
- }
787
-
788
- interface ILens<T extends TNullable<object>, Value> {
789
- get(obj: T): TNullable<Value>;
790
- set(obj: T, value: Value): void;
791
- }
792
- type TValuePath = string | string[];
793
- type TRecordAccessor<Settings extends object, Value> = TValuePath | ILens<Settings, Value>;
794
- interface IDisplayPredicate<Settings> {
795
- (s: Settings): boolean;
796
- }
797
- /** Конфигурация разделителя */
798
- interface IDividerRecord<Settings extends object = object> {
799
- type: "divider";
800
- shouldDisplay?: IDisplayPredicate<Settings>;
801
- }
802
- /** Конфигурация набора групп */
803
- interface IGroupSetRecord {
804
- type: "groupSet";
805
- groupSetKey: string;
806
- }
807
- type TEmptyRecord = boolean | null | undefined;
808
- /** Набор конфигураций, которые могут встречаться на уровне виджета */
809
- type TWidgetLevelRecord<Settings extends object> = IControlRecord<Settings, any, EControlType> | IDividerRecord<Settings> | IGroupSetRecord | TEmptyRecord;
810
- /** Набор конфигураций, которые могут встречаться на уровне группы */
811
- type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<LevelGroupSettings, any, EControlType> | IDividerRecord<LevelGroupSettings> | TEmptyRecord;
812
- interface ISelectOption {
813
- value: string;
814
- label: string;
815
- }
816
- interface ICustomAddButtonProps {
817
- options?: ISelectOption[];
818
- fetchOptions?: () => Promise<ISelectOption[]>;
819
- onSelect: (value: string, update: <T extends object>(f: (prevItems: T[]) => T[]) => void) => void;
820
- }
821
- /** Кнопка добавления группы в набор */
822
- type TAddButton = {
823
- title: string;
824
- indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM>;
825
- } | {
826
- title: string;
827
- indicatorType: EWidgetIndicatorType.CUSTOM;
828
- props: ICustomAddButtonProps;
829
- };
830
- interface IAutoIdentifiedArrayItem {
831
- /**
832
- * Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
833
- * Гарантируется уникальность id в пределах settings виджета.
834
- */
835
- id: number;
836
- }
837
- interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
838
- }
839
- /** Конфигурация набора групп */
840
- interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
841
- /** Заголовок */
842
- title: string;
843
- /** Максимальное количество групп в наборе */
844
- maxCount: number;
845
- /** Описание доступа к настройкам групп */
846
- accessor: TRecordAccessor<Settings, GroupSettings[]>;
847
- /** Кнопки добавления группы в набор */
848
- addButtons: TAddButton[];
849
- /** Создать элементы управления внутри группы (для вкладки настроек данных) */
850
- createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
851
- /** Создать элементы управления внутри группы (для вкладки настроек отображения) */
852
- createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
853
- /** Получить название для плашки */
854
- getGroupTitle?(group: IGroupSettings): string;
855
- /** Валидная ли группа */
856
- isValid?(group: IGroupSettings): boolean;
857
- /** Находится ли группа в состоянии загрузки */
858
- isLoading?(group: IGroupSettings): boolean;
859
- }
860
- /** Конфигурация левой панели */
861
- interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
862
- /** Конфигурация настроек данных виджета */
863
- dataRecords?: TWidgetLevelRecord<Settings>[];
864
- /** Конфигурация настроек отображения виджета */
865
- displayRecords?: TWidgetLevelRecord<Settings>[];
866
- /** Конфигурации наборов групп */
867
- groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
868
- }
869
- interface IWidgetProcess {
870
- guid: string;
871
- /** Имя процесса */
872
- name: string;
873
- /** Формула имени события */
874
- eventNameFormula: string;
875
- /** Формула времени события */
876
- eventTimeFormula: string;
877
- /** Формула CaseId события */
878
- eventCaseIdFormula: string;
879
- /** Формула CaseId кейса */
880
- caseCaseIdFormula: string;
881
- /** Имя колонки CaseId события */
882
- eventCaseIdColumnName: string;
883
- /** Тип данных CaseId */
884
- caseIdDataType: ESimpleDataType;
885
- /** Тип данных времени события */
886
- eventTimeDataType: ESimpleDataType;
887
- /** Является ли процесс валидным */
888
- isValid: boolean;
889
- }
890
- /** Конфигурация левой панели при погружении на уровень вниз */
891
- interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
892
- }
893
- interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
894
- (context: IWidgetsContext, panelSettings: Settings): IPanelDescription<Settings, GroupSettings>;
895
- }
896
-
897
- interface IWidgetPlaceholderController {
898
- setError(value: Error | null): void;
899
- setConfigured(value: boolean): void;
900
- setDisplay(value: boolean): void;
901
- setEmpty(value: boolean): void;
902
- }
903
-
904
- /** Вид переменной для калькулятора */
905
- interface ICalculatorVariable {
906
- dataType: ESimpleDataType;
907
- value: string | string[];
908
- }
909
- /** Коллекция значений переменных по их имени */
910
- interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
911
- }
912
-
913
- /** Формат входного параметра GeneralCalculator */
914
- interface IBaseDimensionsAndMeasuresCalculatorInput {
915
- /** Разрезы */
916
- dimensions: ICalculatorDimensionInput[];
917
- /** Меры */
918
- measures: ICalculatorMeasureInput[];
919
- /** Значения переменных */
920
- variablesValues?: ICalculatorVariablesValues;
921
- /** Фильтры, использующие WHERE */
922
- filters: ICalculatorFilter[];
923
- /** Фильтры, использующие HAVING */
924
- postFilters?: ICalculatorFilter[];
925
- /** Лимит мер (будут вычислены первые measuresLimit мер, попавшие под условие отображения) */
926
- measuresLimit?: number;
927
- /** Лимит разрезов (будут вычислены первые dimensionsLimit разрезов, попавшие под условие отображения) */
928
- dimensionsLimit?: number;
929
- /** Удалять ли строки, в которых значения всех мер пустые */
930
- isHideEmptyMeasures?: boolean;
931
- /**
932
- * Направления сортировки (в качестве ключа - формула показателя)
933
- * todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
934
- * правильнее будет указывать его явно через массив.
935
- */
936
- sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
937
- /** Формула условия отображения */
938
- displayConditionFormula?: TNullable<string>;
939
- }
940
- interface IBaseDimensionsAndMeasuresCalculatorOutput {
941
- dimensions: Map<string, ICalculatorDimensionOutput>;
942
- measures: Map<string, ICalculatorMeasureOutput>;
943
- isDisplay: boolean;
944
- isValuesEmpty: boolean;
945
- }
946
- interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
947
- }
948
-
949
- interface IGeneralCalculatorInput extends IBaseDimensionsAndMeasuresCalculatorInput {
950
- /** Лимит строк */
951
- limit?: number;
952
- /** Смещение при выборе строк */
953
- offset?: number;
954
- /** Вычислять ли итоговые значения */
955
- isCalculateTotals?: boolean;
987
+ interface IGeneralCalculatorInput extends IBaseDimensionsAndMeasuresCalculatorInput {
988
+ /** Лимит строк */
989
+ limit?: number;
990
+ /** Смещение при выборе строк */
991
+ offset?: number;
992
+ /** Вычислять ли итоговые значения */
993
+ isCalculateTotals?: boolean;
956
994
  }
957
995
  interface IGeneralCalculatorExportInput extends IGeneralCalculatorInput {
958
996
  fileName: string;
@@ -971,8 +1009,6 @@ interface IHistogramCalculatorInput {
971
1009
  dimensions: ICalculatorDimensionInput[];
972
1010
  /** Лимит корзин */
973
1011
  binsLimit: number;
974
- /** Значения переменных */
975
- variablesValues?: ICalculatorVariablesValues;
976
1012
  /** Формула условия отображения */
977
1013
  displayConditionFormula?: TNullable<string>;
978
1014
  /** Фильтры, использующие WHERE */
@@ -1025,8 +1061,6 @@ interface IProcessGraphCalculatorInput {
1025
1061
  filters: ICalculatorFilter[];
1026
1062
  eventFilters?: ICalculatorFilter[];
1027
1063
  displayConditionFormula?: TNullable<string>;
1028
- /** Значения переменных */
1029
- variablesValues?: ICalculatorVariablesValues;
1030
1064
  }
1031
1065
  interface IProcessGraphCalculatorOutput {
1032
1066
  vertexMaxLimit: number;
@@ -1051,8 +1085,6 @@ interface ITwoLimitsCalculatorInput {
1051
1085
  dimensionsSecondGroup: ICalculatorDimensionInput[];
1052
1086
  /** Меры */
1053
1087
  measures: ICalculatorMeasureInput[];
1054
- /** Значения переменных */
1055
- variablesValues?: ICalculatorVariablesValues;
1056
1088
  /** Фильтры, использующие WHERE */
1057
1089
  filters: ICalculatorFilter[];
1058
1090
  /** Фильтры, использующие HAVING */
@@ -1061,18 +1093,16 @@ interface ITwoLimitsCalculatorInput {
1061
1093
  measuresLimit?: number;
1062
1094
  /** Удалять ли строки, в которых значения всех мер пустые */
1063
1095
  isHideEmptyMeasures?: boolean;
1064
- /**
1065
- * Направления сортировки (в качестве ключа - формула показателя)
1066
- * todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
1067
- * правильнее будет указывать его явно через массив.
1068
- */
1069
- sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
1096
+ /** Сортировка */
1097
+ sortOrders?: ISortOrder[];
1070
1098
  /** Формула условия отображения */
1071
1099
  displayConditionFormula?: TNullable<string>;
1072
1100
  /** Лимит строк */
1073
1101
  limit?: number;
1074
1102
  /** Второй лимит */
1075
1103
  secondLimit?: number;
1104
+ /** Смещение при выборе строк */
1105
+ offset?: number;
1076
1106
  }
1077
1107
  interface ITwoLimitsCalculatorExportInput extends ITwoLimitsCalculatorInput {
1078
1108
  fileName: string;
@@ -1089,19 +1119,28 @@ interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, IT
1089
1119
  }
1090
1120
 
1091
1121
  interface ITypeCalculatorInput {
1092
- formula: string;
1093
- variablesValues: ICalculatorVariablesValues;
1122
+ dimensions: {
1123
+ alias: string;
1124
+ formula: string;
1125
+ }[];
1126
+ measures: {
1127
+ alias: string;
1128
+ formula: string;
1129
+ }[];
1130
+ }
1131
+ interface ITypeCalculatorOutputItem {
1132
+ simpleType: ESimpleDataType;
1133
+ dataType: ESimpleDataType;
1134
+ isArrayDataType: boolean;
1094
1135
  }
1095
1136
  interface ITypeCalculatorOutput {
1096
- type: ESimpleDataType;
1137
+ types: Map<string, ITypeCalculatorOutputItem>;
1097
1138
  }
1098
1139
  interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalculatorOutput> {
1099
1140
  }
1100
1141
 
1101
1142
  declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
1102
1143
 
1103
- declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
1104
-
1105
1144
  declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
1106
1145
  declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
1107
1146
  declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
@@ -1110,7 +1149,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
1110
1149
  declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
1111
1150
 
1112
1151
  /** Конвертировать разрезы виджета во входы для вычислителя */
1113
- declare function mapDimensionsToInputs(dimensions: IWidgetDimension[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1152
+ declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1114
1153
 
1115
1154
  /** Конвертировать процессные показатели виджета во входы для вычислителя */
1116
1155
  declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
@@ -1118,14 +1157,17 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
1118
1157
  /** Конвертировать показатели процессных событий виджета во входы для вычислителя */
1119
1158
  declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
1120
1159
 
1121
- /**
1122
- * Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя
1123
- * @param sortingIndicators объекты сортировок из settings виджета
1124
- * @param dimensionsInOriginalOrder разрезы виджета (конкретный разрез будет браться по индексу)
1125
- * @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
1126
- * @returns
1127
- */
1128
- declare function mapSortingToInputs(sortingIndicators?: IWidgetSortingIndicator[], dimensionsInOriginalOrder?: IWidgetDimension[], measuresInOriginalOrder?: IWidgetMeasure[]): ISortOrder[];
1160
+ /** Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя */
1161
+ interface IMapSortingToInputsParams<Settings, Indicator> {
1162
+ settings: Settings;
1163
+ variables: Map<string, TWidgetVariable>;
1164
+ filters: ICalculatorFilter[];
1165
+ getIndicatorType(key: string, indicator: Indicator): EWidgetIndicatorType.DIMENSION | EWidgetIndicatorType.MEASURE;
1166
+ /** При отсутствии сортировки использовать предустановленную сортировку(на основе sortableIndicatorsKeys) */
1167
+ withDefaultSortOrder?: boolean;
1168
+ sortableIndicatorsKeys?: Readonly<StringKeyOf<Settings>[]>;
1169
+ }
1170
+ declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType, withDefaultSortOrder, sortableIndicatorsKeys, }: IMapSortingToInputsParams<Settings, Indicator>): ISortOrder[];
1129
1171
 
1130
1172
  /**
1131
1173
  * Выбрать активный разрез иерархии на основе активных фильтров.
@@ -1133,7 +1175,7 @@ declare function mapSortingToInputs(sortingIndicators?: IWidgetSortingIndicator[
1133
1175
  * Если к разрезу иерархии применяется INCLUDE-фильтр с одним значением - выбираем следующий за ним разрез
1134
1176
  * Если к разрезу иерархии применяется INCLUDE-фильтр с несколькими значениями - выбираем данный разрез
1135
1177
  */
1136
- declare function selectDimensionFromHierarchy<H extends IWidgetDimensionHierarchy<D>, D extends IWidgetDimension>({ dimensions }: H, filters: ICalculatorFilter[]): TNullable<D>;
1178
+ declare function selectDimensionFromHierarchy<H extends IWidgetDimensionHierarchy<D>, D extends IWidgetDimension>({ hierarchyDimensions }: H, filters: ICalculatorFilter[]): TNullable<D>;
1137
1179
 
1138
1180
  declare const replaceHierarchiesWithDimensions: <D extends IWidgetDimension = IWidgetDimension>(dimensions: (D | IWidgetDimensionHierarchy<D>)[], filters: ICalculatorFilter[]) => D[];
1139
1181
 
@@ -1151,6 +1193,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
1151
1193
 
1152
1194
  declare const escapeSpecialCharacters: (formula: string) => string;
1153
1195
 
1196
+ /** Удалить из строки символы экранирования */
1197
+ declare function unescapeSpecialCharacters(str: string): string;
1198
+
1199
+ /** Вид переменной для калькулятора */
1200
+ interface ICalculatorVariable {
1201
+ dataType: ESimpleDataType;
1202
+ value: string | string[];
1203
+ }
1204
+ /** Коллекция значений переменных по их имени */
1205
+ interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
1206
+ }
1207
+
1154
1208
  interface ICalculatorFactory {
1155
1209
  general: () => IGeneralCalculator;
1156
1210
  pie: () => IPieCalculator;
@@ -1160,6 +1214,213 @@ interface ICalculatorFactory {
1160
1214
  type: () => ITypeCalculator;
1161
1215
  }
1162
1216
 
1217
+ interface ILens<T extends TNullable<object>, Value> {
1218
+ get(obj: T): TNullable<Value>;
1219
+ set(obj: T, value: Value): void;
1220
+ }
1221
+ type TValuePath = string | string[];
1222
+ type TRecordAccessor<Settings extends object, Value> = TValuePath | ILens<Settings, Value>;
1223
+ interface IDisplayPredicate<Settings> {
1224
+ (s: Settings): boolean;
1225
+ }
1226
+ /** Конфигурация разделителя */
1227
+ interface IDividerRecord<Settings extends object = object> {
1228
+ type: "divider";
1229
+ shouldDisplay?: IDisplayPredicate<Settings>;
1230
+ }
1231
+ /** Конфигурация набора групп */
1232
+ interface IGroupSetRecord {
1233
+ type: "groupSet";
1234
+ groupSetKey: string;
1235
+ }
1236
+ type TEmptyRecord = boolean | null | undefined;
1237
+ /** Набор конфигураций, которые могут встречаться на уровне виджета */
1238
+ type TWidgetLevelRecord<Settings extends object> = IControlRecord<Settings, any, EControlType> | IDividerRecord<Settings> | IGroupSetRecord | TEmptyRecord;
1239
+ /** Набор конфигураций, которые могут встречаться на уровне группы */
1240
+ type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<LevelGroupSettings, any, EControlType> | IDividerRecord<LevelGroupSettings> | TEmptyRecord;
1241
+ interface ISelectOption {
1242
+ value: string;
1243
+ label: string;
1244
+ disabled?: boolean;
1245
+ rightIcon?: "fx" | string;
1246
+ }
1247
+ declare enum ESelectOptionTypes {
1248
+ DIVIDER = "DIVIDER",
1249
+ SYSTEM = "SYSTEM",
1250
+ GROUP = "GROUP",
1251
+ BRANCH = "BRANCH",
1252
+ LEAF = "LEAF"
1253
+ }
1254
+ declare enum ECustomSelectTemplates {
1255
+ FORMULA = "FORMULA",
1256
+ DIMENSION_GROUPS = "DIMENSION_GROUPS"
1257
+ }
1258
+ interface ISelectDividerOption {
1259
+ type: ESelectOptionTypes.DIVIDER;
1260
+ }
1261
+ interface ISelectSystemOption<T extends string = string> {
1262
+ type: ESelectOptionTypes.SYSTEM;
1263
+ template: T;
1264
+ }
1265
+ interface ISelectGroupOption {
1266
+ type: ESelectOptionTypes.GROUP;
1267
+ label: string;
1268
+ options: IAddButtonSelectOption[];
1269
+ icon: string;
1270
+ }
1271
+ type TSelectFetchOptions = () => Promise<TCustomAddButtonSelectOption[]>;
1272
+ type TSelectChildOptions = TCustomAddButtonSelectOption[] | TSelectFetchOptions;
1273
+ interface ISelectBranchOption {
1274
+ type: ESelectOptionTypes.BRANCH;
1275
+ label: string;
1276
+ options: TSelectChildOptions;
1277
+ icon?: string;
1278
+ disabled?: boolean;
1279
+ }
1280
+ interface ISelectLeafOption {
1281
+ type: ESelectOptionTypes.LEAF;
1282
+ label: string;
1283
+ value: string;
1284
+ onSelect: <T extends object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
1285
+ /** Строка в формате base64 */
1286
+ icon?: string;
1287
+ disabled?: boolean;
1288
+ }
1289
+ type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption;
1290
+ type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
1291
+ type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
1292
+ interface ICustomAddButtonProps {
1293
+ options: TSelectChildOptions;
1294
+ hasDropdown?: boolean;
1295
+ onClick?: ISelectLeafOption["onSelect"];
1296
+ }
1297
+ interface IWidgetIndicatorAddButtonProps {
1298
+ hideTablesColumnsOptions?: boolean;
1299
+ hideCommonOptions?: boolean;
1300
+ hideQuantityOption?: boolean;
1301
+ }
1302
+ interface IMeasureAddButtonProps extends IWidgetIndicatorAddButtonProps {
1303
+ options?: TMeasureAddButtonSelectOption[];
1304
+ }
1305
+ interface ISortingAddButtonProps extends IWidgetIndicatorAddButtonProps {
1306
+ }
1307
+ interface IInitialSettings extends Record<string, any> {
1308
+ }
1309
+ /** Кнопка добавления группы в набор */
1310
+ type TAddButton = {
1311
+ title: string;
1312
+ props?: ICustomAddButtonProps | IMeasureAddButtonProps | ISortingAddButtonProps;
1313
+ /**
1314
+ * Начальные настройки, которые получит показатель при создании через кнопку добавления.
1315
+ * Возможность не поддерживается для иерархии разрезов.
1316
+ *
1317
+ * Кейс использования:
1318
+ * - Добавление поля type разрезам и мерам виджета "Таблица", т.к. разрезы и меры хранятся в одном массиве.
1319
+ */
1320
+ initialSettings?: IInitialSettings;
1321
+ };
1322
+ interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
1323
+ }
1324
+ /** Конфигурация набора групп */
1325
+ interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
1326
+ /** Заголовок */
1327
+ title: string;
1328
+ /** Максимальное количество групп в наборе */
1329
+ maxCount: number;
1330
+ /** Описание доступа к настройкам групп */
1331
+ accessor: TRecordAccessor<Settings, GroupSettings[]>;
1332
+ /** Получить тип индикатора */
1333
+ getType?: (settings: IInitialSettings) => EWidgetIndicatorType;
1334
+ /** Кнопки добавления группы в набор */
1335
+ addButtons: TAddButton[];
1336
+ /** Создать элементы управления внутри группы (для вкладки настроек данных) */
1337
+ createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1338
+ /** Создать элементы управления внутри группы (для вкладки настроек отображения) */
1339
+ createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1340
+ /** Получить название для плашки */
1341
+ getGroupTitle?(group: IGroupSettings): string;
1342
+ /** Валидная ли группа */
1343
+ isValid?(group: IGroupSettings): boolean;
1344
+ /** Находится ли группа в состоянии загрузки */
1345
+ isLoading?(group: IGroupSettings): boolean;
1346
+ /** Можно ли удалять группу по умолчанию true */
1347
+ isRemovable?(group: IGroupSettings): boolean;
1348
+ /** Можно ли сортировать группу по умолчанию true */
1349
+ isDraggable?: boolean;
1350
+ /** Опциональный верхний отступ для группы */
1351
+ marginTop?: number;
1352
+ }
1353
+ /** Конфигурация левой панели */
1354
+ interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
1355
+ /** Добавить заголовок для виджета */
1356
+ useTitle?: boolean;
1357
+ /** Добавить описание для виджета */
1358
+ useMarkdown?: boolean;
1359
+ /** Конфигурация настроек данных виджета */
1360
+ dataRecords?: TWidgetLevelRecord<Settings>[];
1361
+ /** Конфигурация настроек отображения виджета */
1362
+ displayRecords?: TWidgetLevelRecord<Settings>[];
1363
+ /** Конфигурации наборов групп */
1364
+ groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
1365
+ /** Добавить вкладку с действиями (по умолчанию false) */
1366
+ useActions?: boolean;
1367
+ /** Добавить вкладку с фильтрацией (по умолчанию true) */
1368
+ useFiltration?: boolean;
1369
+ /** Конфигурация настроек фильтров */
1370
+ filtrationRecords?: Exclude<TWidgetLevelRecord<Settings>, IGroupSetRecord>[];
1371
+ /** Режимы фильтрации */
1372
+ filtrationModes?: EWidgetFilterMode[];
1373
+ }
1374
+ interface IWidgetProcess {
1375
+ guid: string;
1376
+ /** Имя процесса */
1377
+ name: string;
1378
+ /** Формула имени события */
1379
+ eventNameFormula: string;
1380
+ /** Формула времени события */
1381
+ eventTimeFormula: string;
1382
+ /** Формула CaseId события */
1383
+ eventCaseIdFormula: string;
1384
+ /** Формула CaseId кейса */
1385
+ caseCaseIdFormula: string;
1386
+ /** Имя колонки CaseId события */
1387
+ eventCaseIdColumnName: string;
1388
+ /** Тип данных CaseId */
1389
+ caseIdDataType: ESimpleDataType;
1390
+ /** Тип данных времени события */
1391
+ eventTimeDataType: ESimpleDataType;
1392
+ /** Является ли процесс валидным */
1393
+ isValid: boolean;
1394
+ }
1395
+ /** Конфигурация левой панели при погружении на уровень вниз */
1396
+ interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
1397
+ }
1398
+ interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1399
+ (context: IGlobalContext, panelSettings: Settings, calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
1400
+ }
1401
+
1402
+ interface IWidgetPlaceholderController {
1403
+ setError(value: Error | null): void;
1404
+ setConfigured(value: boolean): void;
1405
+ /**
1406
+ * Устанавливает состояние видимости виджета.
1407
+ *
1408
+ * После вызова данного метода виджет станет доступен для отображения.
1409
+ * Это предотвращает мерцание при первом появлении виджета на экране.
1410
+ * Метод должен быть вызван после полной готовности виджета: все необходимые данные загружены, высота установлена.
1411
+ */
1412
+ setDisplay(value: boolean): void;
1413
+ setEmpty(value: boolean): void;
1414
+ setOverlay(value: boolean): void;
1415
+ }
1416
+ interface IWidgetPlaceholderValues {
1417
+ error: Error | null;
1418
+ isConfigured: boolean;
1419
+ isDisplay: boolean | undefined;
1420
+ isEmpty: boolean;
1421
+ isOverlay: boolean;
1422
+ }
1423
+
1163
1424
  interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1164
1425
  /** иконка виджета отображаемая в системе (в base64, svg или png) */
1165
1426
  icon?: string;
@@ -1167,20 +1428,91 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1167
1428
  createPanelDescription: IPanelDescriptionCreator<WidgetSettings, GroupSettings>;
1168
1429
  /** заполняет настройки значениями по умолчанию */
1169
1430
  fillSettings: IFillSettings<WidgetSettings>;
1170
- getDimensions?(settings: WidgetSettings): (IWidgetDimension | IWidgetDimensionHierarchy)[];
1171
- getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
1431
+ /** возвращает ключи показателей(разрезов или мер), для которых должна работать системная сортировка */
1432
+ getSortableIndicatorsKeys(): Readonly<StringKeyOf<WidgetSettings>[]>;
1433
+ }
1434
+
1435
+ type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
1436
+ event?: MouseEvent;
1437
+ placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
1438
+ positionOrigin?: "frame" | "workArea";
1439
+ position?: {
1440
+ unitX?: TContextMenuPositionUnit;
1441
+ unitY?: TContextMenuPositionUnit;
1442
+ x?: number;
1443
+ y?: number;
1444
+ };
1445
+ };
1446
+ type TContextMenuPositionUnit = "%" | "px";
1447
+ type TContextMenuList = {
1448
+ type: "list";
1449
+ items: TContextMenuRow[];
1450
+ };
1451
+ type TContextMenuButtonGroup = {
1452
+ type: "buttonGroup";
1453
+ items: TContextMenuButton[];
1454
+ };
1455
+ type TContextMenuRow = {
1456
+ key: string;
1457
+ label: string;
1458
+ onClick: () => void;
1459
+ };
1460
+ type TContextMenuButton = TContextMenuButtonActions | TContextMenuButtonClose | TContextMenuButtonApply | TContextMenuButtonCustom | TContextMenuButtonOptions;
1461
+ type TContextMenuButtonActions = {
1462
+ type: "actions";
1463
+ actions: TActionsOnClick[];
1464
+ onClick: (action: TActionsOnClick) => void;
1465
+ };
1466
+ type TContextMenuButtonClose = {
1467
+ type: "close";
1468
+ onClick?: () => void;
1469
+ };
1470
+ type TContextMenuButtonApply = {
1471
+ type: "apply";
1472
+ onClick: () => void;
1473
+ };
1474
+ type TContextMenuButtonCustom = {
1475
+ key: string;
1476
+ type: "custom";
1477
+ icon: string;
1478
+ tooltip?: {
1479
+ title: string;
1480
+ offset?: [number | `${number}%`, number | `${number}%`];
1481
+ };
1482
+ onClick: () => void;
1483
+ };
1484
+ type TContextMenuButtonOptions = {
1485
+ key: string;
1486
+ type: "options";
1487
+ icon: string;
1488
+ items: TContextMenuRow[];
1489
+ };
1490
+
1491
+ interface IViewInputValue {
1492
+ value: TNullable<string> | TNullable<string>[];
1493
+ dataType: ESimpleDataType;
1494
+ }
1495
+ interface IViewContext {
1496
+ variables: Map<string, IViewInputValue>;
1172
1497
  }
1173
1498
 
1174
1499
  type TLaunchActionParams = {
1175
- action: IWidgetAction;
1500
+ action: TAction;
1176
1501
  onSuccess: () => void;
1177
1502
  filters: ICalculatorFilter[];
1178
1503
  needConfirmation?: boolean;
1504
+ eventNames?: [string] | [string, string];
1179
1505
  };
1180
1506
  type TWidgetContainer = {
1181
1507
  /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1182
1508
  isMaxHeightLimited: boolean;
1509
+ /** Установить минимальную высоту рабочей области виджета */
1510
+ setContentMinHeight(value: number): void;
1183
1511
  };
1512
+ interface IWidgetPersistValue<T extends object = object> {
1513
+ get(): T | null;
1514
+ set(value: T | null): void;
1515
+ }
1184
1516
  interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1185
1517
  /** guid виджета */
1186
1518
  guid: string;
@@ -1201,28 +1533,26 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
1201
1533
  rootViewContainer: HTMLDivElement;
1202
1534
  /** Объект для управления плейсхолдером */
1203
1535
  placeholder: IWidgetPlaceholderController;
1204
- /** Контекст виджетов */
1205
- widgetsContext: IWidgetsContext;
1536
+ /** Объект для получения значений плейсхолдера */
1537
+ placeholderValues: IWidgetPlaceholderValues;
1538
+ /** Глобальный контекст. Содержит информацию из отчета, пространства и платформы системы */
1539
+ globalContext: IGlobalContext;
1540
+ /** Контекст образа */
1541
+ viewContext: IViewContext;
1206
1542
  /** Данные о контейнере виджета */
1207
1543
  widgetContainer: TWidgetContainer;
1208
1544
  /** Запуск действия */
1209
1545
  launchAction(params: TLaunchActionParams): void;
1546
+ /** Значение, сохраняемое в localStorage и URL */
1547
+ persistValue: IWidgetPersistValue;
1548
+ /** функция для управления контекстными меню */
1549
+ setContextMenu: (key: string, value: TContextMenu | null) => void;
1210
1550
  }
1211
1551
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1212
- /** @deprecated - нужно использовать из widgetsContext */
1213
- language: ELanguages;
1214
- /**
1215
- * режим дашборда
1216
- * @deprecated 2401 - необходимо использовать displayMode из widgetsContext */
1217
- isViewMode: boolean;
1218
1552
  /** манифест виджета */
1219
1553
  manifest: Record<string, any>;
1220
- /** @deprecated - процессы приходят в widgetsContext */
1221
- processes: Map<string, IWidgetProcess>;
1222
1554
  /** body DOM элемент родительского приложения */
1223
1555
  bodyElement: HTMLBodyElement;
1224
- /** @deprecated - значения переменных на дашборде нужно использовать из widgetsContext */
1225
- variables: Map<string, TWidgetVariable>;
1226
1556
  /** Форматирование */
1227
1557
  formatting: IWidgetFormatting;
1228
1558
  /** Получить ресурс виджета по имени файла */
@@ -1265,7 +1595,7 @@ interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
1265
1595
  unmount(container: HTMLElement): void;
1266
1596
  }
1267
1597
  interface IFillSettings<WidgetSettings extends IBaseWidgetSettings> {
1268
- (settings: Partial<WidgetSettings>, context: IWidgetsContext): void;
1598
+ (settings: Partial<WidgetSettings>, context: IGlobalContext): void;
1269
1599
  }
1270
1600
  interface IWidgetEntity<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1271
1601
  new (): IWidget<WidgetSettings>;
@@ -1324,25 +1654,46 @@ declare const measureTemplateFormulas: {
1324
1654
  declare function getMeasureFormula({ value }: IWidgetMeasure): string;
1325
1655
 
1326
1656
  declare enum EEventMeasureTemplateNames {
1327
- count = "count",
1657
+ eventsCount = "eventsCount",
1328
1658
  reworksCount = "reworksCount"
1329
1659
  }
1330
1660
  declare const eventMeasureTemplateFormulas: {
1331
- readonly count: "count()";
1661
+ readonly eventsCount: "count()";
1332
1662
  readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
1333
1663
  };
1334
1664
  declare function getEventMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
1335
1665
 
1336
1666
  declare enum ETransitionMeasureTemplateNames {
1337
- count = "count",
1667
+ transitionsCount = "transitionsCount",
1338
1668
  medianTime = "medianTime"
1339
1669
  }
1340
1670
  declare const transitionMeasureTemplateFormulas: {
1341
- readonly count: "count()";
1671
+ readonly transitionsCount: "count()";
1342
1672
  readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
1343
1673
  };
1344
1674
  declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
1345
1675
 
1676
+ /**
1677
+ * Регулярное выражение для поиска имени ссылки внутри формулы.
1678
+ * Учитывает, что имя внутри формулы содержит экраны.
1679
+ *
1680
+ * Принцип работы:
1681
+ * Пробовать следующие вхождения:
1682
+ * - \\\\ - экранированный символ обратного слэша.
1683
+ * - Иначе \\" - экранированный символ кавычки.
1684
+ * - Иначе [^"] - любой символ кроме кавычки.
1685
+ * Если встречается любой другой символ, то это закрывающая кавычка имени переменной.
1686
+ */
1687
+ declare const linkNameRegExp = "(?:\\\\\\\\|\\\\\"|[^\"])+";
1688
+ declare const dashboardLinkRegExp: RegExp;
1689
+ declare const workspaceLinkRegExp: RegExp;
1690
+ interface IIndicatorLink {
1691
+ /** string - имя группы пространства, null - используется текущий отчет */
1692
+ scopeName: string | null;
1693
+ indicatorName: string;
1694
+ }
1695
+ declare const parseIndicatorLink: (formula: string) => IIndicatorLink | null;
1696
+
1346
1697
  interface IDimensionSelection {
1347
1698
  values: Set<string | null>;
1348
1699
  replacedFilter: ICalculatorFilter | null;
@@ -1362,15 +1713,13 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
1362
1713
  * @param {P} [props] - Дополнительные параметры локализации.
1363
1714
  * @returns {string} - Локализованный текст для указанного языка.
1364
1715
  */
1365
- declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P | undefined) => string;
1716
+ declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
1366
1717
 
1367
1718
  type TDefineWidgetOptions = {
1368
1719
  manifest?: Record<string, unknown>;
1369
1720
  };
1370
1721
  declare global {
1371
1722
  interface Infomaximum {
1372
- /** @deprecated 2402 - необходимо использовать window.im.widget.defineWidget */
1373
- defineWidget: <WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings>(uuid: string, Widget: IWidgetEntity<WidgetSettings, GroupSettings>) => void;
1374
1723
  widget: {
1375
1724
  currentSdkVersion: number;
1376
1725
  defineWidget: <WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings>(uuid: string, Widget: IWidgetEntity<WidgetSettings, GroupSettings>, options?: TDefineWidgetOptions) => void;
@@ -1378,4 +1727,4 @@ declare global {
1378
1727
  }
1379
1728
  }
1380
1729
 
1381
- export { ECalculatorFilterMethods, EColorMode, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionScript, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, 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 ICalculatorVariable, type ICalculatorVariablesValues, type ICommonColumnIndicator, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILens, 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 ISelectOption, type ISortOrder, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetAction, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetMeasure, type IWidgetPlaceholderController, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TBoundedContentWithIndicator, type TColor, type TColumnIndicatorValue, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TGroupLevelRecord, type TLaunchActionParams, type TProcessIndicatorValue, type TRecordAccessor, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionInputValue, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
1730
+ 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, 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 ICalculatorVariable, type ICalculatorVariablesValues, 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 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, 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 };