@infomaximum/widget-sdk 5.10.0 → 5.11.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/dist/index.esm.js CHANGED
@@ -340,6 +340,7 @@ var EFormatTypes;
340
340
  EFormatTypes["WEEK"] = "WEEK";
341
341
  /** Логический */
342
342
  EFormatTypes["BOOLEAN"] = "BOOLEAN";
343
+ EFormatTypes["PERCENT"] = "PERCENT";
343
344
  })(EFormatTypes || (EFormatTypes = {}));
344
345
  var EFormattingPresets;
345
346
  (function (EFormattingPresets) {
@@ -446,7 +447,7 @@ var formattingConfig = {
446
447
  return _a = {},
447
448
  _a[ESimpleDataType.OTHER] = [EFormatTypes.STRING],
448
449
  _a[ESimpleDataType.STRING] = [EFormatTypes.STRING],
449
- _a[ESimpleDataType.FLOAT] = [EFormatTypes.NUMBER, EFormatTypes.DURATION],
450
+ _a[ESimpleDataType.FLOAT] = [EFormatTypes.NUMBER, EFormatTypes.DURATION, EFormatTypes.PERCENT],
450
451
  _a[ESimpleDataType.INTEGER] = [
451
452
  EFormatTypes.NUMBER,
452
453
  EFormatTypes.DURATION,
@@ -454,6 +455,7 @@ var formattingConfig = {
454
455
  EFormatTypes.MONTH_YEAR,
455
456
  EFormatTypes.MONTH,
456
457
  EFormatTypes.DAY_OF_WEEK,
458
+ EFormatTypes.PERCENT,
457
459
  ],
458
460
  _a[ESimpleDataType.DATE] = [EFormatTypes.DATE],
459
461
  _a[ESimpleDataType.DATETIME] = [EFormatTypes.DATETIME],
@@ -588,6 +590,11 @@ var formattingConfig = {
588
590
  _a[EFormatTypes.WEEK] = [],
589
591
  _a[EFormatTypes.YEAR] = [],
590
592
  _a[EFormatTypes.BOOLEAN] = [],
593
+ _a[EFormatTypes.PERCENT] = [
594
+ EFormattingPresets.AUTO,
595
+ EFormattingPresets["x.x[%]"],
596
+ EFormattingPresets["zx.xx[%]"],
597
+ ],
591
598
  _a;
592
599
  },
593
600
  };
@@ -829,6 +836,7 @@ var EOuterAggregation;
829
836
  EOuterAggregation["min"] = "min";
830
837
  EOuterAggregation["max"] = "max";
831
838
  EOuterAggregation["sum"] = "sum";
839
+ EOuterAggregation["top"] = "top";
832
840
  })(EOuterAggregation || (EOuterAggregation = {}));
833
841
  /** Режимы значения показателя (на основе чего генерируется формула) */
834
842
  var EWidgetIndicatorValueModes;
@@ -1172,21 +1180,32 @@ var EMeasureAggregationTemplateName;
1172
1180
  EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
1173
1181
  EMeasureAggregationTemplateName["countReworks"] = "countReworks";
1174
1182
  })(EMeasureAggregationTemplateName || (EMeasureAggregationTemplateName = {}));
1183
+ function createAggregationTemplate(fn, additionalFn) {
1184
+ return "{outerAggregation}If(process(".concat(fn, "(").concat(additionalFn ? additionalFn + " " : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})");
1185
+ }
1175
1186
  /** Шаблоны процессных метрик меры с режимом AGGREGATION */
1176
1187
  var measureAggregationTemplates = (_a$3 = {},
1177
- _a$3[EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1178
- _a$3[EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1179
- _a$3[EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1180
- _a$3[EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1181
- _a$3[EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1182
- _a$3[EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1183
- _a$3[EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1184
- _a$3[EMeasureAggregationTemplateName.top] = "{outerAggregation}If(".concat(topTemplate, ", {objectFilters})"),
1185
- _a$3[EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(".concat(firstValueTemplate, ", {objectFilters})"),
1186
- _a$3[EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(".concat(lastValueTemplate, ", {objectFilters})"),
1188
+ _a$3[EMeasureAggregationTemplateName.agvIf] = createAggregationTemplate("avgIf"),
1189
+ _a$3[EMeasureAggregationTemplateName.medianIf] = createAggregationTemplate("medianIf"),
1190
+ _a$3[EMeasureAggregationTemplateName.countIf] = createAggregationTemplate("countIf"),
1191
+ _a$3[EMeasureAggregationTemplateName.countIfDistinct] = createAggregationTemplate("countIf", "distinct"),
1192
+ _a$3[EMeasureAggregationTemplateName.minIf] = createAggregationTemplate("minIf"),
1193
+ _a$3[EMeasureAggregationTemplateName.maxIf] = createAggregationTemplate("maxIf"),
1194
+ _a$3[EMeasureAggregationTemplateName.sumIf] = createAggregationTemplate("sumIf"),
1195
+ _a$3[EMeasureAggregationTemplateName.top] = createTopLikeTemplate(topTemplate),
1196
+ _a$3[EMeasureAggregationTemplateName.firstValue] = createTopLikeTemplate(firstValueTemplate),
1197
+ _a$3[EMeasureAggregationTemplateName.lastValue] = createTopLikeTemplate(lastValueTemplate),
1187
1198
  _a$3[EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
1188
1199
  _a$3[EMeasureAggregationTemplateName.countReworks] = "{outerAggregation}If(".concat(countReworksTemplate, ",{objectFilters})"),
1189
1200
  _a$3);
1201
+ /** Вспомогательная функция для шаблонов top/firstValue/lastValue */
1202
+ function createTopLikeTemplate(template) {
1203
+ return function (outerAggregation) {
1204
+ return outerAggregation === EOuterAggregation.top
1205
+ ? "{outerAggregation}KIf(1)(".concat(template, ", {objectFilters})[1]")
1206
+ : "{outerAggregation}If(".concat(template, ", {objectFilters})");
1207
+ };
1208
+ }
1190
1209
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1191
1210
  var prepareMeasureAggregationParams = function (value) {
1192
1211
  if (!value.eventName ||
@@ -1246,7 +1265,7 @@ var measureTemplateFormulas = (_a$2 = {},
1246
1265
  _a$2);
1247
1266
 
1248
1267
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1249
- 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) * 100 / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
1268
+ 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)";
1250
1269
  /** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
1251
1270
  var prepareConversionParams = function (value) {
1252
1271
  if (!value.startEventName ||
@@ -1335,12 +1354,17 @@ function getMeasureFormula(_a) {
1335
1354
  });
1336
1355
  }
1337
1356
  if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
1338
- var preparedParams = prepareMeasureAggregationParams(value);
1339
- if (!preparedParams) {
1357
+ var preparedParams_1 = prepareMeasureAggregationParams(value);
1358
+ if (!preparedParams_1) {
1340
1359
  return "";
1341
1360
  }
1342
- var templateFormula = measureAggregationTemplates[value.templateName];
1343
- return fillTemplateString(templateFormula, preparedParams);
1361
+ var getTemplateFormula = function () {
1362
+ var templateFormula = measureAggregationTemplates[value.templateName];
1363
+ return typeof templateFormula === "function"
1364
+ ? templateFormula(preparedParams_1.outerAggregation)
1365
+ : templateFormula;
1366
+ };
1367
+ return fillTemplateString(getTemplateFormula(), preparedParams_1);
1344
1368
  }
1345
1369
  if (value.mode === EWidgetIndicatorValueModes.CONVERSION) {
1346
1370
  var preparedParams = prepareConversionParams(value);
@@ -1613,10 +1637,14 @@ var getDefaultSortOrders = function (_a) {
1613
1637
  if (measures.length > 0) {
1614
1638
  var firstMeasure = measures[0];
1615
1639
  if (firstMeasure) {
1640
+ var formula = getMeasureFormula(firstMeasure);
1641
+ if (!formula) {
1642
+ return [];
1643
+ }
1616
1644
  return [
1617
1645
  {
1618
1646
  direction: ESortDirection.descend,
1619
- formula: getMeasureFormula(firstMeasure),
1647
+ formula: formula,
1620
1648
  dbDataType: firstMeasure.dbDataType,
1621
1649
  },
1622
1650
  ];
@@ -1695,33 +1723,55 @@ function bindContentsWithIndicators(outputs, indicators) {
1695
1723
  return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
1696
1724
  }
1697
1725
 
1698
- var EUnitMode;
1699
- (function (EUnitMode) {
1700
- EUnitMode["PIXEL"] = "PIXEL";
1701
- EUnitMode["PERCENT"] = "PERCENT";
1702
- })(EUnitMode || (EUnitMode = {}));
1703
1726
  var EControlType;
1704
1727
  (function (EControlType) {
1728
+ /** Ввод текста */
1729
+ EControlType["input"] = "input";
1730
+ /** Ввод текста в формате markdown */
1731
+ EControlType["inputMarkdown"] = "inputMarkdown";
1732
+ /** Ввод числа */
1705
1733
  EControlType["inputNumber"] = "inputNumber";
1734
+ /** Выбор диапазона чисел */
1735
+ EControlType["inputRange"] = "inputRange";
1736
+ /** Ввод размера (число + единица измерения) */
1737
+ EControlType["size"] = "size";
1738
+ /** Выбор boolean значения через переключатель */
1706
1739
  EControlType["switch"] = "switch";
1707
- EControlType["input"] = "input";
1708
- EControlType["formattingTemplate"] = "formattingTemplate";
1709
- EControlType["radioIconGroup"] = "radioIconGroup";
1740
+ /** Выбор варианта из выпадающего списка */
1710
1741
  EControlType["select"] = "select";
1711
- EControlType["tagSet"] = "tagSet";
1742
+ /** Выбор одного из вариантов, представленных через иконки */
1743
+ EControlType["radioIconGroup"] = "radioIconGroup";
1744
+ /** Ввод значения показателя */
1712
1745
  EControlType["formula"] = "formula";
1746
+ /** Ввод формулы и ее типа */
1713
1747
  EControlType["typedFormula"] = "typedFormula";
1714
- EControlType["inputRange"] = "inputRange";
1715
- EControlType["colorPicker"] = "colorPicker";
1716
- EControlType["displayCondition"] = "displayCondition";
1717
- EControlType["eventsColor"] = "eventsColor";
1718
- EControlType["inputMarkdown"] = "inputMarkdown";
1719
- EControlType["filter"] = "filter";
1748
+ /** Выбор настроек форматирования */
1749
+ EControlType["formatting"] = "formatting";
1750
+ /** Ввод шаблона форматирования */
1751
+ EControlType["formattingTemplate"] = "formattingTemplate";
1752
+ /** Выбор действий по клику */
1720
1753
  EControlType["actionOnClick"] = "actionOnClick";
1754
+ /** Ввод фильтров */
1755
+ EControlType["filter"] = "filter";
1756
+ /** Ввод условия отображения */
1757
+ EControlType["displayCondition"] = "displayCondition";
1758
+ /** Ввод цвета */
1759
+ EControlType["colorPicker"] = "colorPicker";
1760
+ /** Отображение тегов с возможностью "провалиться" внутрь */
1761
+ EControlType["tagSet"] = "tagSet";
1762
+ /** Множественный выбор событий процесса */
1721
1763
  EControlType["eventsPicker"] = "eventsPicker";
1722
- EControlType["size"] = "size";
1723
- EControlType["formatting"] = "formatting";
1764
+ /**
1765
+ * @deprecated используется только для виджета "Маршруты", будет перенесено на уровень виджета.
1766
+ * Ввод цветов для событий процесса.
1767
+ */
1768
+ EControlType["eventsColor"] = "eventsColor";
1724
1769
  })(EControlType || (EControlType = {}));
1770
+ var EUnitMode;
1771
+ (function (EUnitMode) {
1772
+ EUnitMode["PIXEL"] = "PIXEL";
1773
+ EUnitMode["PERCENT"] = "PERCENT";
1774
+ })(EUnitMode || (EUnitMode = {}));
1725
1775
 
1726
1776
  var ESelectOptionTypes;
1727
1777
  (function (ESelectOptionTypes) {
package/dist/index.js CHANGED
@@ -341,6 +341,7 @@ exports.EFormatTypes = void 0;
341
341
  EFormatTypes["WEEK"] = "WEEK";
342
342
  /** Логический */
343
343
  EFormatTypes["BOOLEAN"] = "BOOLEAN";
344
+ EFormatTypes["PERCENT"] = "PERCENT";
344
345
  })(exports.EFormatTypes || (exports.EFormatTypes = {}));
345
346
  exports.EFormattingPresets = void 0;
346
347
  (function (EFormattingPresets) {
@@ -447,7 +448,7 @@ var formattingConfig = {
447
448
  return _a = {},
448
449
  _a[exports.ESimpleDataType.OTHER] = [exports.EFormatTypes.STRING],
449
450
  _a[exports.ESimpleDataType.STRING] = [exports.EFormatTypes.STRING],
450
- _a[exports.ESimpleDataType.FLOAT] = [exports.EFormatTypes.NUMBER, exports.EFormatTypes.DURATION],
451
+ _a[exports.ESimpleDataType.FLOAT] = [exports.EFormatTypes.NUMBER, exports.EFormatTypes.DURATION, exports.EFormatTypes.PERCENT],
451
452
  _a[exports.ESimpleDataType.INTEGER] = [
452
453
  exports.EFormatTypes.NUMBER,
453
454
  exports.EFormatTypes.DURATION,
@@ -455,6 +456,7 @@ var formattingConfig = {
455
456
  exports.EFormatTypes.MONTH_YEAR,
456
457
  exports.EFormatTypes.MONTH,
457
458
  exports.EFormatTypes.DAY_OF_WEEK,
459
+ exports.EFormatTypes.PERCENT,
458
460
  ],
459
461
  _a[exports.ESimpleDataType.DATE] = [exports.EFormatTypes.DATE],
460
462
  _a[exports.ESimpleDataType.DATETIME] = [exports.EFormatTypes.DATETIME],
@@ -589,6 +591,11 @@ var formattingConfig = {
589
591
  _a[exports.EFormatTypes.WEEK] = [],
590
592
  _a[exports.EFormatTypes.YEAR] = [],
591
593
  _a[exports.EFormatTypes.BOOLEAN] = [],
594
+ _a[exports.EFormatTypes.PERCENT] = [
595
+ exports.EFormattingPresets.AUTO,
596
+ exports.EFormattingPresets["x.x[%]"],
597
+ exports.EFormattingPresets["zx.xx[%]"],
598
+ ],
592
599
  _a;
593
600
  },
594
601
  };
@@ -830,6 +837,7 @@ exports.EOuterAggregation = void 0;
830
837
  EOuterAggregation["min"] = "min";
831
838
  EOuterAggregation["max"] = "max";
832
839
  EOuterAggregation["sum"] = "sum";
840
+ EOuterAggregation["top"] = "top";
833
841
  })(exports.EOuterAggregation || (exports.EOuterAggregation = {}));
834
842
  /** Режимы значения показателя (на основе чего генерируется формула) */
835
843
  exports.EWidgetIndicatorValueModes = void 0;
@@ -1173,21 +1181,32 @@ exports.EMeasureAggregationTemplateName = void 0;
1173
1181
  EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
1174
1182
  EMeasureAggregationTemplateName["countReworks"] = "countReworks";
1175
1183
  })(exports.EMeasureAggregationTemplateName || (exports.EMeasureAggregationTemplateName = {}));
1184
+ function createAggregationTemplate(fn, additionalFn) {
1185
+ return "{outerAggregation}If(process(".concat(fn, "(").concat(additionalFn ? additionalFn + " " : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})");
1186
+ }
1176
1187
  /** Шаблоны процессных метрик меры с режимом AGGREGATION */
1177
1188
  var measureAggregationTemplates = (_a$3 = {},
1178
- _a$3[exports.EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1179
- _a$3[exports.EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1180
- _a$3[exports.EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1181
- _a$3[exports.EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1182
- _a$3[exports.EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1183
- _a$3[exports.EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1184
- _a$3[exports.EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
1185
- _a$3[exports.EMeasureAggregationTemplateName.top] = "{outerAggregation}If(".concat(topTemplate, ", {objectFilters})"),
1186
- _a$3[exports.EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(".concat(firstValueTemplate, ", {objectFilters})"),
1187
- _a$3[exports.EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(".concat(lastValueTemplate, ", {objectFilters})"),
1189
+ _a$3[exports.EMeasureAggregationTemplateName.agvIf] = createAggregationTemplate("avgIf"),
1190
+ _a$3[exports.EMeasureAggregationTemplateName.medianIf] = createAggregationTemplate("medianIf"),
1191
+ _a$3[exports.EMeasureAggregationTemplateName.countIf] = createAggregationTemplate("countIf"),
1192
+ _a$3[exports.EMeasureAggregationTemplateName.countIfDistinct] = createAggregationTemplate("countIf", "distinct"),
1193
+ _a$3[exports.EMeasureAggregationTemplateName.minIf] = createAggregationTemplate("minIf"),
1194
+ _a$3[exports.EMeasureAggregationTemplateName.maxIf] = createAggregationTemplate("maxIf"),
1195
+ _a$3[exports.EMeasureAggregationTemplateName.sumIf] = createAggregationTemplate("sumIf"),
1196
+ _a$3[exports.EMeasureAggregationTemplateName.top] = createTopLikeTemplate(topTemplate),
1197
+ _a$3[exports.EMeasureAggregationTemplateName.firstValue] = createTopLikeTemplate(firstValueTemplate),
1198
+ _a$3[exports.EMeasureAggregationTemplateName.lastValue] = createTopLikeTemplate(lastValueTemplate),
1188
1199
  _a$3[exports.EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
1189
1200
  _a$3[exports.EMeasureAggregationTemplateName.countReworks] = "{outerAggregation}If(".concat(countReworksTemplate, ",{objectFilters})"),
1190
1201
  _a$3);
1202
+ /** Вспомогательная функция для шаблонов top/firstValue/lastValue */
1203
+ function createTopLikeTemplate(template) {
1204
+ return function (outerAggregation) {
1205
+ return outerAggregation === exports.EOuterAggregation.top
1206
+ ? "{outerAggregation}KIf(1)(".concat(template, ", {objectFilters})[1]")
1207
+ : "{outerAggregation}If(".concat(template, ", {objectFilters})");
1208
+ };
1209
+ }
1191
1210
  /** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
1192
1211
  var prepareMeasureAggregationParams = function (value) {
1193
1212
  if (!value.eventName ||
@@ -1247,7 +1266,7 @@ var measureTemplateFormulas = (_a$2 = {},
1247
1266
  _a$2);
1248
1267
 
1249
1268
  /** Шаблон процессной метрики меры с режимом CONVERSION */
1250
- 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) * 100 / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
1269
+ 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)";
1251
1270
  /** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
1252
1271
  var prepareConversionParams = function (value) {
1253
1272
  if (!value.startEventName ||
@@ -1336,12 +1355,17 @@ function getMeasureFormula(_a) {
1336
1355
  });
1337
1356
  }
1338
1357
  if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
1339
- var preparedParams = prepareMeasureAggregationParams(value);
1340
- if (!preparedParams) {
1358
+ var preparedParams_1 = prepareMeasureAggregationParams(value);
1359
+ if (!preparedParams_1) {
1341
1360
  return "";
1342
1361
  }
1343
- var templateFormula = measureAggregationTemplates[value.templateName];
1344
- return fillTemplateString(templateFormula, preparedParams);
1362
+ var getTemplateFormula = function () {
1363
+ var templateFormula = measureAggregationTemplates[value.templateName];
1364
+ return typeof templateFormula === "function"
1365
+ ? templateFormula(preparedParams_1.outerAggregation)
1366
+ : templateFormula;
1367
+ };
1368
+ return fillTemplateString(getTemplateFormula(), preparedParams_1);
1345
1369
  }
1346
1370
  if (value.mode === exports.EWidgetIndicatorValueModes.CONVERSION) {
1347
1371
  var preparedParams = prepareConversionParams(value);
@@ -1614,10 +1638,14 @@ var getDefaultSortOrders = function (_a) {
1614
1638
  if (measures.length > 0) {
1615
1639
  var firstMeasure = measures[0];
1616
1640
  if (firstMeasure) {
1641
+ var formula = getMeasureFormula(firstMeasure);
1642
+ if (!formula) {
1643
+ return [];
1644
+ }
1617
1645
  return [
1618
1646
  {
1619
1647
  direction: exports.ESortDirection.descend,
1620
- formula: getMeasureFormula(firstMeasure),
1648
+ formula: formula,
1621
1649
  dbDataType: firstMeasure.dbDataType,
1622
1650
  },
1623
1651
  ];
@@ -1696,33 +1724,55 @@ function bindContentsWithIndicators(outputs, indicators) {
1696
1724
  return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
1697
1725
  }
1698
1726
 
1699
- exports.EUnitMode = void 0;
1700
- (function (EUnitMode) {
1701
- EUnitMode["PIXEL"] = "PIXEL";
1702
- EUnitMode["PERCENT"] = "PERCENT";
1703
- })(exports.EUnitMode || (exports.EUnitMode = {}));
1704
1727
  exports.EControlType = void 0;
1705
1728
  (function (EControlType) {
1729
+ /** Ввод текста */
1730
+ EControlType["input"] = "input";
1731
+ /** Ввод текста в формате markdown */
1732
+ EControlType["inputMarkdown"] = "inputMarkdown";
1733
+ /** Ввод числа */
1706
1734
  EControlType["inputNumber"] = "inputNumber";
1735
+ /** Выбор диапазона чисел */
1736
+ EControlType["inputRange"] = "inputRange";
1737
+ /** Ввод размера (число + единица измерения) */
1738
+ EControlType["size"] = "size";
1739
+ /** Выбор boolean значения через переключатель */
1707
1740
  EControlType["switch"] = "switch";
1708
- EControlType["input"] = "input";
1709
- EControlType["formattingTemplate"] = "formattingTemplate";
1710
- EControlType["radioIconGroup"] = "radioIconGroup";
1741
+ /** Выбор варианта из выпадающего списка */
1711
1742
  EControlType["select"] = "select";
1712
- EControlType["tagSet"] = "tagSet";
1743
+ /** Выбор одного из вариантов, представленных через иконки */
1744
+ EControlType["radioIconGroup"] = "radioIconGroup";
1745
+ /** Ввод значения показателя */
1713
1746
  EControlType["formula"] = "formula";
1747
+ /** Ввод формулы и ее типа */
1714
1748
  EControlType["typedFormula"] = "typedFormula";
1715
- EControlType["inputRange"] = "inputRange";
1716
- EControlType["colorPicker"] = "colorPicker";
1717
- EControlType["displayCondition"] = "displayCondition";
1718
- EControlType["eventsColor"] = "eventsColor";
1719
- EControlType["inputMarkdown"] = "inputMarkdown";
1720
- EControlType["filter"] = "filter";
1749
+ /** Выбор настроек форматирования */
1750
+ EControlType["formatting"] = "formatting";
1751
+ /** Ввод шаблона форматирования */
1752
+ EControlType["formattingTemplate"] = "formattingTemplate";
1753
+ /** Выбор действий по клику */
1721
1754
  EControlType["actionOnClick"] = "actionOnClick";
1755
+ /** Ввод фильтров */
1756
+ EControlType["filter"] = "filter";
1757
+ /** Ввод условия отображения */
1758
+ EControlType["displayCondition"] = "displayCondition";
1759
+ /** Ввод цвета */
1760
+ EControlType["colorPicker"] = "colorPicker";
1761
+ /** Отображение тегов с возможностью "провалиться" внутрь */
1762
+ EControlType["tagSet"] = "tagSet";
1763
+ /** Множественный выбор событий процесса */
1722
1764
  EControlType["eventsPicker"] = "eventsPicker";
1723
- EControlType["size"] = "size";
1724
- EControlType["formatting"] = "formatting";
1765
+ /**
1766
+ * @deprecated используется только для виджета "Маршруты", будет перенесено на уровень виджета.
1767
+ * Ввод цветов для событий процесса.
1768
+ */
1769
+ EControlType["eventsColor"] = "eventsColor";
1725
1770
  })(exports.EControlType || (exports.EControlType = {}));
1771
+ exports.EUnitMode = void 0;
1772
+ (function (EUnitMode) {
1773
+ EUnitMode["PIXEL"] = "PIXEL";
1774
+ EUnitMode["PERCENT"] = "PERCENT";
1775
+ })(exports.EUnitMode || (exports.EUnitMode = {}));
1726
1776
 
1727
1777
  exports.ESelectOptionTypes = void 0;
1728
1778
  (function (ESelectOptionTypes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "5.10.0",
3
+ "version": "5.11.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",