@infomaximum/widget-sdk 4.0.0-beta7 → 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,46 +295,43 @@ 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
  * События, доступные при выборе процесса.
309
301
  * Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
310
302
  */
311
- eventsNamesByProcessGuidMap?: Map<string, (string | null)[]>;
303
+ eventsNamesByProcessNameMap?: Map<string, (string | null)[]>;
312
304
  }
313
305
  interface IProcessEventFilterValue extends IProcessFilterValue {
314
- processGuid: string;
306
+ processName: string;
315
307
  eventName: string;
316
308
  }
317
309
  interface IProcessTransitionFilterValue extends IProcessFilterValue {
318
- startEventProcessGuid: string;
310
+ startEventProcessName: string;
319
311
  startEventName: string;
320
- endEventProcessGuid: string;
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",
@@ -451,7 +441,7 @@ type TDisplayCondition = {
451
441
  formula: TNullable<string>;
452
442
  } | {
453
443
  mode: EDisplayConditionMode.VARIABLE;
454
- variableGuid: TNullable<string>;
444
+ variableName: TNullable<string>;
455
445
  variableValue: TNullable<string>;
456
446
  };
457
447
  interface IRange {
@@ -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
- guid: 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,21 +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 */
571
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 {
572
841
  name: string;
573
842
  formula: string;
574
843
  }
@@ -598,21 +867,21 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
598
867
  formatting?: EFormattingPresets;
599
868
  formattingTemplate?: string;
600
869
  displayCondition?: TDisplayCondition;
870
+ onClick?: TActionsOnClick[];
601
871
  }
602
- interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
603
- /** Идентификатор, генерируемый на основе текущего времени */
604
- id: number;
605
- type: EWidgetIndicatorType.DIMENSION_HIERARCHY;
872
+ interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> extends IAutoIdentifiedArrayItem {
606
873
  name: string;
607
- dimensions: D[];
874
+ hierarchyDimensions: D[];
608
875
  displayCondition?: TDisplayCondition;
609
876
  }
610
877
  interface IWidgetDimension extends IWidgetColumnIndicator {
611
- type: EWidgetIndicatorType.DIMENSION;
612
878
  hideEmptyValues: boolean;
613
879
  }
614
880
  interface IWidgetMeasure extends IWidgetColumnIndicator {
615
- type: EWidgetIndicatorType.MEASURE;
881
+ }
882
+ interface IMarkdownMeasure extends IWidgetMeasure {
883
+ format: EFormatTypes;
884
+ displaySign: EMarkdownDisplayMode;
616
885
  }
617
886
  /** Тип показателя */
618
887
  declare enum EIndicatorType {
@@ -644,6 +913,8 @@ type TWidgetVariable = {
644
913
  defaultValue: string;
645
914
  /** Тип данных */
646
915
  dataType: ESimpleDataType;
916
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
917
+ guid: string;
647
918
  } | {
648
919
  /** Тип переменной */
649
920
  type: EIndicatorType.STATIC_LIST;
@@ -659,6 +930,8 @@ type TWidgetVariable = {
659
930
  dataType: ESimpleDataType.STRING;
660
931
  /** Множественный выбор */
661
932
  multipleChoice: boolean;
933
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
934
+ guid: string;
662
935
  } | {
663
936
  /** Тип переменной */
664
937
  type: EIndicatorType.DYNAMIC_LIST;
@@ -675,286 +948,49 @@ type TWidgetVariable = {
675
948
  /** Множественный выбор */
676
949
  multipleChoice: boolean;
677
950
  /** Фильтры */
678
- filters: (string | IFormulaFilterValue)[];
951
+ filters: TExtendedFormulaFilterValue[];
952
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
953
+ guid: string;
679
954
  };
680
- declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
955
+ declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
681
956
 
682
- interface IWidgetTableColumn {
683
- /** Имя колонки */
684
- name: string;
685
- /** Тип данных колонки */
686
- dataType: ESimpleDataType;
687
- }
688
- interface IActionScript {
689
- guid: string | undefined;
690
- fieldsGuids: 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>;
691
977
  }
692
- interface IWidgetTable {
693
- /** Имя таблицы */
694
- name: string;
695
- /** Колонки таблицы */
696
- columns: Map<string, IWidgetTableColumn>;
978
+ interface IBaseDimensionsAndMeasuresCalculatorOutput {
979
+ dimensions: Map<string, ICalculatorDimensionOutput>;
980
+ measures: Map<string, ICalculatorMeasureOutput>;
981
+ isDisplay: boolean;
982
+ isValuesEmpty: boolean;
697
983
  }
698
- /**
699
- * preview - упрощенный
700
- *
701
- * full - полный
702
- */
703
- type TDisplayMode = "preview" | "full";
704
- interface IWidgetsContext {
705
- /** используемый язык в системе */
706
- language: ELanguages;
707
- processes: Map<string, IWidgetProcess>;
708
- reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
709
- workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
710
- /** Переменные отчета */
711
- variables: Map<string, TWidgetVariable>;
712
- /** Метод установки значения переменной отчета */
713
- setVariableValue(guid: string, value: TNullable<string> | string[]): void;
714
- statesGuids: Set<string>;
715
- reportName: string;
716
- /**
717
- * режим дашборда
718
- * @deprecated 2401 - необходимо использовать displayMode */
719
- isViewMode: boolean;
720
- /** Режим отображения виджета */
721
- displayMode: TDisplayMode;
722
- /** @deprecated необходимо получать из системной переменной "Login" */
723
- userLogin: string;
724
- scripts: Map<string, IActionScript>;
725
- tables: Set<string>;
984
+ interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
726
985
  }
727
986
 
728
- declare enum EWidgetActionInputMode {
729
- FROM_COLUMN = "FROM_COLUMN",
730
- FROM_VARIABLE = "FROM_VARIABLE",
731
- STATIC_LIST = "STATIC_LIST",
732
- DYNAMIC_LIST = "DYNAMIC_LIST",
733
- FORMULA = "FORMULA",
734
- MANUALLY = "MANUALLY"
735
- }
736
- type TWidgetActionInputValue = {
737
- mode: EWidgetActionInputMode.FROM_COLUMN;
738
- tableName: string;
739
- columnName: string;
740
- } | {
741
- mode: EWidgetActionInputMode.FROM_VARIABLE;
742
- guid: string;
743
- } | {
744
- mode: EWidgetActionInputMode.FORMULA;
745
- formula: string;
746
- } | {
747
- mode: EWidgetActionInputMode.MANUALLY;
748
- description: string;
749
- } | {
750
- mode: EWidgetActionInputMode.STATIC_LIST;
751
- options: string[];
752
- defaultOptionIndex: number;
753
- } | {
754
- mode: EWidgetActionInputMode.DYNAMIC_LIST;
755
- formula: string;
756
- defaultValue: string;
757
- };
758
- interface IWidgetActionInput {
759
- guid: string;
760
- value: TWidgetActionInputValue;
761
- }
762
- interface IWidgetAction {
763
- id: number;
764
- name: string;
765
- description: string;
766
- filters: (IFormulaFilterValue | string)[];
767
- scriptGuid?: string;
768
- /** Поле name необходимо, чтобы показать название скрипта, который был удален */
769
- scriptName?: string;
770
- inputs: IWidgetActionInput[];
771
- shouldRefreshWidgetsAfterExecution: boolean;
772
- }
773
- declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
774
-
775
- interface IBaseWidgetSettings {
776
- apiVersion: string;
777
- type: string;
778
- header?: string;
779
- headerSize?: number;
780
- stateGuid?: string | null;
781
- filters?: (IFormulaFilterValue | string)[];
782
- filterMode?: EWidgetFilterMode;
783
- ignoreFilters?: boolean;
784
- sorting?: IWidgetSortingIndicator[];
785
- actions?: IWidgetAction[];
786
- displayCondition?: TDisplayCondition;
787
- displayConditionComment?: string;
788
- }
789
-
790
- interface ILens<T extends TNullable<object>, Value> {
791
- get(obj: T): TNullable<Value>;
792
- set(obj: T, value: Value): void;
793
- }
794
- type TValuePath = string | string[];
795
- type TRecordAccessor<Settings extends object, Value> = TValuePath | ILens<Settings, Value>;
796
- interface IDisplayPredicate<Settings> {
797
- (s: Settings): boolean;
798
- }
799
- /** Конфигурация разделителя */
800
- interface IDividerRecord<Settings extends object = object> {
801
- type: "divider";
802
- shouldDisplay?: IDisplayPredicate<Settings>;
803
- }
804
- /** Конфигурация набора групп */
805
- interface IGroupSetRecord {
806
- type: "groupSet";
807
- groupSetKey: string;
808
- }
809
- type TEmptyRecord = boolean | null | undefined;
810
- /** Набор конфигураций, которые могут встречаться на уровне виджета */
811
- type TWidgetLevelRecord<Settings extends object> = IControlRecord<Settings, any, EControlType> | IDividerRecord<Settings> | IGroupSetRecord | TEmptyRecord;
812
- /** Набор конфигураций, которые могут встречаться на уровне группы */
813
- type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<LevelGroupSettings, any, EControlType> | IDividerRecord<LevelGroupSettings> | TEmptyRecord;
814
- interface ISelectOption {
815
- value: string;
816
- label: string;
817
- }
818
- interface ICustomAddButtonProps {
819
- options?: ISelectOption[];
820
- fetchOptions?: () => Promise<ISelectOption[]>;
821
- onSelect: (value: string, update: <T extends object>(f: (prevItems: T[]) => T[]) => void) => void;
822
- }
823
- /** Кнопка добавления группы в набор */
824
- type TAddButton = {
825
- title: string;
826
- indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM>;
827
- } | {
828
- title: string;
829
- indicatorType: EWidgetIndicatorType.CUSTOM;
830
- props: ICustomAddButtonProps;
831
- };
832
- interface IAutoIdentifiedArrayItem {
833
- /**
834
- * Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
835
- * Гарантируется уникальность id в пределах settings виджета.
836
- */
837
- id: number;
838
- }
839
- interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
840
- }
841
- /** Конфигурация набора групп */
842
- interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
843
- /** Заголовок */
844
- title: string;
845
- /** Максимальное количество групп в наборе */
846
- maxCount: number;
847
- /** Описание доступа к настройкам групп */
848
- accessor: TRecordAccessor<Settings, GroupSettings[]>;
849
- /** Кнопки добавления группы в набор */
850
- addButtons: TAddButton[];
851
- /** Создать элементы управления внутри группы (для вкладки настроек данных) */
852
- createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
853
- /** Создать элементы управления внутри группы (для вкладки настроек отображения) */
854
- createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
855
- /** Получить название для плашки */
856
- getGroupTitle?(group: IGroupSettings): string;
857
- /** Валидная ли группа */
858
- isValid?(group: IGroupSettings): boolean;
859
- /** Находится ли группа в состоянии загрузки */
860
- isLoading?(group: IGroupSettings): boolean;
861
- }
862
- /** Конфигурация левой панели */
863
- interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
864
- /** Конфигурация настроек данных виджета */
865
- dataRecords?: TWidgetLevelRecord<Settings>[];
866
- /** Конфигурация настроек отображения виджета */
867
- displayRecords?: TWidgetLevelRecord<Settings>[];
868
- /** Конфигурации наборов групп */
869
- groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
870
- }
871
- interface IWidgetProcess {
872
- guid: string;
873
- /** Имя процесса */
874
- name: string;
875
- /** Формула имени события */
876
- eventNameFormula: string;
877
- /** Формула времени события */
878
- eventTimeFormula: string;
879
- /** Формула CaseId события */
880
- eventCaseIdFormula: string;
881
- /** Формула CaseId кейса */
882
- caseCaseIdFormula: string;
883
- /** Имя колонки CaseId события */
884
- eventCaseIdColumnName: string;
885
- /** Тип данных CaseId */
886
- caseIdDataType: ESimpleDataType;
887
- /** Тип данных времени события */
888
- eventTimeDataType: ESimpleDataType;
889
- /** Является ли процесс валидным */
890
- isValid: boolean;
891
- }
892
- /** Конфигурация левой панели при погружении на уровень вниз */
893
- interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
894
- }
895
- interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
896
- (context: IWidgetsContext, panelSettings: Settings): IPanelDescription<Settings, GroupSettings>;
897
- }
898
-
899
- interface IWidgetPlaceholderController {
900
- setError(value: Error | null): void;
901
- setConfigured(value: boolean): void;
902
- setDisplay(value: boolean): void;
903
- setEmpty(value: boolean): void;
904
- }
905
-
906
- /** Вид переменной для калькулятора */
907
- interface ICalculatorVariable {
908
- dataType: ESimpleDataType;
909
- value: string | string[];
910
- }
911
- /** Коллекция значений переменных по их имени */
912
- interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
913
- }
914
-
915
- /** Формат входного параметра GeneralCalculator */
916
- interface IBaseDimensionsAndMeasuresCalculatorInput {
917
- /** Разрезы */
918
- dimensions: ICalculatorDimensionInput[];
919
- /** Меры */
920
- measures: ICalculatorMeasureInput[];
921
- /** Значения переменных */
922
- variablesValues?: ICalculatorVariablesValues;
923
- /** Фильтры, использующие WHERE */
924
- filters: ICalculatorFilter[];
925
- /** Фильтры, использующие HAVING */
926
- postFilters?: ICalculatorFilter[];
927
- /** Лимит мер (будут вычислены первые measuresLimit мер, попавшие под условие отображения) */
928
- measuresLimit?: number;
929
- /** Лимит разрезов (будут вычислены первые dimensionsLimit разрезов, попавшие под условие отображения) */
930
- dimensionsLimit?: number;
931
- /** Удалять ли строки, в которых значения всех мер пустые */
932
- isHideEmptyMeasures?: boolean;
933
- /**
934
- * Направления сортировки (в качестве ключа - формула показателя)
935
- * todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
936
- * правильнее будет указывать его явно через массив.
937
- */
938
- sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
939
- /** Формула условия отображения */
940
- displayConditionFormula?: TNullable<string>;
941
- }
942
- interface IBaseDimensionsAndMeasuresCalculatorOutput {
943
- dimensions: Map<string, ICalculatorDimensionOutput>;
944
- measures: Map<string, ICalculatorMeasureOutput>;
945
- isDisplay: boolean;
946
- isValuesEmpty: boolean;
947
- }
948
- interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
949
- }
950
-
951
- interface IGeneralCalculatorInput extends IBaseDimensionsAndMeasuresCalculatorInput {
952
- /** Лимит строк */
953
- limit?: number;
954
- /** Смещение при выборе строк */
955
- offset?: number;
956
- /** Вычислять ли итоговые значения */
957
- isCalculateTotals?: boolean;
987
+ interface IGeneralCalculatorInput extends IBaseDimensionsAndMeasuresCalculatorInput {
988
+ /** Лимит строк */
989
+ limit?: number;
990
+ /** Смещение при выборе строк */
991
+ offset?: number;
992
+ /** Вычислять ли итоговые значения */
993
+ isCalculateTotals?: boolean;
958
994
  }
959
995
  interface IGeneralCalculatorExportInput extends IGeneralCalculatorInput {
960
996
  fileName: string;
@@ -973,8 +1009,6 @@ interface IHistogramCalculatorInput {
973
1009
  dimensions: ICalculatorDimensionInput[];
974
1010
  /** Лимит корзин */
975
1011
  binsLimit: number;
976
- /** Значения переменных */
977
- variablesValues?: ICalculatorVariablesValues;
978
1012
  /** Формула условия отображения */
979
1013
  displayConditionFormula?: TNullable<string>;
980
1014
  /** Фильтры, использующие WHERE */
@@ -1019,7 +1053,7 @@ interface IEdge extends IGraphElement {
1019
1053
  endName: string | null;
1020
1054
  }
1021
1055
  interface IProcessGraphCalculatorInput {
1022
- processGuid: string;
1056
+ processName: string;
1023
1057
  vertexLimit: number | null;
1024
1058
  edgeLimit: number;
1025
1059
  vertexMeasures: ICalculatorMeasureInput[];
@@ -1027,8 +1061,6 @@ interface IProcessGraphCalculatorInput {
1027
1061
  filters: ICalculatorFilter[];
1028
1062
  eventFilters?: ICalculatorFilter[];
1029
1063
  displayConditionFormula?: TNullable<string>;
1030
- /** Значения переменных */
1031
- variablesValues?: ICalculatorVariablesValues;
1032
1064
  }
1033
1065
  interface IProcessGraphCalculatorOutput {
1034
1066
  vertexMaxLimit: number;
@@ -1053,8 +1085,6 @@ interface ITwoLimitsCalculatorInput {
1053
1085
  dimensionsSecondGroup: ICalculatorDimensionInput[];
1054
1086
  /** Меры */
1055
1087
  measures: ICalculatorMeasureInput[];
1056
- /** Значения переменных */
1057
- variablesValues?: ICalculatorVariablesValues;
1058
1088
  /** Фильтры, использующие WHERE */
1059
1089
  filters: ICalculatorFilter[];
1060
1090
  /** Фильтры, использующие HAVING */
@@ -1063,18 +1093,16 @@ interface ITwoLimitsCalculatorInput {
1063
1093
  measuresLimit?: number;
1064
1094
  /** Удалять ли строки, в которых значения всех мер пустые */
1065
1095
  isHideEmptyMeasures?: boolean;
1066
- /**
1067
- * Направления сортировки (в качестве ключа - формула показателя)
1068
- * todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
1069
- * правильнее будет указывать его явно через массив.
1070
- */
1071
- sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
1096
+ /** Сортировка */
1097
+ sortOrders?: ISortOrder[];
1072
1098
  /** Формула условия отображения */
1073
1099
  displayConditionFormula?: TNullable<string>;
1074
1100
  /** Лимит строк */
1075
1101
  limit?: number;
1076
1102
  /** Второй лимит */
1077
1103
  secondLimit?: number;
1104
+ /** Смещение при выборе строк */
1105
+ offset?: number;
1078
1106
  }
1079
1107
  interface ITwoLimitsCalculatorExportInput extends ITwoLimitsCalculatorInput {
1080
1108
  fileName: string;
@@ -1091,19 +1119,28 @@ interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, IT
1091
1119
  }
1092
1120
 
1093
1121
  interface ITypeCalculatorInput {
1094
- formula: string;
1095
- 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;
1096
1135
  }
1097
1136
  interface ITypeCalculatorOutput {
1098
- type: ESimpleDataType;
1137
+ types: Map<string, ITypeCalculatorOutputItem>;
1099
1138
  }
1100
1139
  interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalculatorOutput> {
1101
1140
  }
1102
1141
 
1103
1142
  declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
1104
1143
 
1105
- declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
1106
-
1107
1144
  declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
1108
1145
  declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
1109
1146
  declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
@@ -1112,7 +1149,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
1112
1149
  declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
1113
1150
 
1114
1151
  /** Конвертировать разрезы виджета во входы для вычислителя */
1115
- declare function mapDimensionsToInputs(dimensions: IWidgetDimension[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1152
+ declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1116
1153
 
1117
1154
  /** Конвертировать процессные показатели виджета во входы для вычислителя */
1118
1155
  declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
@@ -1120,14 +1157,17 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
1120
1157
  /** Конвертировать показатели процессных событий виджета во входы для вычислителя */
1121
1158
  declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
1122
1159
 
1123
- /**
1124
- * Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя
1125
- * @param sortingIndicators объекты сортировок из settings виджета
1126
- * @param dimensionsInOriginalOrder разрезы виджета (конкретный разрез будет браться по индексу)
1127
- * @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
1128
- * @returns
1129
- */
1130
- 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[];
1131
1171
 
1132
1172
  /**
1133
1173
  * Выбрать активный разрез иерархии на основе активных фильтров.
@@ -1135,7 +1175,7 @@ declare function mapSortingToInputs(sortingIndicators?: IWidgetSortingIndicator[
1135
1175
  * Если к разрезу иерархии применяется INCLUDE-фильтр с одним значением - выбираем следующий за ним разрез
1136
1176
  * Если к разрезу иерархии применяется INCLUDE-фильтр с несколькими значениями - выбираем данный разрез
1137
1177
  */
1138
- 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>;
1139
1179
 
1140
1180
  declare const replaceHierarchiesWithDimensions: <D extends IWidgetDimension = IWidgetDimension>(dimensions: (D | IWidgetDimensionHierarchy<D>)[], filters: ICalculatorFilter[]) => D[];
1141
1181
 
@@ -1153,6 +1193,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
1153
1193
 
1154
1194
  declare const escapeSpecialCharacters: (formula: string) => string;
1155
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
+
1156
1208
  interface ICalculatorFactory {
1157
1209
  general: () => IGeneralCalculator;
1158
1210
  pie: () => IPieCalculator;
@@ -1162,6 +1214,213 @@ interface ICalculatorFactory {
1162
1214
  type: () => ITypeCalculator;
1163
1215
  }
1164
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
+
1165
1424
  interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1166
1425
  /** иконка виджета отображаемая в системе (в base64, svg или png) */
1167
1426
  icon?: string;
@@ -1169,20 +1428,91 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1169
1428
  createPanelDescription: IPanelDescriptionCreator<WidgetSettings, GroupSettings>;
1170
1429
  /** заполняет настройки значениями по умолчанию */
1171
1430
  fillSettings: IFillSettings<WidgetSettings>;
1172
- getDimensions?(settings: WidgetSettings): (IWidgetDimension | IWidgetDimensionHierarchy)[];
1173
- 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>;
1174
1497
  }
1175
1498
 
1176
1499
  type TLaunchActionParams = {
1177
- action: IWidgetAction;
1500
+ action: TAction;
1178
1501
  onSuccess: () => void;
1179
1502
  filters: ICalculatorFilter[];
1180
1503
  needConfirmation?: boolean;
1504
+ eventNames?: [string] | [string, string];
1181
1505
  };
1182
1506
  type TWidgetContainer = {
1183
1507
  /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1184
1508
  isMaxHeightLimited: boolean;
1509
+ /** Установить минимальную высоту рабочей области виджета */
1510
+ setContentMinHeight(value: number): void;
1185
1511
  };
1512
+ interface IWidgetPersistValue<T extends object = object> {
1513
+ get(): T | null;
1514
+ set(value: T | null): void;
1515
+ }
1186
1516
  interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1187
1517
  /** guid виджета */
1188
1518
  guid: string;
@@ -1203,28 +1533,26 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
1203
1533
  rootViewContainer: HTMLDivElement;
1204
1534
  /** Объект для управления плейсхолдером */
1205
1535
  placeholder: IWidgetPlaceholderController;
1206
- /** Контекст виджетов */
1207
- widgetsContext: IWidgetsContext;
1536
+ /** Объект для получения значений плейсхолдера */
1537
+ placeholderValues: IWidgetPlaceholderValues;
1538
+ /** Глобальный контекст. Содержит информацию из отчета, пространства и платформы системы */
1539
+ globalContext: IGlobalContext;
1540
+ /** Контекст образа */
1541
+ viewContext: IViewContext;
1208
1542
  /** Данные о контейнере виджета */
1209
1543
  widgetContainer: TWidgetContainer;
1210
1544
  /** Запуск действия */
1211
1545
  launchAction(params: TLaunchActionParams): void;
1546
+ /** Значение, сохраняемое в localStorage и URL */
1547
+ persistValue: IWidgetPersistValue;
1548
+ /** функция для управления контекстными меню */
1549
+ setContextMenu: (key: string, value: TContextMenu | null) => void;
1212
1550
  }
1213
1551
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1214
- /** @deprecated - нужно использовать из widgetsContext */
1215
- language: ELanguages;
1216
- /**
1217
- * режим дашборда
1218
- * @deprecated 2401 - необходимо использовать displayMode из widgetsContext */
1219
- isViewMode: boolean;
1220
1552
  /** манифест виджета */
1221
1553
  manifest: Record<string, any>;
1222
- /** @deprecated - процессы приходят в widgetsContext */
1223
- processes: Map<string, IWidgetProcess>;
1224
1554
  /** body DOM элемент родительского приложения */
1225
1555
  bodyElement: HTMLBodyElement;
1226
- /** @deprecated - значения переменных на дашборде нужно использовать из widgetsContext */
1227
- variables: Map<string, TWidgetVariable>;
1228
1556
  /** Форматирование */
1229
1557
  formatting: IWidgetFormatting;
1230
1558
  /** Получить ресурс виджета по имени файла */
@@ -1267,7 +1595,7 @@ interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
1267
1595
  unmount(container: HTMLElement): void;
1268
1596
  }
1269
1597
  interface IFillSettings<WidgetSettings extends IBaseWidgetSettings> {
1270
- (settings: Partial<WidgetSettings>, context: IWidgetsContext): void;
1598
+ (settings: Partial<WidgetSettings>, context: IGlobalContext): void;
1271
1599
  }
1272
1600
  interface IWidgetEntity<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1273
1601
  new (): IWidget<WidgetSettings>;
@@ -1326,25 +1654,46 @@ declare const measureTemplateFormulas: {
1326
1654
  declare function getMeasureFormula({ value }: IWidgetMeasure): string;
1327
1655
 
1328
1656
  declare enum EEventMeasureTemplateNames {
1329
- count = "count",
1657
+ eventsCount = "eventsCount",
1330
1658
  reworksCount = "reworksCount"
1331
1659
  }
1332
1660
  declare const eventMeasureTemplateFormulas: {
1333
- readonly count: "count()";
1661
+ readonly eventsCount: "count()";
1334
1662
  readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
1335
1663
  };
1336
1664
  declare function getEventMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
1337
1665
 
1338
1666
  declare enum ETransitionMeasureTemplateNames {
1339
- count = "count",
1667
+ transitionsCount = "transitionsCount",
1340
1668
  medianTime = "medianTime"
1341
1669
  }
1342
1670
  declare const transitionMeasureTemplateFormulas: {
1343
- readonly count: "count()";
1671
+ readonly transitionsCount: "count()";
1344
1672
  readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
1345
1673
  };
1346
1674
  declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
1347
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
+
1348
1697
  interface IDimensionSelection {
1349
1698
  values: Set<string | null>;
1350
1699
  replacedFilter: ICalculatorFilter | null;
@@ -1364,15 +1713,13 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
1364
1713
  * @param {P} [props] - Дополнительные параметры локализации.
1365
1714
  * @returns {string} - Локализованный текст для указанного языка.
1366
1715
  */
1367
- 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;
1368
1717
 
1369
1718
  type TDefineWidgetOptions = {
1370
1719
  manifest?: Record<string, unknown>;
1371
1720
  };
1372
1721
  declare global {
1373
1722
  interface Infomaximum {
1374
- /** @deprecated 2402 - необходимо использовать window.im.widget.defineWidget */
1375
- defineWidget: <WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings>(uuid: string, Widget: IWidgetEntity<WidgetSettings, GroupSettings>) => void;
1376
1723
  widget: {
1377
1724
  currentSdkVersion: number;
1378
1725
  defineWidget: <WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings>(uuid: string, Widget: IWidgetEntity<WidgetSettings, GroupSettings>, options?: TDefineWidgetOptions) => void;
@@ -1380,4 +1727,4 @@ declare global {
1380
1727
  }
1381
1728
  }
1382
1729
 
1383
- 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 };