@infomaximum/widget-sdk 4.0.0-beta6 → 4.0.0-beta60

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