@infomaximum/widget-sdk 5.8.0 → 5.9.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 +7 -0
- package/dist/index.d.ts +94 -41
- package/dist/index.esm.js +259 -125
- package/dist/index.js +263 -126
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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
|
+
## [5.9.0](https://github.com/Infomaximum/widget-sdk/compare/v5.8.0...v5.9.0) (2025-03-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* добавлены шаблоны для процессных разрезов ([452af57](https://github.com/Infomaximum/widget-sdk/commit/452af57627cb34a92a6354f562d878926f443d0e))
|
|
11
|
+
|
|
5
12
|
## [5.8.0](https://github.com/Infomaximum/widget-sdk/compare/v5.7.1...v5.8.0) (2025-02-28)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.d.ts
CHANGED
|
@@ -905,7 +905,9 @@ declare enum EWidgetIndicatorValueModes {
|
|
|
905
905
|
TEMPLATE = "TEMPLATE",
|
|
906
906
|
AGGREGATION = "AGGREGATION",
|
|
907
907
|
DURATION = "DURATION",
|
|
908
|
-
CONVERSION = "CONVERSION"
|
|
908
|
+
CONVERSION = "CONVERSION",
|
|
909
|
+
START_TIME = "START_TIME",
|
|
910
|
+
END_TIME = "END_TIME"
|
|
909
911
|
}
|
|
910
912
|
/** Режимы сортировки (на что ссылается сортировка) */
|
|
911
913
|
declare enum ESortingValueModes {
|
|
@@ -956,7 +958,9 @@ interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimensio
|
|
|
956
958
|
displayCondition?: TDisplayCondition;
|
|
957
959
|
}
|
|
958
960
|
interface IWidgetDimension extends Omit<IWidgetColumnIndicator, "value"> {
|
|
959
|
-
value?: TColumnIndicatorValue
|
|
961
|
+
value?: TColumnIndicatorValue | (TWidgetIndicatorAggregationValue & {
|
|
962
|
+
innerTemplateName?: string;
|
|
963
|
+
}) | TWidgetIndicatorTimeValue;
|
|
960
964
|
hideEmptyValues: boolean;
|
|
961
965
|
}
|
|
962
966
|
interface IWidgetMeasure extends Omit<IWidgetColumnIndicator, "value"> {
|
|
@@ -1106,6 +1110,16 @@ type TWidgetIndicatorDurationValue = {
|
|
|
1106
1110
|
startEventAppearances: EEventAppearances;
|
|
1107
1111
|
endEventAppearances: EEventAppearances;
|
|
1108
1112
|
} & Omit<TWidgetIndicatorConversionValue, "mode">;
|
|
1113
|
+
type TWidgetIndicatorTimeValue = {
|
|
1114
|
+
templateName: string;
|
|
1115
|
+
mode: EWidgetIndicatorValueModes.START_TIME | EWidgetIndicatorValueModes.END_TIME;
|
|
1116
|
+
processName: string;
|
|
1117
|
+
eventName: string;
|
|
1118
|
+
eventTimeFormula: string;
|
|
1119
|
+
caseCaseIdFormula: string;
|
|
1120
|
+
eventNameFormula: string;
|
|
1121
|
+
filters: TExtendedFormulaFilterValue[];
|
|
1122
|
+
};
|
|
1109
1123
|
|
|
1110
1124
|
/** Формат входного параметра GeneralCalculator */
|
|
1111
1125
|
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
@@ -1422,9 +1436,6 @@ interface ICalculatorFactory {
|
|
|
1422
1436
|
type: () => ITypeCalculator;
|
|
1423
1437
|
}
|
|
1424
1438
|
|
|
1425
|
-
declare function generateColumnFormula(tableName: string, columnName: string): string;
|
|
1426
|
-
declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
|
|
1427
|
-
|
|
1428
1439
|
declare enum EDimensionTemplateNames {
|
|
1429
1440
|
dateTime = "dateTime",
|
|
1430
1441
|
date = "date",
|
|
@@ -1438,21 +1449,49 @@ declare enum EDimensionTemplateNames {
|
|
|
1438
1449
|
dayOfWeek = "dayOfWeek",
|
|
1439
1450
|
hour = "hour"
|
|
1440
1451
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
readonly year: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))";
|
|
1445
|
-
readonly yearAndQuarter: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))";
|
|
1446
|
-
readonly quarter: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))";
|
|
1447
|
-
readonly yearAndMonth: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))";
|
|
1448
|
-
readonly month: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))";
|
|
1449
|
-
readonly dayOfMonth: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))";
|
|
1450
|
-
readonly week: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))";
|
|
1451
|
-
readonly dayOfWeek: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))";
|
|
1452
|
-
readonly hour: "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))";
|
|
1453
|
-
};
|
|
1452
|
+
/** Стандартные шаблоны разреза */
|
|
1453
|
+
declare const dimensionTemplateFormulas: Record<EDimensionTemplateNames, string>;
|
|
1454
|
+
|
|
1454
1455
|
declare function getDimensionFormula({ value }: IWidgetDimension): string;
|
|
1455
1456
|
|
|
1457
|
+
declare enum EDimensionAggregationTemplateName {
|
|
1458
|
+
top = "top",
|
|
1459
|
+
firstValue = "firstValue",
|
|
1460
|
+
lastValue = "lastValue",
|
|
1461
|
+
countExecutions = "countExecutions",
|
|
1462
|
+
countReworks = "countReworks"
|
|
1463
|
+
}
|
|
1464
|
+
/** Шаблоны процессных метрик разреза с режимом AGGREGATION */
|
|
1465
|
+
declare const dimensionAggregationTemplates: Record<EDimensionAggregationTemplateName, string>;
|
|
1466
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1467
|
+
declare const prepareDimensionAggregationParams: (value: Extract<IWidgetDimension["value"], {
|
|
1468
|
+
mode: EWidgetIndicatorValueModes.AGGREGATION;
|
|
1469
|
+
}>) => {
|
|
1470
|
+
eventNameFormula: string;
|
|
1471
|
+
caseCaseIdFormula: string;
|
|
1472
|
+
eventName: string;
|
|
1473
|
+
objectFilters: string;
|
|
1474
|
+
filters: string;
|
|
1475
|
+
eventTimeFormula: string;
|
|
1476
|
+
columnFormula: string;
|
|
1477
|
+
} | null;
|
|
1478
|
+
|
|
1479
|
+
/** Шаблоны процессных метрик разреза с режимами START_TIME/END_TIME */
|
|
1480
|
+
declare const timeTemplates: {
|
|
1481
|
+
START_TIME: Record<EDimensionTemplateNames, string>;
|
|
1482
|
+
END_TIME: Record<EDimensionTemplateNames, string>;
|
|
1483
|
+
};
|
|
1484
|
+
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
1485
|
+
declare const prepareTimeParams: (value: TWidgetIndicatorTimeValue) => {
|
|
1486
|
+
eventTimeFormula: string;
|
|
1487
|
+
eventNameFormula: string;
|
|
1488
|
+
caseCaseIdFormula: string;
|
|
1489
|
+
filters: string;
|
|
1490
|
+
eventName: string;
|
|
1491
|
+
} | undefined;
|
|
1492
|
+
|
|
1493
|
+
declare function getMeasureFormula({ value }: IWidgetMeasure): string;
|
|
1494
|
+
|
|
1456
1495
|
declare enum EMeasureTemplateNames {
|
|
1457
1496
|
avg = "avg",
|
|
1458
1497
|
median = "median",
|
|
@@ -1462,6 +1501,7 @@ declare enum EMeasureTemplateNames {
|
|
|
1462
1501
|
max = "max",
|
|
1463
1502
|
sum = "sum"
|
|
1464
1503
|
}
|
|
1504
|
+
/** Стандартные шаблоны меры */
|
|
1465
1505
|
declare const measureTemplateFormulas: {
|
|
1466
1506
|
readonly avg: "avg({columnFormula})";
|
|
1467
1507
|
readonly count: "count({columnFormula})";
|
|
@@ -1471,7 +1511,25 @@ declare const measureTemplateFormulas: {
|
|
|
1471
1511
|
readonly max: "max({columnFormula})";
|
|
1472
1512
|
readonly sum: "sum({columnFormula})";
|
|
1473
1513
|
};
|
|
1474
|
-
|
|
1514
|
+
|
|
1515
|
+
declare enum EMeasureAggregationTemplateName {
|
|
1516
|
+
agvIf = "agvIf",
|
|
1517
|
+
medianIf = "medianIf",
|
|
1518
|
+
countIf = "countIf",
|
|
1519
|
+
countIfDistinct = "countIfDistinct",
|
|
1520
|
+
minIf = "minIf",
|
|
1521
|
+
maxIf = "maxIf",
|
|
1522
|
+
sumIf = "sumIf",
|
|
1523
|
+
top = "top",
|
|
1524
|
+
firstValue = "firstValue",
|
|
1525
|
+
lastValue = "lastValue",
|
|
1526
|
+
countExecutions = "countExecutions",
|
|
1527
|
+
countReworks = "countReworks"
|
|
1528
|
+
}
|
|
1529
|
+
/** Шаблоны процессных метрик меры с режимом AGGREGATION */
|
|
1530
|
+
declare const measureAggregationTemplates: Record<EMeasureAggregationTemplateName, string>;
|
|
1531
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1532
|
+
declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["value"], {
|
|
1475
1533
|
mode: EWidgetIndicatorValueModes.AGGREGATION;
|
|
1476
1534
|
}>) => {
|
|
1477
1535
|
outerAggregation: EOuterAggregation;
|
|
@@ -1483,6 +1541,10 @@ declare const prepareAggregationParams: (value: Extract<IWidgetMeasure["value"],
|
|
|
1483
1541
|
eventTimeFormula: string;
|
|
1484
1542
|
columnFormula: string;
|
|
1485
1543
|
} | null;
|
|
1544
|
+
|
|
1545
|
+
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1546
|
+
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) * 100 / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
1547
|
+
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1486
1548
|
declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
|
|
1487
1549
|
objectFilters: string;
|
|
1488
1550
|
startEventTimeFormula: string;
|
|
@@ -1495,6 +1557,10 @@ declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue)
|
|
|
1495
1557
|
endEventName: string;
|
|
1496
1558
|
endEventFilters: string;
|
|
1497
1559
|
} | null;
|
|
1560
|
+
|
|
1561
|
+
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1562
|
+
declare const durationTemplates: Record<EDurationTemplateName, string>;
|
|
1563
|
+
/** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1498
1564
|
declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
|
|
1499
1565
|
objectFilters: string;
|
|
1500
1566
|
startEventTimeFormula: string;
|
|
@@ -1509,7 +1575,8 @@ declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
|
|
|
1509
1575
|
endEventFilters: string;
|
|
1510
1576
|
endEventAggregationName: string;
|
|
1511
1577
|
} | null;
|
|
1512
|
-
|
|
1578
|
+
|
|
1579
|
+
declare function getEventMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
|
|
1513
1580
|
|
|
1514
1581
|
declare enum EEventMeasureTemplateNames {
|
|
1515
1582
|
eventsCount = "eventsCount",
|
|
@@ -1519,7 +1586,8 @@ declare const eventMeasureTemplateFormulas: {
|
|
|
1519
1586
|
readonly eventsCount: "count()";
|
|
1520
1587
|
readonly reworksCount: "count() - uniqExact({caseCaseIdFormula})";
|
|
1521
1588
|
};
|
|
1522
|
-
|
|
1589
|
+
|
|
1590
|
+
declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
|
|
1523
1591
|
|
|
1524
1592
|
declare enum ETransitionMeasureTemplateNames {
|
|
1525
1593
|
transitionsCount = "transitionsCount",
|
|
@@ -1529,27 +1597,12 @@ declare const transitionMeasureTemplateFormulas: {
|
|
|
1529
1597
|
readonly transitionsCount: "count()";
|
|
1530
1598
|
readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
|
|
1531
1599
|
};
|
|
1532
|
-
declare function getTransitionMeasureFormula({ value }: IProcessIndicator, process: IWidgetProcess): string;
|
|
1533
1600
|
|
|
1534
|
-
declare enum EMeasureAggregationTemplateName {
|
|
1535
|
-
agvIf = "agvIf",
|
|
1536
|
-
medianIf = "medianIf",
|
|
1537
|
-
countIf = "countIf",
|
|
1538
|
-
countIfDistinct = "countIfDistinct",
|
|
1539
|
-
minIf = "minIf",
|
|
1540
|
-
maxIf = "maxIf",
|
|
1541
|
-
sumIf = "sumIf",
|
|
1542
|
-
top = "top",
|
|
1543
|
-
firstValue = "firstValue",
|
|
1544
|
-
lastValue = "lastValue",
|
|
1545
|
-
countExecutions = "countExecutions",
|
|
1546
|
-
countReworks = "countReworks"
|
|
1547
|
-
}
|
|
1548
|
-
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) * 100 / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
1549
|
-
declare const durationTemplates: Record<EDurationTemplateName, string>;
|
|
1550
|
-
declare const countReworksTemplate = "{outerAggregation}If(process(if(countIf({eventNameFormula} = '{eventName}'{filters}) > 0, countIf({eventNameFormula} = '{eventName}'{filters}) - 1, 0), {caseCaseIdFormula}),{objectFilters})";
|
|
1551
1601
|
declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
1552
|
-
|
|
1602
|
+
|
|
1603
|
+
declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
|
|
1604
|
+
|
|
1605
|
+
declare function generateColumnFormula(tableName: string, columnName: string): string;
|
|
1553
1606
|
|
|
1554
1607
|
/**
|
|
1555
1608
|
* Регулярное выражение для поиска имени ссылки внутри формулы.
|
|
@@ -2168,4 +2221,4 @@ declare global {
|
|
|
2168
2221
|
}
|
|
2169
2222
|
}
|
|
2170
2223
|
|
|
2171
|
-
export { EActionButtonsTypes, EActionTypes, EBlockingConditionMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, 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 IActionGoToUrl, 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 ICollapseRecord, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, 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 IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, 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 TAppearanceSettings, 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 TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorData, type TWidgetIndicatorDurationValue, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate,
|
|
2224
|
+
export { EActionButtonsTypes, EActionTypes, EBlockingConditionMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, 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 IActionGoToUrl, 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 ICollapseRecord, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, 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 IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, 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 TAppearanceSettings, 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 TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorData, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, durationTemplates, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureAggregationTemplates, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -775,21 +775,35 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
775
775
|
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
776
776
|
};
|
|
777
777
|
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
778
|
+
var _a$5;
|
|
779
|
+
var EDimensionTemplateNames;
|
|
780
|
+
(function (EDimensionTemplateNames) {
|
|
781
|
+
EDimensionTemplateNames["dateTime"] = "dateTime";
|
|
782
|
+
EDimensionTemplateNames["date"] = "date";
|
|
783
|
+
EDimensionTemplateNames["year"] = "year";
|
|
784
|
+
EDimensionTemplateNames["yearAndQuarter"] = "yearAndQuarter";
|
|
785
|
+
EDimensionTemplateNames["quarter"] = "quarter";
|
|
786
|
+
EDimensionTemplateNames["yearAndMonth"] = "yearAndMonth";
|
|
787
|
+
EDimensionTemplateNames["dayOfMonth"] = "dayOfMonth";
|
|
788
|
+
EDimensionTemplateNames["month"] = "month";
|
|
789
|
+
EDimensionTemplateNames["week"] = "week";
|
|
790
|
+
EDimensionTemplateNames["dayOfWeek"] = "dayOfWeek";
|
|
791
|
+
EDimensionTemplateNames["hour"] = "hour";
|
|
792
|
+
})(EDimensionTemplateNames || (EDimensionTemplateNames = {}));
|
|
793
|
+
/** Стандартные шаблоны разреза */
|
|
794
|
+
var dimensionTemplateFormulas = (_a$5 = {},
|
|
795
|
+
_a$5[EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
796
|
+
_a$5[EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
797
|
+
_a$5[EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
798
|
+
_a$5[EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
799
|
+
_a$5[EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
800
|
+
_a$5[EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
801
|
+
_a$5[EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
802
|
+
_a$5[EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
803
|
+
_a$5[EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
804
|
+
_a$5[EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
805
|
+
_a$5[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
806
|
+
_a$5);
|
|
793
807
|
|
|
794
808
|
var EWidgetIndicatorType;
|
|
795
809
|
(function (EWidgetIndicatorType) {
|
|
@@ -819,6 +833,8 @@ var EWidgetIndicatorValueModes;
|
|
|
819
833
|
EWidgetIndicatorValueModes["AGGREGATION"] = "AGGREGATION";
|
|
820
834
|
EWidgetIndicatorValueModes["DURATION"] = "DURATION";
|
|
821
835
|
EWidgetIndicatorValueModes["CONVERSION"] = "CONVERSION";
|
|
836
|
+
EWidgetIndicatorValueModes["START_TIME"] = "START_TIME";
|
|
837
|
+
EWidgetIndicatorValueModes["END_TIME"] = "END_TIME";
|
|
822
838
|
})(EWidgetIndicatorValueModes || (EWidgetIndicatorValueModes = {}));
|
|
823
839
|
/** Режимы сортировки (на что ссылается сортировка) */
|
|
824
840
|
var ESortingValueModes;
|
|
@@ -888,94 +904,28 @@ var EEventAppearances;
|
|
|
888
904
|
EEventAppearances["LAST"] = "LAST";
|
|
889
905
|
})(EEventAppearances || (EEventAppearances = {}));
|
|
890
906
|
|
|
891
|
-
var
|
|
892
|
-
var
|
|
893
|
-
(
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
EDimensionTemplateNames["yearAndMonth"] = "yearAndMonth";
|
|
900
|
-
EDimensionTemplateNames["dayOfMonth"] = "dayOfMonth";
|
|
901
|
-
EDimensionTemplateNames["month"] = "month";
|
|
902
|
-
EDimensionTemplateNames["week"] = "week";
|
|
903
|
-
EDimensionTemplateNames["dayOfWeek"] = "dayOfWeek";
|
|
904
|
-
EDimensionTemplateNames["hour"] = "hour";
|
|
905
|
-
})(EDimensionTemplateNames || (EDimensionTemplateNames = {}));
|
|
906
|
-
var dimensionTemplateFormulas = (_a$4 = {},
|
|
907
|
-
_a$4[EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
908
|
-
_a$4[EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
909
|
-
_a$4[EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
910
|
-
_a$4[EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
911
|
-
_a$4[EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
912
|
-
_a$4[EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
913
|
-
_a$4[EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
914
|
-
_a$4[EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
915
|
-
_a$4[EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
916
|
-
_a$4[EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
917
|
-
_a$4[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
918
|
-
_a$4);
|
|
919
|
-
function getDimensionFormula(_a) {
|
|
920
|
-
var _b;
|
|
921
|
-
var value = _a.value;
|
|
922
|
-
if (!value) {
|
|
923
|
-
return "";
|
|
924
|
-
}
|
|
925
|
-
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
926
|
-
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
927
|
-
}
|
|
928
|
-
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
929
|
-
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
930
|
-
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
931
|
-
if (!templateFormula || !tableName || !columnName) {
|
|
932
|
-
return "";
|
|
933
|
-
}
|
|
934
|
-
return fillTemplateString(templateFormula, {
|
|
935
|
-
columnFormula: generateColumnFormula(tableName, columnName),
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
return "";
|
|
907
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = '{eventName}'{filters}) > 0, countIf({eventNameFormula} = '{eventName}'{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
908
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
909
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
910
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
911
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = '{eventName}'{filters})[1], {caseCaseIdFormula})";
|
|
912
|
+
|
|
913
|
+
function fillTemplateString(templateString, params) {
|
|
914
|
+
return templateString.replace(/\{(.*?)\}/g, function (_, key) { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ""; });
|
|
939
915
|
}
|
|
940
916
|
|
|
941
|
-
var
|
|
942
|
-
|
|
943
|
-
(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
EMeasureAggregationTemplateName["lastValue"] = "lastValue";
|
|
954
|
-
EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
955
|
-
EMeasureAggregationTemplateName["countReworks"] = "countReworks";
|
|
956
|
-
})(EMeasureAggregationTemplateName || (EMeasureAggregationTemplateName = {}));
|
|
957
|
-
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)";
|
|
958
|
-
var durationTemplate = "\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";
|
|
959
|
-
var durationTemplates = (_a$3 = {},
|
|
960
|
-
_a$3[EDurationTemplateName.avg] = "avgIf(".concat(durationTemplate, ")"),
|
|
961
|
-
_a$3[EDurationTemplateName.median] = "medianIf(".concat(durationTemplate, ")"),
|
|
962
|
-
_a$3);
|
|
963
|
-
var countReworksTemplate = "{outerAggregation}If(process(if(countIf({eventNameFormula} = '{eventName}'{filters}) > 0, countIf({eventNameFormula} = '{eventName}'{filters}) - 1, 0), {caseCaseIdFormula}),{objectFilters})";
|
|
964
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
965
|
-
var measureAggregationTemplates = (_b = {},
|
|
966
|
-
_b[EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
967
|
-
_b[EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
968
|
-
_b[EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
969
|
-
_b[EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
970
|
-
_b[EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
971
|
-
_b[EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
972
|
-
_b[EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
973
|
-
_b[EMeasureAggregationTemplateName.top] = "{outerAggregation}If(process(topKIf(1)({columnFormula}, {eventNameFormula} = '{eventName}'{filters})[1], {caseCaseIdFormula}), {objectFilters})",
|
|
974
|
-
_b[EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
975
|
-
_b[EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
976
|
-
_b[EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
|
|
977
|
-
_b[EMeasureAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
978
|
-
_b);
|
|
917
|
+
var escapeSpecialCharacters = function (formula) {
|
|
918
|
+
return formula
|
|
919
|
+
.replaceAll("\\", "\\\\")
|
|
920
|
+
.replaceAll('"', '\\"')
|
|
921
|
+
.replaceAll("`", "\\`");
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
function generateColumnFormula(tableName, columnName) {
|
|
925
|
+
var preparedTableName = escapeSpecialCharacters(tableName);
|
|
926
|
+
var preparedColumnName = escapeSpecialCharacters(columnName);
|
|
927
|
+
return "\"".concat(preparedTableName, "\".\"").concat(preparedColumnName, "\"");
|
|
928
|
+
}
|
|
979
929
|
|
|
980
930
|
var escapeSingularQuotes = function (formula) {
|
|
981
931
|
if (typeof formula !== "string") {
|
|
@@ -1067,27 +1017,171 @@ var convertFiltersToFormula = function (filters) {
|
|
|
1067
1017
|
return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
|
|
1068
1018
|
};
|
|
1069
1019
|
|
|
1070
|
-
var _a$
|
|
1071
|
-
var
|
|
1072
|
-
(function (
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
_a$
|
|
1083
|
-
_a$
|
|
1084
|
-
_a$
|
|
1085
|
-
_a$
|
|
1086
|
-
_a$
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1020
|
+
var _a$4;
|
|
1021
|
+
var EDimensionAggregationTemplateName;
|
|
1022
|
+
(function (EDimensionAggregationTemplateName) {
|
|
1023
|
+
EDimensionAggregationTemplateName["top"] = "top";
|
|
1024
|
+
EDimensionAggregationTemplateName["firstValue"] = "firstValue";
|
|
1025
|
+
EDimensionAggregationTemplateName["lastValue"] = "lastValue";
|
|
1026
|
+
EDimensionAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
1027
|
+
EDimensionAggregationTemplateName["countReworks"] = "countReworks";
|
|
1028
|
+
})(EDimensionAggregationTemplateName || (EDimensionAggregationTemplateName = {}));
|
|
1029
|
+
/** Шаблоны процессных метрик разреза с режимом AGGREGATION */
|
|
1030
|
+
var dimensionAggregationTemplates = (_a$4 = {},
|
|
1031
|
+
_a$4[EDimensionAggregationTemplateName.top] = topTemplate,
|
|
1032
|
+
_a$4[EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
|
|
1033
|
+
_a$4[EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
|
|
1034
|
+
_a$4[EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
|
|
1035
|
+
_a$4[EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
1036
|
+
_a$4);
|
|
1037
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1038
|
+
var prepareDimensionAggregationParams = function (value) {
|
|
1039
|
+
if (!value.eventName ||
|
|
1040
|
+
!value.caseCaseIdFormula ||
|
|
1041
|
+
!value.eventNameFormula ||
|
|
1042
|
+
!value.processName ||
|
|
1043
|
+
!value.templateName) {
|
|
1044
|
+
return null;
|
|
1045
|
+
}
|
|
1046
|
+
var commonParams = {
|
|
1047
|
+
eventNameFormula: value.eventNameFormula,
|
|
1048
|
+
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1049
|
+
eventName: value.eventName,
|
|
1050
|
+
objectFilters: "1",
|
|
1051
|
+
filters: convertFiltersToFormula(value.filters),
|
|
1052
|
+
eventTimeFormula: "",
|
|
1053
|
+
columnFormula: "",
|
|
1054
|
+
};
|
|
1055
|
+
if (value.templateName === EDimensionAggregationTemplateName.countReworks ||
|
|
1056
|
+
value.templateName === EDimensionAggregationTemplateName.countExecutions) {
|
|
1057
|
+
return commonParams;
|
|
1058
|
+
}
|
|
1059
|
+
if (!value.tableName || !value.columnName) {
|
|
1060
|
+
return null;
|
|
1061
|
+
}
|
|
1062
|
+
var columnParams = __assign(__assign(__assign({}, commonParams), (value.innerTemplateName && { innerTemplateName: value.innerTemplateName })), { columnFormula: generateColumnFormula(value.tableName, value.columnName) });
|
|
1063
|
+
if (value.templateName === EDimensionAggregationTemplateName.firstValue ||
|
|
1064
|
+
value.templateName === EDimensionAggregationTemplateName.lastValue) {
|
|
1065
|
+
if (!value.eventTimeFormula) {
|
|
1066
|
+
return null;
|
|
1067
|
+
}
|
|
1068
|
+
return __assign(__assign({}, columnParams), { eventTimeFormula: value.eventTimeFormula });
|
|
1069
|
+
}
|
|
1070
|
+
return columnParams;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
/** Шаблоны процессных метрик разреза с режимами START_TIME/END_TIME */
|
|
1074
|
+
var timeTemplates = (function () {
|
|
1075
|
+
var _a;
|
|
1076
|
+
var generateTemplates = function (innerTemplate) {
|
|
1077
|
+
var templates = {};
|
|
1078
|
+
for (var key in dimensionTemplateFormulas) {
|
|
1079
|
+
templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1080
|
+
}
|
|
1081
|
+
return templates;
|
|
1082
|
+
};
|
|
1083
|
+
return _a = {},
|
|
1084
|
+
_a[EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})"),
|
|
1085
|
+
_a[EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})"),
|
|
1086
|
+
_a;
|
|
1087
|
+
})();
|
|
1088
|
+
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
1089
|
+
var prepareTimeParams = function (value) {
|
|
1090
|
+
if (!value.eventName ||
|
|
1091
|
+
!value.caseCaseIdFormula ||
|
|
1092
|
+
!value.eventNameFormula ||
|
|
1093
|
+
!value.processName ||
|
|
1094
|
+
!value.templateName ||
|
|
1095
|
+
!value.eventTimeFormula) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
return {
|
|
1099
|
+
eventTimeFormula: value.eventTimeFormula,
|
|
1100
|
+
eventNameFormula: value.eventNameFormula,
|
|
1101
|
+
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1102
|
+
filters: convertFiltersToFormula(value.filters),
|
|
1103
|
+
eventName: value.eventName,
|
|
1104
|
+
};
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
function getDimensionFormula(_a) {
|
|
1108
|
+
var _b;
|
|
1109
|
+
var value = _a.value;
|
|
1110
|
+
if (!value) {
|
|
1111
|
+
return "";
|
|
1112
|
+
}
|
|
1113
|
+
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
1114
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
1115
|
+
}
|
|
1116
|
+
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1117
|
+
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
1118
|
+
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
1119
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
1120
|
+
return "";
|
|
1121
|
+
}
|
|
1122
|
+
return fillTemplateString(templateFormula, {
|
|
1123
|
+
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1127
|
+
var preparedParams = prepareDimensionAggregationParams(value);
|
|
1128
|
+
if (!preparedParams) {
|
|
1129
|
+
return "";
|
|
1130
|
+
}
|
|
1131
|
+
var innerTemplate = value.innerTemplateName
|
|
1132
|
+
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1133
|
+
: null;
|
|
1134
|
+
var columnFormula = innerTemplate
|
|
1135
|
+
? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1136
|
+
: preparedParams.columnFormula;
|
|
1137
|
+
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1138
|
+
return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1139
|
+
}
|
|
1140
|
+
if (value.mode === EWidgetIndicatorValueModes.START_TIME ||
|
|
1141
|
+
value.mode === EWidgetIndicatorValueModes.END_TIME) {
|
|
1142
|
+
var preparedParams = prepareTimeParams(value);
|
|
1143
|
+
if (!preparedParams) {
|
|
1144
|
+
return "";
|
|
1145
|
+
}
|
|
1146
|
+
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1147
|
+
return fillTemplateString(templateFormula, preparedParams);
|
|
1148
|
+
}
|
|
1149
|
+
return "";
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
var _a$3;
|
|
1153
|
+
var EMeasureAggregationTemplateName;
|
|
1154
|
+
(function (EMeasureAggregationTemplateName) {
|
|
1155
|
+
EMeasureAggregationTemplateName["agvIf"] = "agvIf";
|
|
1156
|
+
EMeasureAggregationTemplateName["medianIf"] = "medianIf";
|
|
1157
|
+
EMeasureAggregationTemplateName["countIf"] = "countIf";
|
|
1158
|
+
EMeasureAggregationTemplateName["countIfDistinct"] = "countIfDistinct";
|
|
1159
|
+
EMeasureAggregationTemplateName["minIf"] = "minIf";
|
|
1160
|
+
EMeasureAggregationTemplateName["maxIf"] = "maxIf";
|
|
1161
|
+
EMeasureAggregationTemplateName["sumIf"] = "sumIf";
|
|
1162
|
+
EMeasureAggregationTemplateName["top"] = "top";
|
|
1163
|
+
EMeasureAggregationTemplateName["firstValue"] = "firstValue";
|
|
1164
|
+
EMeasureAggregationTemplateName["lastValue"] = "lastValue";
|
|
1165
|
+
EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
1166
|
+
EMeasureAggregationTemplateName["countReworks"] = "countReworks";
|
|
1167
|
+
})(EMeasureAggregationTemplateName || (EMeasureAggregationTemplateName = {}));
|
|
1168
|
+
/** Шаблоны процессных метрик меры с режимом AGGREGATION */
|
|
1169
|
+
var measureAggregationTemplates = (_a$3 = {},
|
|
1170
|
+
_a$3[EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1171
|
+
_a$3[EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1172
|
+
_a$3[EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1173
|
+
_a$3[EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1174
|
+
_a$3[EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1175
|
+
_a$3[EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1176
|
+
_a$3[EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1177
|
+
_a$3[EMeasureAggregationTemplateName.top] = "{outerAggregation}If(".concat(topTemplate, ", {objectFilters})"),
|
|
1178
|
+
_a$3[EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(".concat(firstValueTemplate, ", {objectFilters})"),
|
|
1179
|
+
_a$3[EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(".concat(lastValueTemplate, ", {objectFilters})"),
|
|
1180
|
+
_a$3[EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
|
|
1181
|
+
_a$3[EMeasureAggregationTemplateName.countReworks] = "{outerAggregation}If(".concat(countReworksTemplate, ",{objectFilters})"),
|
|
1182
|
+
_a$3);
|
|
1183
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1184
|
+
var prepareMeasureAggregationParams = function (value) {
|
|
1091
1185
|
if (!value.eventName ||
|
|
1092
1186
|
!value.caseCaseIdFormula ||
|
|
1093
1187
|
!value.eventNameFormula ||
|
|
@@ -1121,6 +1215,32 @@ var prepareAggregationParams = function (value) {
|
|
|
1121
1215
|
}
|
|
1122
1216
|
return columnParams;
|
|
1123
1217
|
};
|
|
1218
|
+
|
|
1219
|
+
var _a$2;
|
|
1220
|
+
var EMeasureTemplateNames;
|
|
1221
|
+
(function (EMeasureTemplateNames) {
|
|
1222
|
+
EMeasureTemplateNames["avg"] = "avg";
|
|
1223
|
+
EMeasureTemplateNames["median"] = "median";
|
|
1224
|
+
EMeasureTemplateNames["count"] = "count";
|
|
1225
|
+
EMeasureTemplateNames["countDistinct"] = "countDistinct";
|
|
1226
|
+
EMeasureTemplateNames["min"] = "min";
|
|
1227
|
+
EMeasureTemplateNames["max"] = "max";
|
|
1228
|
+
EMeasureTemplateNames["sum"] = "sum";
|
|
1229
|
+
})(EMeasureTemplateNames || (EMeasureTemplateNames = {}));
|
|
1230
|
+
/** Стандартные шаблоны меры */
|
|
1231
|
+
var measureTemplateFormulas = (_a$2 = {},
|
|
1232
|
+
_a$2[EMeasureTemplateNames.avg] = "avg({columnFormula})",
|
|
1233
|
+
_a$2[EMeasureTemplateNames.count] = "count({columnFormula})",
|
|
1234
|
+
_a$2[EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
|
|
1235
|
+
_a$2[EMeasureTemplateNames.median] = "medianExact({columnFormula})",
|
|
1236
|
+
_a$2[EMeasureTemplateNames.min] = "min({columnFormula})",
|
|
1237
|
+
_a$2[EMeasureTemplateNames.max] = "max({columnFormula})",
|
|
1238
|
+
_a$2[EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
1239
|
+
_a$2);
|
|
1240
|
+
|
|
1241
|
+
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1242
|
+
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)";
|
|
1243
|
+
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1124
1244
|
var prepareConversionParams = function (value) {
|
|
1125
1245
|
if (!value.startEventName ||
|
|
1126
1246
|
!value.endEventName ||
|
|
@@ -1146,6 +1266,17 @@ var prepareConversionParams = function (value) {
|
|
|
1146
1266
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1147
1267
|
};
|
|
1148
1268
|
};
|
|
1269
|
+
|
|
1270
|
+
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1271
|
+
var durationTemplates = (function () {
|
|
1272
|
+
var _a;
|
|
1273
|
+
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 ";
|
|
1274
|
+
return _a = {},
|
|
1275
|
+
_a[EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1276
|
+
_a[EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
1277
|
+
_a;
|
|
1278
|
+
})();
|
|
1279
|
+
/** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1149
1280
|
var prepareDurationParams = function (value) {
|
|
1150
1281
|
if (!value.startEventName ||
|
|
1151
1282
|
!value.endEventName ||
|
|
@@ -1159,7 +1290,7 @@ var prepareDurationParams = function (value) {
|
|
|
1159
1290
|
return null;
|
|
1160
1291
|
}
|
|
1161
1292
|
var getAggregationNameByAppearances = function (appearance) {
|
|
1162
|
-
return appearance ===
|
|
1293
|
+
return appearance === EEventAppearances.FIRST ? "minIf" : "maxIf";
|
|
1163
1294
|
};
|
|
1164
1295
|
return {
|
|
1165
1296
|
objectFilters: "1",
|
|
@@ -1176,6 +1307,7 @@ var prepareDurationParams = function (value) {
|
|
|
1176
1307
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1177
1308
|
};
|
|
1178
1309
|
};
|
|
1310
|
+
|
|
1179
1311
|
function getMeasureFormula(_a) {
|
|
1180
1312
|
var _b;
|
|
1181
1313
|
var value = _a.value;
|
|
@@ -1196,7 +1328,7 @@ function getMeasureFormula(_a) {
|
|
|
1196
1328
|
});
|
|
1197
1329
|
}
|
|
1198
1330
|
if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1199
|
-
var preparedParams =
|
|
1331
|
+
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1200
1332
|
if (!preparedParams) {
|
|
1201
1333
|
return "";
|
|
1202
1334
|
}
|
|
@@ -1230,6 +1362,7 @@ var eventMeasureTemplateFormulas = (_a$1 = {},
|
|
|
1230
1362
|
_a$1[EEventMeasureTemplateNames.eventsCount] = "count()",
|
|
1231
1363
|
_a$1[EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
|
|
1232
1364
|
_a$1);
|
|
1365
|
+
|
|
1233
1366
|
function getEventMeasureFormula(_a, process) {
|
|
1234
1367
|
var value = _a.value;
|
|
1235
1368
|
if (!value) {
|
|
@@ -1255,6 +1388,7 @@ var transitionMeasureTemplateFormulas = (_a = {},
|
|
|
1255
1388
|
_a[ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1256
1389
|
_a[ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1257
1390
|
_a);
|
|
1391
|
+
|
|
1258
1392
|
function getTransitionMeasureFormula(_a, process) {
|
|
1259
1393
|
var value = _a.value;
|
|
1260
1394
|
if (!value) {
|
|
@@ -1781,4 +1915,4 @@ var getColorByIndex = function (index) {
|
|
|
1781
1915
|
return color;
|
|
1782
1916
|
};
|
|
1783
1917
|
|
|
1784
|
-
export { EActionButtonsTypes, EActionTypes, EBlockingConditionMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, 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, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate,
|
|
1918
|
+
export { EActionButtonsTypes, EActionTypes, EBlockingConditionMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, 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, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, durationTemplates, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureAggregationTemplates, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.js
CHANGED
|
@@ -776,21 +776,35 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
776
776
|
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
777
777
|
};
|
|
778
778
|
|
|
779
|
-
var
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}
|
|
779
|
+
var _a$5;
|
|
780
|
+
exports.EDimensionTemplateNames = void 0;
|
|
781
|
+
(function (EDimensionTemplateNames) {
|
|
782
|
+
EDimensionTemplateNames["dateTime"] = "dateTime";
|
|
783
|
+
EDimensionTemplateNames["date"] = "date";
|
|
784
|
+
EDimensionTemplateNames["year"] = "year";
|
|
785
|
+
EDimensionTemplateNames["yearAndQuarter"] = "yearAndQuarter";
|
|
786
|
+
EDimensionTemplateNames["quarter"] = "quarter";
|
|
787
|
+
EDimensionTemplateNames["yearAndMonth"] = "yearAndMonth";
|
|
788
|
+
EDimensionTemplateNames["dayOfMonth"] = "dayOfMonth";
|
|
789
|
+
EDimensionTemplateNames["month"] = "month";
|
|
790
|
+
EDimensionTemplateNames["week"] = "week";
|
|
791
|
+
EDimensionTemplateNames["dayOfWeek"] = "dayOfWeek";
|
|
792
|
+
EDimensionTemplateNames["hour"] = "hour";
|
|
793
|
+
})(exports.EDimensionTemplateNames || (exports.EDimensionTemplateNames = {}));
|
|
794
|
+
/** Стандартные шаблоны разреза */
|
|
795
|
+
var dimensionTemplateFormulas = (_a$5 = {},
|
|
796
|
+
_a$5[exports.EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
797
|
+
_a$5[exports.EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
798
|
+
_a$5[exports.EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
799
|
+
_a$5[exports.EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
800
|
+
_a$5[exports.EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
801
|
+
_a$5[exports.EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
802
|
+
_a$5[exports.EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
803
|
+
_a$5[exports.EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
804
|
+
_a$5[exports.EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
805
|
+
_a$5[exports.EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
806
|
+
_a$5[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
807
|
+
_a$5);
|
|
794
808
|
|
|
795
809
|
exports.EWidgetIndicatorType = void 0;
|
|
796
810
|
(function (EWidgetIndicatorType) {
|
|
@@ -820,6 +834,8 @@ exports.EWidgetIndicatorValueModes = void 0;
|
|
|
820
834
|
EWidgetIndicatorValueModes["AGGREGATION"] = "AGGREGATION";
|
|
821
835
|
EWidgetIndicatorValueModes["DURATION"] = "DURATION";
|
|
822
836
|
EWidgetIndicatorValueModes["CONVERSION"] = "CONVERSION";
|
|
837
|
+
EWidgetIndicatorValueModes["START_TIME"] = "START_TIME";
|
|
838
|
+
EWidgetIndicatorValueModes["END_TIME"] = "END_TIME";
|
|
823
839
|
})(exports.EWidgetIndicatorValueModes || (exports.EWidgetIndicatorValueModes = {}));
|
|
824
840
|
/** Режимы сортировки (на что ссылается сортировка) */
|
|
825
841
|
exports.ESortingValueModes = void 0;
|
|
@@ -889,94 +905,28 @@ exports.EEventAppearances = void 0;
|
|
|
889
905
|
EEventAppearances["LAST"] = "LAST";
|
|
890
906
|
})(exports.EEventAppearances || (exports.EEventAppearances = {}));
|
|
891
907
|
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
(
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
EDimensionTemplateNames["yearAndMonth"] = "yearAndMonth";
|
|
901
|
-
EDimensionTemplateNames["dayOfMonth"] = "dayOfMonth";
|
|
902
|
-
EDimensionTemplateNames["month"] = "month";
|
|
903
|
-
EDimensionTemplateNames["week"] = "week";
|
|
904
|
-
EDimensionTemplateNames["dayOfWeek"] = "dayOfWeek";
|
|
905
|
-
EDimensionTemplateNames["hour"] = "hour";
|
|
906
|
-
})(exports.EDimensionTemplateNames || (exports.EDimensionTemplateNames = {}));
|
|
907
|
-
var dimensionTemplateFormulas = (_a$4 = {},
|
|
908
|
-
_a$4[exports.EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
909
|
-
_a$4[exports.EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
910
|
-
_a$4[exports.EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
911
|
-
_a$4[exports.EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
912
|
-
_a$4[exports.EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
913
|
-
_a$4[exports.EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
914
|
-
_a$4[exports.EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
915
|
-
_a$4[exports.EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
916
|
-
_a$4[exports.EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
917
|
-
_a$4[exports.EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
918
|
-
_a$4[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
919
|
-
_a$4);
|
|
920
|
-
function getDimensionFormula(_a) {
|
|
921
|
-
var _b;
|
|
922
|
-
var value = _a.value;
|
|
923
|
-
if (!value) {
|
|
924
|
-
return "";
|
|
925
|
-
}
|
|
926
|
-
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
927
|
-
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
928
|
-
}
|
|
929
|
-
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
930
|
-
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
931
|
-
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
932
|
-
if (!templateFormula || !tableName || !columnName) {
|
|
933
|
-
return "";
|
|
934
|
-
}
|
|
935
|
-
return fillTemplateString(templateFormula, {
|
|
936
|
-
columnFormula: generateColumnFormula(tableName, columnName),
|
|
937
|
-
});
|
|
938
|
-
}
|
|
939
|
-
return "";
|
|
908
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = '{eventName}'{filters}) > 0, countIf({eventNameFormula} = '{eventName}'{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
909
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
910
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
911
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
912
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = '{eventName}'{filters})[1], {caseCaseIdFormula})";
|
|
913
|
+
|
|
914
|
+
function fillTemplateString(templateString, params) {
|
|
915
|
+
return templateString.replace(/\{(.*?)\}/g, function (_, key) { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ""; });
|
|
940
916
|
}
|
|
941
917
|
|
|
942
|
-
var
|
|
943
|
-
|
|
944
|
-
(
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
EMeasureAggregationTemplateName["lastValue"] = "lastValue";
|
|
955
|
-
EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
956
|
-
EMeasureAggregationTemplateName["countReworks"] = "countReworks";
|
|
957
|
-
})(exports.EMeasureAggregationTemplateName || (exports.EMeasureAggregationTemplateName = {}));
|
|
958
|
-
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)";
|
|
959
|
-
var durationTemplate = "\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";
|
|
960
|
-
var durationTemplates = (_a$3 = {},
|
|
961
|
-
_a$3[exports.EDurationTemplateName.avg] = "avgIf(".concat(durationTemplate, ")"),
|
|
962
|
-
_a$3[exports.EDurationTemplateName.median] = "medianIf(".concat(durationTemplate, ")"),
|
|
963
|
-
_a$3);
|
|
964
|
-
var countReworksTemplate = "{outerAggregation}If(process(if(countIf({eventNameFormula} = '{eventName}'{filters}) > 0, countIf({eventNameFormula} = '{eventName}'{filters}) - 1, 0), {caseCaseIdFormula}),{objectFilters})";
|
|
965
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in '{eventName}'{filters}), {caseCaseIdFormula})";
|
|
966
|
-
var measureAggregationTemplates = (_b = {},
|
|
967
|
-
_b[exports.EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
968
|
-
_b[exports.EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
969
|
-
_b[exports.EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
970
|
-
_b[exports.EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
971
|
-
_b[exports.EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
972
|
-
_b[exports.EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
973
|
-
_b[exports.EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
974
|
-
_b[exports.EMeasureAggregationTemplateName.top] = "{outerAggregation}If(process(topKIf(1)({columnFormula}, {eventNameFormula} = '{eventName}'{filters})[1], {caseCaseIdFormula}), {objectFilters})",
|
|
975
|
-
_b[exports.EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
976
|
-
_b[exports.EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
977
|
-
_b[exports.EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
|
|
978
|
-
_b[exports.EMeasureAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
979
|
-
_b);
|
|
918
|
+
var escapeSpecialCharacters = function (formula) {
|
|
919
|
+
return formula
|
|
920
|
+
.replaceAll("\\", "\\\\")
|
|
921
|
+
.replaceAll('"', '\\"')
|
|
922
|
+
.replaceAll("`", "\\`");
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
function generateColumnFormula(tableName, columnName) {
|
|
926
|
+
var preparedTableName = escapeSpecialCharacters(tableName);
|
|
927
|
+
var preparedColumnName = escapeSpecialCharacters(columnName);
|
|
928
|
+
return "\"".concat(preparedTableName, "\".\"").concat(preparedColumnName, "\"");
|
|
929
|
+
}
|
|
980
930
|
|
|
981
931
|
var escapeSingularQuotes = function (formula) {
|
|
982
932
|
if (typeof formula !== "string") {
|
|
@@ -1068,27 +1018,171 @@ var convertFiltersToFormula = function (filters) {
|
|
|
1068
1018
|
return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
|
|
1069
1019
|
};
|
|
1070
1020
|
|
|
1071
|
-
var _a$
|
|
1072
|
-
exports.
|
|
1073
|
-
(function (
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
_a$
|
|
1084
|
-
_a$
|
|
1085
|
-
_a$
|
|
1086
|
-
_a$
|
|
1087
|
-
_a$
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1021
|
+
var _a$4;
|
|
1022
|
+
exports.EDimensionAggregationTemplateName = void 0;
|
|
1023
|
+
(function (EDimensionAggregationTemplateName) {
|
|
1024
|
+
EDimensionAggregationTemplateName["top"] = "top";
|
|
1025
|
+
EDimensionAggregationTemplateName["firstValue"] = "firstValue";
|
|
1026
|
+
EDimensionAggregationTemplateName["lastValue"] = "lastValue";
|
|
1027
|
+
EDimensionAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
1028
|
+
EDimensionAggregationTemplateName["countReworks"] = "countReworks";
|
|
1029
|
+
})(exports.EDimensionAggregationTemplateName || (exports.EDimensionAggregationTemplateName = {}));
|
|
1030
|
+
/** Шаблоны процессных метрик разреза с режимом AGGREGATION */
|
|
1031
|
+
var dimensionAggregationTemplates = (_a$4 = {},
|
|
1032
|
+
_a$4[exports.EDimensionAggregationTemplateName.top] = topTemplate,
|
|
1033
|
+
_a$4[exports.EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
|
|
1034
|
+
_a$4[exports.EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
|
|
1035
|
+
_a$4[exports.EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
|
|
1036
|
+
_a$4[exports.EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
1037
|
+
_a$4);
|
|
1038
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1039
|
+
var prepareDimensionAggregationParams = function (value) {
|
|
1040
|
+
if (!value.eventName ||
|
|
1041
|
+
!value.caseCaseIdFormula ||
|
|
1042
|
+
!value.eventNameFormula ||
|
|
1043
|
+
!value.processName ||
|
|
1044
|
+
!value.templateName) {
|
|
1045
|
+
return null;
|
|
1046
|
+
}
|
|
1047
|
+
var commonParams = {
|
|
1048
|
+
eventNameFormula: value.eventNameFormula,
|
|
1049
|
+
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1050
|
+
eventName: value.eventName,
|
|
1051
|
+
objectFilters: "1",
|
|
1052
|
+
filters: convertFiltersToFormula(value.filters),
|
|
1053
|
+
eventTimeFormula: "",
|
|
1054
|
+
columnFormula: "",
|
|
1055
|
+
};
|
|
1056
|
+
if (value.templateName === exports.EDimensionAggregationTemplateName.countReworks ||
|
|
1057
|
+
value.templateName === exports.EDimensionAggregationTemplateName.countExecutions) {
|
|
1058
|
+
return commonParams;
|
|
1059
|
+
}
|
|
1060
|
+
if (!value.tableName || !value.columnName) {
|
|
1061
|
+
return null;
|
|
1062
|
+
}
|
|
1063
|
+
var columnParams = __assign(__assign(__assign({}, commonParams), (value.innerTemplateName && { innerTemplateName: value.innerTemplateName })), { columnFormula: generateColumnFormula(value.tableName, value.columnName) });
|
|
1064
|
+
if (value.templateName === exports.EDimensionAggregationTemplateName.firstValue ||
|
|
1065
|
+
value.templateName === exports.EDimensionAggregationTemplateName.lastValue) {
|
|
1066
|
+
if (!value.eventTimeFormula) {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
return __assign(__assign({}, columnParams), { eventTimeFormula: value.eventTimeFormula });
|
|
1070
|
+
}
|
|
1071
|
+
return columnParams;
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
/** Шаблоны процессных метрик разреза с режимами START_TIME/END_TIME */
|
|
1075
|
+
var timeTemplates = (function () {
|
|
1076
|
+
var _a;
|
|
1077
|
+
var generateTemplates = function (innerTemplate) {
|
|
1078
|
+
var templates = {};
|
|
1079
|
+
for (var key in dimensionTemplateFormulas) {
|
|
1080
|
+
templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1081
|
+
}
|
|
1082
|
+
return templates;
|
|
1083
|
+
};
|
|
1084
|
+
return _a = {},
|
|
1085
|
+
_a[exports.EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})"),
|
|
1086
|
+
_a[exports.EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula})"),
|
|
1087
|
+
_a;
|
|
1088
|
+
})();
|
|
1089
|
+
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
1090
|
+
var prepareTimeParams = function (value) {
|
|
1091
|
+
if (!value.eventName ||
|
|
1092
|
+
!value.caseCaseIdFormula ||
|
|
1093
|
+
!value.eventNameFormula ||
|
|
1094
|
+
!value.processName ||
|
|
1095
|
+
!value.templateName ||
|
|
1096
|
+
!value.eventTimeFormula) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
return {
|
|
1100
|
+
eventTimeFormula: value.eventTimeFormula,
|
|
1101
|
+
eventNameFormula: value.eventNameFormula,
|
|
1102
|
+
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1103
|
+
filters: convertFiltersToFormula(value.filters),
|
|
1104
|
+
eventName: value.eventName,
|
|
1105
|
+
};
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1108
|
+
function getDimensionFormula(_a) {
|
|
1109
|
+
var _b;
|
|
1110
|
+
var value = _a.value;
|
|
1111
|
+
if (!value) {
|
|
1112
|
+
return "";
|
|
1113
|
+
}
|
|
1114
|
+
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
1115
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
1116
|
+
}
|
|
1117
|
+
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1118
|
+
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
1119
|
+
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
1120
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
1121
|
+
return "";
|
|
1122
|
+
}
|
|
1123
|
+
return fillTemplateString(templateFormula, {
|
|
1124
|
+
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1128
|
+
var preparedParams = prepareDimensionAggregationParams(value);
|
|
1129
|
+
if (!preparedParams) {
|
|
1130
|
+
return "";
|
|
1131
|
+
}
|
|
1132
|
+
var innerTemplate = value.innerTemplateName
|
|
1133
|
+
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1134
|
+
: null;
|
|
1135
|
+
var columnFormula = innerTemplate
|
|
1136
|
+
? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1137
|
+
: preparedParams.columnFormula;
|
|
1138
|
+
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1139
|
+
return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1140
|
+
}
|
|
1141
|
+
if (value.mode === exports.EWidgetIndicatorValueModes.START_TIME ||
|
|
1142
|
+
value.mode === exports.EWidgetIndicatorValueModes.END_TIME) {
|
|
1143
|
+
var preparedParams = prepareTimeParams(value);
|
|
1144
|
+
if (!preparedParams) {
|
|
1145
|
+
return "";
|
|
1146
|
+
}
|
|
1147
|
+
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1148
|
+
return fillTemplateString(templateFormula, preparedParams);
|
|
1149
|
+
}
|
|
1150
|
+
return "";
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
var _a$3;
|
|
1154
|
+
exports.EMeasureAggregationTemplateName = void 0;
|
|
1155
|
+
(function (EMeasureAggregationTemplateName) {
|
|
1156
|
+
EMeasureAggregationTemplateName["agvIf"] = "agvIf";
|
|
1157
|
+
EMeasureAggregationTemplateName["medianIf"] = "medianIf";
|
|
1158
|
+
EMeasureAggregationTemplateName["countIf"] = "countIf";
|
|
1159
|
+
EMeasureAggregationTemplateName["countIfDistinct"] = "countIfDistinct";
|
|
1160
|
+
EMeasureAggregationTemplateName["minIf"] = "minIf";
|
|
1161
|
+
EMeasureAggregationTemplateName["maxIf"] = "maxIf";
|
|
1162
|
+
EMeasureAggregationTemplateName["sumIf"] = "sumIf";
|
|
1163
|
+
EMeasureAggregationTemplateName["top"] = "top";
|
|
1164
|
+
EMeasureAggregationTemplateName["firstValue"] = "firstValue";
|
|
1165
|
+
EMeasureAggregationTemplateName["lastValue"] = "lastValue";
|
|
1166
|
+
EMeasureAggregationTemplateName["countExecutions"] = "countExecutions";
|
|
1167
|
+
EMeasureAggregationTemplateName["countReworks"] = "countReworks";
|
|
1168
|
+
})(exports.EMeasureAggregationTemplateName || (exports.EMeasureAggregationTemplateName = {}));
|
|
1169
|
+
/** Шаблоны процессных метрик меры с режимом AGGREGATION */
|
|
1170
|
+
var measureAggregationTemplates = (_a$3 = {},
|
|
1171
|
+
_a$3[exports.EMeasureAggregationTemplateName.agvIf] = "{outerAggregation}If(process(avgIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1172
|
+
_a$3[exports.EMeasureAggregationTemplateName.medianIf] = "{outerAggregation}If(process(medianIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1173
|
+
_a$3[exports.EMeasureAggregationTemplateName.countIf] = "{outerAggregation}If(process(countIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1174
|
+
_a$3[exports.EMeasureAggregationTemplateName.countIfDistinct] = "{outerAggregation}If(process(countIf(distinct {columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1175
|
+
_a$3[exports.EMeasureAggregationTemplateName.minIf] = "{outerAggregation}If(process(minIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1176
|
+
_a$3[exports.EMeasureAggregationTemplateName.maxIf] = "{outerAggregation}If(process(maxIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1177
|
+
_a$3[exports.EMeasureAggregationTemplateName.sumIf] = "{outerAggregation}If(process(sumIf({columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}), {objectFilters})",
|
|
1178
|
+
_a$3[exports.EMeasureAggregationTemplateName.top] = "{outerAggregation}If(".concat(topTemplate, ", {objectFilters})"),
|
|
1179
|
+
_a$3[exports.EMeasureAggregationTemplateName.firstValue] = "{outerAggregation}If(".concat(firstValueTemplate, ", {objectFilters})"),
|
|
1180
|
+
_a$3[exports.EMeasureAggregationTemplateName.lastValue] = "{outerAggregation}If(".concat(lastValueTemplate, ", {objectFilters})"),
|
|
1181
|
+
_a$3[exports.EMeasureAggregationTemplateName.countExecutions] = "{outerAggregation}If(".concat(countExecutionsTemplate, ",{objectFilters})"),
|
|
1182
|
+
_a$3[exports.EMeasureAggregationTemplateName.countReworks] = "{outerAggregation}If(".concat(countReworksTemplate, ",{objectFilters})"),
|
|
1183
|
+
_a$3);
|
|
1184
|
+
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1185
|
+
var prepareMeasureAggregationParams = function (value) {
|
|
1092
1186
|
if (!value.eventName ||
|
|
1093
1187
|
!value.caseCaseIdFormula ||
|
|
1094
1188
|
!value.eventNameFormula ||
|
|
@@ -1122,6 +1216,32 @@ var prepareAggregationParams = function (value) {
|
|
|
1122
1216
|
}
|
|
1123
1217
|
return columnParams;
|
|
1124
1218
|
};
|
|
1219
|
+
|
|
1220
|
+
var _a$2;
|
|
1221
|
+
exports.EMeasureTemplateNames = void 0;
|
|
1222
|
+
(function (EMeasureTemplateNames) {
|
|
1223
|
+
EMeasureTemplateNames["avg"] = "avg";
|
|
1224
|
+
EMeasureTemplateNames["median"] = "median";
|
|
1225
|
+
EMeasureTemplateNames["count"] = "count";
|
|
1226
|
+
EMeasureTemplateNames["countDistinct"] = "countDistinct";
|
|
1227
|
+
EMeasureTemplateNames["min"] = "min";
|
|
1228
|
+
EMeasureTemplateNames["max"] = "max";
|
|
1229
|
+
EMeasureTemplateNames["sum"] = "sum";
|
|
1230
|
+
})(exports.EMeasureTemplateNames || (exports.EMeasureTemplateNames = {}));
|
|
1231
|
+
/** Стандартные шаблоны меры */
|
|
1232
|
+
var measureTemplateFormulas = (_a$2 = {},
|
|
1233
|
+
_a$2[exports.EMeasureTemplateNames.avg] = "avg({columnFormula})",
|
|
1234
|
+
_a$2[exports.EMeasureTemplateNames.count] = "count({columnFormula})",
|
|
1235
|
+
_a$2[exports.EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
|
|
1236
|
+
_a$2[exports.EMeasureTemplateNames.median] = "medianExact({columnFormula})",
|
|
1237
|
+
_a$2[exports.EMeasureTemplateNames.min] = "min({columnFormula})",
|
|
1238
|
+
_a$2[exports.EMeasureTemplateNames.max] = "max({columnFormula})",
|
|
1239
|
+
_a$2[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
1240
|
+
_a$2);
|
|
1241
|
+
|
|
1242
|
+
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1243
|
+
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)";
|
|
1244
|
+
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1125
1245
|
var prepareConversionParams = function (value) {
|
|
1126
1246
|
if (!value.startEventName ||
|
|
1127
1247
|
!value.endEventName ||
|
|
@@ -1147,6 +1267,17 @@ var prepareConversionParams = function (value) {
|
|
|
1147
1267
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1148
1268
|
};
|
|
1149
1269
|
};
|
|
1270
|
+
|
|
1271
|
+
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1272
|
+
var durationTemplates = (function () {
|
|
1273
|
+
var _a;
|
|
1274
|
+
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 ";
|
|
1275
|
+
return _a = {},
|
|
1276
|
+
_a[exports.EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1277
|
+
_a[exports.EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
1278
|
+
_a;
|
|
1279
|
+
})();
|
|
1280
|
+
/** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1150
1281
|
var prepareDurationParams = function (value) {
|
|
1151
1282
|
if (!value.startEventName ||
|
|
1152
1283
|
!value.endEventName ||
|
|
@@ -1160,7 +1291,7 @@ var prepareDurationParams = function (value) {
|
|
|
1160
1291
|
return null;
|
|
1161
1292
|
}
|
|
1162
1293
|
var getAggregationNameByAppearances = function (appearance) {
|
|
1163
|
-
return appearance ===
|
|
1294
|
+
return appearance === exports.EEventAppearances.FIRST ? "minIf" : "maxIf";
|
|
1164
1295
|
};
|
|
1165
1296
|
return {
|
|
1166
1297
|
objectFilters: "1",
|
|
@@ -1177,6 +1308,7 @@ var prepareDurationParams = function (value) {
|
|
|
1177
1308
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1178
1309
|
};
|
|
1179
1310
|
};
|
|
1311
|
+
|
|
1180
1312
|
function getMeasureFormula(_a) {
|
|
1181
1313
|
var _b;
|
|
1182
1314
|
var value = _a.value;
|
|
@@ -1197,7 +1329,7 @@ function getMeasureFormula(_a) {
|
|
|
1197
1329
|
});
|
|
1198
1330
|
}
|
|
1199
1331
|
if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1200
|
-
var preparedParams =
|
|
1332
|
+
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1201
1333
|
if (!preparedParams) {
|
|
1202
1334
|
return "";
|
|
1203
1335
|
}
|
|
@@ -1231,6 +1363,7 @@ var eventMeasureTemplateFormulas = (_a$1 = {},
|
|
|
1231
1363
|
_a$1[exports.EEventMeasureTemplateNames.eventsCount] = "count()",
|
|
1232
1364
|
_a$1[exports.EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
|
|
1233
1365
|
_a$1);
|
|
1366
|
+
|
|
1234
1367
|
function getEventMeasureFormula(_a, process) {
|
|
1235
1368
|
var value = _a.value;
|
|
1236
1369
|
if (!value) {
|
|
@@ -1256,6 +1389,7 @@ var transitionMeasureTemplateFormulas = (_a = {},
|
|
|
1256
1389
|
_a[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1257
1390
|
_a[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1258
1391
|
_a);
|
|
1392
|
+
|
|
1259
1393
|
function getTransitionMeasureFormula(_a, process) {
|
|
1260
1394
|
var value = _a.value;
|
|
1261
1395
|
if (!value) {
|
|
@@ -1800,8 +1934,8 @@ exports.conversionTemplate = conversionTemplate;
|
|
|
1800
1934
|
exports.convertFiltersToFormula = convertFiltersToFormula;
|
|
1801
1935
|
exports.convertToFormulasChain = convertToFormulasChain;
|
|
1802
1936
|
exports.countExecutionsTemplate = countExecutionsTemplate;
|
|
1803
|
-
exports.countReworksTemplate = countReworksTemplate;
|
|
1804
1937
|
exports.dashboardLinkRegExp = dashboardLinkRegExp;
|
|
1938
|
+
exports.dimensionAggregationTemplates = dimensionAggregationTemplates;
|
|
1805
1939
|
exports.dimensionTemplateFormulas = dimensionTemplateFormulas;
|
|
1806
1940
|
exports.durationTemplates = durationTemplates;
|
|
1807
1941
|
exports.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
@@ -1834,16 +1968,19 @@ exports.measureAggregationTemplates = measureAggregationTemplates;
|
|
|
1834
1968
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1835
1969
|
exports.parseClickHouseType = parseClickHouseType;
|
|
1836
1970
|
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1837
|
-
exports.prepareAggregationParams = prepareAggregationParams;
|
|
1838
1971
|
exports.prepareConversionParams = prepareConversionParams;
|
|
1972
|
+
exports.prepareDimensionAggregationParams = prepareDimensionAggregationParams;
|
|
1839
1973
|
exports.prepareDurationParams = prepareDurationParams;
|
|
1840
1974
|
exports.prepareFormulaForSql = prepareFormulaForSql;
|
|
1975
|
+
exports.prepareMeasureAggregationParams = prepareMeasureAggregationParams;
|
|
1841
1976
|
exports.prepareSortOrders = prepareSortOrders;
|
|
1977
|
+
exports.prepareTimeParams = prepareTimeParams;
|
|
1842
1978
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1843
1979
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1844
1980
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|
|
1845
1981
|
exports.replaceHierarchiesWithDimensions = replaceHierarchiesWithDimensions;
|
|
1846
1982
|
exports.selectDimensionFromHierarchy = selectDimensionFromHierarchy;
|
|
1983
|
+
exports.timeTemplates = timeTemplates;
|
|
1847
1984
|
exports.transitionMeasureTemplateFormulas = transitionMeasureTemplateFormulas;
|
|
1848
1985
|
exports.unescapeSpecialCharacters = unescapeSpecialCharacters;
|
|
1849
1986
|
exports.updateDefaultModeSelection = updateDefaultModeSelection;
|