@infomaximum/widget-sdk 6.0.0-8 → 6.0.0-view-theme.0

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/CHANGELOG.md CHANGED
@@ -2,116 +2,138 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [6.0.0-view-theme.0](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-12...v6.0.0-view-theme.0) (2025-09-29)
6
+
7
+ ## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
8
+
9
+
10
+ ### Features
11
+
12
+ * для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
13
+
14
+ ## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-10...v6.0.0-11) (2025-09-23)
15
+
16
+
17
+ ### Features
18
+
19
+ * удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
20
+
21
+ ## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
22
+
23
+ ## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
29
+
30
+ ## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
31
+
32
+ ## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
33
+
34
+ ### Bug Fixes
35
+
36
+ - исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
37
+
5
38
  ## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-7...v6.0.0-8) (2025-09-11)
6
39
 
7
40
  ## [6.0.0-7](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-6...v6.0.0-7) (2025-09-10)
8
41
 
9
-
10
42
  ### Bug Fixes
11
43
 
12
- * исправлена проблема с подстановкой sql-комментариев в формулы. ([a07cbbe](https://github.com/Infomaximum/widget-sdk/commit/a07cbbe3d1597d9eb22bdeb0ee4621abecbd5740))
44
+ - исправлена проблема с подстановкой sql-комментариев в формулы. ([a07cbbe](https://github.com/Infomaximum/widget-sdk/commit/a07cbbe3d1597d9eb22bdeb0ee4621abecbd5740))
13
45
 
14
46
  ## [6.0.0-6](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-5...v6.0.0-6) (2025-09-02)
15
47
 
16
-
17
48
  ### ⚠ BREAKING CHANGES
18
49
 
19
- * Удален formattingTemplate. Изменены поля формат и форматирование
50
+ - Удален formattingTemplate. Изменены поля формат и форматирование
20
51
 
21
52
  ### Features
22
53
 
23
- * изменены формат и форматирование. Удален formattingTemplate. Добавлен новый контрол inputTemplated. ([7c3d230](https://github.com/Infomaximum/widget-sdk/commit/7c3d230c443f897d20be4ec4a23f6fe6b914a213))
54
+ - изменены формат и форматирование. Удален formattingTemplate. Добавлен новый контрол inputTemplated. ([7c3d230](https://github.com/Infomaximum/widget-sdk/commit/7c3d230c443f897d20be4ec4a23f6fe6b914a213))
24
55
 
25
56
  ## [6.0.0-5](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-4...v6.0.0-5) (2025-09-01)
26
57
 
27
-
28
58
  ### Features
29
59
 
30
- * добавлена поддержка фильтрации шаблонов мер и агригатных разрезов [WD-1197] ([af49cc3](https://github.com/Infomaximum/widget-sdk/commit/af49cc3ff7840f0d7762c6c40eb1bf183a32d4b7))
31
- * добавлена фильтрация шаблонов для процессных разрезов времяни [WD-1197] ([564cd57](https://github.com/Infomaximum/widget-sdk/commit/564cd5782276c4ec74c8d26de109f0d2e9deec50))
60
+ - добавлена поддержка фильтрации шаблонов мер и агригатных разрезов [WD-1197] ([af49cc3](https://github.com/Infomaximum/widget-sdk/commit/af49cc3ff7840f0d7762c6c40eb1bf183a32d4b7))
61
+ - добавлена фильтрация шаблонов для процессных разрезов времяни [WD-1197] ([564cd57](https://github.com/Infomaximum/widget-sdk/commit/564cd5782276c4ec74c8d26de109f0d2e9deec50))
32
62
 
33
63
  ## [6.0.0-4](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-3...v6.0.0-4) (2025-08-29)
34
64
 
35
-
36
65
  ### ⚠ BREAKING CHANGES
37
66
 
38
- * если виджеты использовали типы данных процесса, то теперь должны запрашивать их сами через type_calculator
39
- * требуется поддержка в виджетах
67
+ - если виджеты использовали типы данных процесса, то теперь должны запрашивать их сами через type_calculator
68
+ - требуется поддержка в виджетах
40
69
 
41
70
  ### Features
42
71
 
43
- * удален deprecated код в связи с переходом на widget-sdk 6 ([c1ce6cb](https://github.com/Infomaximum/widget-sdk/commit/c1ce6cb5f3838a4bfea3003ee2de0cb494477e8c))
44
- * удалены типы данных из интерфейса процесса ([3b17150](https://github.com/Infomaximum/widget-sdk/commit/3b17150ef67facaf50e489ec308a69fad1d6db82))
72
+ - удален deprecated код в связи с переходом на widget-sdk 6 ([c1ce6cb](https://github.com/Infomaximum/widget-sdk/commit/c1ce6cb5f3838a4bfea3003ee2de0cb494477e8c))
73
+ - удалены типы данных из интерфейса процесса ([3b17150](https://github.com/Infomaximum/widget-sdk/commit/3b17150ef67facaf50e489ec308a69fad1d6db82))
45
74
 
46
75
  ## [6.0.0-3](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2...v6.0.0-3) (2025-08-28)
47
76
 
48
-
49
77
  ### Features
50
78
 
51
- * виджета дана возможность фильтровать таблицы в дропдаунах кнопок добавления индикаторов и фильтрации по процессам ([cb9fd22](https://github.com/Infomaximum/widget-sdk/commit/cb9fd22cbf6ebf12f0261949ab9d467edcaf0a36))
79
+ - виджета дана возможность фильтровать таблицы в дропдаунах кнопок добавления индикаторов и фильтрации по процессам ([cb9fd22](https://github.com/Infomaximum/widget-sdk/commit/cb9fd22cbf6ebf12f0261949ab9d467edcaf0a36))
52
80
 
53
81
  ## [6.0.0-2](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-1...v6.0.0-2) (2025-08-26)
54
82
 
55
-
56
83
  ### ⚠ BREAKING CHANGES
57
84
 
58
- * - Виджеты, использующие импорты, связанные со старым синтаксисом ссылок, будут работать некорректно в новой версии системы (dashboardLinkRegExp, workspaceLinkRegExp, parseIndicatorLink, getRuleColor, isValidColor).
59
- - Функция escapeSpecialCharacters заменена на escapeDoubleQuoteLinkName.
60
- - Константа linkNameRegExp удалена - вместо нее используется curlyBracketsContentPattern.
85
+ - - Виджеты, использующие импорты, связанные со старым синтаксисом ссылок, будут работать некорректно в новой версии системы (dashboardLinkRegExp, workspaceLinkRegExp, parseIndicatorLink, getRuleColor, isValidColor).
86
+
87
+ * Функция escapeSpecialCharacters заменена на escapeDoubleQuoteLinkName.
88
+ * Константа linkNameRegExp удалена - вместо нее используется curlyBracketsContentPattern.
61
89
 
62
90
  ### Features
63
91
 
64
- * добавлена поддержка нового синтаксиса ссылок на показатели ([7449482](https://github.com/Infomaximum/widget-sdk/commit/74494820ae4ca9e05f5d225ad243a57ca0a6d6aa))
92
+ - добавлена поддержка нового синтаксиса ссылок на показатели ([7449482](https://github.com/Infomaximum/widget-sdk/commit/74494820ae4ca9e05f5d225ad243a57ca0a6d6aa))
65
93
 
66
94
  ## [6.0.0-1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-0...v6.0.0-1) (2025-08-26)
67
95
 
68
-
69
96
  ### ⚠ BREAKING CHANGES
70
97
 
71
- * если виджет использовал guid, то требуется поддержка
98
+ - если виджет использовал guid, то требуется поддержка
72
99
 
73
100
  ### Features
74
101
 
75
- * удален guid из интерфейсов. ([f50d978](https://github.com/Infomaximum/widget-sdk/commit/f50d9781ab2fc41ed1deb3fafee262e4c4057db1))
102
+ - удален guid из интерфейсов. ([f50d978](https://github.com/Infomaximum/widget-sdk/commit/f50d9781ab2fc41ed1deb3fafee262e4c4057db1))
76
103
 
77
104
  ## [6.0.0-0](https://github.com/Infomaximum/widget-sdk/compare/v5.33.1...v6.0.0-0) (2025-08-20)
78
105
 
79
-
80
106
  ### ⚠ BREAKING CHANGES
81
107
 
82
- * получение ф-ии шаблона процессной агрегации для меры через константу "measureAggregationTemplates" заменено на получение через ф-ию "createAggregationFormulaByTemplateName"
83
- * поле actions удалено из настроек виджетов
108
+ - получение ф-ии шаблона процессной агрегации для меры через константу "measureAggregationTemplates" заменено на получение через ф-ию "createAggregationFormulaByTemplateName"
109
+ - поле actions удалено из настроек виджетов
84
110
 
85
111
  ### Features
86
112
 
87
- * отказ от поля actions в пользу actionButtons в настройках виджетов ([2ee361a](https://github.com/Infomaximum/widget-sdk/commit/2ee361a5ab1478e1b0ad90feae2256cf90d46058))
88
- * расширен IInputControl полями hint и hintPlacement. Для запуска скрипта из действий по клику добавлена подсказка ([63d02d6](https://github.com/Infomaximum/widget-sdk/commit/63d02d68bc38bb6d6b1bb2dfd1898d4b948ee6fc))
89
-
113
+ - отказ от поля actions в пользу actionButtons в настройках виджетов ([2ee361a](https://github.com/Infomaximum/widget-sdk/commit/2ee361a5ab1478e1b0ad90feae2256cf90d46058))
114
+ - расширен IInputControl полями hint и hintPlacement. Для запуска скрипта из действий по клику добавлена подсказка ([63d02d6](https://github.com/Infomaximum/widget-sdk/commit/63d02d68bc38bb6d6b1bb2dfd1898d4b948ee6fc))
90
115
 
91
- * From BI-15231 into master (#92) ([8257237](https://github.com/Infomaximum/widget-sdk/commit/8257237e12b42ee403378408d0bb5007853c379d)), closes [#92](https://github.com/Infomaximum/widget-sdk/issues/92)
116
+ - From BI-15231 into master (#92) ([8257237](https://github.com/Infomaximum/widget-sdk/commit/8257237e12b42ee403378408d0bb5007853c379d)), closes [#92](https://github.com/Infomaximum/widget-sdk/issues/92)
92
117
 
93
118
  ### [5.33.1](https://github.com/Infomaximum/widget-sdk/compare/v5.33.0...v5.33.1) (2025-08-15)
94
119
 
95
120
  ## [5.33.0](https://github.com/Infomaximum/widget-sdk/compare/v5.32.1...v5.33.0) (2025-08-06)
96
121
 
97
-
98
122
  ### Features
99
123
 
100
- * расширены шаблоны процессных агрегаций ([f2bfbaf](https://github.com/Infomaximum/widget-sdk/commit/f2bfbafb557ba72ae605d906ae1341109adf3894))
124
+ - расширены шаблоны процессных агрегаций ([f2bfbaf](https://github.com/Infomaximum/widget-sdk/commit/f2bfbafb557ba72ae605d906ae1341109adf3894))
101
125
 
102
126
  ### [5.32.1](https://github.com/Infomaximum/widget-sdk/compare/v5.32.0...v5.32.1) (2025-08-05)
103
127
 
104
-
105
128
  ### Bug Fixes
106
129
 
107
- * исправлена типизация ответов вычислителей ([0453793](https://github.com/Infomaximum/widget-sdk/commit/04537930ba1916d300b279e658a7e9b8da191af4))
130
+ - исправлена типизация ответов вычислителей ([0453793](https://github.com/Infomaximum/widget-sdk/commit/04537930ba1916d300b279e658a7e9b8da191af4))
108
131
 
109
132
  ## [5.32.0](https://github.com/Infomaximum/widget-sdk/compare/v5.31.0...v5.32.0) (2025-07-31)
110
133
 
111
-
112
134
  ### Features
113
135
 
114
- * добавлена возможность управления якорем для сохранения положения виджета ([3bd5610](https://github.com/Infomaximum/widget-sdk/commit/3bd561058e48055ec10f99c53f88f2fcddf18d94))
136
+ - добавлена возможность управления якорем для сохранения положения виджета ([3bd5610](https://github.com/Infomaximum/widget-sdk/commit/3bd561058e48055ec10f99c53f88f2fcddf18d94))
115
137
 
116
138
  ## [5.31.0](https://github.com/Infomaximum/widget-sdk/compare/v5.30.0...v5.31.0) (2025-07-17)
117
139
 
@@ -119,15 +141,13 @@ All notable changes to this project will be documented in this file. See [standa
119
141
 
120
142
  ## [5.29.0-0](https://github.com/Infomaximum/widget-sdk/compare/v5.28.0...v5.29.0-0) (2025-07-10)
121
143
 
122
-
123
144
  ### Features
124
145
 
125
- * отказ от имени процесса ([4fa01d5](https://github.com/Infomaximum/widget-sdk/commit/4fa01d5c2602211810277d0b6aef6b4d5f62e19c))
126
-
146
+ - отказ от имени процесса ([4fa01d5](https://github.com/Infomaximum/widget-sdk/commit/4fa01d5c2602211810277d0b6aef6b4d5f62e19c))
127
147
 
128
148
  ### Bug Fixes
129
149
 
130
- * deprecated поле processName для интерфейса IProcessGraphCalculatorInput сделано необзятельным ([859f959](https://github.com/Infomaximum/widget-sdk/commit/859f959ea963ea2ed9214ccc4a4dc43a8b49142c))
150
+ - deprecated поле processName для интерфейса IProcessGraphCalculatorInput сделано необзятельным ([859f959](https://github.com/Infomaximum/widget-sdk/commit/859f959ea963ea2ed9214ccc4a4dc43a8b49142c))
131
151
 
132
152
  ## [5.30.0](https://github.com/Infomaximum/widget-sdk/compare/v5.29.0...v5.30.0) (2025-07-15)
133
153
 
package/README.md CHANGED
@@ -12,5 +12,7 @@
12
12
  | ------------------- | -------------- |
13
13
  | 3.x.x | 2401 - 2407 |
14
14
  | 4.x.x | 2408 - 2411 |
15
- | 5.x.x | 2412 - latest |
15
+ | 5.x.x | 2412 - 2507 |
16
+ | 6.x.x | 2508 - latest |
17
+
16
18
  ---
package/dist/index.d.ts CHANGED
@@ -255,7 +255,7 @@ interface IBaseWidgetSettings {
255
255
  markdownMeasures?: IMarkdownMeasure[];
256
256
  markdownText?: string;
257
257
  markdownTextSize?: number;
258
- filters?: TExtendedFormulaFilterValue[];
258
+ filters?: TSettingsFilter[];
259
259
  filterMode?: EWidgetFilterMode;
260
260
  ignoreFilters?: boolean;
261
261
  sorting?: IWidgetSortingIndicator[];
@@ -554,11 +554,11 @@ type TWidgetIndicatorDurationValue = {
554
554
  type TWidgetIndicatorTimeValue = {
555
555
  templateName: string;
556
556
  mode: EWidgetIndicatorValueModes.START_TIME | EWidgetIndicatorValueModes.END_TIME;
557
- processKey: string;
558
- eventName: string;
559
- eventTimeFormula: string;
560
- caseCaseIdFormula: string;
561
- eventNameFormula: string;
557
+ processKey: string | null;
558
+ eventName: string | null;
559
+ eventTimeFormula: string | null;
560
+ caseCaseIdFormula: string | null;
561
+ eventNameFormula: string | null;
562
562
  filters: TExtendedFormulaFilterValue[];
563
563
  };
564
564
 
@@ -849,6 +849,24 @@ interface IFormulaFilterValue {
849
849
  [EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
850
850
  }>;
851
851
  }
852
+ declare enum EDimensionProcessFilterTimeUnit {
853
+ YEARS = "YEARS",
854
+ MONTHS = "MONTHS",
855
+ HOURS = "HOURS",
856
+ DAYS = "DAYS",
857
+ MINUTES = "MINUTES"
858
+ }
859
+ interface IDimensionProcessFilter {
860
+ value: Extract<IFormulaControl["value"]["value"], {
861
+ mode: EWidgetIndicatorValueModes.AGGREGATION | EWidgetIndicatorValueModes.START_TIME | EWidgetIndicatorValueModes.END_TIME | EWidgetIndicatorValueModes.FORMULA;
862
+ }>;
863
+ dbDataType: string;
864
+ condition: {
865
+ filteringMethod: valueof<typeof formulaFilterMethods>;
866
+ timeUnit?: EDimensionProcessFilterTimeUnit;
867
+ values: (string | null)[];
868
+ };
869
+ }
852
870
  type TExtendedFormulaFilterValue = {
853
871
  formula: string;
854
872
  } | IFormulaFilterValue;
@@ -907,7 +925,9 @@ interface IWidgetFiltration {
907
925
  /** Удалить фильтр по этапам */
908
926
  removeStagesFilter(widgetKey: string): void;
909
927
  }
928
+ type TSettingsFilter = TExtendedFormulaFilterValue | IDimensionProcessFilter;
910
929
  declare const isFormulaFilterValue: (value: TExtendedFormulaFilterValue) => value is IFormulaFilterValue;
930
+ declare const isDimensionProcessFilter: (filter: TSettingsFilter) => filter is IDimensionProcessFilter;
911
931
 
912
932
  declare enum EWidgetActionInputMethod {
913
933
  COLUMN = "COLUMN",
@@ -1122,7 +1142,7 @@ interface IActionButton extends IAutoIdentifiedArrayItem {
1122
1142
  color: TColor;
1123
1143
  hint?: string;
1124
1144
  }
1125
- type TViewActionParameter = (IParameterFromAggregation | IParameterFromVariable) & {
1145
+ type TViewActionParameter = (IParameterFromAggregation | IParameterFromVariable) & IAutoIdentifiedArrayItem & {
1126
1146
  name: string;
1127
1147
  };
1128
1148
  interface IViewAction {
@@ -1313,7 +1333,6 @@ interface IInputControl {
1313
1333
  type: EControlType.input;
1314
1334
  value: string;
1315
1335
  props: {
1316
- isBordered?: boolean;
1317
1336
  placeholder?: string;
1318
1337
  /** Максимальное количество символов которое можно ввести в поле */
1319
1338
  maxLength?: number;
@@ -1752,6 +1771,8 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
1752
1771
 
1753
1772
  declare const prepareValuesForSql: (simpleType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
1754
1773
 
1774
+ declare const mapSettingsFiltersToInputs: (filters: TSettingsFilter[]) => ICalculatorFilter[];
1775
+
1755
1776
  declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
1756
1777
  declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
1757
1778
  declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
@@ -1910,6 +1931,9 @@ declare enum EDimensionTemplateNames {
1910
1931
  declare const dimensionTemplateFormulas: Record<EDimensionTemplateNames, string>;
1911
1932
 
1912
1933
  declare function getDimensionFormula({ value }: IWidgetDimension): string;
1934
+ declare function getProcessDimensionValueFormula(value: (TWidgetIndicatorAggregationValue & {
1935
+ innerTemplateName?: string;
1936
+ }) | TWidgetIndicatorTimeValue): string | undefined;
1913
1937
 
1914
1938
  declare enum EDimensionAggregationTemplateName {
1915
1939
  avg = "avg",
@@ -1934,7 +1958,6 @@ declare const prepareDimensionAggregationParams: (value: Extract<IWidgetDimensio
1934
1958
  eventNameFormula: string;
1935
1959
  caseCaseIdFormula: string;
1936
1960
  eventName: string;
1937
- objectFilters: string;
1938
1961
  filters: string;
1939
1962
  eventTimeFormula: string;
1940
1963
  columnFormula: string;
@@ -1997,8 +2020,7 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
1997
2020
  outerAggregation: EOuterAggregation;
1998
2021
  eventNameFormula: string;
1999
2022
  caseCaseIdFormula: string;
2000
- eventName: string | null;
2001
- objectFilters: string;
2023
+ eventName: string;
2002
2024
  filters: string;
2003
2025
  eventTimeFormula: string;
2004
2026
  columnFormula: string;
@@ -2008,7 +2030,6 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
2008
2030
  declare const conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
2009
2031
  /** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
2010
2032
  declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
2011
- objectFilters: string;
2012
2033
  startEventTimeFormula: string;
2013
2034
  startEventNameFormula: string;
2014
2035
  startEventFilters: string;
@@ -2028,7 +2049,6 @@ declare function createAggregationTemplate(templateName: EMeasureAggregationTemp
2028
2049
  declare const durationTemplates: Record<EDurationTemplateName, string>;
2029
2050
  /** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
2030
2051
  declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
2031
- objectFilters: string;
2032
2052
  startEventTimeFormula: string;
2033
2053
  startEventNameFormula: string;
2034
2054
  startEventFilters: string;
@@ -2042,7 +2062,7 @@ declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
2042
2062
  endEventAggregationName: string;
2043
2063
  } | null;
2044
2064
 
2045
- declare function getEventMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
2065
+ declare function getEventMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
2046
2066
 
2047
2067
  declare enum EEventMeasureTemplateNames {
2048
2068
  eventsCount = "eventsCount",
@@ -2053,7 +2073,7 @@ declare const eventMeasureTemplateFormulas: {
2053
2073
  readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
2054
2074
  };
2055
2075
 
2056
- declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
2076
+ declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
2057
2077
 
2058
2078
  declare enum ETransitionMeasureTemplateNames {
2059
2079
  transitionsCount = "transitionsCount",
@@ -2069,7 +2089,7 @@ declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in '
2069
2089
  /** @deprecated - следует использовать fillTemplateSql */
2070
2090
  declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
2071
2091
  /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
2072
- declare function fillTemplateSql(templateString: string, params: Record<string, any>): string;
2092
+ declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
2073
2093
 
2074
2094
  declare function generateColumnFormula(tableName: string, columnName: string): string;
2075
2095
 
@@ -2493,7 +2513,7 @@ type TContextMenuButtonOptions = {
2493
2513
 
2494
2514
  /** Контекст с данными образа (будет заполняться по мере необходимости) */
2495
2515
  interface IViewContext {
2496
- filters: TExtendedFormulaFilterValue[];
2516
+ filters: TSettingsFilter[];
2497
2517
  }
2498
2518
 
2499
2519
  type TLaunchActionParams = {
@@ -2732,4 +2752,4 @@ declare global {
2732
2752
  }
2733
2753
  }
2734
2754
 
2735
- export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionButton, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, 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 IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IParameterColumnList, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IParameterTableList, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, OuterAggregation, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorBase, 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 TControlUnion, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
2755
+ export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionButton, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionProcessFilter, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, 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 IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IParameterColumnList, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IParameterTableList, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, OuterAggregation, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorBase, 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 TControlUnion, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSettingsFilter, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.esm.js CHANGED
@@ -212,9 +212,18 @@ var EFormulaFilterFieldKeys;
212
212
  EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
213
213
  EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
214
214
  })(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
215
+ var EDimensionProcessFilterTimeUnit;
216
+ (function (EDimensionProcessFilterTimeUnit) {
217
+ EDimensionProcessFilterTimeUnit["YEARS"] = "YEARS";
218
+ EDimensionProcessFilterTimeUnit["MONTHS"] = "MONTHS";
219
+ EDimensionProcessFilterTimeUnit["HOURS"] = "HOURS";
220
+ EDimensionProcessFilterTimeUnit["DAYS"] = "DAYS";
221
+ EDimensionProcessFilterTimeUnit["MINUTES"] = "MINUTES";
222
+ })(EDimensionProcessFilterTimeUnit || (EDimensionProcessFilterTimeUnit = {}));
215
223
  var isFormulaFilterValue = function (value) {
216
224
  return "filteringMethod" in value;
217
225
  };
226
+ var isDimensionProcessFilter = function (filter) { return "value" in filter && "condition" in filter; };
218
227
 
219
228
  var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
220
229
  var compactMap = function (items, f) {
@@ -639,7 +648,7 @@ var formattingConfig = {
639
648
  },
640
649
  };
641
650
 
642
- var _a$4;
651
+ var _a$5;
643
652
  var EDimensionTemplateNames;
644
653
  (function (EDimensionTemplateNames) {
645
654
  EDimensionTemplateNames["dateTime"] = "dateTime";
@@ -655,19 +664,19 @@ var EDimensionTemplateNames;
655
664
  EDimensionTemplateNames["hour"] = "hour";
656
665
  })(EDimensionTemplateNames || (EDimensionTemplateNames = {}));
657
666
  /** Стандартные шаблоны разреза */
658
- var dimensionTemplateFormulas = (_a$4 = {},
659
- _a$4[EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
660
- _a$4[EDimensionTemplateNames.date] = "toDate({columnFormula})",
661
- _a$4[EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
662
- _a$4[EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
663
- _a$4[EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
664
- _a$4[EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
665
- _a$4[EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
666
- _a$4[EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
667
- _a$4[EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
668
- _a$4[EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
669
- _a$4[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
670
- _a$4);
667
+ var dimensionTemplateFormulas = (_a$5 = {},
668
+ _a$5[EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
669
+ _a$5[EDimensionTemplateNames.date] = "toDate({columnFormula})",
670
+ _a$5[EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
671
+ _a$5[EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
672
+ _a$5[EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
673
+ _a$5[EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
674
+ _a$5[EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
675
+ _a$5[EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
676
+ _a$5[EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
677
+ _a$5[EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
678
+ _a$5[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
679
+ _a$5);
671
680
 
672
681
  var EWidgetIndicatorType;
673
682
  (function (EWidgetIndicatorType) {
@@ -807,17 +816,13 @@ function fillTemplateSql(templateString, params) {
807
816
  try {
808
817
  for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
809
818
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
810
- if (!value) {
811
- newParams[key] = value;
812
- break;
813
- }
814
819
  /** Эвристическая проверка на возможное присутствие sql-комментария в значении подставляемом в template
815
820
  */
816
- if (typeof value === "string" && value.indexOf("--") >= 0) {
821
+ if (String(value).indexOf("--") >= 0) {
817
822
  newParams[key] = "".concat(value, "\n");
818
- break;
823
+ continue;
819
824
  }
820
- newParams[key] = value;
825
+ newParams[key] = String(value);
821
826
  }
822
827
  }
823
828
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -983,7 +988,7 @@ var convertFiltersToFormula = function (filters) {
983
988
  return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
984
989
  };
985
990
 
986
- var _a$3;
991
+ var _a$4;
987
992
  var EDimensionAggregationTemplateName;
988
993
  (function (EDimensionAggregationTemplateName) {
989
994
  EDimensionAggregationTemplateName["avg"] = "avg";
@@ -1000,20 +1005,20 @@ var EDimensionAggregationTemplateName;
1000
1005
  EDimensionAggregationTemplateName["countReworks"] = "countReworks";
1001
1006
  })(EDimensionAggregationTemplateName || (EDimensionAggregationTemplateName = {}));
1002
1007
  /** Шаблоны процессных метрик разреза с режимом AGGREGATION */
1003
- var dimensionAggregationTemplates = (_a$3 = {},
1004
- _a$3[EDimensionAggregationTemplateName.avg] = avgTemplate,
1005
- _a$3[EDimensionAggregationTemplateName.median] = medianTemplate,
1006
- _a$3[EDimensionAggregationTemplateName.count] = countTemplate,
1007
- _a$3[EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
1008
- _a$3[EDimensionAggregationTemplateName.min] = minTemplate,
1009
- _a$3[EDimensionAggregationTemplateName.max] = maxTemplate,
1010
- _a$3[EDimensionAggregationTemplateName.sum] = sumTemplate,
1011
- _a$3[EDimensionAggregationTemplateName.top] = topTemplate,
1012
- _a$3[EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
1013
- _a$3[EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
1014
- _a$3[EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
1015
- _a$3[EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
1016
- _a$3);
1008
+ var dimensionAggregationTemplates = (_a$4 = {},
1009
+ _a$4[EDimensionAggregationTemplateName.avg] = avgTemplate,
1010
+ _a$4[EDimensionAggregationTemplateName.median] = medianTemplate,
1011
+ _a$4[EDimensionAggregationTemplateName.count] = countTemplate,
1012
+ _a$4[EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
1013
+ _a$4[EDimensionAggregationTemplateName.min] = minTemplate,
1014
+ _a$4[EDimensionAggregationTemplateName.max] = maxTemplate,
1015
+ _a$4[EDimensionAggregationTemplateName.sum] = sumTemplate,
1016
+ _a$4[EDimensionAggregationTemplateName.top] = topTemplate,
1017
+ _a$4[EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
1018
+ _a$4[EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
1019
+ _a$4[EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
1020
+ _a$4[EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
1021
+ _a$4);
1017
1022
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1018
1023
  var prepareDimensionAggregationParams = function (value) {
1019
1024
  if (!value.eventName ||
@@ -1027,7 +1032,6 @@ var prepareDimensionAggregationParams = function (value) {
1027
1032
  eventNameFormula: value.eventNameFormula,
1028
1033
  caseCaseIdFormula: value.caseCaseIdFormula,
1029
1034
  eventName: value.eventName,
1030
- objectFilters: "1",
1031
1035
  filters: convertFiltersToFormula(value.filters),
1032
1036
  eventTimeFormula: "",
1033
1037
  columnFormula: "",
@@ -1085,7 +1089,7 @@ var prepareTimeParams = function (value) {
1085
1089
  };
1086
1090
 
1087
1091
  function getDimensionFormula(_a) {
1088
- var _b;
1092
+ var _b, _c;
1089
1093
  var value = _a.value;
1090
1094
  if (!value) {
1091
1095
  return "";
@@ -1103,6 +1107,9 @@ function getDimensionFormula(_a) {
1103
1107
  columnFormula: generateColumnFormula(tableName, columnName),
1104
1108
  });
1105
1109
  }
1110
+ return (_c = getProcessDimensionValueFormula(value)) !== null && _c !== void 0 ? _c : "";
1111
+ }
1112
+ function getProcessDimensionValueFormula(value) {
1106
1113
  if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
1107
1114
  var preparedParams = prepareDimensionAggregationParams(value);
1108
1115
  if (!preparedParams) {
@@ -1126,7 +1133,6 @@ function getDimensionFormula(_a) {
1126
1133
  var templateFormula = timeTemplates[value.mode][value.templateName];
1127
1134
  return fillTemplateSql(templateFormula, preparedParams);
1128
1135
  }
1129
- return "";
1130
1136
  }
1131
1137
 
1132
1138
  var EMeasureAggregationTemplateName;
@@ -1146,6 +1152,7 @@ var EMeasureAggregationTemplateName;
1146
1152
  })(EMeasureAggregationTemplateName || (EMeasureAggregationTemplateName = {}));
1147
1153
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1148
1154
  var prepareMeasureAggregationParams = function (value) {
1155
+ var _a;
1149
1156
  if ((!value.anyEvent && !value.eventName) ||
1150
1157
  !value.caseCaseIdFormula ||
1151
1158
  !value.eventNameFormula ||
@@ -1158,8 +1165,7 @@ var prepareMeasureAggregationParams = function (value) {
1158
1165
  outerAggregation: value.outerAggregation,
1159
1166
  eventNameFormula: value.eventNameFormula,
1160
1167
  caseCaseIdFormula: value.caseCaseIdFormula,
1161
- eventName: value.eventName,
1162
- objectFilters: "1",
1168
+ eventName: (_a = value.eventName) !== null && _a !== void 0 ? _a : "",
1163
1169
  filters: convertFiltersToFormula(value.filters),
1164
1170
  eventTimeFormula: "",
1165
1171
  columnFormula: "",
@@ -1180,7 +1186,7 @@ var prepareMeasureAggregationParams = function (value) {
1180
1186
  return columnParams;
1181
1187
  };
1182
1188
 
1183
- var _a$2;
1189
+ var _a$3;
1184
1190
  var EMeasureTemplateNames;
1185
1191
  (function (EMeasureTemplateNames) {
1186
1192
  EMeasureTemplateNames["avg"] = "avg";
@@ -1192,15 +1198,15 @@ var EMeasureTemplateNames;
1192
1198
  EMeasureTemplateNames["sum"] = "sum";
1193
1199
  })(EMeasureTemplateNames || (EMeasureTemplateNames = {}));
1194
1200
  /** Стандартные шаблоны меры */
1195
- var measureTemplateFormulas = (_a$2 = {},
1196
- _a$2[EMeasureTemplateNames.avg] = "avg({columnFormula})",
1197
- _a$2[EMeasureTemplateNames.count] = "count({columnFormula})",
1198
- _a$2[EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
1199
- _a$2[EMeasureTemplateNames.median] = "medianExact({columnFormula})",
1200
- _a$2[EMeasureTemplateNames.min] = "min({columnFormula})",
1201
- _a$2[EMeasureTemplateNames.max] = "max({columnFormula})",
1202
- _a$2[EMeasureTemplateNames.sum] = "sum({columnFormula})",
1203
- _a$2);
1201
+ var measureTemplateFormulas = (_a$3 = {},
1202
+ _a$3[EMeasureTemplateNames.avg] = "avg({columnFormula})",
1203
+ _a$3[EMeasureTemplateNames.count] = "count({columnFormula})",
1204
+ _a$3[EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
1205
+ _a$3[EMeasureTemplateNames.median] = "medianExact({columnFormula})",
1206
+ _a$3[EMeasureTemplateNames.min] = "min({columnFormula})",
1207
+ _a$3[EMeasureTemplateNames.max] = "max({columnFormula})",
1208
+ _a$3[EMeasureTemplateNames.sum] = "sum({columnFormula})",
1209
+ _a$3);
1204
1210
 
1205
1211
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1206
1212
  var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
@@ -1218,7 +1224,6 @@ var prepareConversionParams = function (value) {
1218
1224
  return null;
1219
1225
  }
1220
1226
  return {
1221
- objectFilters: "1",
1222
1227
  startEventTimeFormula: value.startEventTimeFormula,
1223
1228
  startEventNameFormula: value.startEventNameFormula,
1224
1229
  startEventFilters: convertFiltersToFormula(value.startEventFilters),
@@ -1257,7 +1262,6 @@ var prepareDurationParams = function (value) {
1257
1262
  return appearance === EEventAppearances.FIRST ? "minIf" : "maxIf";
1258
1263
  };
1259
1264
  return {
1260
- objectFilters: "1",
1261
1265
  startEventTimeFormula: value.startEventTimeFormula,
1262
1266
  startEventNameFormula: value.startEventNameFormula,
1263
1267
  startEventFilters: convertFiltersToFormula(value.startEventFilters),
@@ -1273,16 +1277,16 @@ var prepareDurationParams = function (value) {
1273
1277
  };
1274
1278
 
1275
1279
  function createAnyEventTemplate(aggregatePart) {
1276
- return "{outerAggregation}If(process(".concat(aggregatePart, ", {caseCaseIdFormula}), {objectFilters})");
1280
+ return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
1277
1281
  }
1278
1282
  function createSpecificEventTemplate(fn, additionalFn) {
1279
- return "{outerAggregation}If(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})");
1283
+ return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}))");
1280
1284
  }
1281
1285
  function createTopLikeTemplate(template) {
1282
1286
  return function (outerAggregation) {
1283
1287
  return outerAggregation === EOuterAggregation.top
1284
- ? "{outerAggregation}KIf(1)(".concat(template, ", {objectFilters})[1]")
1285
- : "{outerAggregation}If(".concat(template, ", {objectFilters})");
1288
+ ? "{outerAggregation}K(1)(".concat(template, ")[1]")
1289
+ : "{outerAggregation}(".concat(template, ")");
1286
1290
  };
1287
1291
  }
1288
1292
  function createAggregationTemplate(templateName, _a) {
@@ -1329,9 +1333,9 @@ function createAggregationTemplate(templateName, _a) {
1329
1333
  ? createAnyEventTemplate("argMax({columnFormula}, {eventTimeFormula})")
1330
1334
  : createTopLikeTemplate(lastValueTemplate)(outerAggregation);
1331
1335
  case EMeasureAggregationTemplateName.countExecutions:
1332
- return "{outerAggregation}If(".concat(countExecutionsTemplate, ", {objectFilters})");
1336
+ return "{outerAggregation}(".concat(countExecutionsTemplate, ")");
1333
1337
  case EMeasureAggregationTemplateName.countReworks:
1334
- return "{outerAggregation}If(".concat(countReworksTemplate, ", {objectFilters})");
1338
+ return "{outerAggregation}(".concat(countReworksTemplate, ")");
1335
1339
  }
1336
1340
  }
1337
1341
 
@@ -1380,16 +1384,16 @@ function getMeasureFormula(_a) {
1380
1384
  return "";
1381
1385
  }
1382
1386
 
1383
- var _a$1;
1387
+ var _a$2;
1384
1388
  var EEventMeasureTemplateNames;
1385
1389
  (function (EEventMeasureTemplateNames) {
1386
1390
  EEventMeasureTemplateNames["eventsCount"] = "eventsCount";
1387
1391
  EEventMeasureTemplateNames["reworksCount"] = "reworksCount";
1388
1392
  })(EEventMeasureTemplateNames || (EEventMeasureTemplateNames = {}));
1389
- var eventMeasureTemplateFormulas = (_a$1 = {},
1390
- _a$1[EEventMeasureTemplateNames.eventsCount] = "count()",
1391
- _a$1[EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
1392
- _a$1);
1393
+ var eventMeasureTemplateFormulas = (_a$2 = {},
1394
+ _a$2[EEventMeasureTemplateNames.eventsCount] = "count()",
1395
+ _a$2[EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
1396
+ _a$2);
1393
1397
 
1394
1398
  function getEventMeasureFormula(_a, process) {
1395
1399
  var value = _a.value;
@@ -1406,16 +1410,16 @@ function getEventMeasureFormula(_a, process) {
1406
1410
  return "";
1407
1411
  }
1408
1412
 
1409
- var _a;
1413
+ var _a$1;
1410
1414
  var ETransitionMeasureTemplateNames;
1411
1415
  (function (ETransitionMeasureTemplateNames) {
1412
1416
  ETransitionMeasureTemplateNames["transitionsCount"] = "transitionsCount";
1413
1417
  ETransitionMeasureTemplateNames["medianTime"] = "medianTime";
1414
1418
  })(ETransitionMeasureTemplateNames || (ETransitionMeasureTemplateNames = {}));
1415
- var transitionMeasureTemplateFormulas = (_a = {},
1416
- _a[ETransitionMeasureTemplateNames.transitionsCount] = "count()",
1417
- _a[ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
1418
- _a);
1419
+ var transitionMeasureTemplateFormulas = (_a$1 = {},
1420
+ _a$1[ETransitionMeasureTemplateNames.transitionsCount] = "count()",
1421
+ _a$1[ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
1422
+ _a$1);
1419
1423
 
1420
1424
  function getTransitionMeasureFormula(_a, process) {
1421
1425
  var value = _a.value;
@@ -1654,6 +1658,46 @@ var mapFormulaFiltersToInputs = function (filters) {
1654
1658
  return compactMap(filters, mapFormulaFilterToCalculatorInput);
1655
1659
  };
1656
1660
 
1661
+ var _a;
1662
+ var intervalByUnit = (_a = {},
1663
+ _a[EDimensionProcessFilterTimeUnit.YEARS] = "year",
1664
+ _a[EDimensionProcessFilterTimeUnit.MONTHS] = "month",
1665
+ _a[EDimensionProcessFilterTimeUnit.DAYS] = "day",
1666
+ _a[EDimensionProcessFilterTimeUnit.HOURS] = "hour",
1667
+ _a[EDimensionProcessFilterTimeUnit.MINUTES] = "minute",
1668
+ _a);
1669
+ function mapDimensionProcessFilterToCalculatorInput(filter) {
1670
+ var formula = filter.value.mode === EWidgetIndicatorValueModes.FORMULA
1671
+ ? filter.value.formula
1672
+ : getProcessDimensionValueFormula(filter.value);
1673
+ if (formula === undefined) {
1674
+ throw new Error("Formula generation error");
1675
+ }
1676
+ var _a = filter.condition, timeUnit = _a.timeUnit, filteringMethod = _a.filteringMethod, values = _a.values;
1677
+ if (filteringMethod === "LAST_TIME") {
1678
+ if (!timeUnit) {
1679
+ throw new Error("Missing time unit");
1680
+ }
1681
+ return {
1682
+ dbDataType: EClickHouseBaseTypes.Bool,
1683
+ formula: "date_diff('".concat(intervalByUnit[timeUnit], "', ").concat(formula, ", now())"),
1684
+ values: values,
1685
+ filteringMethod: formulaFilterMethods.LESS_THAN_OR_EQUAL_TO,
1686
+ };
1687
+ }
1688
+ return { formula: formula, filteringMethod: filteringMethod, values: values, dbDataType: filter.dbDataType };
1689
+ }
1690
+
1691
+ var mapSettingsFilterToCalculatorInput = function (filter) {
1692
+ if (isDimensionProcessFilter(filter)) {
1693
+ return mapDimensionProcessFilterToCalculatorInput(filter);
1694
+ }
1695
+ return mapFormulaFilterToCalculatorInput(filter);
1696
+ };
1697
+ var mapSettingsFiltersToInputs = function (filters) {
1698
+ return compactMap(filters, mapSettingsFilterToCalculatorInput);
1699
+ };
1700
+
1657
1701
  function mapMeasureToInput(measure, variables, addFormulas) {
1658
1702
  if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
1659
1703
  var mainFormula = getMeasureFormula(measure);
@@ -2148,4 +2192,4 @@ var getColorByIndex = function (index) {
2148
2192
  return color;
2149
2193
  };
2150
2194
 
2151
- export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
2195
+ export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.js CHANGED
@@ -213,9 +213,18 @@ exports.EFormulaFilterFieldKeys = void 0;
213
213
  EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
214
214
  EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
215
215
  })(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
216
+ exports.EDimensionProcessFilterTimeUnit = void 0;
217
+ (function (EDimensionProcessFilterTimeUnit) {
218
+ EDimensionProcessFilterTimeUnit["YEARS"] = "YEARS";
219
+ EDimensionProcessFilterTimeUnit["MONTHS"] = "MONTHS";
220
+ EDimensionProcessFilterTimeUnit["HOURS"] = "HOURS";
221
+ EDimensionProcessFilterTimeUnit["DAYS"] = "DAYS";
222
+ EDimensionProcessFilterTimeUnit["MINUTES"] = "MINUTES";
223
+ })(exports.EDimensionProcessFilterTimeUnit || (exports.EDimensionProcessFilterTimeUnit = {}));
216
224
  var isFormulaFilterValue = function (value) {
217
225
  return "filteringMethod" in value;
218
226
  };
227
+ var isDimensionProcessFilter = function (filter) { return "value" in filter && "condition" in filter; };
219
228
 
220
229
  var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
221
230
  var compactMap = function (items, f) {
@@ -640,7 +649,7 @@ var formattingConfig = {
640
649
  },
641
650
  };
642
651
 
643
- var _a$4;
652
+ var _a$5;
644
653
  exports.EDimensionTemplateNames = void 0;
645
654
  (function (EDimensionTemplateNames) {
646
655
  EDimensionTemplateNames["dateTime"] = "dateTime";
@@ -656,19 +665,19 @@ exports.EDimensionTemplateNames = void 0;
656
665
  EDimensionTemplateNames["hour"] = "hour";
657
666
  })(exports.EDimensionTemplateNames || (exports.EDimensionTemplateNames = {}));
658
667
  /** Стандартные шаблоны разреза */
659
- var dimensionTemplateFormulas = (_a$4 = {},
660
- _a$4[exports.EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
661
- _a$4[exports.EDimensionTemplateNames.date] = "toDate({columnFormula})",
662
- _a$4[exports.EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
663
- _a$4[exports.EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
664
- _a$4[exports.EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
665
- _a$4[exports.EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
666
- _a$4[exports.EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
667
- _a$4[exports.EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
668
- _a$4[exports.EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
669
- _a$4[exports.EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
670
- _a$4[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
671
- _a$4);
668
+ var dimensionTemplateFormulas = (_a$5 = {},
669
+ _a$5[exports.EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
670
+ _a$5[exports.EDimensionTemplateNames.date] = "toDate({columnFormula})",
671
+ _a$5[exports.EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
672
+ _a$5[exports.EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
673
+ _a$5[exports.EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
674
+ _a$5[exports.EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
675
+ _a$5[exports.EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
676
+ _a$5[exports.EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
677
+ _a$5[exports.EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
678
+ _a$5[exports.EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
679
+ _a$5[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
680
+ _a$5);
672
681
 
673
682
  exports.EWidgetIndicatorType = void 0;
674
683
  (function (EWidgetIndicatorType) {
@@ -808,17 +817,13 @@ function fillTemplateSql(templateString, params) {
808
817
  try {
809
818
  for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
810
819
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
811
- if (!value) {
812
- newParams[key] = value;
813
- break;
814
- }
815
820
  /** Эвристическая проверка на возможное присутствие sql-комментария в значении подставляемом в template
816
821
  */
817
- if (typeof value === "string" && value.indexOf("--") >= 0) {
822
+ if (String(value).indexOf("--") >= 0) {
818
823
  newParams[key] = "".concat(value, "\n");
819
- break;
824
+ continue;
820
825
  }
821
- newParams[key] = value;
826
+ newParams[key] = String(value);
822
827
  }
823
828
  }
824
829
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -984,7 +989,7 @@ var convertFiltersToFormula = function (filters) {
984
989
  return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
985
990
  };
986
991
 
987
- var _a$3;
992
+ var _a$4;
988
993
  exports.EDimensionAggregationTemplateName = void 0;
989
994
  (function (EDimensionAggregationTemplateName) {
990
995
  EDimensionAggregationTemplateName["avg"] = "avg";
@@ -1001,20 +1006,20 @@ exports.EDimensionAggregationTemplateName = void 0;
1001
1006
  EDimensionAggregationTemplateName["countReworks"] = "countReworks";
1002
1007
  })(exports.EDimensionAggregationTemplateName || (exports.EDimensionAggregationTemplateName = {}));
1003
1008
  /** Шаблоны процессных метрик разреза с режимом AGGREGATION */
1004
- var dimensionAggregationTemplates = (_a$3 = {},
1005
- _a$3[exports.EDimensionAggregationTemplateName.avg] = avgTemplate,
1006
- _a$3[exports.EDimensionAggregationTemplateName.median] = medianTemplate,
1007
- _a$3[exports.EDimensionAggregationTemplateName.count] = countTemplate,
1008
- _a$3[exports.EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
1009
- _a$3[exports.EDimensionAggregationTemplateName.min] = minTemplate,
1010
- _a$3[exports.EDimensionAggregationTemplateName.max] = maxTemplate,
1011
- _a$3[exports.EDimensionAggregationTemplateName.sum] = sumTemplate,
1012
- _a$3[exports.EDimensionAggregationTemplateName.top] = topTemplate,
1013
- _a$3[exports.EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
1014
- _a$3[exports.EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
1015
- _a$3[exports.EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
1016
- _a$3[exports.EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
1017
- _a$3);
1009
+ var dimensionAggregationTemplates = (_a$4 = {},
1010
+ _a$4[exports.EDimensionAggregationTemplateName.avg] = avgTemplate,
1011
+ _a$4[exports.EDimensionAggregationTemplateName.median] = medianTemplate,
1012
+ _a$4[exports.EDimensionAggregationTemplateName.count] = countTemplate,
1013
+ _a$4[exports.EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
1014
+ _a$4[exports.EDimensionAggregationTemplateName.min] = minTemplate,
1015
+ _a$4[exports.EDimensionAggregationTemplateName.max] = maxTemplate,
1016
+ _a$4[exports.EDimensionAggregationTemplateName.sum] = sumTemplate,
1017
+ _a$4[exports.EDimensionAggregationTemplateName.top] = topTemplate,
1018
+ _a$4[exports.EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
1019
+ _a$4[exports.EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
1020
+ _a$4[exports.EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
1021
+ _a$4[exports.EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
1022
+ _a$4);
1018
1023
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1019
1024
  var prepareDimensionAggregationParams = function (value) {
1020
1025
  if (!value.eventName ||
@@ -1028,7 +1033,6 @@ var prepareDimensionAggregationParams = function (value) {
1028
1033
  eventNameFormula: value.eventNameFormula,
1029
1034
  caseCaseIdFormula: value.caseCaseIdFormula,
1030
1035
  eventName: value.eventName,
1031
- objectFilters: "1",
1032
1036
  filters: convertFiltersToFormula(value.filters),
1033
1037
  eventTimeFormula: "",
1034
1038
  columnFormula: "",
@@ -1086,7 +1090,7 @@ var prepareTimeParams = function (value) {
1086
1090
  };
1087
1091
 
1088
1092
  function getDimensionFormula(_a) {
1089
- var _b;
1093
+ var _b, _c;
1090
1094
  var value = _a.value;
1091
1095
  if (!value) {
1092
1096
  return "";
@@ -1104,6 +1108,9 @@ function getDimensionFormula(_a) {
1104
1108
  columnFormula: generateColumnFormula(tableName, columnName),
1105
1109
  });
1106
1110
  }
1111
+ return (_c = getProcessDimensionValueFormula(value)) !== null && _c !== void 0 ? _c : "";
1112
+ }
1113
+ function getProcessDimensionValueFormula(value) {
1107
1114
  if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
1108
1115
  var preparedParams = prepareDimensionAggregationParams(value);
1109
1116
  if (!preparedParams) {
@@ -1127,7 +1134,6 @@ function getDimensionFormula(_a) {
1127
1134
  var templateFormula = timeTemplates[value.mode][value.templateName];
1128
1135
  return fillTemplateSql(templateFormula, preparedParams);
1129
1136
  }
1130
- return "";
1131
1137
  }
1132
1138
 
1133
1139
  exports.EMeasureAggregationTemplateName = void 0;
@@ -1147,6 +1153,7 @@ exports.EMeasureAggregationTemplateName = void 0;
1147
1153
  })(exports.EMeasureAggregationTemplateName || (exports.EMeasureAggregationTemplateName = {}));
1148
1154
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1149
1155
  var prepareMeasureAggregationParams = function (value) {
1156
+ var _a;
1150
1157
  if ((!value.anyEvent && !value.eventName) ||
1151
1158
  !value.caseCaseIdFormula ||
1152
1159
  !value.eventNameFormula ||
@@ -1159,8 +1166,7 @@ var prepareMeasureAggregationParams = function (value) {
1159
1166
  outerAggregation: value.outerAggregation,
1160
1167
  eventNameFormula: value.eventNameFormula,
1161
1168
  caseCaseIdFormula: value.caseCaseIdFormula,
1162
- eventName: value.eventName,
1163
- objectFilters: "1",
1169
+ eventName: (_a = value.eventName) !== null && _a !== void 0 ? _a : "",
1164
1170
  filters: convertFiltersToFormula(value.filters),
1165
1171
  eventTimeFormula: "",
1166
1172
  columnFormula: "",
@@ -1181,7 +1187,7 @@ var prepareMeasureAggregationParams = function (value) {
1181
1187
  return columnParams;
1182
1188
  };
1183
1189
 
1184
- var _a$2;
1190
+ var _a$3;
1185
1191
  exports.EMeasureTemplateNames = void 0;
1186
1192
  (function (EMeasureTemplateNames) {
1187
1193
  EMeasureTemplateNames["avg"] = "avg";
@@ -1193,15 +1199,15 @@ exports.EMeasureTemplateNames = void 0;
1193
1199
  EMeasureTemplateNames["sum"] = "sum";
1194
1200
  })(exports.EMeasureTemplateNames || (exports.EMeasureTemplateNames = {}));
1195
1201
  /** Стандартные шаблоны меры */
1196
- var measureTemplateFormulas = (_a$2 = {},
1197
- _a$2[exports.EMeasureTemplateNames.avg] = "avg({columnFormula})",
1198
- _a$2[exports.EMeasureTemplateNames.count] = "count({columnFormula})",
1199
- _a$2[exports.EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
1200
- _a$2[exports.EMeasureTemplateNames.median] = "medianExact({columnFormula})",
1201
- _a$2[exports.EMeasureTemplateNames.min] = "min({columnFormula})",
1202
- _a$2[exports.EMeasureTemplateNames.max] = "max({columnFormula})",
1203
- _a$2[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
1204
- _a$2);
1202
+ var measureTemplateFormulas = (_a$3 = {},
1203
+ _a$3[exports.EMeasureTemplateNames.avg] = "avg({columnFormula})",
1204
+ _a$3[exports.EMeasureTemplateNames.count] = "count({columnFormula})",
1205
+ _a$3[exports.EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
1206
+ _a$3[exports.EMeasureTemplateNames.median] = "medianExact({columnFormula})",
1207
+ _a$3[exports.EMeasureTemplateNames.min] = "min({columnFormula})",
1208
+ _a$3[exports.EMeasureTemplateNames.max] = "max({columnFormula})",
1209
+ _a$3[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
1210
+ _a$3);
1205
1211
 
1206
1212
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1207
1213
  var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
@@ -1219,7 +1225,6 @@ var prepareConversionParams = function (value) {
1219
1225
  return null;
1220
1226
  }
1221
1227
  return {
1222
- objectFilters: "1",
1223
1228
  startEventTimeFormula: value.startEventTimeFormula,
1224
1229
  startEventNameFormula: value.startEventNameFormula,
1225
1230
  startEventFilters: convertFiltersToFormula(value.startEventFilters),
@@ -1258,7 +1263,6 @@ var prepareDurationParams = function (value) {
1258
1263
  return appearance === exports.EEventAppearances.FIRST ? "minIf" : "maxIf";
1259
1264
  };
1260
1265
  return {
1261
- objectFilters: "1",
1262
1266
  startEventTimeFormula: value.startEventTimeFormula,
1263
1267
  startEventNameFormula: value.startEventNameFormula,
1264
1268
  startEventFilters: convertFiltersToFormula(value.startEventFilters),
@@ -1274,16 +1278,16 @@ var prepareDurationParams = function (value) {
1274
1278
  };
1275
1279
 
1276
1280
  function createAnyEventTemplate(aggregatePart) {
1277
- return "{outerAggregation}If(process(".concat(aggregatePart, ", {caseCaseIdFormula}), {objectFilters})");
1281
+ return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
1278
1282
  }
1279
1283
  function createSpecificEventTemplate(fn, additionalFn) {
1280
- return "{outerAggregation}If(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})");
1284
+ return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}))");
1281
1285
  }
1282
1286
  function createTopLikeTemplate(template) {
1283
1287
  return function (outerAggregation) {
1284
1288
  return outerAggregation === exports.EOuterAggregation.top
1285
- ? "{outerAggregation}KIf(1)(".concat(template, ", {objectFilters})[1]")
1286
- : "{outerAggregation}If(".concat(template, ", {objectFilters})");
1289
+ ? "{outerAggregation}K(1)(".concat(template, ")[1]")
1290
+ : "{outerAggregation}(".concat(template, ")");
1287
1291
  };
1288
1292
  }
1289
1293
  function createAggregationTemplate(templateName, _a) {
@@ -1330,9 +1334,9 @@ function createAggregationTemplate(templateName, _a) {
1330
1334
  ? createAnyEventTemplate("argMax({columnFormula}, {eventTimeFormula})")
1331
1335
  : createTopLikeTemplate(lastValueTemplate)(outerAggregation);
1332
1336
  case exports.EMeasureAggregationTemplateName.countExecutions:
1333
- return "{outerAggregation}If(".concat(countExecutionsTemplate, ", {objectFilters})");
1337
+ return "{outerAggregation}(".concat(countExecutionsTemplate, ")");
1334
1338
  case exports.EMeasureAggregationTemplateName.countReworks:
1335
- return "{outerAggregation}If(".concat(countReworksTemplate, ", {objectFilters})");
1339
+ return "{outerAggregation}(".concat(countReworksTemplate, ")");
1336
1340
  }
1337
1341
  }
1338
1342
 
@@ -1381,16 +1385,16 @@ function getMeasureFormula(_a) {
1381
1385
  return "";
1382
1386
  }
1383
1387
 
1384
- var _a$1;
1388
+ var _a$2;
1385
1389
  exports.EEventMeasureTemplateNames = void 0;
1386
1390
  (function (EEventMeasureTemplateNames) {
1387
1391
  EEventMeasureTemplateNames["eventsCount"] = "eventsCount";
1388
1392
  EEventMeasureTemplateNames["reworksCount"] = "reworksCount";
1389
1393
  })(exports.EEventMeasureTemplateNames || (exports.EEventMeasureTemplateNames = {}));
1390
- var eventMeasureTemplateFormulas = (_a$1 = {},
1391
- _a$1[exports.EEventMeasureTemplateNames.eventsCount] = "count()",
1392
- _a$1[exports.EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
1393
- _a$1);
1394
+ var eventMeasureTemplateFormulas = (_a$2 = {},
1395
+ _a$2[exports.EEventMeasureTemplateNames.eventsCount] = "count()",
1396
+ _a$2[exports.EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
1397
+ _a$2);
1394
1398
 
1395
1399
  function getEventMeasureFormula(_a, process) {
1396
1400
  var value = _a.value;
@@ -1407,16 +1411,16 @@ function getEventMeasureFormula(_a, process) {
1407
1411
  return "";
1408
1412
  }
1409
1413
 
1410
- var _a;
1414
+ var _a$1;
1411
1415
  exports.ETransitionMeasureTemplateNames = void 0;
1412
1416
  (function (ETransitionMeasureTemplateNames) {
1413
1417
  ETransitionMeasureTemplateNames["transitionsCount"] = "transitionsCount";
1414
1418
  ETransitionMeasureTemplateNames["medianTime"] = "medianTime";
1415
1419
  })(exports.ETransitionMeasureTemplateNames || (exports.ETransitionMeasureTemplateNames = {}));
1416
- var transitionMeasureTemplateFormulas = (_a = {},
1417
- _a[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
1418
- _a[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
1419
- _a);
1420
+ var transitionMeasureTemplateFormulas = (_a$1 = {},
1421
+ _a$1[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
1422
+ _a$1[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
1423
+ _a$1);
1420
1424
 
1421
1425
  function getTransitionMeasureFormula(_a, process) {
1422
1426
  var value = _a.value;
@@ -1655,6 +1659,46 @@ var mapFormulaFiltersToInputs = function (filters) {
1655
1659
  return compactMap(filters, mapFormulaFilterToCalculatorInput);
1656
1660
  };
1657
1661
 
1662
+ var _a;
1663
+ var intervalByUnit = (_a = {},
1664
+ _a[exports.EDimensionProcessFilterTimeUnit.YEARS] = "year",
1665
+ _a[exports.EDimensionProcessFilterTimeUnit.MONTHS] = "month",
1666
+ _a[exports.EDimensionProcessFilterTimeUnit.DAYS] = "day",
1667
+ _a[exports.EDimensionProcessFilterTimeUnit.HOURS] = "hour",
1668
+ _a[exports.EDimensionProcessFilterTimeUnit.MINUTES] = "minute",
1669
+ _a);
1670
+ function mapDimensionProcessFilterToCalculatorInput(filter) {
1671
+ var formula = filter.value.mode === exports.EWidgetIndicatorValueModes.FORMULA
1672
+ ? filter.value.formula
1673
+ : getProcessDimensionValueFormula(filter.value);
1674
+ if (formula === undefined) {
1675
+ throw new Error("Formula generation error");
1676
+ }
1677
+ var _a = filter.condition, timeUnit = _a.timeUnit, filteringMethod = _a.filteringMethod, values = _a.values;
1678
+ if (filteringMethod === "LAST_TIME") {
1679
+ if (!timeUnit) {
1680
+ throw new Error("Missing time unit");
1681
+ }
1682
+ return {
1683
+ dbDataType: exports.EClickHouseBaseTypes.Bool,
1684
+ formula: "date_diff('".concat(intervalByUnit[timeUnit], "', ").concat(formula, ", now())"),
1685
+ values: values,
1686
+ filteringMethod: formulaFilterMethods.LESS_THAN_OR_EQUAL_TO,
1687
+ };
1688
+ }
1689
+ return { formula: formula, filteringMethod: filteringMethod, values: values, dbDataType: filter.dbDataType };
1690
+ }
1691
+
1692
+ var mapSettingsFilterToCalculatorInput = function (filter) {
1693
+ if (isDimensionProcessFilter(filter)) {
1694
+ return mapDimensionProcessFilterToCalculatorInput(filter);
1695
+ }
1696
+ return mapFormulaFilterToCalculatorInput(filter);
1697
+ };
1698
+ var mapSettingsFiltersToInputs = function (filters) {
1699
+ return compactMap(filters, mapSettingsFilterToCalculatorInput);
1700
+ };
1701
+
1658
1702
  function mapMeasureToInput(measure, variables, addFormulas) {
1659
1703
  if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
1660
1704
  var mainFormula = getMeasureFormula(measure);
@@ -2192,8 +2236,10 @@ exports.getDisplayConditionFormula = getDisplayConditionFormula;
2192
2236
  exports.getEventMeasureFormula = getEventMeasureFormula;
2193
2237
  exports.getLocalizedText = getLocalizedText;
2194
2238
  exports.getMeasureFormula = getMeasureFormula;
2239
+ exports.getProcessDimensionValueFormula = getProcessDimensionValueFormula;
2195
2240
  exports.getRuleColor = getRuleColor;
2196
2241
  exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
2242
+ exports.isDimensionProcessFilter = isDimensionProcessFilter;
2197
2243
  exports.isDimensionsHierarchy = isDimensionsHierarchy;
2198
2244
  exports.isFormulaFilterValue = isFormulaFilterValue;
2199
2245
  exports.isValidColor = isValidColor;
@@ -2202,6 +2248,7 @@ exports.mapEventMeasuresToInputs = mapEventMeasuresToInputs;
2202
2248
  exports.mapFormulaFilterToCalculatorInput = mapFormulaFilterToCalculatorInput;
2203
2249
  exports.mapFormulaFiltersToInputs = mapFormulaFiltersToInputs;
2204
2250
  exports.mapMeasuresToInputs = mapMeasuresToInputs;
2251
+ exports.mapSettingsFiltersToInputs = mapSettingsFiltersToInputs;
2205
2252
  exports.mapSortingToInputs = mapSortingToInputs;
2206
2253
  exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
2207
2254
  exports.measureTemplateFormulas = measureTemplateFormulas;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "6.0.0-8",
3
+ "version": "6.0.0-view-theme.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",