@infomaximum/widget-sdk 6.0.0-16 → 6.0.0-18

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,6 +2,21 @@
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-18](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-17...v6.0.0-18) (2025-12-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * исправлено формирование формулы для разреза типа массив ([cc0b7a6](https://github.com/Infomaximum/widget-sdk/commit/cc0b7a6f82706326afdd556d5dcb4b0af184759e))
11
+
12
+ ## [6.0.0-17](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-16...v6.0.0-17) (2025-11-19)
13
+
14
+
15
+ ### Features
16
+
17
+ * добавлен innerTemplateName для шаблонов ([7980b8a](https://github.com/Infomaximum/widget-sdk/commit/7980b8a9a18b166c74b77f8ef5cf8f9e13ca711a))
18
+ * добавлена возможность изменять список селлекта условий отображения ([dd0c1d7](https://github.com/Infomaximum/widget-sdk/commit/dd0c1d7b8df655ad23eea77c16cbb1baa44192f7))
19
+
5
20
  ## [6.0.0-16](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-15...v6.0.0-16) (2025-11-13)
6
21
 
7
22
 
package/dist/index.d.ts CHANGED
@@ -73,6 +73,216 @@ interface IExportColumnOrder {
73
73
  exportName: string;
74
74
  }
75
75
 
76
+ declare enum EDimensionTemplateNames {
77
+ dateTime = "dateTime",
78
+ date = "date",
79
+ year = "year",
80
+ yearAndQuarter = "yearAndQuarter",
81
+ quarter = "quarter",
82
+ yearAndMonth = "yearAndMonth",
83
+ dayOfMonth = "dayOfMonth",
84
+ month = "month",
85
+ week = "week",
86
+ dayOfWeek = "dayOfWeek",
87
+ hour = "hour"
88
+ }
89
+ /** Стандартные шаблоны разреза */
90
+ declare const dimensionTemplateFormulas: Record<EDimensionTemplateNames, string>;
91
+
92
+ declare function getDimensionFormula({ value }: IWidgetDimension): string;
93
+ declare function getProcessDimensionValueFormula(value: (TWidgetIndicatorAggregationValue & {
94
+ innerTemplateName?: string;
95
+ }) | TWidgetIndicatorTimeValue): string | undefined;
96
+
97
+ declare enum EDimensionAggregationTemplateName {
98
+ avg = "avg",
99
+ median = "median",
100
+ count = "count",
101
+ countDistinct = "countDistinct",
102
+ min = "min",
103
+ max = "max",
104
+ sum = "sum",
105
+ top = "top",
106
+ firstValue = "firstValue",
107
+ lastValue = "lastValue",
108
+ countExecutions = "countExecutions",
109
+ countReworks = "countReworks"
110
+ }
111
+ /** Шаблоны процессных метрик разреза с режимом AGGREGATION */
112
+ declare const dimensionAggregationTemplates: Record<EDimensionAggregationTemplateName, string>;
113
+ /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
114
+ declare const prepareDimensionAggregationParams: (value: Extract<IWidgetDimension["value"], {
115
+ mode: EWidgetIndicatorValueModes.AGGREGATION;
116
+ }>) => {
117
+ eventNameFormula: string;
118
+ caseCaseIdFormula: string;
119
+ eventName: string;
120
+ filters: string;
121
+ eventTimeFormula: string;
122
+ columnFormula: string;
123
+ } | null;
124
+
125
+ /** Шаблоны процессных метрик разреза с режимами START_TIME/END_TIME */
126
+ declare const timeTemplates: {
127
+ START_TIME: Record<EDimensionTemplateNames, string>;
128
+ END_TIME: Record<EDimensionTemplateNames, string>;
129
+ };
130
+ /** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
131
+ declare const prepareTimeParams: (value: TWidgetIndicatorTimeValue) => {
132
+ eventTimeFormula: string;
133
+ eventNameFormula: string;
134
+ caseCaseIdFormula: string;
135
+ filters: string;
136
+ eventName: string;
137
+ } | undefined;
138
+
139
+ declare function getMeasureFormula({ value }: IWidgetMeasure): string;
140
+
141
+ declare enum EMeasureTemplateNames {
142
+ avg = "avg",
143
+ median = "median",
144
+ count = "count",
145
+ countDistinct = "countDistinct",
146
+ min = "min",
147
+ max = "max",
148
+ sum = "sum"
149
+ }
150
+ declare enum EMeasureInnerTemplateNames {
151
+ begin = "begin",
152
+ end = "end"
153
+ }
154
+ /** Стандартные шаблоны меры */
155
+ declare const measureTemplateFormulas: {
156
+ readonly avg: "avg({columnFormula})";
157
+ readonly count: "count({columnFormula})";
158
+ readonly countDistinct: "count(distinct {columnFormula})";
159
+ readonly median: "medianExact({columnFormula})";
160
+ readonly min: "min({columnFormula})";
161
+ readonly max: "max({columnFormula})";
162
+ readonly sum: "sum({columnFormula})";
163
+ };
164
+ declare const measureInnerTemplateFormulas: {
165
+ readonly begin: "begin({columnFormula})";
166
+ readonly end: "end({columnFormula})";
167
+ };
168
+
169
+ declare enum EMeasureAggregationTemplateName {
170
+ agvIf = "agvIf",
171
+ medianIf = "medianIf",
172
+ countIf = "countIf",
173
+ countIfDistinct = "countIfDistinct",
174
+ minIf = "minIf",
175
+ maxIf = "maxIf",
176
+ sumIf = "sumIf",
177
+ top = "top",
178
+ firstValue = "firstValue",
179
+ lastValue = "lastValue",
180
+ countExecutions = "countExecutions",
181
+ countReworks = "countReworks"
182
+ }
183
+ /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
184
+ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["value"], {
185
+ mode: EWidgetIndicatorValueModes.AGGREGATION;
186
+ }>) => {
187
+ outerAggregation: EOuterAggregation;
188
+ eventNameFormula: string;
189
+ caseCaseIdFormula: string;
190
+ eventName: string;
191
+ filters: string;
192
+ eventTimeFormula: string;
193
+ columnFormula: string;
194
+ } | null;
195
+
196
+ /** Шаблон процессной метрики меры с режимом CONVERSION */
197
+ 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)";
198
+ /** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
199
+ declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
200
+ startEventTimeFormula: string;
201
+ startEventNameFormula: string;
202
+ startEventFilters: string;
203
+ startEventName: string;
204
+ endEventTimeFormula: string;
205
+ endCaseCaseIdFormula: string;
206
+ endEventNameFormula: string;
207
+ endEventName: string;
208
+ endEventFilters: string;
209
+ } | null;
210
+
211
+ declare function createAggregationTemplate(templateName: EMeasureAggregationTemplateName, { outerAggregation, anyEvent, }: Pick<TWidgetIndicatorAggregationValue, "anyEvent"> & {
212
+ outerAggregation: EOuterAggregation;
213
+ }): string;
214
+
215
+ /** Шаблоны процессных метрик меры с режимом DURATION */
216
+ declare const durationTemplates: Record<EDurationTemplateName, string>;
217
+ /** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
218
+ declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
219
+ startEventTimeFormula: string;
220
+ startEventNameFormula: string;
221
+ startEventFilters: string;
222
+ startEventName: string;
223
+ startEventAggregationName: string;
224
+ endEventTimeFormula: string;
225
+ endCaseCaseIdFormula: string;
226
+ endEventNameFormula: string;
227
+ endEventName: string;
228
+ endEventFilters: string;
229
+ endEventAggregationName: string;
230
+ } | null;
231
+
232
+ declare function getEventMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
233
+
234
+ declare enum EEventMeasureTemplateNames {
235
+ eventsCount = "eventsCount",
236
+ reworksCount = "reworksCount"
237
+ }
238
+ declare const eventMeasureTemplateFormulas: {
239
+ readonly eventsCount: "count()";
240
+ readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
241
+ };
242
+
243
+ declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
244
+
245
+ declare enum ETransitionMeasureTemplateNames {
246
+ transitionsCount = "transitionsCount",
247
+ medianTime = "medianTime"
248
+ }
249
+ declare const transitionMeasureTemplateFormulas: {
250
+ readonly transitionsCount: "count()";
251
+ readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
252
+ };
253
+
254
+ declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
255
+
256
+ /** @deprecated - следует использовать fillTemplateSql */
257
+ declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
258
+ /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
259
+ declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
260
+
261
+ declare function generateColumnFormula(tableName: string, columnName: string): string;
262
+
263
+ /**
264
+ * Паттерн подстроки, валидной для использования внутри фигурных скобок.
265
+ * Требование к подстроке - отсутствие закрывающих фигурных скобок (кроме экранированных).
266
+ */
267
+ declare const curlyBracketsContentPattern: string;
268
+ /**
269
+ * Паттерн подстроки, валидной для использования внутри двойных кавычек.
270
+ * Требование к подстроке - отсутствие двойных кавычек (кроме экранированных).
271
+ */
272
+ declare const doubleQuoteContentPattern: string;
273
+ declare const dashboardLinkRegExp: RegExp;
274
+ declare const workspaceLinkRegExp: RegExp;
275
+ /** Экранирование спец.символов при подстановке названий таблиц и колонок */
276
+ declare const escapeDoubleQuoteLinkName: (str: string) => string;
277
+ /** Экранирование спец.символов при подстановке названий переменных и показателей */
278
+ declare const escapeCurlyBracketLinkName: (str: string) => string;
279
+ interface IIndicatorLink {
280
+ /** string - имя группы пространства, null - используется текущий отчет */
281
+ scopeName: string | null;
282
+ indicatorName: string;
283
+ }
284
+ declare const parseIndicatorLink: (formula: string) => IIndicatorLink | null;
285
+
76
286
  declare enum EWidgetFilterMode {
77
287
  DEFAULT = "DEFAULT",
78
288
  SINGLE = "SINGLE",
@@ -364,10 +574,11 @@ interface ICommonDimensions {
364
574
  name: string;
365
575
  formula: string;
366
576
  }
367
- type TColumnIndicatorValue = {
577
+ type TWidgetIndicatorFormulaValue = {
368
578
  mode: EWidgetIndicatorValueModes.FORMULA;
369
579
  formula?: string;
370
- } | {
580
+ };
581
+ type TWidgetIndicatorTemplateValue = {
371
582
  mode: EWidgetIndicatorValueModes.TEMPLATE;
372
583
  /** Имя шаблонной формулы, использующей колонку таблицы */
373
584
  templateName?: string;
@@ -376,6 +587,13 @@ type TColumnIndicatorValue = {
376
587
  /** Имя колонки */
377
588
  columnName?: string;
378
589
  };
590
+ type TMeasureValue = TWidgetIndicatorFormulaValue | (TWidgetIndicatorTemplateValue & {
591
+ innerTemplateName?: EMeasureInnerTemplateNames;
592
+ });
593
+ type TDimensionValue = TWidgetIndicatorFormulaValue | (TWidgetIndicatorTemplateValue & {
594
+ innerTemplateName?: never;
595
+ });
596
+ type TColumnIndicatorValue = TMeasureValue | TDimensionValue;
379
597
  declare enum EFormatOrFormattingMode {
380
598
  BASE = "BASE",
381
599
  TEMPLATE = "TEMPLATE"
@@ -1472,6 +1690,7 @@ interface IFormulaControl {
1472
1690
  indicatorConfig?: ({
1473
1691
  type: "measure";
1474
1692
  templates?: TWidgetMeasureData["templates"];
1693
+ innerTemplateNames?: EMeasureInnerTemplateNames[];
1475
1694
  } & {
1476
1695
  /** @deprecated временное решение для виджета "Воронка", не следует использовать [BI-14710] */
1477
1696
  allowClear?: boolean;
@@ -1556,6 +1775,7 @@ interface IDisplayConditionControl {
1556
1775
  props: {
1557
1776
  isInMeasure?: boolean;
1558
1777
  labelFontSize?: number;
1778
+ modes?: EDisplayConditionMode[];
1559
1779
  };
1560
1780
  }
1561
1781
  interface IColorPickerControl {
@@ -1917,208 +2137,6 @@ interface ICalculatorFactory {
1917
2137
  type: (options?: ICalculatorOptions) => ITypeCalculator;
1918
2138
  }
1919
2139
 
1920
- declare enum EDimensionTemplateNames {
1921
- dateTime = "dateTime",
1922
- date = "date",
1923
- year = "year",
1924
- yearAndQuarter = "yearAndQuarter",
1925
- quarter = "quarter",
1926
- yearAndMonth = "yearAndMonth",
1927
- dayOfMonth = "dayOfMonth",
1928
- month = "month",
1929
- week = "week",
1930
- dayOfWeek = "dayOfWeek",
1931
- hour = "hour"
1932
- }
1933
- /** Стандартные шаблоны разреза */
1934
- declare const dimensionTemplateFormulas: Record<EDimensionTemplateNames, string>;
1935
-
1936
- declare function getDimensionFormula({ value }: IWidgetDimension): string;
1937
- declare function getProcessDimensionValueFormula(value: (TWidgetIndicatorAggregationValue & {
1938
- innerTemplateName?: string;
1939
- }) | TWidgetIndicatorTimeValue): string | undefined;
1940
-
1941
- declare enum EDimensionAggregationTemplateName {
1942
- avg = "avg",
1943
- median = "median",
1944
- count = "count",
1945
- countDistinct = "countDistinct",
1946
- min = "min",
1947
- max = "max",
1948
- sum = "sum",
1949
- top = "top",
1950
- firstValue = "firstValue",
1951
- lastValue = "lastValue",
1952
- countExecutions = "countExecutions",
1953
- countReworks = "countReworks"
1954
- }
1955
- /** Шаблоны процессных метрик разреза с режимом AGGREGATION */
1956
- declare const dimensionAggregationTemplates: Record<EDimensionAggregationTemplateName, string>;
1957
- /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1958
- declare const prepareDimensionAggregationParams: (value: Extract<IWidgetDimension["value"], {
1959
- mode: EWidgetIndicatorValueModes.AGGREGATION;
1960
- }>) => {
1961
- eventNameFormula: string;
1962
- caseCaseIdFormula: string;
1963
- eventName: string;
1964
- filters: string;
1965
- eventTimeFormula: string;
1966
- columnFormula: string;
1967
- } | null;
1968
-
1969
- /** Шаблоны процессных метрик разреза с режимами START_TIME/END_TIME */
1970
- declare const timeTemplates: {
1971
- START_TIME: Record<EDimensionTemplateNames, string>;
1972
- END_TIME: Record<EDimensionTemplateNames, string>;
1973
- };
1974
- /** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
1975
- declare const prepareTimeParams: (value: TWidgetIndicatorTimeValue) => {
1976
- eventTimeFormula: string;
1977
- eventNameFormula: string;
1978
- caseCaseIdFormula: string;
1979
- filters: string;
1980
- eventName: string;
1981
- } | undefined;
1982
-
1983
- declare function getMeasureFormula({ value }: IWidgetMeasure): string;
1984
-
1985
- declare enum EMeasureTemplateNames {
1986
- avg = "avg",
1987
- median = "median",
1988
- count = "count",
1989
- countDistinct = "countDistinct",
1990
- min = "min",
1991
- max = "max",
1992
- sum = "sum"
1993
- }
1994
- /** Стандартные шаблоны меры */
1995
- declare const measureTemplateFormulas: {
1996
- readonly avg: "avg({columnFormula})";
1997
- readonly count: "count({columnFormula})";
1998
- readonly countDistinct: "count(distinct {columnFormula})";
1999
- readonly median: "medianExact({columnFormula})";
2000
- readonly min: "min({columnFormula})";
2001
- readonly max: "max({columnFormula})";
2002
- readonly sum: "sum({columnFormula})";
2003
- };
2004
-
2005
- declare enum EMeasureAggregationTemplateName {
2006
- agvIf = "agvIf",
2007
- medianIf = "medianIf",
2008
- countIf = "countIf",
2009
- countIfDistinct = "countIfDistinct",
2010
- minIf = "minIf",
2011
- maxIf = "maxIf",
2012
- sumIf = "sumIf",
2013
- top = "top",
2014
- firstValue = "firstValue",
2015
- lastValue = "lastValue",
2016
- countExecutions = "countExecutions",
2017
- countReworks = "countReworks"
2018
- }
2019
- /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
2020
- declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["value"], {
2021
- mode: EWidgetIndicatorValueModes.AGGREGATION;
2022
- }>) => {
2023
- outerAggregation: EOuterAggregation;
2024
- eventNameFormula: string;
2025
- caseCaseIdFormula: string;
2026
- eventName: string;
2027
- filters: string;
2028
- eventTimeFormula: string;
2029
- columnFormula: string;
2030
- } | null;
2031
-
2032
- /** Шаблон процессной метрики меры с режимом CONVERSION */
2033
- 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)";
2034
- /** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
2035
- declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
2036
- startEventTimeFormula: string;
2037
- startEventNameFormula: string;
2038
- startEventFilters: string;
2039
- startEventName: string;
2040
- endEventTimeFormula: string;
2041
- endCaseCaseIdFormula: string;
2042
- endEventNameFormula: string;
2043
- endEventName: string;
2044
- endEventFilters: string;
2045
- } | null;
2046
-
2047
- declare function createAggregationTemplate(templateName: EMeasureAggregationTemplateName, { outerAggregation, anyEvent, }: Pick<TWidgetIndicatorAggregationValue, "anyEvent"> & {
2048
- outerAggregation: EOuterAggregation;
2049
- }): string;
2050
-
2051
- /** Шаблоны процессных метрик меры с режимом DURATION */
2052
- declare const durationTemplates: Record<EDurationTemplateName, string>;
2053
- /** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
2054
- declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
2055
- startEventTimeFormula: string;
2056
- startEventNameFormula: string;
2057
- startEventFilters: string;
2058
- startEventName: string;
2059
- startEventAggregationName: string;
2060
- endEventTimeFormula: string;
2061
- endCaseCaseIdFormula: string;
2062
- endEventNameFormula: string;
2063
- endEventName: string;
2064
- endEventFilters: string;
2065
- endEventAggregationName: string;
2066
- } | null;
2067
-
2068
- declare function getEventMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
2069
-
2070
- declare enum EEventMeasureTemplateNames {
2071
- eventsCount = "eventsCount",
2072
- reworksCount = "reworksCount"
2073
- }
2074
- declare const eventMeasureTemplateFormulas: {
2075
- readonly eventsCount: "count()";
2076
- readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
2077
- };
2078
-
2079
- declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: Omit<IWidgetProcess, "isValid">): string;
2080
-
2081
- declare enum ETransitionMeasureTemplateNames {
2082
- transitionsCount = "transitionsCount",
2083
- medianTime = "medianTime"
2084
- }
2085
- declare const transitionMeasureTemplateFormulas: {
2086
- readonly transitionsCount: "count()";
2087
- readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
2088
- };
2089
-
2090
- declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
2091
-
2092
- /** @deprecated - следует использовать fillTemplateSql */
2093
- declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
2094
- /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
2095
- declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
2096
-
2097
- declare function generateColumnFormula(tableName: string, columnName: string): string;
2098
-
2099
- /**
2100
- * Паттерн подстроки, валидной для использования внутри фигурных скобок.
2101
- * Требование к подстроке - отсутствие закрывающих фигурных скобок (кроме экранированных).
2102
- */
2103
- declare const curlyBracketsContentPattern: string;
2104
- /**
2105
- * Паттерн подстроки, валидной для использования внутри двойных кавычек.
2106
- * Требование к подстроке - отсутствие двойных кавычек (кроме экранированных).
2107
- */
2108
- declare const doubleQuoteContentPattern: string;
2109
- declare const dashboardLinkRegExp: RegExp;
2110
- declare const workspaceLinkRegExp: RegExp;
2111
- /** Экранирование спец.символов при подстановке названий таблиц и колонок */
2112
- declare const escapeDoubleQuoteLinkName: (str: string) => string;
2113
- /** Экранирование спец.символов при подстановке названий переменных и показателей */
2114
- declare const escapeCurlyBracketLinkName: (str: string) => string;
2115
- interface IIndicatorLink {
2116
- /** string - имя группы пространства, null - используется текущий отчет */
2117
- scopeName: string | null;
2118
- indicatorName: string;
2119
- }
2120
- declare const parseIndicatorLink: (formula: string) => IIndicatorLink | null;
2121
-
2122
2140
  interface ILens<T extends TNullable<object>, Value> {
2123
2141
  get(obj: T): TNullable<Value>;
2124
2142
  set(obj: T, value: Value): void;
@@ -2755,4 +2773,4 @@ declare global {
2755
2773
  }
2756
2774
  }
2757
2775
 
2758
- 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 };
2776
+ 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, EMeasureInnerTemplateNames, 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 TDimensionValue, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMeasureValue, 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 TWidgetIndicatorFormulaValue, type TWidgetIndicatorTemplateValue, 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, measureInnerTemplateFormulas, 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
@@ -1203,7 +1203,7 @@ var prepareMeasureAggregationParams = function (value) {
1203
1203
  return columnParams;
1204
1204
  };
1205
1205
 
1206
- var _a$3;
1206
+ var _a$3, _b;
1207
1207
  var EMeasureTemplateNames;
1208
1208
  (function (EMeasureTemplateNames) {
1209
1209
  EMeasureTemplateNames["avg"] = "avg";
@@ -1214,6 +1214,11 @@ var EMeasureTemplateNames;
1214
1214
  EMeasureTemplateNames["max"] = "max";
1215
1215
  EMeasureTemplateNames["sum"] = "sum";
1216
1216
  })(EMeasureTemplateNames || (EMeasureTemplateNames = {}));
1217
+ var EMeasureInnerTemplateNames;
1218
+ (function (EMeasureInnerTemplateNames) {
1219
+ EMeasureInnerTemplateNames["begin"] = "begin";
1220
+ EMeasureInnerTemplateNames["end"] = "end";
1221
+ })(EMeasureInnerTemplateNames || (EMeasureInnerTemplateNames = {}));
1217
1222
  /** Стандартные шаблоны меры */
1218
1223
  var measureTemplateFormulas = (_a$3 = {},
1219
1224
  _a$3[EMeasureTemplateNames.avg] = "avg({columnFormula})",
@@ -1224,6 +1229,10 @@ var measureTemplateFormulas = (_a$3 = {},
1224
1229
  _a$3[EMeasureTemplateNames.max] = "max({columnFormula})",
1225
1230
  _a$3[EMeasureTemplateNames.sum] = "sum({columnFormula})",
1226
1231
  _a$3);
1232
+ var measureInnerTemplateFormulas = (_b = {},
1233
+ _b[EMeasureInnerTemplateNames.begin] = "begin({columnFormula})",
1234
+ _b[EMeasureInnerTemplateNames.end] = "end({columnFormula})",
1235
+ _b);
1227
1236
 
1228
1237
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1229
1238
  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)";
@@ -1366,13 +1375,18 @@ function getMeasureFormula(_a) {
1366
1375
  return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
1367
1376
  }
1368
1377
  if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
1369
- var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
1378
+ var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName, innerTemplateName = value.innerTemplateName;
1370
1379
  var templateFormula = measureTemplateFormulas[templateName];
1371
1380
  if (!templateFormula || !tableName || !columnName) {
1372
1381
  return "";
1373
1382
  }
1383
+ var columnFormula = innerTemplateName
1384
+ ? fillTemplateSql(measureInnerTemplateFormulas[innerTemplateName], {
1385
+ columnFormula: generateColumnFormula(tableName, columnName),
1386
+ })
1387
+ : generateColumnFormula(tableName, columnName);
1374
1388
  return fillTemplateSql(templateFormula, {
1375
- columnFormula: generateColumnFormula(tableName, columnName),
1389
+ columnFormula: columnFormula,
1376
1390
  });
1377
1391
  }
1378
1392
  if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
@@ -1632,7 +1646,9 @@ var getFormulaFilterValues = function (filterValue) {
1632
1646
  }
1633
1647
  return [];
1634
1648
  };
1635
- var applyIndexToArrayFormula = function (formula, index) { return "".concat(formula, "[").concat(index, "]"); };
1649
+ var applyIndexToArrayFormula = function (formula, index) {
1650
+ return "(".concat(formula, ")[").concat(index, "]");
1651
+ };
1636
1652
  var mapFormulaFilterToCalculatorInput = function (filterValue) {
1637
1653
  if (!filterValue) {
1638
1654
  return null;
@@ -2209,4 +2225,4 @@ var getColorByIndex = function (index) {
2209
2225
  return color;
2210
2226
  };
2211
2227
 
2212
- 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 };
2228
+ 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, EMeasureInnerTemplateNames, 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, measureInnerTemplateFormulas, 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
@@ -1204,7 +1204,7 @@ var prepareMeasureAggregationParams = function (value) {
1204
1204
  return columnParams;
1205
1205
  };
1206
1206
 
1207
- var _a$3;
1207
+ var _a$3, _b;
1208
1208
  exports.EMeasureTemplateNames = void 0;
1209
1209
  (function (EMeasureTemplateNames) {
1210
1210
  EMeasureTemplateNames["avg"] = "avg";
@@ -1215,6 +1215,11 @@ exports.EMeasureTemplateNames = void 0;
1215
1215
  EMeasureTemplateNames["max"] = "max";
1216
1216
  EMeasureTemplateNames["sum"] = "sum";
1217
1217
  })(exports.EMeasureTemplateNames || (exports.EMeasureTemplateNames = {}));
1218
+ exports.EMeasureInnerTemplateNames = void 0;
1219
+ (function (EMeasureInnerTemplateNames) {
1220
+ EMeasureInnerTemplateNames["begin"] = "begin";
1221
+ EMeasureInnerTemplateNames["end"] = "end";
1222
+ })(exports.EMeasureInnerTemplateNames || (exports.EMeasureInnerTemplateNames = {}));
1218
1223
  /** Стандартные шаблоны меры */
1219
1224
  var measureTemplateFormulas = (_a$3 = {},
1220
1225
  _a$3[exports.EMeasureTemplateNames.avg] = "avg({columnFormula})",
@@ -1225,6 +1230,10 @@ var measureTemplateFormulas = (_a$3 = {},
1225
1230
  _a$3[exports.EMeasureTemplateNames.max] = "max({columnFormula})",
1226
1231
  _a$3[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
1227
1232
  _a$3);
1233
+ var measureInnerTemplateFormulas = (_b = {},
1234
+ _b[exports.EMeasureInnerTemplateNames.begin] = "begin({columnFormula})",
1235
+ _b[exports.EMeasureInnerTemplateNames.end] = "end({columnFormula})",
1236
+ _b);
1228
1237
 
1229
1238
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1230
1239
  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)";
@@ -1367,13 +1376,18 @@ function getMeasureFormula(_a) {
1367
1376
  return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
1368
1377
  }
1369
1378
  if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
1370
- var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
1379
+ var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName, innerTemplateName = value.innerTemplateName;
1371
1380
  var templateFormula = measureTemplateFormulas[templateName];
1372
1381
  if (!templateFormula || !tableName || !columnName) {
1373
1382
  return "";
1374
1383
  }
1384
+ var columnFormula = innerTemplateName
1385
+ ? fillTemplateSql(measureInnerTemplateFormulas[innerTemplateName], {
1386
+ columnFormula: generateColumnFormula(tableName, columnName),
1387
+ })
1388
+ : generateColumnFormula(tableName, columnName);
1375
1389
  return fillTemplateSql(templateFormula, {
1376
- columnFormula: generateColumnFormula(tableName, columnName),
1390
+ columnFormula: columnFormula,
1377
1391
  });
1378
1392
  }
1379
1393
  if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
@@ -1633,7 +1647,9 @@ var getFormulaFilterValues = function (filterValue) {
1633
1647
  }
1634
1648
  return [];
1635
1649
  };
1636
- var applyIndexToArrayFormula = function (formula, index) { return "".concat(formula, "[").concat(index, "]"); };
1650
+ var applyIndexToArrayFormula = function (formula, index) {
1651
+ return "(".concat(formula, ")[").concat(index, "]");
1652
+ };
1637
1653
  var mapFormulaFilterToCalculatorInput = function (filterValue) {
1638
1654
  if (!filterValue) {
1639
1655
  return null;
@@ -2268,6 +2284,7 @@ exports.mapMeasuresToInputs = mapMeasuresToInputs;
2268
2284
  exports.mapSettingsFiltersToInputs = mapSettingsFiltersToInputs;
2269
2285
  exports.mapSortingToInputs = mapSortingToInputs;
2270
2286
  exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
2287
+ exports.measureInnerTemplateFormulas = measureInnerTemplateFormulas;
2271
2288
  exports.measureTemplateFormulas = measureTemplateFormulas;
2272
2289
  exports.parseClickHouseType = parseClickHouseType;
2273
2290
  exports.parseIndicatorLink = parseIndicatorLink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "6.0.0-16",
3
+ "version": "6.0.0-18",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",