@infomaximum/widget-sdk 6.0.0-2508.0 → 6.0.0-2508.2
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 +24 -0
- package/dist/index.d.ts +33 -13
- package/dist/index.esm.js +109 -62
- package/dist/index.js +111 -61
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [6.0.0-2508.2](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-2508.2) (2025-09-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* удален флаг isBordered для IInputControl [BI-15461] ([aabacfe](https://github.com/Infomaximum/widget-sdk/commit/aabacfe1ed8083f8ac891b619f26ec612dbf59fa))
|
|
11
|
+
|
|
12
|
+
## [6.0.0-2508.1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-2508.1) (2025-09-12)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### ⚠ BREAKING CHANGES
|
|
16
|
+
|
|
17
|
+
* в виджетах требуется обработать получение нового типа фильтра
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* в настройки виджетов и образов добавлен новый тип фильтра - по процессному разрезу ([e5811d1](https://github.com/Infomaximum/widget-sdk/commit/e5811d1c2f5beb31374aa845b256ccae9044baad))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* исправлена типизация полей интерфейса TWidgetIndicatorTimeValue ([9beb5d9](https://github.com/Infomaximum/widget-sdk/commit/9beb5d97ec62c774f894a389067058494186dfc7))
|
|
27
|
+
* поле timeUnit сделано необязательным в фильтре по процессному разрезу ([3c97c94](https://github.com/Infomaximum/widget-sdk/commit/3c97c94a1fb7e7112dd9c4737346d50ca746c84d))
|
|
28
|
+
|
|
5
29
|
## [6.0.0-2508.0](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-7...v6.0.0-2508.0) (2025-09-11)
|
|
6
30
|
|
|
7
31
|
## [6.0.0-7](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-6...v6.0.0-7) (2025-09-10)
|
package/dist/index.d.ts
CHANGED
|
@@ -255,7 +255,7 @@ interface IBaseWidgetSettings {
|
|
|
255
255
|
markdownMeasures?: IMarkdownMeasure[];
|
|
256
256
|
markdownText?: string;
|
|
257
257
|
markdownTextSize?: number;
|
|
258
|
-
filters?:
|
|
258
|
+
filters?: TSettingsFilter[];
|
|
259
259
|
filterMode?: EWidgetFilterMode;
|
|
260
260
|
ignoreFilters?: boolean;
|
|
261
261
|
sorting?: IWidgetSortingIndicator[];
|
|
@@ -554,11 +554,11 @@ type TWidgetIndicatorDurationValue = {
|
|
|
554
554
|
type TWidgetIndicatorTimeValue = {
|
|
555
555
|
templateName: string;
|
|
556
556
|
mode: EWidgetIndicatorValueModes.START_TIME | EWidgetIndicatorValueModes.END_TIME;
|
|
557
|
-
processKey: string;
|
|
558
|
-
eventName: string;
|
|
559
|
-
eventTimeFormula: string;
|
|
560
|
-
caseCaseIdFormula: string;
|
|
561
|
-
eventNameFormula: string;
|
|
557
|
+
processKey: string | null;
|
|
558
|
+
eventName: string | null;
|
|
559
|
+
eventTimeFormula: string | null;
|
|
560
|
+
caseCaseIdFormula: string | null;
|
|
561
|
+
eventNameFormula: string | null;
|
|
562
562
|
filters: TExtendedFormulaFilterValue[];
|
|
563
563
|
};
|
|
564
564
|
|
|
@@ -849,6 +849,24 @@ interface IFormulaFilterValue {
|
|
|
849
849
|
[EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
|
|
850
850
|
}>;
|
|
851
851
|
}
|
|
852
|
+
declare enum EDimensionProcessFilterTimeUnit {
|
|
853
|
+
YEARS = "YEARS",
|
|
854
|
+
MONTHS = "MONTHS",
|
|
855
|
+
HOURS = "HOURS",
|
|
856
|
+
DAYS = "DAYS",
|
|
857
|
+
MINUTES = "MINUTES"
|
|
858
|
+
}
|
|
859
|
+
interface IDimensionProcessFilter {
|
|
860
|
+
value: Extract<IFormulaControl["value"]["value"], {
|
|
861
|
+
mode: EWidgetIndicatorValueModes.AGGREGATION | EWidgetIndicatorValueModes.START_TIME | EWidgetIndicatorValueModes.END_TIME | EWidgetIndicatorValueModes.FORMULA;
|
|
862
|
+
}>;
|
|
863
|
+
dbDataType: string;
|
|
864
|
+
condition: {
|
|
865
|
+
filteringMethod: valueof<typeof formulaFilterMethods>;
|
|
866
|
+
timeUnit?: EDimensionProcessFilterTimeUnit;
|
|
867
|
+
values: (string | null)[];
|
|
868
|
+
};
|
|
869
|
+
}
|
|
852
870
|
type TExtendedFormulaFilterValue = {
|
|
853
871
|
formula: string;
|
|
854
872
|
} | IFormulaFilterValue;
|
|
@@ -907,7 +925,9 @@ interface IWidgetFiltration {
|
|
|
907
925
|
/** Удалить фильтр по этапам */
|
|
908
926
|
removeStagesFilter(widgetKey: string): void;
|
|
909
927
|
}
|
|
928
|
+
type TSettingsFilter = TExtendedFormulaFilterValue | IDimensionProcessFilter;
|
|
910
929
|
declare const isFormulaFilterValue: (value: TExtendedFormulaFilterValue) => value is IFormulaFilterValue;
|
|
930
|
+
declare const isDimensionProcessFilter: (filter: TSettingsFilter) => filter is IDimensionProcessFilter;
|
|
911
931
|
|
|
912
932
|
declare enum EWidgetActionInputMethod {
|
|
913
933
|
COLUMN = "COLUMN",
|
|
@@ -1313,7 +1333,6 @@ interface IInputControl {
|
|
|
1313
1333
|
type: EControlType.input;
|
|
1314
1334
|
value: string;
|
|
1315
1335
|
props: {
|
|
1316
|
-
isBordered?: boolean;
|
|
1317
1336
|
placeholder?: string;
|
|
1318
1337
|
/** Максимальное количество символов которое можно ввести в поле */
|
|
1319
1338
|
maxLength?: number;
|
|
@@ -1752,6 +1771,8 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
|
|
|
1752
1771
|
|
|
1753
1772
|
declare const prepareValuesForSql: (simpleType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
|
|
1754
1773
|
|
|
1774
|
+
declare const mapSettingsFiltersToInputs: (filters: TSettingsFilter[]) => ICalculatorFilter[];
|
|
1775
|
+
|
|
1755
1776
|
declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
|
|
1756
1777
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1757
1778
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
@@ -1910,6 +1931,9 @@ declare enum EDimensionTemplateNames {
|
|
|
1910
1931
|
declare const dimensionTemplateFormulas: Record<EDimensionTemplateNames, string>;
|
|
1911
1932
|
|
|
1912
1933
|
declare function getDimensionFormula({ value }: IWidgetDimension): string;
|
|
1934
|
+
declare function getProcessDimensionValueFormula(value: (TWidgetIndicatorAggregationValue & {
|
|
1935
|
+
innerTemplateName?: string;
|
|
1936
|
+
}) | TWidgetIndicatorTimeValue): string | undefined;
|
|
1913
1937
|
|
|
1914
1938
|
declare enum EDimensionAggregationTemplateName {
|
|
1915
1939
|
avg = "avg",
|
|
@@ -1934,7 +1958,6 @@ declare const prepareDimensionAggregationParams: (value: Extract<IWidgetDimensio
|
|
|
1934
1958
|
eventNameFormula: string;
|
|
1935
1959
|
caseCaseIdFormula: string;
|
|
1936
1960
|
eventName: string;
|
|
1937
|
-
objectFilters: string;
|
|
1938
1961
|
filters: string;
|
|
1939
1962
|
eventTimeFormula: string;
|
|
1940
1963
|
columnFormula: string;
|
|
@@ -1998,7 +2021,6 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
|
|
|
1998
2021
|
eventNameFormula: string;
|
|
1999
2022
|
caseCaseIdFormula: string;
|
|
2000
2023
|
eventName: string | null;
|
|
2001
|
-
objectFilters: string;
|
|
2002
2024
|
filters: string;
|
|
2003
2025
|
eventTimeFormula: string;
|
|
2004
2026
|
columnFormula: string;
|
|
@@ -2008,7 +2030,6 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
|
|
|
2008
2030
|
declare const conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
2009
2031
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
2010
2032
|
declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
|
|
2011
|
-
objectFilters: string;
|
|
2012
2033
|
startEventTimeFormula: string;
|
|
2013
2034
|
startEventNameFormula: string;
|
|
2014
2035
|
startEventFilters: string;
|
|
@@ -2028,7 +2049,6 @@ declare function createAggregationTemplate(templateName: EMeasureAggregationTemp
|
|
|
2028
2049
|
declare const durationTemplates: Record<EDurationTemplateName, string>;
|
|
2029
2050
|
/** На основе значения режима DURATION подготовить параметры для подстановки в шаблонную формулу */
|
|
2030
2051
|
declare const prepareDurationParams: (value: TWidgetIndicatorDurationValue) => {
|
|
2031
|
-
objectFilters: string;
|
|
2032
2052
|
startEventTimeFormula: string;
|
|
2033
2053
|
startEventNameFormula: string;
|
|
2034
2054
|
startEventFilters: string;
|
|
@@ -2493,7 +2513,7 @@ type TContextMenuButtonOptions = {
|
|
|
2493
2513
|
|
|
2494
2514
|
/** Контекст с данными образа (будет заполняться по мере необходимости) */
|
|
2495
2515
|
interface IViewContext {
|
|
2496
|
-
filters:
|
|
2516
|
+
filters: TSettingsFilter[];
|
|
2497
2517
|
}
|
|
2498
2518
|
|
|
2499
2519
|
type TLaunchActionParams = {
|
|
@@ -2732,4 +2752,4 @@ declare global {
|
|
|
2732
2752
|
}
|
|
2733
2753
|
}
|
|
2734
2754
|
|
|
2735
|
-
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionButton, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IParameterColumnList, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IParameterTableList, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, OuterAggregation, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TControlUnion, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
2755
|
+
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionButton, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionProcessFilter, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IParameterColumnList, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IParameterTableList, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, OuterAggregation, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TControlUnion, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSettingsFilter, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -212,9 +212,18 @@ var EFormulaFilterFieldKeys;
|
|
|
212
212
|
EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
|
|
213
213
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
214
214
|
})(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
|
|
215
|
+
var EDimensionProcessFilterTimeUnit;
|
|
216
|
+
(function (EDimensionProcessFilterTimeUnit) {
|
|
217
|
+
EDimensionProcessFilterTimeUnit["YEARS"] = "YEARS";
|
|
218
|
+
EDimensionProcessFilterTimeUnit["MONTHS"] = "MONTHS";
|
|
219
|
+
EDimensionProcessFilterTimeUnit["HOURS"] = "HOURS";
|
|
220
|
+
EDimensionProcessFilterTimeUnit["DAYS"] = "DAYS";
|
|
221
|
+
EDimensionProcessFilterTimeUnit["MINUTES"] = "MINUTES";
|
|
222
|
+
})(EDimensionProcessFilterTimeUnit || (EDimensionProcessFilterTimeUnit = {}));
|
|
215
223
|
var isFormulaFilterValue = function (value) {
|
|
216
224
|
return "filteringMethod" in value;
|
|
217
225
|
};
|
|
226
|
+
var isDimensionProcessFilter = function (filter) { return "value" in filter && "condition" in filter; };
|
|
218
227
|
|
|
219
228
|
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
220
229
|
var compactMap = function (items, f) {
|
|
@@ -639,7 +648,7 @@ var formattingConfig = {
|
|
|
639
648
|
},
|
|
640
649
|
};
|
|
641
650
|
|
|
642
|
-
var _a$
|
|
651
|
+
var _a$5;
|
|
643
652
|
var EDimensionTemplateNames;
|
|
644
653
|
(function (EDimensionTemplateNames) {
|
|
645
654
|
EDimensionTemplateNames["dateTime"] = "dateTime";
|
|
@@ -655,19 +664,19 @@ var EDimensionTemplateNames;
|
|
|
655
664
|
EDimensionTemplateNames["hour"] = "hour";
|
|
656
665
|
})(EDimensionTemplateNames || (EDimensionTemplateNames = {}));
|
|
657
666
|
/** Стандартные шаблоны разреза */
|
|
658
|
-
var dimensionTemplateFormulas = (_a$
|
|
659
|
-
_a$
|
|
660
|
-
_a$
|
|
661
|
-
_a$
|
|
662
|
-
_a$
|
|
663
|
-
_a$
|
|
664
|
-
_a$
|
|
665
|
-
_a$
|
|
666
|
-
_a$
|
|
667
|
-
_a$
|
|
668
|
-
_a$
|
|
669
|
-
_a$
|
|
670
|
-
_a$
|
|
667
|
+
var dimensionTemplateFormulas = (_a$5 = {},
|
|
668
|
+
_a$5[EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
669
|
+
_a$5[EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
670
|
+
_a$5[EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
671
|
+
_a$5[EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
672
|
+
_a$5[EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
673
|
+
_a$5[EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
674
|
+
_a$5[EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
675
|
+
_a$5[EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
676
|
+
_a$5[EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
677
|
+
_a$5[EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
678
|
+
_a$5[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
679
|
+
_a$5);
|
|
671
680
|
|
|
672
681
|
var EWidgetIndicatorType;
|
|
673
682
|
(function (EWidgetIndicatorType) {
|
|
@@ -983,7 +992,7 @@ var convertFiltersToFormula = function (filters) {
|
|
|
983
992
|
return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
|
|
984
993
|
};
|
|
985
994
|
|
|
986
|
-
var _a$
|
|
995
|
+
var _a$4;
|
|
987
996
|
var EDimensionAggregationTemplateName;
|
|
988
997
|
(function (EDimensionAggregationTemplateName) {
|
|
989
998
|
EDimensionAggregationTemplateName["avg"] = "avg";
|
|
@@ -1000,20 +1009,20 @@ var EDimensionAggregationTemplateName;
|
|
|
1000
1009
|
EDimensionAggregationTemplateName["countReworks"] = "countReworks";
|
|
1001
1010
|
})(EDimensionAggregationTemplateName || (EDimensionAggregationTemplateName = {}));
|
|
1002
1011
|
/** Шаблоны процессных метрик разреза с режимом AGGREGATION */
|
|
1003
|
-
var dimensionAggregationTemplates = (_a$
|
|
1004
|
-
_a$
|
|
1005
|
-
_a$
|
|
1006
|
-
_a$
|
|
1007
|
-
_a$
|
|
1008
|
-
_a$
|
|
1009
|
-
_a$
|
|
1010
|
-
_a$
|
|
1011
|
-
_a$
|
|
1012
|
-
_a$
|
|
1013
|
-
_a$
|
|
1014
|
-
_a$
|
|
1015
|
-
_a$
|
|
1016
|
-
_a$
|
|
1012
|
+
var dimensionAggregationTemplates = (_a$4 = {},
|
|
1013
|
+
_a$4[EDimensionAggregationTemplateName.avg] = avgTemplate,
|
|
1014
|
+
_a$4[EDimensionAggregationTemplateName.median] = medianTemplate,
|
|
1015
|
+
_a$4[EDimensionAggregationTemplateName.count] = countTemplate,
|
|
1016
|
+
_a$4[EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
|
|
1017
|
+
_a$4[EDimensionAggregationTemplateName.min] = minTemplate,
|
|
1018
|
+
_a$4[EDimensionAggregationTemplateName.max] = maxTemplate,
|
|
1019
|
+
_a$4[EDimensionAggregationTemplateName.sum] = sumTemplate,
|
|
1020
|
+
_a$4[EDimensionAggregationTemplateName.top] = topTemplate,
|
|
1021
|
+
_a$4[EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
|
|
1022
|
+
_a$4[EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
|
|
1023
|
+
_a$4[EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
|
|
1024
|
+
_a$4[EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
1025
|
+
_a$4);
|
|
1017
1026
|
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1018
1027
|
var prepareDimensionAggregationParams = function (value) {
|
|
1019
1028
|
if (!value.eventName ||
|
|
@@ -1027,7 +1036,6 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
1027
1036
|
eventNameFormula: value.eventNameFormula,
|
|
1028
1037
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1029
1038
|
eventName: value.eventName,
|
|
1030
|
-
objectFilters: "1",
|
|
1031
1039
|
filters: convertFiltersToFormula(value.filters),
|
|
1032
1040
|
eventTimeFormula: "",
|
|
1033
1041
|
columnFormula: "",
|
|
@@ -1085,7 +1093,7 @@ var prepareTimeParams = function (value) {
|
|
|
1085
1093
|
};
|
|
1086
1094
|
|
|
1087
1095
|
function getDimensionFormula(_a) {
|
|
1088
|
-
var _b;
|
|
1096
|
+
var _b, _c;
|
|
1089
1097
|
var value = _a.value;
|
|
1090
1098
|
if (!value) {
|
|
1091
1099
|
return "";
|
|
@@ -1103,6 +1111,9 @@ function getDimensionFormula(_a) {
|
|
|
1103
1111
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1104
1112
|
});
|
|
1105
1113
|
}
|
|
1114
|
+
return (_c = getProcessDimensionValueFormula(value)) !== null && _c !== void 0 ? _c : "";
|
|
1115
|
+
}
|
|
1116
|
+
function getProcessDimensionValueFormula(value) {
|
|
1106
1117
|
if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1107
1118
|
var preparedParams = prepareDimensionAggregationParams(value);
|
|
1108
1119
|
if (!preparedParams) {
|
|
@@ -1126,7 +1137,6 @@ function getDimensionFormula(_a) {
|
|
|
1126
1137
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1127
1138
|
return fillTemplateSql(templateFormula, preparedParams);
|
|
1128
1139
|
}
|
|
1129
|
-
return "";
|
|
1130
1140
|
}
|
|
1131
1141
|
|
|
1132
1142
|
var EMeasureAggregationTemplateName;
|
|
@@ -1159,7 +1169,6 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1159
1169
|
eventNameFormula: value.eventNameFormula,
|
|
1160
1170
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1161
1171
|
eventName: value.eventName,
|
|
1162
|
-
objectFilters: "1",
|
|
1163
1172
|
filters: convertFiltersToFormula(value.filters),
|
|
1164
1173
|
eventTimeFormula: "",
|
|
1165
1174
|
columnFormula: "",
|
|
@@ -1180,7 +1189,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1180
1189
|
return columnParams;
|
|
1181
1190
|
};
|
|
1182
1191
|
|
|
1183
|
-
var _a$
|
|
1192
|
+
var _a$3;
|
|
1184
1193
|
var EMeasureTemplateNames;
|
|
1185
1194
|
(function (EMeasureTemplateNames) {
|
|
1186
1195
|
EMeasureTemplateNames["avg"] = "avg";
|
|
@@ -1192,15 +1201,15 @@ var EMeasureTemplateNames;
|
|
|
1192
1201
|
EMeasureTemplateNames["sum"] = "sum";
|
|
1193
1202
|
})(EMeasureTemplateNames || (EMeasureTemplateNames = {}));
|
|
1194
1203
|
/** Стандартные шаблоны меры */
|
|
1195
|
-
var measureTemplateFormulas = (_a$
|
|
1196
|
-
_a$
|
|
1197
|
-
_a$
|
|
1198
|
-
_a$
|
|
1199
|
-
_a$
|
|
1200
|
-
_a$
|
|
1201
|
-
_a$
|
|
1202
|
-
_a$
|
|
1203
|
-
_a$
|
|
1204
|
+
var measureTemplateFormulas = (_a$3 = {},
|
|
1205
|
+
_a$3[EMeasureTemplateNames.avg] = "avg({columnFormula})",
|
|
1206
|
+
_a$3[EMeasureTemplateNames.count] = "count({columnFormula})",
|
|
1207
|
+
_a$3[EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
|
|
1208
|
+
_a$3[EMeasureTemplateNames.median] = "medianExact({columnFormula})",
|
|
1209
|
+
_a$3[EMeasureTemplateNames.min] = "min({columnFormula})",
|
|
1210
|
+
_a$3[EMeasureTemplateNames.max] = "max({columnFormula})",
|
|
1211
|
+
_a$3[EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
1212
|
+
_a$3);
|
|
1204
1213
|
|
|
1205
1214
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1206
1215
|
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
@@ -1218,7 +1227,6 @@ var prepareConversionParams = function (value) {
|
|
|
1218
1227
|
return null;
|
|
1219
1228
|
}
|
|
1220
1229
|
return {
|
|
1221
|
-
objectFilters: "1",
|
|
1222
1230
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1223
1231
|
startEventNameFormula: value.startEventNameFormula,
|
|
1224
1232
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
@@ -1257,7 +1265,6 @@ var prepareDurationParams = function (value) {
|
|
|
1257
1265
|
return appearance === EEventAppearances.FIRST ? "minIf" : "maxIf";
|
|
1258
1266
|
};
|
|
1259
1267
|
return {
|
|
1260
|
-
objectFilters: "1",
|
|
1261
1268
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1262
1269
|
startEventNameFormula: value.startEventNameFormula,
|
|
1263
1270
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
@@ -1273,16 +1280,16 @@ var prepareDurationParams = function (value) {
|
|
|
1273
1280
|
};
|
|
1274
1281
|
|
|
1275
1282
|
function createAnyEventTemplate(aggregatePart) {
|
|
1276
|
-
return "{outerAggregation}
|
|
1283
|
+
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1277
1284
|
}
|
|
1278
1285
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1279
|
-
return "{outerAggregation}
|
|
1286
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}))");
|
|
1280
1287
|
}
|
|
1281
1288
|
function createTopLikeTemplate(template) {
|
|
1282
1289
|
return function (outerAggregation) {
|
|
1283
1290
|
return outerAggregation === EOuterAggregation.top
|
|
1284
|
-
? "{outerAggregation}
|
|
1285
|
-
: "{outerAggregation}
|
|
1291
|
+
? "{outerAggregation}K(1)(".concat(template, ")[1]")
|
|
1292
|
+
: "{outerAggregation}(".concat(template, ")");
|
|
1286
1293
|
};
|
|
1287
1294
|
}
|
|
1288
1295
|
function createAggregationTemplate(templateName, _a) {
|
|
@@ -1329,9 +1336,9 @@ function createAggregationTemplate(templateName, _a) {
|
|
|
1329
1336
|
? createAnyEventTemplate("argMax({columnFormula}, {eventTimeFormula})")
|
|
1330
1337
|
: createTopLikeTemplate(lastValueTemplate)(outerAggregation);
|
|
1331
1338
|
case EMeasureAggregationTemplateName.countExecutions:
|
|
1332
|
-
return "{outerAggregation}
|
|
1339
|
+
return "{outerAggregation}(".concat(countExecutionsTemplate, ")");
|
|
1333
1340
|
case EMeasureAggregationTemplateName.countReworks:
|
|
1334
|
-
return "{outerAggregation}
|
|
1341
|
+
return "{outerAggregation}(".concat(countReworksTemplate, ")");
|
|
1335
1342
|
}
|
|
1336
1343
|
}
|
|
1337
1344
|
|
|
@@ -1380,16 +1387,16 @@ function getMeasureFormula(_a) {
|
|
|
1380
1387
|
return "";
|
|
1381
1388
|
}
|
|
1382
1389
|
|
|
1383
|
-
var _a$
|
|
1390
|
+
var _a$2;
|
|
1384
1391
|
var EEventMeasureTemplateNames;
|
|
1385
1392
|
(function (EEventMeasureTemplateNames) {
|
|
1386
1393
|
EEventMeasureTemplateNames["eventsCount"] = "eventsCount";
|
|
1387
1394
|
EEventMeasureTemplateNames["reworksCount"] = "reworksCount";
|
|
1388
1395
|
})(EEventMeasureTemplateNames || (EEventMeasureTemplateNames = {}));
|
|
1389
|
-
var eventMeasureTemplateFormulas = (_a$
|
|
1390
|
-
_a$
|
|
1391
|
-
_a$
|
|
1392
|
-
_a$
|
|
1396
|
+
var eventMeasureTemplateFormulas = (_a$2 = {},
|
|
1397
|
+
_a$2[EEventMeasureTemplateNames.eventsCount] = "count()",
|
|
1398
|
+
_a$2[EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
|
|
1399
|
+
_a$2);
|
|
1393
1400
|
|
|
1394
1401
|
function getEventMeasureFormula(_a, process) {
|
|
1395
1402
|
var value = _a.value;
|
|
@@ -1406,16 +1413,16 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1406
1413
|
return "";
|
|
1407
1414
|
}
|
|
1408
1415
|
|
|
1409
|
-
var _a;
|
|
1416
|
+
var _a$1;
|
|
1410
1417
|
var ETransitionMeasureTemplateNames;
|
|
1411
1418
|
(function (ETransitionMeasureTemplateNames) {
|
|
1412
1419
|
ETransitionMeasureTemplateNames["transitionsCount"] = "transitionsCount";
|
|
1413
1420
|
ETransitionMeasureTemplateNames["medianTime"] = "medianTime";
|
|
1414
1421
|
})(ETransitionMeasureTemplateNames || (ETransitionMeasureTemplateNames = {}));
|
|
1415
|
-
var transitionMeasureTemplateFormulas = (_a = {},
|
|
1416
|
-
_a[ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1417
|
-
_a[ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1418
|
-
_a);
|
|
1422
|
+
var transitionMeasureTemplateFormulas = (_a$1 = {},
|
|
1423
|
+
_a$1[ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1424
|
+
_a$1[ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1425
|
+
_a$1);
|
|
1419
1426
|
|
|
1420
1427
|
function getTransitionMeasureFormula(_a, process) {
|
|
1421
1428
|
var value = _a.value;
|
|
@@ -1654,6 +1661,46 @@ var mapFormulaFiltersToInputs = function (filters) {
|
|
|
1654
1661
|
return compactMap(filters, mapFormulaFilterToCalculatorInput);
|
|
1655
1662
|
};
|
|
1656
1663
|
|
|
1664
|
+
var _a;
|
|
1665
|
+
var intervalByUnit = (_a = {},
|
|
1666
|
+
_a[EDimensionProcessFilterTimeUnit.YEARS] = "year",
|
|
1667
|
+
_a[EDimensionProcessFilterTimeUnit.MONTHS] = "month",
|
|
1668
|
+
_a[EDimensionProcessFilterTimeUnit.DAYS] = "day",
|
|
1669
|
+
_a[EDimensionProcessFilterTimeUnit.HOURS] = "hour",
|
|
1670
|
+
_a[EDimensionProcessFilterTimeUnit.MINUTES] = "minute",
|
|
1671
|
+
_a);
|
|
1672
|
+
function mapDimensionProcessFilterToCalculatorInput(filter) {
|
|
1673
|
+
var formula = filter.value.mode === EWidgetIndicatorValueModes.FORMULA
|
|
1674
|
+
? filter.value.formula
|
|
1675
|
+
: getProcessDimensionValueFormula(filter.value);
|
|
1676
|
+
if (formula === undefined) {
|
|
1677
|
+
throw new Error("Formula generation error");
|
|
1678
|
+
}
|
|
1679
|
+
var _a = filter.condition, timeUnit = _a.timeUnit, filteringMethod = _a.filteringMethod, values = _a.values;
|
|
1680
|
+
if (filteringMethod === "LAST_TIME") {
|
|
1681
|
+
if (!timeUnit) {
|
|
1682
|
+
throw new Error("Missing time unit");
|
|
1683
|
+
}
|
|
1684
|
+
return {
|
|
1685
|
+
dbDataType: EClickHouseBaseTypes.Bool,
|
|
1686
|
+
formula: "date_diff('".concat(intervalByUnit[timeUnit], "', ").concat(formula, ", now())"),
|
|
1687
|
+
values: values,
|
|
1688
|
+
filteringMethod: formulaFilterMethods.LESS_THAN_OR_EQUAL_TO,
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
return { formula: formula, filteringMethod: filteringMethod, values: values, dbDataType: filter.dbDataType };
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
var mapSettingsFilterToCalculatorInput = function (filter) {
|
|
1695
|
+
if (isDimensionProcessFilter(filter)) {
|
|
1696
|
+
return mapDimensionProcessFilterToCalculatorInput(filter);
|
|
1697
|
+
}
|
|
1698
|
+
return mapFormulaFilterToCalculatorInput(filter);
|
|
1699
|
+
};
|
|
1700
|
+
var mapSettingsFiltersToInputs = function (filters) {
|
|
1701
|
+
return compactMap(filters, mapSettingsFilterToCalculatorInput);
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1657
1704
|
function mapMeasureToInput(measure, variables, addFormulas) {
|
|
1658
1705
|
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
1659
1706
|
var mainFormula = getMeasureFormula(measure);
|
|
@@ -2148,4 +2195,4 @@ var getColorByIndex = function (index) {
|
|
|
2148
2195
|
return color;
|
|
2149
2196
|
};
|
|
2150
2197
|
|
|
2151
|
-
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
2198
|
+
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.js
CHANGED
|
@@ -213,9 +213,18 @@ exports.EFormulaFilterFieldKeys = void 0;
|
|
|
213
213
|
EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
|
|
214
214
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
215
215
|
})(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
|
|
216
|
+
exports.EDimensionProcessFilterTimeUnit = void 0;
|
|
217
|
+
(function (EDimensionProcessFilterTimeUnit) {
|
|
218
|
+
EDimensionProcessFilterTimeUnit["YEARS"] = "YEARS";
|
|
219
|
+
EDimensionProcessFilterTimeUnit["MONTHS"] = "MONTHS";
|
|
220
|
+
EDimensionProcessFilterTimeUnit["HOURS"] = "HOURS";
|
|
221
|
+
EDimensionProcessFilterTimeUnit["DAYS"] = "DAYS";
|
|
222
|
+
EDimensionProcessFilterTimeUnit["MINUTES"] = "MINUTES";
|
|
223
|
+
})(exports.EDimensionProcessFilterTimeUnit || (exports.EDimensionProcessFilterTimeUnit = {}));
|
|
216
224
|
var isFormulaFilterValue = function (value) {
|
|
217
225
|
return "filteringMethod" in value;
|
|
218
226
|
};
|
|
227
|
+
var isDimensionProcessFilter = function (filter) { return "value" in filter && "condition" in filter; };
|
|
219
228
|
|
|
220
229
|
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
221
230
|
var compactMap = function (items, f) {
|
|
@@ -640,7 +649,7 @@ var formattingConfig = {
|
|
|
640
649
|
},
|
|
641
650
|
};
|
|
642
651
|
|
|
643
|
-
var _a$
|
|
652
|
+
var _a$5;
|
|
644
653
|
exports.EDimensionTemplateNames = void 0;
|
|
645
654
|
(function (EDimensionTemplateNames) {
|
|
646
655
|
EDimensionTemplateNames["dateTime"] = "dateTime";
|
|
@@ -656,19 +665,19 @@ exports.EDimensionTemplateNames = void 0;
|
|
|
656
665
|
EDimensionTemplateNames["hour"] = "hour";
|
|
657
666
|
})(exports.EDimensionTemplateNames || (exports.EDimensionTemplateNames = {}));
|
|
658
667
|
/** Стандартные шаблоны разреза */
|
|
659
|
-
var dimensionTemplateFormulas = (_a$
|
|
660
|
-
_a$
|
|
661
|
-
_a$
|
|
662
|
-
_a$
|
|
663
|
-
_a$
|
|
664
|
-
_a$
|
|
665
|
-
_a$
|
|
666
|
-
_a$
|
|
667
|
-
_a$
|
|
668
|
-
_a$
|
|
669
|
-
_a$
|
|
670
|
-
_a$
|
|
671
|
-
_a$
|
|
668
|
+
var dimensionTemplateFormulas = (_a$5 = {},
|
|
669
|
+
_a$5[exports.EDimensionTemplateNames.dateTime] = "toDateTime({columnFormula})",
|
|
670
|
+
_a$5[exports.EDimensionTemplateNames.date] = "toDate({columnFormula})",
|
|
671
|
+
_a$5[exports.EDimensionTemplateNames.year] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}))",
|
|
672
|
+
_a$5[exports.EDimensionTemplateNames.yearAndQuarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYear({columnFormula}) * 10 + toQuarter({columnFormula}))",
|
|
673
|
+
_a$5[exports.EDimensionTemplateNames.quarter] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toQuarter({columnFormula}))",
|
|
674
|
+
_a$5[exports.EDimensionTemplateNames.yearAndMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toYYYYMM({columnFormula}))",
|
|
675
|
+
_a$5[exports.EDimensionTemplateNames.month] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toMonth({columnFormula}))",
|
|
676
|
+
_a$5[exports.EDimensionTemplateNames.dayOfMonth] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfMonth({columnFormula}))",
|
|
677
|
+
_a$5[exports.EDimensionTemplateNames.week] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toWeek({columnFormula}))",
|
|
678
|
+
_a$5[exports.EDimensionTemplateNames.dayOfWeek] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toDayOfWeek({columnFormula}))",
|
|
679
|
+
_a$5[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
680
|
+
_a$5);
|
|
672
681
|
|
|
673
682
|
exports.EWidgetIndicatorType = void 0;
|
|
674
683
|
(function (EWidgetIndicatorType) {
|
|
@@ -984,7 +993,7 @@ var convertFiltersToFormula = function (filters) {
|
|
|
984
993
|
return filters.length > 0 ? " AND ".concat(convertToFormulasChain(filters)) : "";
|
|
985
994
|
};
|
|
986
995
|
|
|
987
|
-
var _a$
|
|
996
|
+
var _a$4;
|
|
988
997
|
exports.EDimensionAggregationTemplateName = void 0;
|
|
989
998
|
(function (EDimensionAggregationTemplateName) {
|
|
990
999
|
EDimensionAggregationTemplateName["avg"] = "avg";
|
|
@@ -1001,20 +1010,20 @@ exports.EDimensionAggregationTemplateName = void 0;
|
|
|
1001
1010
|
EDimensionAggregationTemplateName["countReworks"] = "countReworks";
|
|
1002
1011
|
})(exports.EDimensionAggregationTemplateName || (exports.EDimensionAggregationTemplateName = {}));
|
|
1003
1012
|
/** Шаблоны процессных метрик разреза с режимом AGGREGATION */
|
|
1004
|
-
var dimensionAggregationTemplates = (_a$
|
|
1005
|
-
_a$
|
|
1006
|
-
_a$
|
|
1007
|
-
_a$
|
|
1008
|
-
_a$
|
|
1009
|
-
_a$
|
|
1010
|
-
_a$
|
|
1011
|
-
_a$
|
|
1012
|
-
_a$
|
|
1013
|
-
_a$
|
|
1014
|
-
_a$
|
|
1015
|
-
_a$
|
|
1016
|
-
_a$
|
|
1017
|
-
_a$
|
|
1013
|
+
var dimensionAggregationTemplates = (_a$4 = {},
|
|
1014
|
+
_a$4[exports.EDimensionAggregationTemplateName.avg] = avgTemplate,
|
|
1015
|
+
_a$4[exports.EDimensionAggregationTemplateName.median] = medianTemplate,
|
|
1016
|
+
_a$4[exports.EDimensionAggregationTemplateName.count] = countTemplate,
|
|
1017
|
+
_a$4[exports.EDimensionAggregationTemplateName.countDistinct] = countDistinctTemplate,
|
|
1018
|
+
_a$4[exports.EDimensionAggregationTemplateName.min] = minTemplate,
|
|
1019
|
+
_a$4[exports.EDimensionAggregationTemplateName.max] = maxTemplate,
|
|
1020
|
+
_a$4[exports.EDimensionAggregationTemplateName.sum] = sumTemplate,
|
|
1021
|
+
_a$4[exports.EDimensionAggregationTemplateName.top] = topTemplate,
|
|
1022
|
+
_a$4[exports.EDimensionAggregationTemplateName.firstValue] = firstValueTemplate,
|
|
1023
|
+
_a$4[exports.EDimensionAggregationTemplateName.lastValue] = lastValueTemplate,
|
|
1024
|
+
_a$4[exports.EDimensionAggregationTemplateName.countExecutions] = countExecutionsTemplate,
|
|
1025
|
+
_a$4[exports.EDimensionAggregationTemplateName.countReworks] = countReworksTemplate,
|
|
1026
|
+
_a$4);
|
|
1018
1027
|
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1019
1028
|
var prepareDimensionAggregationParams = function (value) {
|
|
1020
1029
|
if (!value.eventName ||
|
|
@@ -1028,7 +1037,6 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
1028
1037
|
eventNameFormula: value.eventNameFormula,
|
|
1029
1038
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1030
1039
|
eventName: value.eventName,
|
|
1031
|
-
objectFilters: "1",
|
|
1032
1040
|
filters: convertFiltersToFormula(value.filters),
|
|
1033
1041
|
eventTimeFormula: "",
|
|
1034
1042
|
columnFormula: "",
|
|
@@ -1086,7 +1094,7 @@ var prepareTimeParams = function (value) {
|
|
|
1086
1094
|
};
|
|
1087
1095
|
|
|
1088
1096
|
function getDimensionFormula(_a) {
|
|
1089
|
-
var _b;
|
|
1097
|
+
var _b, _c;
|
|
1090
1098
|
var value = _a.value;
|
|
1091
1099
|
if (!value) {
|
|
1092
1100
|
return "";
|
|
@@ -1104,6 +1112,9 @@ function getDimensionFormula(_a) {
|
|
|
1104
1112
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1105
1113
|
});
|
|
1106
1114
|
}
|
|
1115
|
+
return (_c = getProcessDimensionValueFormula(value)) !== null && _c !== void 0 ? _c : "";
|
|
1116
|
+
}
|
|
1117
|
+
function getProcessDimensionValueFormula(value) {
|
|
1107
1118
|
if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1108
1119
|
var preparedParams = prepareDimensionAggregationParams(value);
|
|
1109
1120
|
if (!preparedParams) {
|
|
@@ -1127,7 +1138,6 @@ function getDimensionFormula(_a) {
|
|
|
1127
1138
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1128
1139
|
return fillTemplateSql(templateFormula, preparedParams);
|
|
1129
1140
|
}
|
|
1130
|
-
return "";
|
|
1131
1141
|
}
|
|
1132
1142
|
|
|
1133
1143
|
exports.EMeasureAggregationTemplateName = void 0;
|
|
@@ -1160,7 +1170,6 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1160
1170
|
eventNameFormula: value.eventNameFormula,
|
|
1161
1171
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1162
1172
|
eventName: value.eventName,
|
|
1163
|
-
objectFilters: "1",
|
|
1164
1173
|
filters: convertFiltersToFormula(value.filters),
|
|
1165
1174
|
eventTimeFormula: "",
|
|
1166
1175
|
columnFormula: "",
|
|
@@ -1181,7 +1190,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1181
1190
|
return columnParams;
|
|
1182
1191
|
};
|
|
1183
1192
|
|
|
1184
|
-
var _a$
|
|
1193
|
+
var _a$3;
|
|
1185
1194
|
exports.EMeasureTemplateNames = void 0;
|
|
1186
1195
|
(function (EMeasureTemplateNames) {
|
|
1187
1196
|
EMeasureTemplateNames["avg"] = "avg";
|
|
@@ -1193,15 +1202,15 @@ exports.EMeasureTemplateNames = void 0;
|
|
|
1193
1202
|
EMeasureTemplateNames["sum"] = "sum";
|
|
1194
1203
|
})(exports.EMeasureTemplateNames || (exports.EMeasureTemplateNames = {}));
|
|
1195
1204
|
/** Стандартные шаблоны меры */
|
|
1196
|
-
var measureTemplateFormulas = (_a$
|
|
1197
|
-
_a$
|
|
1198
|
-
_a$
|
|
1199
|
-
_a$
|
|
1200
|
-
_a$
|
|
1201
|
-
_a$
|
|
1202
|
-
_a$
|
|
1203
|
-
_a$
|
|
1204
|
-
_a$
|
|
1205
|
+
var measureTemplateFormulas = (_a$3 = {},
|
|
1206
|
+
_a$3[exports.EMeasureTemplateNames.avg] = "avg({columnFormula})",
|
|
1207
|
+
_a$3[exports.EMeasureTemplateNames.count] = "count({columnFormula})",
|
|
1208
|
+
_a$3[exports.EMeasureTemplateNames.countDistinct] = "count(distinct {columnFormula})",
|
|
1209
|
+
_a$3[exports.EMeasureTemplateNames.median] = "medianExact({columnFormula})",
|
|
1210
|
+
_a$3[exports.EMeasureTemplateNames.min] = "min({columnFormula})",
|
|
1211
|
+
_a$3[exports.EMeasureTemplateNames.max] = "max({columnFormula})",
|
|
1212
|
+
_a$3[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
1213
|
+
_a$3);
|
|
1205
1214
|
|
|
1206
1215
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1207
1216
|
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = '{endEventName}'{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = '{startEventName}'{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
@@ -1219,7 +1228,6 @@ var prepareConversionParams = function (value) {
|
|
|
1219
1228
|
return null;
|
|
1220
1229
|
}
|
|
1221
1230
|
return {
|
|
1222
|
-
objectFilters: "1",
|
|
1223
1231
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1224
1232
|
startEventNameFormula: value.startEventNameFormula,
|
|
1225
1233
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
@@ -1258,7 +1266,6 @@ var prepareDurationParams = function (value) {
|
|
|
1258
1266
|
return appearance === exports.EEventAppearances.FIRST ? "minIf" : "maxIf";
|
|
1259
1267
|
};
|
|
1260
1268
|
return {
|
|
1261
|
-
objectFilters: "1",
|
|
1262
1269
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1263
1270
|
startEventNameFormula: value.startEventNameFormula,
|
|
1264
1271
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
@@ -1274,16 +1281,16 @@ var prepareDurationParams = function (value) {
|
|
|
1274
1281
|
};
|
|
1275
1282
|
|
|
1276
1283
|
function createAnyEventTemplate(aggregatePart) {
|
|
1277
|
-
return "{outerAggregation}
|
|
1284
|
+
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1278
1285
|
}
|
|
1279
1286
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1280
|
-
return "{outerAggregation}
|
|
1287
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = '{eventName}'{filters}), {caseCaseIdFormula}))");
|
|
1281
1288
|
}
|
|
1282
1289
|
function createTopLikeTemplate(template) {
|
|
1283
1290
|
return function (outerAggregation) {
|
|
1284
1291
|
return outerAggregation === exports.EOuterAggregation.top
|
|
1285
|
-
? "{outerAggregation}
|
|
1286
|
-
: "{outerAggregation}
|
|
1292
|
+
? "{outerAggregation}K(1)(".concat(template, ")[1]")
|
|
1293
|
+
: "{outerAggregation}(".concat(template, ")");
|
|
1287
1294
|
};
|
|
1288
1295
|
}
|
|
1289
1296
|
function createAggregationTemplate(templateName, _a) {
|
|
@@ -1330,9 +1337,9 @@ function createAggregationTemplate(templateName, _a) {
|
|
|
1330
1337
|
? createAnyEventTemplate("argMax({columnFormula}, {eventTimeFormula})")
|
|
1331
1338
|
: createTopLikeTemplate(lastValueTemplate)(outerAggregation);
|
|
1332
1339
|
case exports.EMeasureAggregationTemplateName.countExecutions:
|
|
1333
|
-
return "{outerAggregation}
|
|
1340
|
+
return "{outerAggregation}(".concat(countExecutionsTemplate, ")");
|
|
1334
1341
|
case exports.EMeasureAggregationTemplateName.countReworks:
|
|
1335
|
-
return "{outerAggregation}
|
|
1342
|
+
return "{outerAggregation}(".concat(countReworksTemplate, ")");
|
|
1336
1343
|
}
|
|
1337
1344
|
}
|
|
1338
1345
|
|
|
@@ -1381,16 +1388,16 @@ function getMeasureFormula(_a) {
|
|
|
1381
1388
|
return "";
|
|
1382
1389
|
}
|
|
1383
1390
|
|
|
1384
|
-
var _a$
|
|
1391
|
+
var _a$2;
|
|
1385
1392
|
exports.EEventMeasureTemplateNames = void 0;
|
|
1386
1393
|
(function (EEventMeasureTemplateNames) {
|
|
1387
1394
|
EEventMeasureTemplateNames["eventsCount"] = "eventsCount";
|
|
1388
1395
|
EEventMeasureTemplateNames["reworksCount"] = "reworksCount";
|
|
1389
1396
|
})(exports.EEventMeasureTemplateNames || (exports.EEventMeasureTemplateNames = {}));
|
|
1390
|
-
var eventMeasureTemplateFormulas = (_a$
|
|
1391
|
-
_a$
|
|
1392
|
-
_a$
|
|
1393
|
-
_a$
|
|
1397
|
+
var eventMeasureTemplateFormulas = (_a$2 = {},
|
|
1398
|
+
_a$2[exports.EEventMeasureTemplateNames.eventsCount] = "count()",
|
|
1399
|
+
_a$2[exports.EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
|
|
1400
|
+
_a$2);
|
|
1394
1401
|
|
|
1395
1402
|
function getEventMeasureFormula(_a, process) {
|
|
1396
1403
|
var value = _a.value;
|
|
@@ -1407,16 +1414,16 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1407
1414
|
return "";
|
|
1408
1415
|
}
|
|
1409
1416
|
|
|
1410
|
-
var _a;
|
|
1417
|
+
var _a$1;
|
|
1411
1418
|
exports.ETransitionMeasureTemplateNames = void 0;
|
|
1412
1419
|
(function (ETransitionMeasureTemplateNames) {
|
|
1413
1420
|
ETransitionMeasureTemplateNames["transitionsCount"] = "transitionsCount";
|
|
1414
1421
|
ETransitionMeasureTemplateNames["medianTime"] = "medianTime";
|
|
1415
1422
|
})(exports.ETransitionMeasureTemplateNames || (exports.ETransitionMeasureTemplateNames = {}));
|
|
1416
|
-
var transitionMeasureTemplateFormulas = (_a = {},
|
|
1417
|
-
_a[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1418
|
-
_a[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1419
|
-
_a);
|
|
1423
|
+
var transitionMeasureTemplateFormulas = (_a$1 = {},
|
|
1424
|
+
_a$1[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
1425
|
+
_a$1[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
1426
|
+
_a$1);
|
|
1420
1427
|
|
|
1421
1428
|
function getTransitionMeasureFormula(_a, process) {
|
|
1422
1429
|
var value = _a.value;
|
|
@@ -1655,6 +1662,46 @@ var mapFormulaFiltersToInputs = function (filters) {
|
|
|
1655
1662
|
return compactMap(filters, mapFormulaFilterToCalculatorInput);
|
|
1656
1663
|
};
|
|
1657
1664
|
|
|
1665
|
+
var _a;
|
|
1666
|
+
var intervalByUnit = (_a = {},
|
|
1667
|
+
_a[exports.EDimensionProcessFilterTimeUnit.YEARS] = "year",
|
|
1668
|
+
_a[exports.EDimensionProcessFilterTimeUnit.MONTHS] = "month",
|
|
1669
|
+
_a[exports.EDimensionProcessFilterTimeUnit.DAYS] = "day",
|
|
1670
|
+
_a[exports.EDimensionProcessFilterTimeUnit.HOURS] = "hour",
|
|
1671
|
+
_a[exports.EDimensionProcessFilterTimeUnit.MINUTES] = "minute",
|
|
1672
|
+
_a);
|
|
1673
|
+
function mapDimensionProcessFilterToCalculatorInput(filter) {
|
|
1674
|
+
var formula = filter.value.mode === exports.EWidgetIndicatorValueModes.FORMULA
|
|
1675
|
+
? filter.value.formula
|
|
1676
|
+
: getProcessDimensionValueFormula(filter.value);
|
|
1677
|
+
if (formula === undefined) {
|
|
1678
|
+
throw new Error("Formula generation error");
|
|
1679
|
+
}
|
|
1680
|
+
var _a = filter.condition, timeUnit = _a.timeUnit, filteringMethod = _a.filteringMethod, values = _a.values;
|
|
1681
|
+
if (filteringMethod === "LAST_TIME") {
|
|
1682
|
+
if (!timeUnit) {
|
|
1683
|
+
throw new Error("Missing time unit");
|
|
1684
|
+
}
|
|
1685
|
+
return {
|
|
1686
|
+
dbDataType: exports.EClickHouseBaseTypes.Bool,
|
|
1687
|
+
formula: "date_diff('".concat(intervalByUnit[timeUnit], "', ").concat(formula, ", now())"),
|
|
1688
|
+
values: values,
|
|
1689
|
+
filteringMethod: formulaFilterMethods.LESS_THAN_OR_EQUAL_TO,
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
return { formula: formula, filteringMethod: filteringMethod, values: values, dbDataType: filter.dbDataType };
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
var mapSettingsFilterToCalculatorInput = function (filter) {
|
|
1696
|
+
if (isDimensionProcessFilter(filter)) {
|
|
1697
|
+
return mapDimensionProcessFilterToCalculatorInput(filter);
|
|
1698
|
+
}
|
|
1699
|
+
return mapFormulaFilterToCalculatorInput(filter);
|
|
1700
|
+
};
|
|
1701
|
+
var mapSettingsFiltersToInputs = function (filters) {
|
|
1702
|
+
return compactMap(filters, mapSettingsFilterToCalculatorInput);
|
|
1703
|
+
};
|
|
1704
|
+
|
|
1658
1705
|
function mapMeasureToInput(measure, variables, addFormulas) {
|
|
1659
1706
|
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
1660
1707
|
var mainFormula = getMeasureFormula(measure);
|
|
@@ -2192,8 +2239,10 @@ exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
|
2192
2239
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
2193
2240
|
exports.getLocalizedText = getLocalizedText;
|
|
2194
2241
|
exports.getMeasureFormula = getMeasureFormula;
|
|
2242
|
+
exports.getProcessDimensionValueFormula = getProcessDimensionValueFormula;
|
|
2195
2243
|
exports.getRuleColor = getRuleColor;
|
|
2196
2244
|
exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
|
|
2245
|
+
exports.isDimensionProcessFilter = isDimensionProcessFilter;
|
|
2197
2246
|
exports.isDimensionsHierarchy = isDimensionsHierarchy;
|
|
2198
2247
|
exports.isFormulaFilterValue = isFormulaFilterValue;
|
|
2199
2248
|
exports.isValidColor = isValidColor;
|
|
@@ -2202,6 +2251,7 @@ exports.mapEventMeasuresToInputs = mapEventMeasuresToInputs;
|
|
|
2202
2251
|
exports.mapFormulaFilterToCalculatorInput = mapFormulaFilterToCalculatorInput;
|
|
2203
2252
|
exports.mapFormulaFiltersToInputs = mapFormulaFiltersToInputs;
|
|
2204
2253
|
exports.mapMeasuresToInputs = mapMeasuresToInputs;
|
|
2254
|
+
exports.mapSettingsFiltersToInputs = mapSettingsFiltersToInputs;
|
|
2205
2255
|
exports.mapSortingToInputs = mapSortingToInputs;
|
|
2206
2256
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
2207
2257
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|