@infomaximum/widget-sdk 4.0.0-beta3 → 4.0.0-beta31

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
@@ -33,7 +33,9 @@ declare enum EControlType {
33
33
  displayCondition = "displayCondition",
34
34
  eventsColor = "eventsColor",
35
35
  inputMarkdown = "inputMarkdown",
36
- filter = "filter"
36
+ filter = "filter",
37
+ actionOnClick = "actionOnClick",
38
+ eventsPicker = "eventsPicker"
37
39
  }
38
40
  /** Конфигурация элемента управления настройкой */
39
41
  interface IControlRecord<Settings extends object, Value, ControlType = EControlType> {
@@ -77,6 +79,9 @@ interface ICalculatorIndicatorOutput {
77
79
  interface ICalculatorDimensionInput extends ICalculatorIndicatorInput {
78
80
  formula: string;
79
81
  hideEmpty?: boolean;
82
+ /** Временно поддерживается обратная совместимость с форматом { alias: string; formula: string }[] */
83
+ /** Появилась необходимость в ленточном графике, т.к. разрез длительность используется, как мера */
84
+ additionalFormulas?: Map<string, string>;
80
85
  }
81
86
  interface ICalculatorDimensionOutput extends ICalculatorIndicatorOutput {
82
87
  }
@@ -259,6 +264,7 @@ declare enum EDurationUnit {
259
264
  declare const mapFormulaFilterToCalculatorInput: (filterValue: IFormulaFilterValue | string) => TNullable<ICalculatorFilter>;
260
265
  declare const mapFormulaFiltersToInputs: (filters: (string | IFormulaFilterValue)[]) => ICalculatorFilter[];
261
266
 
267
+ type TSelectivePartial<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
262
268
  declare const formulaFilterMethods: {
263
269
  readonly LAST_TIME: "LAST_TIME";
264
270
  readonly EQUAL_TO: ECalculatorFilterMethods.EQUAL_TO;
@@ -288,6 +294,7 @@ declare enum EProcessFilterNames {
288
294
  /** Длительность перехода */
289
295
  durationOfTransition = "durationOfTransition"
290
296
  }
297
+ /** @deprecated необходимо использовать @see {@link IFormulaFilterValue} */
291
298
  interface IWidgetFormulaFilterValue extends ICalculatorFilter {
292
299
  /**
293
300
  * Название фильтра
@@ -304,16 +311,16 @@ interface IProcessFilterValue {
304
311
  * События, доступные при выборе процесса.
305
312
  * Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
306
313
  */
307
- eventsNamesByProcessGuidMap?: Map<string, (string | null)[]>;
314
+ eventsNamesByProcessNameMap?: Map<string, (string | null)[]>;
308
315
  }
309
316
  interface IProcessEventFilterValue extends IProcessFilterValue {
310
- processGuid: string;
317
+ processName: string;
311
318
  eventName: string;
312
319
  }
313
320
  interface IProcessTransitionFilterValue extends IProcessFilterValue {
314
- startEventProcessGuid: string;
321
+ startEventProcessName: string;
315
322
  startEventName: string;
316
- endEventProcessGuid: string;
323
+ endEventProcessName: string;
317
324
  endEventName: string;
318
325
  }
319
326
  interface IAddPresenceOfEventFilter {
@@ -328,15 +335,6 @@ interface IAddPresenceOfTransitionFilter {
328
335
  interface IAddDurationOfTransitionFilter {
329
336
  (name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue): void;
330
337
  }
331
- interface IWidgetFiltration {
332
- /** Значения фильтров, подготовленные для передачи в вычислитель */
333
- preparedFilterValues: ICalculatorFilter[];
334
- /** Добавить фильтр по формуле */
335
- addFormulaFilter(value: IWidgetFormulaFilterValue): void;
336
- /** Удалить фильтр по формуле */
337
- removeFormulaFilter(formula: string): void;
338
- addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
339
- }
340
338
  declare enum EFormulaFilterFieldKeys {
341
339
  date = "date",
342
340
  dateRange = "dateRange",
@@ -360,7 +358,7 @@ interface IFormulaFilterValue {
360
358
  /** Метод фильтрации */
361
359
  filteringMethod: valueof<typeof formulaFilterMethods>;
362
360
  /** Выбранные в списке значения в виде моделей */
363
- checkedValues: string[];
361
+ checkedValues: (string | null)[];
364
362
  /** Значения полей формы редактора */
365
363
  formValues: Partial<{
366
364
  [EFormulaFilterFieldKeys.date]: string | null;
@@ -374,6 +372,40 @@ interface IFormulaFilterValue {
374
372
  [EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
375
373
  }>;
376
374
  }
375
+ interface IStagesFilterItem {
376
+ /** Название этапа */
377
+ name: string;
378
+ /** Формула фильтра этапа */
379
+ formula: string;
380
+ isSelected: boolean;
381
+ }
382
+ interface IStagesFilterValue {
383
+ /** Ключ виджета */
384
+ widgetKey: string;
385
+ /** Заголовок фильтра */
386
+ name: TNullable<string>;
387
+ /** Этапы */
388
+ stages: IStagesFilterItem[];
389
+ }
390
+ type TWidgetFilterValue = IFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
391
+ interface IWidgetFilter {
392
+ filterValue: TWidgetFilterValue;
393
+ preparedFilterValue: ICalculatorFilter;
394
+ }
395
+ interface IWidgetFiltration {
396
+ /** Значения фильтров, подготовленные для передачи в вычислитель */
397
+ preparedFilterValues: ICalculatorFilter[];
398
+ filters: IWidgetFilter[];
399
+ /** Добавить фильтр по формуле */
400
+ addFormulaFilter(value: IWidgetFormulaFilterValue | TSelectivePartial<IFormulaFilterValue, "format" | "formValues">): void;
401
+ /** Удалить фильтр по формуле */
402
+ removeFormulaFilter(formula: string): void;
403
+ addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
404
+ /** Добавить фильтр по этапам */
405
+ addStagesFilter(value: Omit<IStagesFilterValue, "widgetKey">): void;
406
+ /** Удалить фильтр по этапам */
407
+ removeStagesFilter(widgetKey: string): void;
408
+ }
377
409
 
378
410
  declare enum EWidgetFilterMode {
379
411
  DEFAULT = "DEFAULT",
@@ -389,25 +421,62 @@ type TWidgetFiltering = {
389
421
  mode: EWidgetFilterMode;
390
422
  };
391
423
  declare enum EColorMode {
424
+ DISABLED = "DISABLED",
392
425
  FORMULA = "FORMULA",
393
426
  BASE = "BASE",
394
427
  GRADIENT = "GRADIENT",
395
- AUTO = "AUTO"
428
+ AUTO = "AUTO",
429
+ RULE = "RULE",
430
+ VALUES = "VALUES",
431
+ BY_DIMENSION = "BY_DIMENSION"
396
432
  }
397
- /** Настройка цвета */
398
- type TColor = {
399
- mode: EColorMode.FORMULA;
400
- formula: string;
401
- } | {
433
+ type TColorBase = {
402
434
  mode: EColorMode.BASE;
403
435
  value?: string;
404
436
  defaultColor?: string;
437
+ };
438
+ declare enum EColorScope {
439
+ WORKSPACE = "WORKSPACE",
440
+ DASHBOARD = "DASHBOARD"
441
+ }
442
+ type TColorRuleCommon = {
443
+ mode: EColorMode.RULE;
444
+ ruleName: string;
445
+ };
446
+ type TColorRule = ({
447
+ scope: EColorScope.DASHBOARD | null;
405
448
  } | {
449
+ scope: EColorScope.WORKSPACE;
450
+ workspaceGroupId: number | null;
451
+ }) & TColorRuleCommon;
452
+ interface IColoredValue {
453
+ value: string;
454
+ color: TColorBase | TColorRule;
455
+ }
456
+ declare enum EMarkdownDisplayMode {
457
+ NONE = "NONE",
458
+ INDICATOR = "INDICATOR"
459
+ }
460
+ /** Настройка цвета */
461
+ type TColor = {
462
+ mode: EColorMode.FORMULA;
463
+ formula: string;
464
+ } | TColorBase | {
406
465
  mode: EColorMode.GRADIENT;
407
466
  startValue: string;
408
467
  endValue: string;
409
468
  } | {
410
469
  mode: EColorMode.AUTO;
470
+ } | TColorRule | {
471
+ mode: EColorMode.VALUES;
472
+ dimensionFormula: string;
473
+ items: IColoredValue[];
474
+ } | {
475
+ mode: EColorMode.BY_DIMENSION;
476
+ dimensionName: string;
477
+ items: IColoredValue[];
478
+ } | {
479
+ mode: EColorMode.DISABLED;
411
480
  };
412
481
  declare enum EDisplayConditionMode {
413
482
  DISABLED = "DISABLED",
@@ -422,7 +491,7 @@ type TDisplayCondition = {
422
491
  formula: TNullable<string>;
423
492
  } | {
424
493
  mode: EDisplayConditionMode.VARIABLE;
425
- variableGuid: TNullable<string>;
494
+ variableName: TNullable<string>;
426
495
  variableValue: TNullable<string>;
427
496
  };
428
497
  interface IRange {
@@ -441,6 +510,7 @@ type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
441
510
  interface ISortOrder {
442
511
  formula: string;
443
512
  direction: TSortDirection;
513
+ displayCondition?: TNullable<string>;
444
514
  }
445
515
  type TWidgetSortingValueRelatedWidgetMeasure = {
446
516
  mode: ESortingValueModes.MEASURE_IN_WIDGET;
@@ -456,7 +526,7 @@ type TWidgetSortingValue = {
456
526
  formula: string;
457
527
  } | TWidgetSortingValueRelatedWidgetIndicator | {
458
528
  mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
459
- guid: string;
529
+ name: string;
460
530
  formula: string;
461
531
  };
462
532
 
@@ -539,7 +609,6 @@ declare enum ESortingValueModes {
539
609
  IN_WORKSPACE = "IN_WORKSPACE"
540
610
  }
541
611
  interface ICommonColumnIndicator {
542
- guid: string;
543
612
  name: string;
544
613
  formula: string;
545
614
  }
@@ -585,6 +654,10 @@ interface IWidgetDimension extends IWidgetColumnIndicator {
585
654
  interface IWidgetMeasure extends IWidgetColumnIndicator {
586
655
  type: EWidgetIndicatorType.MEASURE;
587
656
  }
657
+ interface IMarkdownMeasure extends IWidgetMeasure {
658
+ format: EFormatTypes;
659
+ displayMode: EMarkdownDisplayMode;
660
+ }
588
661
  /** Тип показателя */
589
662
  declare enum EIndicatorType {
590
663
  /** Показатели процесса */
@@ -657,8 +730,8 @@ interface IWidgetTableColumn {
657
730
  dataType: ESimpleDataType;
658
731
  }
659
732
  interface IActionScript {
660
- guid: string | undefined;
661
- fieldsGuids: Set<string>;
733
+ name: string | undefined;
734
+ fieldsNames: Set<string>;
662
735
  }
663
736
  interface IWidgetTable {
664
737
  /** Имя таблицы */
@@ -666,12 +739,21 @@ interface IWidgetTable {
666
739
  /** Колонки таблицы */
667
740
  columns: Map<string, IWidgetTableColumn>;
668
741
  }
742
+ /**
743
+ * simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
744
+ *
745
+ * full - полный
746
+ */
747
+ type TFiltrationMode = "simplified" | "full";
669
748
  /**
670
749
  * preview - упрощенный
671
750
  *
672
751
  * full - полный
673
752
  */
674
753
  type TDisplayMode = "preview" | "full";
754
+ interface IDisplayRule {
755
+ color: TColor;
756
+ }
675
757
  interface IWidgetsContext {
676
758
  /** используемый язык в системе */
677
759
  language: ELanguages;
@@ -681,8 +763,8 @@ interface IWidgetsContext {
681
763
  /** Переменные отчета */
682
764
  variables: Map<string, TWidgetVariable>;
683
765
  /** Метод установки значения переменной отчета */
684
- setVariableValue(guid: string, value: TNullable<string> | string[]): void;
685
- statesGuids: Set<string>;
766
+ setVariableValue(name: string, value: TNullable<string> | string[]): void;
767
+ statesNames: Set<string>;
686
768
  reportName: string;
687
769
  /**
688
770
  * режим дашборда
@@ -694,6 +776,11 @@ interface IWidgetsContext {
694
776
  userLogin: string;
695
777
  scripts: Map<string, IActionScript>;
696
778
  tables: Set<string>;
779
+ filtrationMode: TFiltrationMode;
780
+ reportDisplayRules: Map<string, IDisplayRule>;
781
+ workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
782
+ viewKeyByName: Map<string, string>;
783
+ fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
697
784
  }
698
785
 
699
786
  declare enum EWidgetActionInputMode {
@@ -704,13 +791,75 @@ declare enum EWidgetActionInputMode {
704
791
  FORMULA = "FORMULA",
705
792
  MANUALLY = "MANUALLY"
706
793
  }
707
- type TWidgetActionInputValue = {
794
+ interface IActionCommon {
795
+ id: number;
796
+ name: string;
797
+ }
798
+ declare enum EActionTypes {
799
+ URL = "URL",
800
+ UPDATE_VARIABLE = "UPDATE_VARIABLE",
801
+ RUN_SCRIPT = "RUN_SCRIPT",
802
+ OPEN_VIEW = "OPEN_VIEW"
803
+ }
804
+ interface IActionGoToUrl extends IActionCommon {
805
+ type: EActionTypes.URL;
806
+ url: string;
807
+ targetBlank: boolean;
808
+ }
809
+ interface IActionScriptField {
810
+ name: string;
811
+ id: number;
812
+ value: TWidgetActionInputValue;
813
+ }
814
+ interface IActionRunScript extends IActionCommon {
815
+ description: string;
816
+ type: EActionTypes.RUN_SCRIPT;
817
+ filters: (IFormulaFilterValue | string)[];
818
+ inputs: IActionScriptField[];
819
+ scriptName: string;
820
+ shouldRefreshWidgetsAfterExecution: boolean;
821
+ }
822
+ interface IActionUpdateVariable extends IActionCommon {
823
+ type: EActionTypes.UPDATE_VARIABLE;
824
+ variables: Array<string>;
825
+ }
826
+ declare enum EViewType {
827
+ CREATED_VIEW = "CREATED_VIEW",
828
+ GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
829
+ }
830
+ declare enum EOpenViewMode {
831
+ NEW_WINDOW = "NEW_WINDOW",
832
+ PLACEHOLDER = "PLACEHOLDER",
833
+ MODAL = "MODAL",
834
+ DRAWER = "DRAWER"
835
+ }
836
+ declare enum EDrawerPlacement {
837
+ LEFT = "LEFT",
838
+ RIGHT = "RIGHT"
839
+ }
840
+ interface IActionOpenView extends IActionCommon {
841
+ type: EActionTypes.OPEN_VIEW;
842
+ viewName: string;
843
+ viewKey: string;
844
+ openMode: EOpenViewMode;
845
+ viewType: EViewType;
846
+ drawerPlacement: EDrawerPlacement;
847
+ placeholderName: string;
848
+ inputs: IActionScriptField[];
849
+ isOpenInCurrentWindow?: boolean;
850
+ }
851
+ type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
852
+ type TWidgetActionCommonInputValue = {
853
+ name: string;
854
+ isHidden: boolean;
855
+ };
856
+ type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
708
857
  mode: EWidgetActionInputMode.FROM_COLUMN;
709
858
  tableName: string;
710
859
  columnName: string;
711
860
  } | {
712
861
  mode: EWidgetActionInputMode.FROM_VARIABLE;
713
- guid: string;
862
+ name: string;
714
863
  } | {
715
864
  mode: EWidgetActionInputMode.FORMULA;
716
865
  formula: string;
@@ -725,35 +874,26 @@ type TWidgetActionInputValue = {
725
874
  mode: EWidgetActionInputMode.DYNAMIC_LIST;
726
875
  formula: string;
727
876
  defaultValue: string;
728
- };
877
+ filters: (IFormulaFilterValue | string)[];
878
+ });
729
879
  interface IWidgetActionInput {
730
- guid: string;
731
- value: TWidgetActionInputValue;
732
- }
733
- interface IWidgetAction {
734
- id: number;
735
880
  name: string;
736
- description: string;
737
- filters: (IFormulaFilterValue | string)[];
738
- scriptGuid?: string;
739
- /** Поле name необходимо, чтобы показать название скрипта, который был удален */
740
- scriptName?: string;
741
- inputs: IWidgetActionInput[];
742
- shouldRefreshWidgetsAfterExecution: boolean;
881
+ value: TWidgetActionInputValue;
743
882
  }
744
- declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
883
+ declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
745
884
 
746
885
  interface IBaseWidgetSettings {
747
- apiVersion: string;
748
- type: string;
749
886
  header?: string;
750
887
  headerSize?: number;
751
- stateGuid?: string | null;
888
+ stateName?: string | null;
889
+ showMarkdown?: boolean;
890
+ markdownMeasures?: IMarkdownMeasure[];
891
+ markdownText?: string;
752
892
  filters?: (IFormulaFilterValue | string)[];
753
893
  filterMode?: EWidgetFilterMode;
754
894
  ignoreFilters?: boolean;
755
895
  sorting?: IWidgetSortingIndicator[];
756
- actions?: IWidgetAction[];
896
+ actions?: TActionsOnClick[];
757
897
  displayCondition?: TDisplayCondition;
758
898
  displayConditionComment?: string;
759
899
  }
@@ -785,20 +925,38 @@ type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<Level
785
925
  interface ISelectOption {
786
926
  value: string;
787
927
  label: string;
928
+ disabled?: boolean;
788
929
  }
789
930
  interface ICustomAddButtonProps {
790
931
  options?: ISelectOption[];
791
932
  fetchOptions?: () => Promise<ISelectOption[]>;
792
933
  onSelect: (value: string, update: <T extends object>(f: (prevItems: T[]) => T[]) => void) => void;
793
934
  }
935
+ interface IWidgetIndicatorMenuConfig {
936
+ hideTablesColumnsOptions?: boolean;
937
+ hideCommonOptions?: boolean;
938
+ hideQuantityOption?: boolean;
939
+ }
940
+ interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
941
+ }
942
+ interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
943
+ }
794
944
  /** Кнопка добавления группы в набор */
795
945
  type TAddButton = {
796
946
  title: string;
797
- indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM>;
947
+ indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM | EWidgetIndicatorType.MEASURE | EWidgetIndicatorType.SORTING>;
798
948
  } | {
799
949
  title: string;
800
950
  indicatorType: EWidgetIndicatorType.CUSTOM;
801
951
  props: ICustomAddButtonProps;
952
+ } | {
953
+ title: string;
954
+ indicatorType: EWidgetIndicatorType.MEASURE;
955
+ menuConfig?: IMeasureMenuConfig;
956
+ } | {
957
+ title: string;
958
+ indicatorType: EWidgetIndicatorType.SORTING;
959
+ menuConfig?: ISortingMenuConfig;
802
960
  };
803
961
  interface IAutoIdentifiedArrayItem {
804
962
  /**
@@ -832,6 +990,10 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
832
990
  }
833
991
  /** Конфигурация левой панели */
834
992
  interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
993
+ /** Добавить заголовок для виджета */
994
+ useHeader?: boolean;
995
+ /** Добавить описание для виджета */
996
+ useMarkdown?: boolean;
835
997
  /** Конфигурация настроек данных виджета */
836
998
  dataRecords?: TWidgetLevelRecord<Settings>[];
837
999
  /** Конфигурация настроек отображения виджета */
@@ -872,15 +1034,14 @@ interface IWidgetPlaceholderController {
872
1034
  setConfigured(value: boolean): void;
873
1035
  setDisplay(value: boolean): void;
874
1036
  setEmpty(value: boolean): void;
1037
+ setOverlay(value: boolean): void;
875
1038
  }
876
-
877
- /** Вид переменной для калькулятора */
878
- interface ICalculatorVariable {
879
- dataType: ESimpleDataType;
880
- value: string | string[];
881
- }
882
- /** Коллекция значений переменных по их имени */
883
- interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
1039
+ interface IWidgetPlaceholderValues {
1040
+ error: Error | null;
1041
+ isConfigured: boolean;
1042
+ isDisplay: boolean | undefined;
1043
+ isEmpty: boolean;
1044
+ isOverlay: boolean;
884
1045
  }
885
1046
 
886
1047
  /** Формат входного параметра GeneralCalculator */
@@ -889,8 +1050,6 @@ interface IBaseDimensionsAndMeasuresCalculatorInput {
889
1050
  dimensions: ICalculatorDimensionInput[];
890
1051
  /** Меры */
891
1052
  measures: ICalculatorMeasureInput[];
892
- /** Значения переменных */
893
- variablesValues?: ICalculatorVariablesValues;
894
1053
  /** Фильтры, использующие WHERE */
895
1054
  filters: ICalculatorFilter[];
896
1055
  /** Фильтры, использующие HAVING */
@@ -944,8 +1103,6 @@ interface IHistogramCalculatorInput {
944
1103
  dimensions: ICalculatorDimensionInput[];
945
1104
  /** Лимит корзин */
946
1105
  binsLimit: number;
947
- /** Значения переменных */
948
- variablesValues?: ICalculatorVariablesValues;
949
1106
  /** Формула условия отображения */
950
1107
  displayConditionFormula?: TNullable<string>;
951
1108
  /** Фильтры, использующие WHERE */
@@ -990,7 +1147,7 @@ interface IEdge extends IGraphElement {
990
1147
  endName: string | null;
991
1148
  }
992
1149
  interface IProcessGraphCalculatorInput {
993
- processGuid: string;
1150
+ processName: string;
994
1151
  vertexLimit: number | null;
995
1152
  edgeLimit: number;
996
1153
  vertexMeasures: ICalculatorMeasureInput[];
@@ -998,8 +1155,6 @@ interface IProcessGraphCalculatorInput {
998
1155
  filters: ICalculatorFilter[];
999
1156
  eventFilters?: ICalculatorFilter[];
1000
1157
  displayConditionFormula?: TNullable<string>;
1001
- /** Значения переменных */
1002
- variablesValues?: ICalculatorVariablesValues;
1003
1158
  }
1004
1159
  interface IProcessGraphCalculatorOutput {
1005
1160
  vertexMaxLimit: number;
@@ -1024,8 +1179,6 @@ interface ITwoLimitsCalculatorInput {
1024
1179
  dimensionsSecondGroup: ICalculatorDimensionInput[];
1025
1180
  /** Меры */
1026
1181
  measures: ICalculatorMeasureInput[];
1027
- /** Значения переменных */
1028
- variablesValues?: ICalculatorVariablesValues;
1029
1182
  /** Фильтры, использующие WHERE */
1030
1183
  filters: ICalculatorFilter[];
1031
1184
  /** Фильтры, использующие HAVING */
@@ -1062,19 +1215,23 @@ interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, IT
1062
1215
  }
1063
1216
 
1064
1217
  interface ITypeCalculatorInput {
1065
- formula: string;
1066
- variablesValues: ICalculatorVariablesValues;
1218
+ dimensions: {
1219
+ alias: string;
1220
+ formula: string;
1221
+ }[];
1222
+ measures: {
1223
+ alias: string;
1224
+ formula: string;
1225
+ }[];
1067
1226
  }
1068
1227
  interface ITypeCalculatorOutput {
1069
- type: ESimpleDataType;
1228
+ types: Map<string, ESimpleDataType>;
1070
1229
  }
1071
1230
  interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalculatorOutput> {
1072
1231
  }
1073
1232
 
1074
1233
  declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
1075
1234
 
1076
- declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
1077
-
1078
1235
  declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
1079
1236
  declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
1080
1237
  declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
@@ -1083,7 +1240,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
1083
1240
  declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
1084
1241
 
1085
1242
  /** Конвертировать разрезы виджета во входы для вычислителя */
1086
- declare function mapDimensionsToInputs(dimensions: IWidgetDimension[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1243
+ declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (dimension: T) => Map<string, string>): ICalculatorDimensionInput[];
1087
1244
 
1088
1245
  /** Конвертировать процессные показатели виджета во входы для вычислителя */
1089
1246
  declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
@@ -1098,7 +1255,7 @@ declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicator
1098
1255
  * @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
1099
1256
  * @returns
1100
1257
  */
1101
- declare function mapSortingToInputs(sortingIndicators?: IWidgetSortingIndicator[], dimensionsInOriginalOrder?: IWidgetDimension[], measuresInOriginalOrder?: IWidgetMeasure[]): ISortOrder[];
1258
+ declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable>): ISortOrder[];
1102
1259
 
1103
1260
  /**
1104
1261
  * Выбрать активный разрез иерархии на основе активных фильтров.
@@ -1124,6 +1281,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
1124
1281
 
1125
1282
  declare const escapeSpecialCharacters: (formula: string) => string;
1126
1283
 
1284
+ /** Удалить из строки символы экранирования */
1285
+ declare function unescapeSpecialCharacters(str: string): string;
1286
+
1287
+ /** Вид переменной для калькулятора */
1288
+ interface ICalculatorVariable {
1289
+ dataType: ESimpleDataType;
1290
+ value: string | string[];
1291
+ }
1292
+ /** Коллекция значений переменных по их имени */
1293
+ interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
1294
+ }
1295
+
1127
1296
  interface ICalculatorFactory {
1128
1297
  general: () => IGeneralCalculator;
1129
1298
  pie: () => IPieCalculator;
@@ -1144,6 +1313,77 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1144
1313
  getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
1145
1314
  }
1146
1315
 
1316
+ type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
1317
+ event?: MouseEvent;
1318
+ placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
1319
+ positionOrigin?: "frame" | "workArea";
1320
+ position?: {
1321
+ unitX?: TContextMenuPositionUnit;
1322
+ unitY?: TContextMenuPositionUnit;
1323
+ x?: number;
1324
+ y?: number;
1325
+ };
1326
+ onClose?: () => void;
1327
+ };
1328
+ type TContextMenuPositionUnit = "%" | "px";
1329
+ type TContextMenuList = {
1330
+ type: "list";
1331
+ items: TContextMenuRow[];
1332
+ };
1333
+ type TContextMenuButtonGroup = {
1334
+ type: "buttonGroup";
1335
+ items: TContextMenuButton[];
1336
+ };
1337
+ type TContextMenuRow = {
1338
+ key: string;
1339
+ label: string;
1340
+ onClick: () => void;
1341
+ };
1342
+ type TContextMenuButton = TContextMenuButtonActions | TContextMenuButtonClose | TContextMenuButtonApply | TContextMenuButtonCustom | TContextMenuButtonOptions;
1343
+ type TContextMenuButtonActions = {
1344
+ type: "actions";
1345
+ actions: TActionsOnClick[];
1346
+ onClick: (action: TActionsOnClick) => void;
1347
+ };
1348
+ type TContextMenuButtonClose = {
1349
+ type: "close";
1350
+ };
1351
+ type TContextMenuButtonApply = {
1352
+ type: "apply";
1353
+ onClick: () => void;
1354
+ };
1355
+ type TContextMenuButtonCustom = {
1356
+ key: string;
1357
+ type: "custom";
1358
+ icon: string;
1359
+ onClick: () => void;
1360
+ };
1361
+ type TContextMenuButtonOptions = {
1362
+ key: string;
1363
+ type: "options";
1364
+ icon: string;
1365
+ items: TContextMenuRow[];
1366
+ };
1367
+
1368
+ type TLaunchActionParams = {
1369
+ action: TActionsOnClick;
1370
+ onSuccess: () => void;
1371
+ filters: ICalculatorFilter[];
1372
+ needConfirmation?: boolean;
1373
+ };
1374
+ interface ILaunchActionSubscribers {
1375
+ onActionSuccess(callback: () => void): void;
1376
+ }
1377
+ type TWidgetContainer = {
1378
+ /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1379
+ isMaxHeightLimited: boolean;
1380
+ /** Установить минимальную высоту рабочей области виджета */
1381
+ setContentMinHeight(value: number): void;
1382
+ };
1383
+ interface IWidgetPersistValue<T extends object = object> {
1384
+ get(): T | null;
1385
+ set(value: T | null): void;
1386
+ }
1147
1387
  interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1148
1388
  /** guid виджета */
1149
1389
  guid: string;
@@ -1164,19 +1404,18 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
1164
1404
  rootViewContainer: HTMLDivElement;
1165
1405
  /** Объект для управления плейсхолдером */
1166
1406
  placeholder: IWidgetPlaceholderController;
1167
- /** Контекст виджетов */
1407
+ /** Объект для получения значений плейсхолдера */
1408
+ placeholderValues?: IWidgetPlaceholderValues;
1409
+ /** Контекст виджета */
1168
1410
  widgetsContext: IWidgetsContext;
1169
- /** Вызывает модальное окно для запуска действия */
1170
- launchAction(params: {
1171
- action: IWidgetAction;
1172
- onSuccess: () => void;
1173
- filters: ICalculatorFilter[];
1174
- }): void;
1175
1411
  /** Данные о контейнере виджета */
1176
- widgetContainer: {
1177
- /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1178
- isMaxHeightLimited: boolean;
1179
- };
1412
+ widgetContainer: TWidgetContainer;
1413
+ /** Запуск действия */
1414
+ launchAction(params: TLaunchActionParams): ILaunchActionSubscribers;
1415
+ /** Значение, сохраняемое в localStorage и URL */
1416
+ persistValue: IWidgetPersistValue;
1417
+ /** функция для управления контекстными меню */
1418
+ setContextMenu: (key: string, value: TContextMenu | null) => void;
1180
1419
  }
1181
1420
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1182
1421
  /** @deprecated - нужно использовать из widgetsContext */
@@ -1332,7 +1571,7 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
1332
1571
  * @param {P} [props] - Дополнительные параметры локализации.
1333
1572
  * @returns {string} - Локализованный текст для указанного языка.
1334
1573
  */
1335
- declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P | undefined) => string;
1574
+ declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
1336
1575
 
1337
1576
  type TDefineWidgetOptions = {
1338
1577
  manifest?: Record<string, unknown>;
@@ -1348,4 +1587,4 @@ declare global {
1348
1587
  }
1349
1588
  }
1350
1589
 
1351
- 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 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 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 TProcessIndicatorValue, type TRecordAccessor, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionInputValue, 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 };
1590
+ export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionCommon, type IActionGoToUrl, type IActionOpenView, type IActionRunScript, type IActionScript, type IActionScriptField, type IActionUpdateVariable, 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 IColoredValue, type ICommonColumnIndicator, 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 IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILaunchActionSubscribers, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, 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 ISortingMenuConfig, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetIndicatorMenuConfig, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TActionsOnClick, 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 TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TProcessIndicatorValue, type TRecordAccessor, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionCommonInputValue, 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, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };