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

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,71 @@ declare enum EWidgetActionInputMode {
704
791
  FORMULA = "FORMULA",
705
792
  MANUALLY = "MANUALLY"
706
793
  }
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;
707
852
  type TWidgetActionInputValue = {
708
853
  mode: EWidgetActionInputMode.FROM_COLUMN;
709
854
  tableName: string;
710
855
  columnName: string;
711
856
  } | {
712
857
  mode: EWidgetActionInputMode.FROM_VARIABLE;
713
- guid: string;
858
+ name: string;
714
859
  } | {
715
860
  mode: EWidgetActionInputMode.FORMULA;
716
861
  formula: string;
@@ -727,33 +872,23 @@ type TWidgetActionInputValue = {
727
872
  defaultValue: string;
728
873
  };
729
874
  interface IWidgetActionInput {
730
- guid: string;
731
- value: TWidgetActionInputValue;
732
- }
733
- interface IWidgetAction {
734
- id: number;
735
875
  name: string;
736
- description: string;
737
- filters: (IFormulaFilterValue | string)[];
738
- scriptGuid?: string;
739
- /** Поле name необходимо, чтобы показать название скрипта, который был удален */
740
- scriptName?: string;
741
- inputs: IWidgetActionInput[];
742
- shouldRefreshWidgetsAfterExecution: boolean;
876
+ value: TWidgetActionInputValue;
743
877
  }
744
- declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
878
+ declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
745
879
 
746
880
  interface IBaseWidgetSettings {
747
- apiVersion: string;
748
- type: string;
749
881
  header?: string;
750
882
  headerSize?: number;
751
- stateGuid?: string | null;
883
+ stateName?: string | null;
884
+ showMarkdown?: boolean;
885
+ markdownMeasures?: IMarkdownMeasure[];
886
+ markdownText?: string;
752
887
  filters?: (IFormulaFilterValue | string)[];
753
888
  filterMode?: EWidgetFilterMode;
754
889
  ignoreFilters?: boolean;
755
890
  sorting?: IWidgetSortingIndicator[];
756
- actions?: IWidgetAction[];
891
+ actions?: TActionsOnClick[];
757
892
  displayCondition?: TDisplayCondition;
758
893
  displayConditionComment?: string;
759
894
  }
@@ -785,20 +920,38 @@ type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<Level
785
920
  interface ISelectOption {
786
921
  value: string;
787
922
  label: string;
923
+ disabled?: boolean;
788
924
  }
789
925
  interface ICustomAddButtonProps {
790
926
  options?: ISelectOption[];
791
927
  fetchOptions?: () => Promise<ISelectOption[]>;
792
928
  onSelect: (value: string, update: <T extends object>(f: (prevItems: T[]) => T[]) => void) => void;
793
929
  }
930
+ interface IWidgetIndicatorMenuConfig {
931
+ hideTablesColumnsOptions?: boolean;
932
+ hideCommonOptions?: boolean;
933
+ hideQuantityOption?: boolean;
934
+ }
935
+ interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
936
+ }
937
+ interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
938
+ }
794
939
  /** Кнопка добавления группы в набор */
795
940
  type TAddButton = {
796
941
  title: string;
797
- indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM>;
942
+ indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM | EWidgetIndicatorType.MEASURE | EWidgetIndicatorType.SORTING>;
798
943
  } | {
799
944
  title: string;
800
945
  indicatorType: EWidgetIndicatorType.CUSTOM;
801
946
  props: ICustomAddButtonProps;
947
+ } | {
948
+ title: string;
949
+ indicatorType: EWidgetIndicatorType.MEASURE;
950
+ menuConfig?: IMeasureMenuConfig;
951
+ } | {
952
+ title: string;
953
+ indicatorType: EWidgetIndicatorType.SORTING;
954
+ menuConfig?: ISortingMenuConfig;
802
955
  };
803
956
  interface IAutoIdentifiedArrayItem {
804
957
  /**
@@ -832,6 +985,10 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
832
985
  }
833
986
  /** Конфигурация левой панели */
834
987
  interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
988
+ /** Добавить заголовок для виджета */
989
+ useHeader?: boolean;
990
+ /** Добавить описание для виджета */
991
+ useMarkdown?: boolean;
835
992
  /** Конфигурация настроек данных виджета */
836
993
  dataRecords?: TWidgetLevelRecord<Settings>[];
837
994
  /** Конфигурация настроек отображения виджета */
@@ -872,15 +1029,14 @@ interface IWidgetPlaceholderController {
872
1029
  setConfigured(value: boolean): void;
873
1030
  setDisplay(value: boolean): void;
874
1031
  setEmpty(value: boolean): void;
1032
+ setOverlay(value: boolean): void;
875
1033
  }
876
-
877
- /** Вид переменной для калькулятора */
878
- interface ICalculatorVariable {
879
- dataType: ESimpleDataType;
880
- value: string | string[];
881
- }
882
- /** Коллекция значений переменных по их имени */
883
- interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
1034
+ interface IWidgetPlaceholderValues {
1035
+ error: Error | null;
1036
+ isConfigured: boolean;
1037
+ isDisplay: boolean | undefined;
1038
+ isEmpty: boolean;
1039
+ isOverlay: boolean;
884
1040
  }
885
1041
 
886
1042
  /** Формат входного параметра GeneralCalculator */
@@ -889,8 +1045,6 @@ interface IBaseDimensionsAndMeasuresCalculatorInput {
889
1045
  dimensions: ICalculatorDimensionInput[];
890
1046
  /** Меры */
891
1047
  measures: ICalculatorMeasureInput[];
892
- /** Значения переменных */
893
- variablesValues?: ICalculatorVariablesValues;
894
1048
  /** Фильтры, использующие WHERE */
895
1049
  filters: ICalculatorFilter[];
896
1050
  /** Фильтры, использующие HAVING */
@@ -944,8 +1098,6 @@ interface IHistogramCalculatorInput {
944
1098
  dimensions: ICalculatorDimensionInput[];
945
1099
  /** Лимит корзин */
946
1100
  binsLimit: number;
947
- /** Значения переменных */
948
- variablesValues?: ICalculatorVariablesValues;
949
1101
  /** Формула условия отображения */
950
1102
  displayConditionFormula?: TNullable<string>;
951
1103
  /** Фильтры, использующие WHERE */
@@ -990,7 +1142,7 @@ interface IEdge extends IGraphElement {
990
1142
  endName: string | null;
991
1143
  }
992
1144
  interface IProcessGraphCalculatorInput {
993
- processGuid: string;
1145
+ processName: string;
994
1146
  vertexLimit: number | null;
995
1147
  edgeLimit: number;
996
1148
  vertexMeasures: ICalculatorMeasureInput[];
@@ -998,8 +1150,6 @@ interface IProcessGraphCalculatorInput {
998
1150
  filters: ICalculatorFilter[];
999
1151
  eventFilters?: ICalculatorFilter[];
1000
1152
  displayConditionFormula?: TNullable<string>;
1001
- /** Значения переменных */
1002
- variablesValues?: ICalculatorVariablesValues;
1003
1153
  }
1004
1154
  interface IProcessGraphCalculatorOutput {
1005
1155
  vertexMaxLimit: number;
@@ -1024,8 +1174,6 @@ interface ITwoLimitsCalculatorInput {
1024
1174
  dimensionsSecondGroup: ICalculatorDimensionInput[];
1025
1175
  /** Меры */
1026
1176
  measures: ICalculatorMeasureInput[];
1027
- /** Значения переменных */
1028
- variablesValues?: ICalculatorVariablesValues;
1029
1177
  /** Фильтры, использующие WHERE */
1030
1178
  filters: ICalculatorFilter[];
1031
1179
  /** Фильтры, использующие HAVING */
@@ -1062,19 +1210,23 @@ interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, IT
1062
1210
  }
1063
1211
 
1064
1212
  interface ITypeCalculatorInput {
1065
- formula: string;
1066
- variablesValues: ICalculatorVariablesValues;
1213
+ dimensions: {
1214
+ alias: string;
1215
+ formula: string;
1216
+ }[];
1217
+ measures: {
1218
+ alias: string;
1219
+ formula: string;
1220
+ }[];
1067
1221
  }
1068
1222
  interface ITypeCalculatorOutput {
1069
- type: ESimpleDataType;
1223
+ types: Map<string, ESimpleDataType>;
1070
1224
  }
1071
1225
  interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalculatorOutput> {
1072
1226
  }
1073
1227
 
1074
1228
  declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
1075
1229
 
1076
- declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
1077
-
1078
1230
  declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
1079
1231
  declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
1080
1232
  declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
@@ -1083,7 +1235,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
1083
1235
  declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
1084
1236
 
1085
1237
  /** Конвертировать разрезы виджета во входы для вычислителя */
1086
- declare function mapDimensionsToInputs(dimensions: IWidgetDimension[], variables: Map<string, TWidgetVariable>): ICalculatorDimensionInput[];
1238
+ declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (dimension: T) => Map<string, string>): ICalculatorDimensionInput[];
1087
1239
 
1088
1240
  /** Конвертировать процессные показатели виджета во входы для вычислителя */
1089
1241
  declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
@@ -1098,7 +1250,7 @@ declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicator
1098
1250
  * @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
1099
1251
  * @returns
1100
1252
  */
1101
- declare function mapSortingToInputs(sortingIndicators?: IWidgetSortingIndicator[], dimensionsInOriginalOrder?: IWidgetDimension[], measuresInOriginalOrder?: IWidgetMeasure[]): ISortOrder[];
1253
+ declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable>): ISortOrder[];
1102
1254
 
1103
1255
  /**
1104
1256
  * Выбрать активный разрез иерархии на основе активных фильтров.
@@ -1124,6 +1276,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
1124
1276
 
1125
1277
  declare const escapeSpecialCharacters: (formula: string) => string;
1126
1278
 
1279
+ /** Удалить из строки символы экранирования */
1280
+ declare function unescapeSpecialCharacters(str: string): string;
1281
+
1282
+ /** Вид переменной для калькулятора */
1283
+ interface ICalculatorVariable {
1284
+ dataType: ESimpleDataType;
1285
+ value: string | string[];
1286
+ }
1287
+ /** Коллекция значений переменных по их имени */
1288
+ interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
1289
+ }
1290
+
1127
1291
  interface ICalculatorFactory {
1128
1292
  general: () => IGeneralCalculator;
1129
1293
  pie: () => IPieCalculator;
@@ -1144,6 +1308,77 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1144
1308
  getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
1145
1309
  }
1146
1310
 
1311
+ type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
1312
+ event?: MouseEvent;
1313
+ placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
1314
+ positionOrigin?: "frame" | "workArea";
1315
+ position?: {
1316
+ unitX?: TContextMenuPositionUnit;
1317
+ unitY?: TContextMenuPositionUnit;
1318
+ x?: number;
1319
+ y?: number;
1320
+ };
1321
+ onClose?: () => void;
1322
+ };
1323
+ type TContextMenuPositionUnit = "%" | "px";
1324
+ type TContextMenuList = {
1325
+ type: "list";
1326
+ items: TContextMenuRow[];
1327
+ };
1328
+ type TContextMenuButtonGroup = {
1329
+ type: "buttonGroup";
1330
+ items: TContextMenuButton[];
1331
+ };
1332
+ type TContextMenuRow = {
1333
+ key: string;
1334
+ label: string;
1335
+ onClick: () => void;
1336
+ };
1337
+ type TContextMenuButton = TContextMenuButtonActions | TContextMenuButtonClose | TContextMenuButtonApply | TContextMenuButtonCustom | TContextMenuButtonOptions;
1338
+ type TContextMenuButtonActions = {
1339
+ type: "actions";
1340
+ actions: TActionsOnClick[];
1341
+ onClick: (action: TActionsOnClick) => void;
1342
+ };
1343
+ type TContextMenuButtonClose = {
1344
+ type: "close";
1345
+ };
1346
+ type TContextMenuButtonApply = {
1347
+ type: "apply";
1348
+ onClick: () => void;
1349
+ };
1350
+ type TContextMenuButtonCustom = {
1351
+ key: string;
1352
+ type: "custom";
1353
+ icon: string;
1354
+ onClick: () => void;
1355
+ };
1356
+ type TContextMenuButtonOptions = {
1357
+ key: string;
1358
+ type: "options";
1359
+ icon: string;
1360
+ items: TContextMenuRow[];
1361
+ };
1362
+
1363
+ type TLaunchActionParams = {
1364
+ action: TActionsOnClick;
1365
+ onSuccess: () => void;
1366
+ filters: ICalculatorFilter[];
1367
+ needConfirmation?: boolean;
1368
+ };
1369
+ interface ILaunchActionSubscribers {
1370
+ onActionSuccess(callback: () => void): void;
1371
+ }
1372
+ type TWidgetContainer = {
1373
+ /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1374
+ isMaxHeightLimited: boolean;
1375
+ /** Установить минимальную высоту рабочей области виджета */
1376
+ setContentMinHeight(value: number): void;
1377
+ };
1378
+ interface IWidgetPersistValue<T extends object = object> {
1379
+ get(): T | null;
1380
+ set(value: T | null): void;
1381
+ }
1147
1382
  interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1148
1383
  /** guid виджета */
1149
1384
  guid: string;
@@ -1164,19 +1399,18 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
1164
1399
  rootViewContainer: HTMLDivElement;
1165
1400
  /** Объект для управления плейсхолдером */
1166
1401
  placeholder: IWidgetPlaceholderController;
1167
- /** Контекст виджетов */
1402
+ /** Объект для получения значений плейсхолдера */
1403
+ placeholderValues?: IWidgetPlaceholderValues;
1404
+ /** Контекст виджета */
1168
1405
  widgetsContext: IWidgetsContext;
1169
- /** Вызывает модальное окно для запуска действия */
1170
- launchAction(params: {
1171
- action: IWidgetAction;
1172
- onSuccess: () => void;
1173
- filters: ICalculatorFilter[];
1174
- }): void;
1175
1406
  /** Данные о контейнере виджета */
1176
- widgetContainer: {
1177
- /** Имеет ли контейнер виджета ограниченную максимальную высоту */
1178
- isMaxHeightLimited: boolean;
1179
- };
1407
+ widgetContainer: TWidgetContainer;
1408
+ /** Запуск действия */
1409
+ launchAction(params: TLaunchActionParams): ILaunchActionSubscribers;
1410
+ /** Значение, сохраняемое в localStorage и URL */
1411
+ persistValue: IWidgetPersistValue;
1412
+ /** функция для управления контекстными меню */
1413
+ setContextMenu: (key: string, value: TContextMenu | null) => void;
1180
1414
  }
1181
1415
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1182
1416
  /** @deprecated - нужно использовать из widgetsContext */
@@ -1332,7 +1566,7 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
1332
1566
  * @param {P} [props] - Дополнительные параметры локализации.
1333
1567
  * @returns {string} - Локализованный текст для указанного языка.
1334
1568
  */
1335
- declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P | undefined) => string;
1569
+ declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
1336
1570
 
1337
1571
  type TDefineWidgetOptions = {
1338
1572
  manifest?: Record<string, unknown>;
@@ -1348,4 +1582,4 @@ declare global {
1348
1582
  }
1349
1583
  }
1350
1584
 
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 };
1585
+ 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 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 };