@infomaximum/widget-sdk 6.0.0-2508.4 → 6.0.0-2509.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 +52 -53
- package/dist/index.d.ts +20 -12
- package/dist/index.esm.js +119 -38
- package/dist/index.js +119 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,149 +2,150 @@
|
|
|
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-
|
|
5
|
+
## [6.0.0-2509.0](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-13...v6.0.0-2509.0) (2026-05-15)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Bug Fixes
|
|
9
9
|
|
|
10
|
-
*
|
|
10
|
+
* исправлен пропуск NULL-строк в фильтре по формуле [BI-16341] ([9e5da85](https://github.com/Infomaximum/widget-sdk/commit/9e5da85249aba553337988207c2cfd904301ef3d))
|
|
11
11
|
|
|
12
|
-
## [6.0.0-
|
|
12
|
+
## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-12...v6.0.0-13) (2025-10-01)
|
|
13
13
|
|
|
14
|
-
## [6.0.0-2508.2](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-2508.2) (2025-09-23)
|
|
15
14
|
|
|
15
|
+
### Bug Fixes
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
* исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
|
|
20
20
|
|
|
21
|
-
## [6.0.0-2508.1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-2508.1) (2025-09-12)
|
|
22
21
|
|
|
22
|
+
### Features
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
* для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
|
|
25
|
+
|
|
26
|
+
## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-10...v6.0.0-11) (2025-09-23)
|
|
25
27
|
|
|
26
|
-
* в виджетах требуется обработать получение нового типа фильтра
|
|
27
28
|
|
|
28
29
|
### Features
|
|
29
30
|
|
|
30
|
-
*
|
|
31
|
+
* удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
|
|
32
|
+
|
|
33
|
+
## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
|
|
34
|
+
|
|
35
|
+
## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
|
|
31
36
|
|
|
32
37
|
|
|
33
38
|
### Bug Fixes
|
|
34
39
|
|
|
35
|
-
*
|
|
36
|
-
* поле timeUnit сделано необязательным в фильтре по процессному разрезу ([3c97c94](https://github.com/Infomaximum/widget-sdk/commit/3c97c94a1fb7e7112dd9c4737346d50ca746c84d))
|
|
40
|
+
* исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
|
|
37
41
|
|
|
38
|
-
## [6.0.0-
|
|
42
|
+
## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
|
|
39
43
|
|
|
40
|
-
## [6.0.0-
|
|
44
|
+
## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
|
|
41
45
|
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
- исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
|
|
49
|
+
|
|
50
|
+
## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-7...v6.0.0-8) (2025-09-11)
|
|
51
|
+
|
|
52
|
+
## [6.0.0-7](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-6...v6.0.0-7) (2025-09-10)
|
|
42
53
|
|
|
43
54
|
### Bug Fixes
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
- исправлена проблема с подстановкой sql-комментариев в формулы. ([a07cbbe](https://github.com/Infomaximum/widget-sdk/commit/a07cbbe3d1597d9eb22bdeb0ee4621abecbd5740))
|
|
46
57
|
|
|
47
58
|
## [6.0.0-6](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-5...v6.0.0-6) (2025-09-02)
|
|
48
59
|
|
|
49
|
-
|
|
50
60
|
### ⚠ BREAKING CHANGES
|
|
51
61
|
|
|
52
|
-
|
|
62
|
+
- Удален formattingTemplate. Изменены поля формат и форматирование
|
|
53
63
|
|
|
54
64
|
### Features
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
- изменены формат и форматирование. Удален formattingTemplate. Добавлен новый контрол inputTemplated. ([7c3d230](https://github.com/Infomaximum/widget-sdk/commit/7c3d230c443f897d20be4ec4a23f6fe6b914a213))
|
|
57
67
|
|
|
58
68
|
## [6.0.0-5](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-4...v6.0.0-5) (2025-09-01)
|
|
59
69
|
|
|
60
|
-
|
|
61
70
|
### Features
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
- добавлена поддержка фильтрации шаблонов мер и агригатных разрезов [WD-1197] ([af49cc3](https://github.com/Infomaximum/widget-sdk/commit/af49cc3ff7840f0d7762c6c40eb1bf183a32d4b7))
|
|
73
|
+
- добавлена фильтрация шаблонов для процессных разрезов времяни [WD-1197] ([564cd57](https://github.com/Infomaximum/widget-sdk/commit/564cd5782276c4ec74c8d26de109f0d2e9deec50))
|
|
65
74
|
|
|
66
75
|
## [6.0.0-4](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-3...v6.0.0-4) (2025-08-29)
|
|
67
76
|
|
|
68
|
-
|
|
69
77
|
### ⚠ BREAKING CHANGES
|
|
70
78
|
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
- если виджеты использовали типы данных процесса, то теперь должны запрашивать их сами через type_calculator
|
|
80
|
+
- требуется поддержка в виджетах
|
|
73
81
|
|
|
74
82
|
### Features
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
- удален deprecated код в связи с переходом на widget-sdk 6 ([c1ce6cb](https://github.com/Infomaximum/widget-sdk/commit/c1ce6cb5f3838a4bfea3003ee2de0cb494477e8c))
|
|
85
|
+
- удалены типы данных из интерфейса процесса ([3b17150](https://github.com/Infomaximum/widget-sdk/commit/3b17150ef67facaf50e489ec308a69fad1d6db82))
|
|
78
86
|
|
|
79
87
|
## [6.0.0-3](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2...v6.0.0-3) (2025-08-28)
|
|
80
88
|
|
|
81
|
-
|
|
82
89
|
### Features
|
|
83
90
|
|
|
84
|
-
|
|
91
|
+
- виджета дана возможность фильтровать таблицы в дропдаунах кнопок добавления индикаторов и фильтрации по процессам ([cb9fd22](https://github.com/Infomaximum/widget-sdk/commit/cb9fd22cbf6ebf12f0261949ab9d467edcaf0a36))
|
|
85
92
|
|
|
86
93
|
## [6.0.0-2](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-1...v6.0.0-2) (2025-08-26)
|
|
87
94
|
|
|
88
|
-
|
|
89
95
|
### ⚠ BREAKING CHANGES
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
- - Виджеты, использующие импорты, связанные со старым синтаксисом ссылок, будут работать некорректно в новой версии системы (dashboardLinkRegExp, workspaceLinkRegExp, parseIndicatorLink, getRuleColor, isValidColor).
|
|
98
|
+
|
|
99
|
+
* Функция escapeSpecialCharacters заменена на escapeDoubleQuoteLinkName.
|
|
100
|
+
* Константа linkNameRegExp удалена - вместо нее используется curlyBracketsContentPattern.
|
|
94
101
|
|
|
95
102
|
### Features
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
- добавлена поддержка нового синтаксиса ссылок на показатели ([7449482](https://github.com/Infomaximum/widget-sdk/commit/74494820ae4ca9e05f5d225ad243a57ca0a6d6aa))
|
|
98
105
|
|
|
99
106
|
## [6.0.0-1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-0...v6.0.0-1) (2025-08-26)
|
|
100
107
|
|
|
101
|
-
|
|
102
108
|
### ⚠ BREAKING CHANGES
|
|
103
109
|
|
|
104
|
-
|
|
110
|
+
- если виджет использовал guid, то требуется поддержка
|
|
105
111
|
|
|
106
112
|
### Features
|
|
107
113
|
|
|
108
|
-
|
|
114
|
+
- удален guid из интерфейсов. ([f50d978](https://github.com/Infomaximum/widget-sdk/commit/f50d9781ab2fc41ed1deb3fafee262e4c4057db1))
|
|
109
115
|
|
|
110
116
|
## [6.0.0-0](https://github.com/Infomaximum/widget-sdk/compare/v5.33.1...v6.0.0-0) (2025-08-20)
|
|
111
117
|
|
|
112
|
-
|
|
113
118
|
### ⚠ BREAKING CHANGES
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
- получение ф-ии шаблона процессной агрегации для меры через константу "measureAggregationTemplates" заменено на получение через ф-ию "createAggregationFormulaByTemplateName"
|
|
121
|
+
- поле actions удалено из настроек виджетов
|
|
117
122
|
|
|
118
123
|
### Features
|
|
119
124
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
- отказ от поля actions в пользу actionButtons в настройках виджетов ([2ee361a](https://github.com/Infomaximum/widget-sdk/commit/2ee361a5ab1478e1b0ad90feae2256cf90d46058))
|
|
126
|
+
- расширен IInputControl полями hint и hintPlacement. Для запуска скрипта из действий по клику добавлена подсказка ([63d02d6](https://github.com/Infomaximum/widget-sdk/commit/63d02d68bc38bb6d6b1bb2dfd1898d4b948ee6fc))
|
|
123
127
|
|
|
124
|
-
|
|
128
|
+
- 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)
|
|
125
129
|
|
|
126
130
|
### [5.33.1](https://github.com/Infomaximum/widget-sdk/compare/v5.33.0...v5.33.1) (2025-08-15)
|
|
127
131
|
|
|
128
132
|
## [5.33.0](https://github.com/Infomaximum/widget-sdk/compare/v5.32.1...v5.33.0) (2025-08-06)
|
|
129
133
|
|
|
130
|
-
|
|
131
134
|
### Features
|
|
132
135
|
|
|
133
|
-
|
|
136
|
+
- расширены шаблоны процессных агрегаций ([f2bfbaf](https://github.com/Infomaximum/widget-sdk/commit/f2bfbafb557ba72ae605d906ae1341109adf3894))
|
|
134
137
|
|
|
135
138
|
### [5.32.1](https://github.com/Infomaximum/widget-sdk/compare/v5.32.0...v5.32.1) (2025-08-05)
|
|
136
139
|
|
|
137
|
-
|
|
138
140
|
### Bug Fixes
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
- исправлена типизация ответов вычислителей ([0453793](https://github.com/Infomaximum/widget-sdk/commit/04537930ba1916d300b279e658a7e9b8da191af4))
|
|
141
143
|
|
|
142
144
|
## [5.32.0](https://github.com/Infomaximum/widget-sdk/compare/v5.31.0...v5.32.0) (2025-07-31)
|
|
143
145
|
|
|
144
|
-
|
|
145
146
|
### Features
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
- добавлена возможность управления якорем для сохранения положения виджета ([3bd5610](https://github.com/Infomaximum/widget-sdk/commit/3bd561058e48055ec10f99c53f88f2fcddf18d94))
|
|
148
149
|
|
|
149
150
|
## [5.31.0](https://github.com/Infomaximum/widget-sdk/compare/v5.30.0...v5.31.0) (2025-07-17)
|
|
150
151
|
|
|
@@ -152,15 +153,13 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
152
153
|
|
|
153
154
|
## [5.29.0-0](https://github.com/Infomaximum/widget-sdk/compare/v5.28.0...v5.29.0-0) (2025-07-10)
|
|
154
155
|
|
|
155
|
-
|
|
156
156
|
### Features
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
- отказ от имени процесса ([4fa01d5](https://github.com/Infomaximum/widget-sdk/commit/4fa01d5c2602211810277d0b6aef6b4d5f62e19c))
|
|
160
159
|
|
|
161
160
|
### Bug Fixes
|
|
162
161
|
|
|
163
|
-
|
|
162
|
+
- deprecated поле processName для интерфейса IProcessGraphCalculatorInput сделано необзятельным ([859f959](https://github.com/Infomaximum/widget-sdk/commit/859f959ea963ea2ed9214ccc4a4dc43a8b49142c))
|
|
164
163
|
|
|
165
164
|
## [5.30.0](https://github.com/Infomaximum/widget-sdk/compare/v5.29.0...v5.30.0) (2025-07-15)
|
|
166
165
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1142,7 +1142,7 @@ interface IActionButton extends IAutoIdentifiedArrayItem {
|
|
|
1142
1142
|
color: TColor;
|
|
1143
1143
|
hint?: string;
|
|
1144
1144
|
}
|
|
1145
|
-
type TViewActionParameter = (IParameterFromAggregation | IParameterFromVariable) & {
|
|
1145
|
+
type TViewActionParameter = (IParameterFromAggregation | IParameterFromVariable) & IAutoIdentifiedArrayItem & {
|
|
1146
1146
|
name: string;
|
|
1147
1147
|
};
|
|
1148
1148
|
interface IViewAction {
|
|
@@ -1777,20 +1777,25 @@ declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondi
|
|
|
1777
1777
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1778
1778
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
1779
1779
|
/**
|
|
1780
|
-
* Шаблон формулы для
|
|
1780
|
+
* Шаблон формулы для приведения произвольного выражения к Boolean.
|
|
1781
|
+
* Используется и для display-condition виджетов/вкладок/инпутов,
|
|
1782
|
+
* и для фильтров по формуле.
|
|
1781
1783
|
*
|
|
1784
|
+
* NULL отсекается явной проверкой isNotNull (трактуется как false).
|
|
1785
|
+
* Остальные непреобразуемые к Boolean значения подпадают под дефолт true.
|
|
1786
|
+
*
|
|
1787
|
+
* - null -> false (явная проверка isNotNull)
|
|
1782
1788
|
* - 0 -> false
|
|
1783
1789
|
* - 1 -> true
|
|
1784
1790
|
* - 15 -> true
|
|
1785
|
-
* - '0' ->
|
|
1791
|
+
* - '0' -> false
|
|
1786
1792
|
* - '1' -> true
|
|
1787
|
-
* - '15' ->
|
|
1793
|
+
* - '15' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1788
1794
|
* - 'false' -> false
|
|
1789
1795
|
* - 'true' -> true
|
|
1790
1796
|
* - 'abc' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1791
|
-
* - null -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1792
1797
|
*/
|
|
1793
|
-
declare const displayConditionTemplate = "accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1798
|
+
declare const displayConditionTemplate = "isNotNull({formula}) AND accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1794
1799
|
|
|
1795
1800
|
/** Конвертировать меры виджета во входы для вычислителя */
|
|
1796
1801
|
declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
@@ -2020,14 +2025,14 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
|
|
|
2020
2025
|
outerAggregation: EOuterAggregation;
|
|
2021
2026
|
eventNameFormula: string;
|
|
2022
2027
|
caseCaseIdFormula: string;
|
|
2023
|
-
eventName: string
|
|
2028
|
+
eventName: string;
|
|
2024
2029
|
filters: string;
|
|
2025
2030
|
eventTimeFormula: string;
|
|
2026
2031
|
columnFormula: string;
|
|
2027
2032
|
} | null;
|
|
2028
2033
|
|
|
2029
2034
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
2030
|
-
declare const conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
2035
|
+
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)";
|
|
2031
2036
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
2032
2037
|
declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
|
|
2033
2038
|
startEventTimeFormula: string;
|
|
@@ -2062,7 +2067,7 @@ declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
|
|
|
2062
2067
|
endEventAggregationName: string;
|
|
2063
2068
|
} | null;
|
|
2064
2069
|
|
|
2065
|
-
declare function getEventMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
|
|
2070
|
+
declare function getEventMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
|
|
2066
2071
|
|
|
2067
2072
|
declare enum EEventMeasureTemplateNames {
|
|
2068
2073
|
eventsCount = "eventsCount",
|
|
@@ -2073,7 +2078,7 @@ declare const eventMeasureTemplateFormulas: {
|
|
|
2073
2078
|
readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
|
|
2074
2079
|
};
|
|
2075
2080
|
|
|
2076
|
-
declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
|
|
2081
|
+
declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
|
|
2077
2082
|
|
|
2078
2083
|
declare enum ETransitionMeasureTemplateNames {
|
|
2079
2084
|
transitionsCount = "transitionsCount",
|
|
@@ -2084,9 +2089,12 @@ declare const transitionMeasureTemplateFormulas: {
|
|
|
2084
2089
|
readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
|
|
2085
2090
|
};
|
|
2086
2091
|
|
|
2087
|
-
declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
2092
|
+
declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
2088
2093
|
|
|
2094
|
+
/** @deprecated - следует использовать fillTemplateSql */
|
|
2089
2095
|
declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
|
|
2096
|
+
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
2097
|
+
declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
|
|
2090
2098
|
|
|
2091
2099
|
declare function generateColumnFormula(tableName: string, columnName: string): string;
|
|
2092
2100
|
|
|
@@ -2749,4 +2757,4 @@ declare global {
|
|
|
2749
2757
|
}
|
|
2750
2758
|
}
|
|
2751
2759
|
|
|
2752
|
-
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, 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 };
|
|
2760
|
+
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
|
@@ -132,6 +132,35 @@ function __rest(s, e) {
|
|
|
132
132
|
return t;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
function __values(o) {
|
|
136
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
137
|
+
if (m) return m.call(o);
|
|
138
|
+
if (o && typeof o.length === "number") return {
|
|
139
|
+
next: function () {
|
|
140
|
+
if (o && i >= o.length) o = void 0;
|
|
141
|
+
return { value: o && o[i++], done: !o };
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function __read(o, n) {
|
|
148
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
149
|
+
if (!m) return o;
|
|
150
|
+
var i = m.call(o), r, ar = [], e;
|
|
151
|
+
try {
|
|
152
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
153
|
+
}
|
|
154
|
+
catch (error) { e = { error: error }; }
|
|
155
|
+
finally {
|
|
156
|
+
try {
|
|
157
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
158
|
+
}
|
|
159
|
+
finally { if (e) throw e.error; }
|
|
160
|
+
}
|
|
161
|
+
return ar;
|
|
162
|
+
}
|
|
163
|
+
|
|
135
164
|
function __makeTemplateObject(cooked, raw) {
|
|
136
165
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
137
166
|
return cooked;
|
|
@@ -757,14 +786,14 @@ var EEventAppearances;
|
|
|
757
786
|
})(EEventAppearances || (EEventAppearances = {}));
|
|
758
787
|
|
|
759
788
|
function createAggregationTemplate$1(functionName, options) {
|
|
760
|
-
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} =
|
|
789
|
+
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} ={eventName}{filters}), {caseCaseIdFormula})");
|
|
761
790
|
}
|
|
762
791
|
|
|
763
|
-
var countReworksTemplate = "process(if(countIf({eventNameFormula} =
|
|
764
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
765
|
-
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
766
|
-
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
767
|
-
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} =
|
|
792
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = {eventName}{filters}) > 0, countIf({eventNameFormula} = {eventName}{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
793
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
794
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
795
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
796
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = {eventName}{filters})[1], {caseCaseIdFormula})";
|
|
768
797
|
var avgTemplate = createAggregationTemplate$1("avgIf");
|
|
769
798
|
var medianTemplate = createAggregationTemplate$1("medianIf");
|
|
770
799
|
var countTemplate = createAggregationTemplate$1("countIf");
|
|
@@ -773,8 +802,55 @@ var minTemplate = createAggregationTemplate$1("minIf");
|
|
|
773
802
|
var maxTemplate = createAggregationTemplate$1("maxIf");
|
|
774
803
|
var sumTemplate = createAggregationTemplate$1("sumIf");
|
|
775
804
|
|
|
805
|
+
function hasPossibleSingleLineComment(str) {
|
|
806
|
+
return str.indexOf("--") >= 0;
|
|
807
|
+
}
|
|
808
|
+
function sanitizeSingleLineComment(formula, wrapInBrackets) {
|
|
809
|
+
if (!hasPossibleSingleLineComment(formula)) {
|
|
810
|
+
return formula;
|
|
811
|
+
}
|
|
812
|
+
var lines = formula.split("\n");
|
|
813
|
+
var lastLine = lines[lines.length - 1];
|
|
814
|
+
// Кейс, когда хотим избежать повторного добавления переноса строки:
|
|
815
|
+
// уже есть переносы и после последнего переноса нет комментария
|
|
816
|
+
if (lines.length > 1 && lastLine && !hasPossibleSingleLineComment(lastLine)) {
|
|
817
|
+
return formula;
|
|
818
|
+
}
|
|
819
|
+
return wrapInBrackets ? "(".concat(formula, "\n)") : "".concat(formula, "\n");
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/** @deprecated - следует использовать fillTemplateSql */
|
|
776
823
|
function fillTemplateString(templateString, params) {
|
|
777
|
-
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
824
|
+
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
825
|
+
var _a;
|
|
826
|
+
return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
830
|
+
function fillTemplateSql(templateString, params) {
|
|
831
|
+
var e_1, _a;
|
|
832
|
+
var newParams = {};
|
|
833
|
+
if (templateString.indexOf("'{") >= 0) {
|
|
834
|
+
throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D: \u043F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440\u044B \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u044B \u0437\u0430\u043A\u043B\u044E\u0447\u0430\u0442\u044C\u0441\u044F \u0432 \u043E\u0434\u0438\u043D\u0430\u0440\u043D\u044B\u0435 \u043A\u0430\u0432\u044B\u0447\u043A\u0438.\n \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 {placeholder} \u0432\u043C\u0435\u0441\u0442\u043E '{placeholder}'.\n \u041A\u0430\u0432\u044B\u0447\u043A\u0438 \u0434\u043E\u043B\u0436\u043D\u044B \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0434\u043B\u044F \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u043F\u043E\u043B\u0435\u0439 \u043F\u0440\u0438 \u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.");
|
|
835
|
+
}
|
|
836
|
+
try {
|
|
837
|
+
for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
838
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
839
|
+
if (String(value).indexOf("--") >= 0) {
|
|
840
|
+
newParams[key] = "".concat(value, "\n");
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
newParams[key] = sanitizeSingleLineComment(String(value));
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
847
|
+
finally {
|
|
848
|
+
try {
|
|
849
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
850
|
+
}
|
|
851
|
+
finally { if (e_1) throw e_1.error; }
|
|
852
|
+
}
|
|
853
|
+
return fillTemplateString(templateString, newParams);
|
|
778
854
|
}
|
|
779
855
|
|
|
780
856
|
/** Создать функцию экранирования переданных `specialChars` внутри `str` */
|
|
@@ -848,7 +924,7 @@ var escapeSingularQuotes = function (formula) {
|
|
|
848
924
|
};
|
|
849
925
|
|
|
850
926
|
var prepareFormulaForSql = function (formula, simpleType) {
|
|
851
|
-
formula =
|
|
927
|
+
formula = sanitizeSingleLineComment(formula, true);
|
|
852
928
|
return simpleType === ESimpleDataType.OTHER ? "toString(".concat(formula, ")") : formula;
|
|
853
929
|
};
|
|
854
930
|
var clearSingleLineComments = function (formula) {
|
|
@@ -973,7 +1049,7 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
973
1049
|
var commonParams = {
|
|
974
1050
|
eventNameFormula: value.eventNameFormula,
|
|
975
1051
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
976
|
-
eventName: escapeSingularQuotes(value.eventName),
|
|
1052
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
977
1053
|
filters: convertFiltersToFormula(value.filters),
|
|
978
1054
|
eventTimeFormula: "",
|
|
979
1055
|
columnFormula: "",
|
|
@@ -1002,13 +1078,13 @@ var timeTemplates = (function () {
|
|
|
1002
1078
|
var generateTemplates = function (innerTemplate) {
|
|
1003
1079
|
var templates = {};
|
|
1004
1080
|
for (var key in dimensionTemplateFormulas) {
|
|
1005
|
-
templates[key] =
|
|
1081
|
+
templates[key] = fillTemplateSql(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1006
1082
|
}
|
|
1007
1083
|
return templates;
|
|
1008
1084
|
};
|
|
1009
1085
|
return _a = {},
|
|
1010
|
-
_a[EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} =
|
|
1011
|
-
_a[EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} =
|
|
1086
|
+
_a[EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1087
|
+
_a[EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1012
1088
|
_a;
|
|
1013
1089
|
})();
|
|
1014
1090
|
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
@@ -1026,7 +1102,7 @@ var prepareTimeParams = function (value) {
|
|
|
1026
1102
|
eventNameFormula: value.eventNameFormula,
|
|
1027
1103
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1028
1104
|
filters: convertFiltersToFormula(value.filters),
|
|
1029
|
-
eventName: escapeSingularQuotes(value.eventName),
|
|
1105
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1030
1106
|
};
|
|
1031
1107
|
};
|
|
1032
1108
|
|
|
@@ -1045,7 +1121,7 @@ function getDimensionFormula(_a) {
|
|
|
1045
1121
|
if (!templateFormula || !tableName || !columnName) {
|
|
1046
1122
|
return "";
|
|
1047
1123
|
}
|
|
1048
|
-
return
|
|
1124
|
+
return fillTemplateSql(templateFormula, {
|
|
1049
1125
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1050
1126
|
});
|
|
1051
1127
|
}
|
|
@@ -1061,10 +1137,10 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1061
1137
|
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1062
1138
|
: null;
|
|
1063
1139
|
var columnFormula = innerTemplate
|
|
1064
|
-
?
|
|
1140
|
+
? fillTemplateSql(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1065
1141
|
: preparedParams.columnFormula;
|
|
1066
1142
|
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1067
|
-
return
|
|
1143
|
+
return fillTemplateSql(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1068
1144
|
}
|
|
1069
1145
|
if (value.mode === EWidgetIndicatorValueModes.START_TIME ||
|
|
1070
1146
|
value.mode === EWidgetIndicatorValueModes.END_TIME) {
|
|
@@ -1073,7 +1149,7 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1073
1149
|
return "";
|
|
1074
1150
|
}
|
|
1075
1151
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1076
|
-
return
|
|
1152
|
+
return fillTemplateSql(templateFormula, preparedParams);
|
|
1077
1153
|
}
|
|
1078
1154
|
}
|
|
1079
1155
|
|
|
@@ -1106,7 +1182,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1106
1182
|
outerAggregation: value.outerAggregation,
|
|
1107
1183
|
eventNameFormula: value.eventNameFormula,
|
|
1108
1184
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1109
|
-
eventName: value.eventName ? escapeSingularQuotes(value.eventName) :
|
|
1185
|
+
eventName: value.eventName ? "'".concat(escapeSingularQuotes(value.eventName), "'") : "",
|
|
1110
1186
|
filters: convertFiltersToFormula(value.filters),
|
|
1111
1187
|
eventTimeFormula: "",
|
|
1112
1188
|
columnFormula: "",
|
|
@@ -1150,7 +1226,7 @@ var measureTemplateFormulas = (_a$3 = {},
|
|
|
1150
1226
|
_a$3);
|
|
1151
1227
|
|
|
1152
1228
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1153
|
-
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1229
|
+
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)";
|
|
1154
1230
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1155
1231
|
var prepareConversionParams = function (value) {
|
|
1156
1232
|
if (!value.startEventName ||
|
|
@@ -1168,11 +1244,11 @@ var prepareConversionParams = function (value) {
|
|
|
1168
1244
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1169
1245
|
startEventNameFormula: value.startEventNameFormula,
|
|
1170
1246
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1171
|
-
startEventName: escapeSingularQuotes(value.startEventName),
|
|
1247
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1172
1248
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1173
1249
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1174
1250
|
endEventNameFormula: value.endEventNameFormula,
|
|
1175
|
-
endEventName: escapeSingularQuotes(value.endEventName),
|
|
1251
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1176
1252
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1177
1253
|
};
|
|
1178
1254
|
};
|
|
@@ -1180,7 +1256,7 @@ var prepareConversionParams = function (value) {
|
|
|
1180
1256
|
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1181
1257
|
var durationTemplates = (function () {
|
|
1182
1258
|
var _a;
|
|
1183
|
-
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1259
|
+
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} = {startEventName}{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ), \n process(\n {endEventAggregationName}(\n {endEventTimeFormula}, \n {endEventNameFormula} = {endEventName}{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n )\n ), \n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} = {startEventName}{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n {endEventAggregationName}(\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 ";
|
|
1184
1260
|
return _a = {},
|
|
1185
1261
|
_a[EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1186
1262
|
_a[EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
@@ -1206,12 +1282,12 @@ var prepareDurationParams = function (value) {
|
|
|
1206
1282
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1207
1283
|
startEventNameFormula: value.startEventNameFormula,
|
|
1208
1284
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1209
|
-
startEventName: escapeSingularQuotes(value.startEventName),
|
|
1285
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1210
1286
|
startEventAggregationName: getAggregationNameByAppearances(value.startEventAppearances),
|
|
1211
1287
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1212
1288
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1213
1289
|
endEventNameFormula: value.endEventNameFormula,
|
|
1214
|
-
endEventName: escapeSingularQuotes(value.endEventName),
|
|
1290
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1215
1291
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1216
1292
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1217
1293
|
};
|
|
@@ -1221,7 +1297,7 @@ function createAnyEventTemplate(aggregatePart) {
|
|
|
1221
1297
|
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1222
1298
|
}
|
|
1223
1299
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1224
|
-
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} =
|
|
1300
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula}))");
|
|
1225
1301
|
}
|
|
1226
1302
|
function createTopLikeTemplate(template) {
|
|
1227
1303
|
return function (outerAggregation) {
|
|
@@ -1295,14 +1371,14 @@ function getMeasureFormula(_a) {
|
|
|
1295
1371
|
if (!templateFormula || !tableName || !columnName) {
|
|
1296
1372
|
return "";
|
|
1297
1373
|
}
|
|
1298
|
-
return
|
|
1374
|
+
return fillTemplateSql(templateFormula, {
|
|
1299
1375
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1300
1376
|
});
|
|
1301
1377
|
}
|
|
1302
1378
|
if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1303
1379
|
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1304
1380
|
return preparedParams
|
|
1305
|
-
?
|
|
1381
|
+
? fillTemplateSql(createAggregationTemplate(value.templateName, {
|
|
1306
1382
|
outerAggregation: preparedParams.outerAggregation,
|
|
1307
1383
|
anyEvent: value.anyEvent,
|
|
1308
1384
|
}), preparedParams)
|
|
@@ -1313,14 +1389,14 @@ function getMeasureFormula(_a) {
|
|
|
1313
1389
|
if (!preparedParams) {
|
|
1314
1390
|
return "";
|
|
1315
1391
|
}
|
|
1316
|
-
return
|
|
1392
|
+
return fillTemplateSql(conversionTemplate, preparedParams);
|
|
1317
1393
|
}
|
|
1318
1394
|
if (value.mode === EWidgetIndicatorValueModes.DURATION) {
|
|
1319
1395
|
var preparedParams = prepareDurationParams(value);
|
|
1320
1396
|
if (!preparedParams) {
|
|
1321
1397
|
return "";
|
|
1322
1398
|
}
|
|
1323
|
-
return
|
|
1399
|
+
return fillTemplateSql(durationTemplates[value.templateName], preparedParams);
|
|
1324
1400
|
}
|
|
1325
1401
|
return "";
|
|
1326
1402
|
}
|
|
@@ -1346,7 +1422,7 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1346
1422
|
}
|
|
1347
1423
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1348
1424
|
var templateFormula = eventMeasureTemplateFormulas[value.templateName];
|
|
1349
|
-
return templateFormula &&
|
|
1425
|
+
return templateFormula && fillTemplateSql(templateFormula, process);
|
|
1350
1426
|
}
|
|
1351
1427
|
return "";
|
|
1352
1428
|
}
|
|
@@ -1372,7 +1448,7 @@ function getTransitionMeasureFormula(_a, process) {
|
|
|
1372
1448
|
}
|
|
1373
1449
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1374
1450
|
var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
|
|
1375
|
-
return templateFormula &&
|
|
1451
|
+
return templateFormula && fillTemplateSql(templateFormula, process);
|
|
1376
1452
|
}
|
|
1377
1453
|
return "";
|
|
1378
1454
|
}
|
|
@@ -1424,20 +1500,25 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
1424
1500
|
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
1425
1501
|
};
|
|
1426
1502
|
/**
|
|
1427
|
-
* Шаблон формулы для
|
|
1503
|
+
* Шаблон формулы для приведения произвольного выражения к Boolean.
|
|
1504
|
+
* Используется и для display-condition виджетов/вкладок/инпутов,
|
|
1505
|
+
* и для фильтров по формуле.
|
|
1506
|
+
*
|
|
1507
|
+
* NULL отсекается явной проверкой isNotNull (трактуется как false).
|
|
1508
|
+
* Остальные непреобразуемые к Boolean значения подпадают под дефолт true.
|
|
1428
1509
|
*
|
|
1510
|
+
* - null -> false (явная проверка isNotNull)
|
|
1429
1511
|
* - 0 -> false
|
|
1430
1512
|
* - 1 -> true
|
|
1431
1513
|
* - 15 -> true
|
|
1432
|
-
* - '0' ->
|
|
1514
|
+
* - '0' -> false
|
|
1433
1515
|
* - '1' -> true
|
|
1434
|
-
* - '15' ->
|
|
1516
|
+
* - '15' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1435
1517
|
* - 'false' -> false
|
|
1436
1518
|
* - 'true' -> true
|
|
1437
1519
|
* - 'abc' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1438
|
-
* - null -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1439
1520
|
*/
|
|
1440
|
-
var displayConditionTemplate = "accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1521
|
+
var displayConditionTemplate = "isNotNull({formula}) AND accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1441
1522
|
|
|
1442
1523
|
var ELastTimeUnit;
|
|
1443
1524
|
(function (ELastTimeUnit) {
|
|
@@ -1564,7 +1645,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
|
|
|
1564
1645
|
if (!isFormulaFilterValue(filterValue)) {
|
|
1565
1646
|
return {
|
|
1566
1647
|
dbDataType: EClickHouseBaseTypes.Bool,
|
|
1567
|
-
formula:
|
|
1648
|
+
formula: fillTemplateSql(displayConditionTemplate, {
|
|
1568
1649
|
formula: prepareFormulaForSql(filterValue.formula),
|
|
1569
1650
|
}),
|
|
1570
1651
|
values: ["true"],
|
|
@@ -2133,4 +2214,4 @@ var getColorByIndex = function (index) {
|
|
|
2133
2214
|
return color;
|
|
2134
2215
|
};
|
|
2135
2216
|
|
|
2136
|
-
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, 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 };
|
|
2217
|
+
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
|
@@ -133,6 +133,35 @@ function __rest(s, e) {
|
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function __values(o) {
|
|
137
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
138
|
+
if (m) return m.call(o);
|
|
139
|
+
if (o && typeof o.length === "number") return {
|
|
140
|
+
next: function () {
|
|
141
|
+
if (o && i >= o.length) o = void 0;
|
|
142
|
+
return { value: o && o[i++], done: !o };
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function __read(o, n) {
|
|
149
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
150
|
+
if (!m) return o;
|
|
151
|
+
var i = m.call(o), r, ar = [], e;
|
|
152
|
+
try {
|
|
153
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
154
|
+
}
|
|
155
|
+
catch (error) { e = { error: error }; }
|
|
156
|
+
finally {
|
|
157
|
+
try {
|
|
158
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
159
|
+
}
|
|
160
|
+
finally { if (e) throw e.error; }
|
|
161
|
+
}
|
|
162
|
+
return ar;
|
|
163
|
+
}
|
|
164
|
+
|
|
136
165
|
function __makeTemplateObject(cooked, raw) {
|
|
137
166
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
138
167
|
return cooked;
|
|
@@ -758,14 +787,14 @@ exports.EEventAppearances = void 0;
|
|
|
758
787
|
})(exports.EEventAppearances || (exports.EEventAppearances = {}));
|
|
759
788
|
|
|
760
789
|
function createAggregationTemplate$1(functionName, options) {
|
|
761
|
-
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} =
|
|
790
|
+
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} ={eventName}{filters}), {caseCaseIdFormula})");
|
|
762
791
|
}
|
|
763
792
|
|
|
764
|
-
var countReworksTemplate = "process(if(countIf({eventNameFormula} =
|
|
765
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
766
|
-
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
767
|
-
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
768
|
-
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} =
|
|
793
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = {eventName}{filters}) > 0, countIf({eventNameFormula} = {eventName}{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
794
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
795
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
796
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
797
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = {eventName}{filters})[1], {caseCaseIdFormula})";
|
|
769
798
|
var avgTemplate = createAggregationTemplate$1("avgIf");
|
|
770
799
|
var medianTemplate = createAggregationTemplate$1("medianIf");
|
|
771
800
|
var countTemplate = createAggregationTemplate$1("countIf");
|
|
@@ -774,8 +803,55 @@ var minTemplate = createAggregationTemplate$1("minIf");
|
|
|
774
803
|
var maxTemplate = createAggregationTemplate$1("maxIf");
|
|
775
804
|
var sumTemplate = createAggregationTemplate$1("sumIf");
|
|
776
805
|
|
|
806
|
+
function hasPossibleSingleLineComment(str) {
|
|
807
|
+
return str.indexOf("--") >= 0;
|
|
808
|
+
}
|
|
809
|
+
function sanitizeSingleLineComment(formula, wrapInBrackets) {
|
|
810
|
+
if (!hasPossibleSingleLineComment(formula)) {
|
|
811
|
+
return formula;
|
|
812
|
+
}
|
|
813
|
+
var lines = formula.split("\n");
|
|
814
|
+
var lastLine = lines[lines.length - 1];
|
|
815
|
+
// Кейс, когда хотим избежать повторного добавления переноса строки:
|
|
816
|
+
// уже есть переносы и после последнего переноса нет комментария
|
|
817
|
+
if (lines.length > 1 && lastLine && !hasPossibleSingleLineComment(lastLine)) {
|
|
818
|
+
return formula;
|
|
819
|
+
}
|
|
820
|
+
return wrapInBrackets ? "(".concat(formula, "\n)") : "".concat(formula, "\n");
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/** @deprecated - следует использовать fillTemplateSql */
|
|
777
824
|
function fillTemplateString(templateString, params) {
|
|
778
|
-
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
825
|
+
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
826
|
+
var _a;
|
|
827
|
+
return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
831
|
+
function fillTemplateSql(templateString, params) {
|
|
832
|
+
var e_1, _a;
|
|
833
|
+
var newParams = {};
|
|
834
|
+
if (templateString.indexOf("'{") >= 0) {
|
|
835
|
+
throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D: \u043F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440\u044B \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u044B \u0437\u0430\u043A\u043B\u044E\u0447\u0430\u0442\u044C\u0441\u044F \u0432 \u043E\u0434\u0438\u043D\u0430\u0440\u043D\u044B\u0435 \u043A\u0430\u0432\u044B\u0447\u043A\u0438.\n \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 {placeholder} \u0432\u043C\u0435\u0441\u0442\u043E '{placeholder}'.\n \u041A\u0430\u0432\u044B\u0447\u043A\u0438 \u0434\u043E\u043B\u0436\u043D\u044B \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0434\u043B\u044F \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u043F\u043E\u043B\u0435\u0439 \u043F\u0440\u0438 \u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.");
|
|
836
|
+
}
|
|
837
|
+
try {
|
|
838
|
+
for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
839
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
840
|
+
if (String(value).indexOf("--") >= 0) {
|
|
841
|
+
newParams[key] = "".concat(value, "\n");
|
|
842
|
+
continue;
|
|
843
|
+
}
|
|
844
|
+
newParams[key] = sanitizeSingleLineComment(String(value));
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
848
|
+
finally {
|
|
849
|
+
try {
|
|
850
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
851
|
+
}
|
|
852
|
+
finally { if (e_1) throw e_1.error; }
|
|
853
|
+
}
|
|
854
|
+
return fillTemplateString(templateString, newParams);
|
|
779
855
|
}
|
|
780
856
|
|
|
781
857
|
/** Создать функцию экранирования переданных `specialChars` внутри `str` */
|
|
@@ -849,7 +925,7 @@ var escapeSingularQuotes = function (formula) {
|
|
|
849
925
|
};
|
|
850
926
|
|
|
851
927
|
var prepareFormulaForSql = function (formula, simpleType) {
|
|
852
|
-
formula =
|
|
928
|
+
formula = sanitizeSingleLineComment(formula, true);
|
|
853
929
|
return simpleType === exports.ESimpleDataType.OTHER ? "toString(".concat(formula, ")") : formula;
|
|
854
930
|
};
|
|
855
931
|
var clearSingleLineComments = function (formula) {
|
|
@@ -974,7 +1050,7 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
974
1050
|
var commonParams = {
|
|
975
1051
|
eventNameFormula: value.eventNameFormula,
|
|
976
1052
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
977
|
-
eventName: escapeSingularQuotes(value.eventName),
|
|
1053
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
978
1054
|
filters: convertFiltersToFormula(value.filters),
|
|
979
1055
|
eventTimeFormula: "",
|
|
980
1056
|
columnFormula: "",
|
|
@@ -1003,13 +1079,13 @@ var timeTemplates = (function () {
|
|
|
1003
1079
|
var generateTemplates = function (innerTemplate) {
|
|
1004
1080
|
var templates = {};
|
|
1005
1081
|
for (var key in dimensionTemplateFormulas) {
|
|
1006
|
-
templates[key] =
|
|
1082
|
+
templates[key] = fillTemplateSql(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1007
1083
|
}
|
|
1008
1084
|
return templates;
|
|
1009
1085
|
};
|
|
1010
1086
|
return _a = {},
|
|
1011
|
-
_a[exports.EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} =
|
|
1012
|
-
_a[exports.EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} =
|
|
1087
|
+
_a[exports.EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1088
|
+
_a[exports.EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1013
1089
|
_a;
|
|
1014
1090
|
})();
|
|
1015
1091
|
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
@@ -1027,7 +1103,7 @@ var prepareTimeParams = function (value) {
|
|
|
1027
1103
|
eventNameFormula: value.eventNameFormula,
|
|
1028
1104
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1029
1105
|
filters: convertFiltersToFormula(value.filters),
|
|
1030
|
-
eventName: escapeSingularQuotes(value.eventName),
|
|
1106
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1031
1107
|
};
|
|
1032
1108
|
};
|
|
1033
1109
|
|
|
@@ -1046,7 +1122,7 @@ function getDimensionFormula(_a) {
|
|
|
1046
1122
|
if (!templateFormula || !tableName || !columnName) {
|
|
1047
1123
|
return "";
|
|
1048
1124
|
}
|
|
1049
|
-
return
|
|
1125
|
+
return fillTemplateSql(templateFormula, {
|
|
1050
1126
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1051
1127
|
});
|
|
1052
1128
|
}
|
|
@@ -1062,10 +1138,10 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1062
1138
|
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1063
1139
|
: null;
|
|
1064
1140
|
var columnFormula = innerTemplate
|
|
1065
|
-
?
|
|
1141
|
+
? fillTemplateSql(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1066
1142
|
: preparedParams.columnFormula;
|
|
1067
1143
|
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1068
|
-
return
|
|
1144
|
+
return fillTemplateSql(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1069
1145
|
}
|
|
1070
1146
|
if (value.mode === exports.EWidgetIndicatorValueModes.START_TIME ||
|
|
1071
1147
|
value.mode === exports.EWidgetIndicatorValueModes.END_TIME) {
|
|
@@ -1074,7 +1150,7 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1074
1150
|
return "";
|
|
1075
1151
|
}
|
|
1076
1152
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1077
|
-
return
|
|
1153
|
+
return fillTemplateSql(templateFormula, preparedParams);
|
|
1078
1154
|
}
|
|
1079
1155
|
}
|
|
1080
1156
|
|
|
@@ -1107,7 +1183,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1107
1183
|
outerAggregation: value.outerAggregation,
|
|
1108
1184
|
eventNameFormula: value.eventNameFormula,
|
|
1109
1185
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1110
|
-
eventName: value.eventName ? escapeSingularQuotes(value.eventName) :
|
|
1186
|
+
eventName: value.eventName ? "'".concat(escapeSingularQuotes(value.eventName), "'") : "",
|
|
1111
1187
|
filters: convertFiltersToFormula(value.filters),
|
|
1112
1188
|
eventTimeFormula: "",
|
|
1113
1189
|
columnFormula: "",
|
|
@@ -1151,7 +1227,7 @@ var measureTemplateFormulas = (_a$3 = {},
|
|
|
1151
1227
|
_a$3);
|
|
1152
1228
|
|
|
1153
1229
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1154
|
-
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1230
|
+
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)";
|
|
1155
1231
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1156
1232
|
var prepareConversionParams = function (value) {
|
|
1157
1233
|
if (!value.startEventName ||
|
|
@@ -1169,11 +1245,11 @@ var prepareConversionParams = function (value) {
|
|
|
1169
1245
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1170
1246
|
startEventNameFormula: value.startEventNameFormula,
|
|
1171
1247
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1172
|
-
startEventName: escapeSingularQuotes(value.startEventName),
|
|
1248
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1173
1249
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1174
1250
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1175
1251
|
endEventNameFormula: value.endEventNameFormula,
|
|
1176
|
-
endEventName: escapeSingularQuotes(value.endEventName),
|
|
1252
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1177
1253
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1178
1254
|
};
|
|
1179
1255
|
};
|
|
@@ -1181,7 +1257,7 @@ var prepareConversionParams = function (value) {
|
|
|
1181
1257
|
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1182
1258
|
var durationTemplates = (function () {
|
|
1183
1259
|
var _a;
|
|
1184
|
-
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1260
|
+
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} = {startEventName}{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ), \n process(\n {endEventAggregationName}(\n {endEventTimeFormula}, \n {endEventNameFormula} = {endEventName}{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n )\n ), \n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} = {startEventName}{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n {endEventAggregationName}(\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 ";
|
|
1185
1261
|
return _a = {},
|
|
1186
1262
|
_a[exports.EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1187
1263
|
_a[exports.EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
@@ -1207,12 +1283,12 @@ var prepareDurationParams = function (value) {
|
|
|
1207
1283
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1208
1284
|
startEventNameFormula: value.startEventNameFormula,
|
|
1209
1285
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1210
|
-
startEventName: escapeSingularQuotes(value.startEventName),
|
|
1286
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1211
1287
|
startEventAggregationName: getAggregationNameByAppearances(value.startEventAppearances),
|
|
1212
1288
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1213
1289
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1214
1290
|
endEventNameFormula: value.endEventNameFormula,
|
|
1215
|
-
endEventName: escapeSingularQuotes(value.endEventName),
|
|
1291
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1216
1292
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1217
1293
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1218
1294
|
};
|
|
@@ -1222,7 +1298,7 @@ function createAnyEventTemplate(aggregatePart) {
|
|
|
1222
1298
|
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1223
1299
|
}
|
|
1224
1300
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1225
|
-
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} =
|
|
1301
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula}))");
|
|
1226
1302
|
}
|
|
1227
1303
|
function createTopLikeTemplate(template) {
|
|
1228
1304
|
return function (outerAggregation) {
|
|
@@ -1296,14 +1372,14 @@ function getMeasureFormula(_a) {
|
|
|
1296
1372
|
if (!templateFormula || !tableName || !columnName) {
|
|
1297
1373
|
return "";
|
|
1298
1374
|
}
|
|
1299
|
-
return
|
|
1375
|
+
return fillTemplateSql(templateFormula, {
|
|
1300
1376
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1301
1377
|
});
|
|
1302
1378
|
}
|
|
1303
1379
|
if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1304
1380
|
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1305
1381
|
return preparedParams
|
|
1306
|
-
?
|
|
1382
|
+
? fillTemplateSql(createAggregationTemplate(value.templateName, {
|
|
1307
1383
|
outerAggregation: preparedParams.outerAggregation,
|
|
1308
1384
|
anyEvent: value.anyEvent,
|
|
1309
1385
|
}), preparedParams)
|
|
@@ -1314,14 +1390,14 @@ function getMeasureFormula(_a) {
|
|
|
1314
1390
|
if (!preparedParams) {
|
|
1315
1391
|
return "";
|
|
1316
1392
|
}
|
|
1317
|
-
return
|
|
1393
|
+
return fillTemplateSql(conversionTemplate, preparedParams);
|
|
1318
1394
|
}
|
|
1319
1395
|
if (value.mode === exports.EWidgetIndicatorValueModes.DURATION) {
|
|
1320
1396
|
var preparedParams = prepareDurationParams(value);
|
|
1321
1397
|
if (!preparedParams) {
|
|
1322
1398
|
return "";
|
|
1323
1399
|
}
|
|
1324
|
-
return
|
|
1400
|
+
return fillTemplateSql(durationTemplates[value.templateName], preparedParams);
|
|
1325
1401
|
}
|
|
1326
1402
|
return "";
|
|
1327
1403
|
}
|
|
@@ -1347,7 +1423,7 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1347
1423
|
}
|
|
1348
1424
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1349
1425
|
var templateFormula = eventMeasureTemplateFormulas[value.templateName];
|
|
1350
|
-
return templateFormula &&
|
|
1426
|
+
return templateFormula && fillTemplateSql(templateFormula, process);
|
|
1351
1427
|
}
|
|
1352
1428
|
return "";
|
|
1353
1429
|
}
|
|
@@ -1373,7 +1449,7 @@ function getTransitionMeasureFormula(_a, process) {
|
|
|
1373
1449
|
}
|
|
1374
1450
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1375
1451
|
var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
|
|
1376
|
-
return templateFormula &&
|
|
1452
|
+
return templateFormula && fillTemplateSql(templateFormula, process);
|
|
1377
1453
|
}
|
|
1378
1454
|
return "";
|
|
1379
1455
|
}
|
|
@@ -1425,20 +1501,25 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
1425
1501
|
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
1426
1502
|
};
|
|
1427
1503
|
/**
|
|
1428
|
-
* Шаблон формулы для
|
|
1504
|
+
* Шаблон формулы для приведения произвольного выражения к Boolean.
|
|
1505
|
+
* Используется и для display-condition виджетов/вкладок/инпутов,
|
|
1506
|
+
* и для фильтров по формуле.
|
|
1507
|
+
*
|
|
1508
|
+
* NULL отсекается явной проверкой isNotNull (трактуется как false).
|
|
1509
|
+
* Остальные непреобразуемые к Boolean значения подпадают под дефолт true.
|
|
1429
1510
|
*
|
|
1511
|
+
* - null -> false (явная проверка isNotNull)
|
|
1430
1512
|
* - 0 -> false
|
|
1431
1513
|
* - 1 -> true
|
|
1432
1514
|
* - 15 -> true
|
|
1433
|
-
* - '0' ->
|
|
1515
|
+
* - '0' -> false
|
|
1434
1516
|
* - '1' -> true
|
|
1435
|
-
* - '15' ->
|
|
1517
|
+
* - '15' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1436
1518
|
* - 'false' -> false
|
|
1437
1519
|
* - 'true' -> true
|
|
1438
1520
|
* - 'abc' -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1439
|
-
* - null -> true (значение по умолчанию, т.к. не преобразуется к Boolean)
|
|
1440
1521
|
*/
|
|
1441
|
-
var displayConditionTemplate = "accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1522
|
+
var displayConditionTemplate = "isNotNull({formula}) AND accurateCastOrDefault({formula}, 'Boolean', true)";
|
|
1442
1523
|
|
|
1443
1524
|
exports.ELastTimeUnit = void 0;
|
|
1444
1525
|
(function (ELastTimeUnit) {
|
|
@@ -1565,7 +1646,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
|
|
|
1565
1646
|
if (!isFormulaFilterValue(filterValue)) {
|
|
1566
1647
|
return {
|
|
1567
1648
|
dbDataType: exports.EClickHouseBaseTypes.Bool,
|
|
1568
|
-
formula:
|
|
1649
|
+
formula: fillTemplateSql(displayConditionTemplate, {
|
|
1569
1650
|
formula: prepareFormulaForSql(filterValue.formula),
|
|
1570
1651
|
}),
|
|
1571
1652
|
values: ["true"],
|
|
@@ -2165,6 +2246,7 @@ exports.durationTemplates = durationTemplates;
|
|
|
2165
2246
|
exports.escapeCurlyBracketLinkName = escapeCurlyBracketLinkName;
|
|
2166
2247
|
exports.escapeDoubleQuoteLinkName = escapeDoubleQuoteLinkName;
|
|
2167
2248
|
exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
|
|
2249
|
+
exports.fillTemplateSql = fillTemplateSql;
|
|
2168
2250
|
exports.fillTemplateString = fillTemplateString;
|
|
2169
2251
|
exports.formattingConfig = formattingConfig;
|
|
2170
2252
|
exports.formulaFilterMethods = formulaFilterMethods;
|