@infomaximum/widget-sdk 6.0.0-view-theme.0 → 6.0.0-view-theme.1
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 +40 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.esm.js +49 -87
- package/dist/index.js +48 -87
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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-view-theme.1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.4...v6.0.0-view-theme.1) (2025-10-01)
|
|
6
|
+
|
|
7
|
+
## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.3...v6.0.0-13) (2025-10-01)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
|
|
13
|
+
|
|
5
14
|
## [6.0.0-view-theme.0](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-12...v6.0.0-view-theme.0) (2025-09-29)
|
|
6
15
|
|
|
7
16
|
## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
|
|
@@ -9,13 +18,14 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
9
18
|
|
|
10
19
|
### Features
|
|
11
20
|
|
|
12
|
-
*
|
|
21
|
+
* поддержен флаг для темы [BI-15496] ([5196fa6](https://github.com/Infomaximum/widget-sdk/commit/5196fa6c69a521c4529a355e674bcb1f8c1aac39))
|
|
13
22
|
|
|
14
|
-
## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-
|
|
23
|
+
## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.2...v6.0.0-11) (2025-09-23)
|
|
15
24
|
|
|
16
25
|
|
|
17
26
|
### Features
|
|
18
27
|
|
|
28
|
+
* для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
|
|
19
29
|
* удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
|
|
20
30
|
|
|
21
31
|
## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
|
|
@@ -29,6 +39,34 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
29
39
|
|
|
30
40
|
## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
|
|
31
41
|
|
|
42
|
+
## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-12...v6.0.0-13) (2025-10-01)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
|
|
47
|
+
|
|
48
|
+
## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
- для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
|
|
53
|
+
|
|
54
|
+
## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-10...v6.0.0-11) (2025-09-23)
|
|
55
|
+
|
|
56
|
+
### Features
|
|
57
|
+
|
|
58
|
+
- удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
|
|
59
|
+
|
|
60
|
+
## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
|
|
61
|
+
|
|
62
|
+
## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
- исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
|
|
67
|
+
|
|
68
|
+
## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
|
|
69
|
+
|
|
32
70
|
## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
|
|
33
71
|
|
|
34
72
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -261,6 +261,7 @@ interface IBaseWidgetSettings {
|
|
|
261
261
|
sorting?: IWidgetSortingIndicator[];
|
|
262
262
|
actionButtons?: IActionButton[];
|
|
263
263
|
paddings?: number | string;
|
|
264
|
+
viewTheme?: boolean;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
declare enum ESortDirection {
|
|
@@ -2027,7 +2028,7 @@ declare const prepareMeasureAggregationParams: (value: Extract<IWidgetMeasure["v
|
|
|
2027
2028
|
} | null;
|
|
2028
2029
|
|
|
2029
2030
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
2030
|
-
declare const conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
2031
|
+
declare const conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} = {startEventName}{startEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) < \n process(\n maxIf(\n {endEventTimeFormula}, \n {endEventNameFormula} = {endEventName}{endEventFilters}\n ), \n {endCaseCaseIdFormula}\n ) \n and \n process(\n countIf(\n {startEventNameFormula} = {startEventName}{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n) / countIf(\n process(\n countIf(\n {startEventNameFormula} = {startEventName}{startEventFilters}\n ) != 0, \n {endCaseCaseIdFormula}\n ) != 0\n)";
|
|
2031
2032
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
2032
2033
|
declare const prepareConversionParams: (value: TWidgetIndicatorConversionValue) => {
|
|
2033
2034
|
startEventTimeFormula: string;
|
|
@@ -2084,12 +2085,10 @@ declare const transitionMeasureTemplateFormulas: {
|
|
|
2084
2085
|
readonly medianTime: "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))";
|
|
2085
2086
|
};
|
|
2086
2087
|
|
|
2087
|
-
declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
2088
|
+
declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
2088
2089
|
|
|
2089
2090
|
/** @deprecated - следует использовать fillTemplateSql */
|
|
2090
2091
|
declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
|
|
2091
|
-
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
2092
|
-
declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
|
|
2093
2092
|
|
|
2094
2093
|
declare function generateColumnFormula(tableName: string, columnName: string): string;
|
|
2095
2094
|
|
|
@@ -2326,6 +2325,8 @@ interface IPanelDescription<Settings extends object, GroupSettings extends IGrou
|
|
|
2326
2325
|
useTitle?: boolean;
|
|
2327
2326
|
/** Добавить поле настройки описания */
|
|
2328
2327
|
useMarkdown?: boolean;
|
|
2328
|
+
/** Добавить переключатель темы */
|
|
2329
|
+
useTheme?: boolean;
|
|
2329
2330
|
/** Конфигурация вкладки настроек данных */
|
|
2330
2331
|
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
2331
2332
|
/** Конфигурация вкладки настроек отображения */
|
|
@@ -2752,4 +2753,4 @@ declare global {
|
|
|
2752
2753
|
}
|
|
2753
2754
|
}
|
|
2754
2755
|
|
|
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,
|
|
2756
|
+
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionButton, type IActionGoToUrl, type IActionOnClickControl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorOptions, type ICollapseRecord, type IColorPickerControl, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionProcessFilter, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayConditionControl, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IEventsColorControl, type IEventsPickerControl, type IExportColumnOrder, type IFillSettings, type IFilterControl, type IFormattingControl, type IFormattingTemplateControl, type IFormulaControl, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type IInputControl, type IInputMarkdownControl, type IInputNumberControl, type IInputRangeControl, type IInputTemplatedControl, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IParameterColumnList, type IParameterFromAggregation, type IParameterFromColumn, type IParameterFromDynamicList, type IParameterFromEndEvent, type IParameterFromEvent, type IParameterFromFormula, type IParameterFromManualInput, type IParameterFromStartEvent, type IParameterFromStaticList, type IParameterFromVariable, type IParameterTableList, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessFilterPreviewParams, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRadioIconGroupControl, type IRange, type ISelectBranchOption, type ISelectControl, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISizeControl, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type IStaticListLabeledOption, type ISwitchControl, type ITagSetControl, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type ITypedFormulaControl, type IVertex, type IViewAction, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, OuterAggregation, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TControlUnion, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type THintPlacement, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TParameterFromDataModel, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSettingsFilter, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TViewActionParameter, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorAggregationValue, type TWidgetIndicatorConversionValue, type TWidgetIndicatorDurationValue, type TWidgetIndicatorTimeValue, type TWidgetLevelRecord, type TWidgetMeasureData, type TWidgetSortingValue, type TWidgetVariable, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -132,35 +132,6 @@ function __rest(s, e) {
|
|
|
132
132
|
return t;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function __values(o) {
|
|
136
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
137
|
-
if (m) return m.call(o);
|
|
138
|
-
if (o && typeof o.length === "number") return {
|
|
139
|
-
next: function () {
|
|
140
|
-
if (o && i >= o.length) o = void 0;
|
|
141
|
-
return { value: o && o[i++], done: !o };
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function __read(o, n) {
|
|
148
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
149
|
-
if (!m) return o;
|
|
150
|
-
var i = m.call(o), r, ar = [], e;
|
|
151
|
-
try {
|
|
152
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
153
|
-
}
|
|
154
|
-
catch (error) { e = { error: error }; }
|
|
155
|
-
finally {
|
|
156
|
-
try {
|
|
157
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
158
|
-
}
|
|
159
|
-
finally { if (e) throw e.error; }
|
|
160
|
-
}
|
|
161
|
-
return ar;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
135
|
function __makeTemplateObject(cooked, raw) {
|
|
165
136
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
166
137
|
return cooked;
|
|
@@ -786,14 +757,14 @@ var EEventAppearances;
|
|
|
786
757
|
})(EEventAppearances || (EEventAppearances = {}));
|
|
787
758
|
|
|
788
759
|
function createAggregationTemplate$1(functionName, options) {
|
|
789
|
-
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} =
|
|
760
|
+
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} ={eventName}{filters}), {caseCaseIdFormula})");
|
|
790
761
|
}
|
|
791
762
|
|
|
792
|
-
var countReworksTemplate = "process(if(countIf({eventNameFormula} =
|
|
793
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
794
|
-
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
795
|
-
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
796
|
-
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} =
|
|
763
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = {eventName}{filters}) > 0, countIf({eventNameFormula} = {eventName}{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
764
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
765
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
766
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
767
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = {eventName}{filters})[1], {caseCaseIdFormula})";
|
|
797
768
|
var avgTemplate = createAggregationTemplate$1("avgIf");
|
|
798
769
|
var medianTemplate = createAggregationTemplate$1("medianIf");
|
|
799
770
|
var countTemplate = createAggregationTemplate$1("countIf");
|
|
@@ -802,6 +773,23 @@ var minTemplate = createAggregationTemplate$1("minIf");
|
|
|
802
773
|
var maxTemplate = createAggregationTemplate$1("maxIf");
|
|
803
774
|
var sumTemplate = createAggregationTemplate$1("sumIf");
|
|
804
775
|
|
|
776
|
+
function hasPossibleSingleLineComment(str) {
|
|
777
|
+
return str.indexOf("--") >= 0;
|
|
778
|
+
}
|
|
779
|
+
function sanitizeSingleLineComment(formula, wrapInBrackets) {
|
|
780
|
+
if (!hasPossibleSingleLineComment(formula)) {
|
|
781
|
+
return formula;
|
|
782
|
+
}
|
|
783
|
+
var lines = formula.split("\n");
|
|
784
|
+
var lastLine = lines[lines.length - 1];
|
|
785
|
+
// Кейс, когда хотим избежать повторного добавления переноса строки:
|
|
786
|
+
// уже есть переносы и после последнего переноса нет комментария
|
|
787
|
+
if (lines.length > 1 && lastLine && !hasPossibleSingleLineComment(lastLine)) {
|
|
788
|
+
return formula;
|
|
789
|
+
}
|
|
790
|
+
return wrapInBrackets ? "(".concat(formula, "\n)") : "".concat(formula, "\n");
|
|
791
|
+
}
|
|
792
|
+
|
|
805
793
|
/** @deprecated - следует использовать fillTemplateSql */
|
|
806
794
|
function fillTemplateString(templateString, params) {
|
|
807
795
|
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
@@ -809,31 +797,6 @@ function fillTemplateString(templateString, params) {
|
|
|
809
797
|
return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
|
|
810
798
|
});
|
|
811
799
|
}
|
|
812
|
-
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
813
|
-
function fillTemplateSql(templateString, params) {
|
|
814
|
-
var e_1, _a;
|
|
815
|
-
var newParams = {};
|
|
816
|
-
try {
|
|
817
|
-
for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
818
|
-
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
819
|
-
/** Эвристическая проверка на возможное присутствие sql-комментария в значении подставляемом в template
|
|
820
|
-
*/
|
|
821
|
-
if (String(value).indexOf("--") >= 0) {
|
|
822
|
-
newParams[key] = "".concat(value, "\n");
|
|
823
|
-
continue;
|
|
824
|
-
}
|
|
825
|
-
newParams[key] = String(value);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
829
|
-
finally {
|
|
830
|
-
try {
|
|
831
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
832
|
-
}
|
|
833
|
-
finally { if (e_1) throw e_1.error; }
|
|
834
|
-
}
|
|
835
|
-
return fillTemplateString(templateString, newParams);
|
|
836
|
-
}
|
|
837
800
|
|
|
838
801
|
/** Создать функцию экранирования переданных `specialChars` внутри `str` */
|
|
839
802
|
var createEscaper = function (specialChars) { return function (str) {
|
|
@@ -906,7 +869,7 @@ var escapeSingularQuotes = function (formula) {
|
|
|
906
869
|
};
|
|
907
870
|
|
|
908
871
|
var prepareFormulaForSql = function (formula, simpleType) {
|
|
909
|
-
formula =
|
|
872
|
+
formula = sanitizeSingleLineComment(formula, true);
|
|
910
873
|
return simpleType === ESimpleDataType.OTHER ? "toString(".concat(formula, ")") : formula;
|
|
911
874
|
};
|
|
912
875
|
var clearSingleLineComments = function (formula) {
|
|
@@ -1031,7 +994,7 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
1031
994
|
var commonParams = {
|
|
1032
995
|
eventNameFormula: value.eventNameFormula,
|
|
1033
996
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1034
|
-
eventName: value.eventName,
|
|
997
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1035
998
|
filters: convertFiltersToFormula(value.filters),
|
|
1036
999
|
eventTimeFormula: "",
|
|
1037
1000
|
columnFormula: "",
|
|
@@ -1060,13 +1023,13 @@ var timeTemplates = (function () {
|
|
|
1060
1023
|
var generateTemplates = function (innerTemplate) {
|
|
1061
1024
|
var templates = {};
|
|
1062
1025
|
for (var key in dimensionTemplateFormulas) {
|
|
1063
|
-
templates[key] =
|
|
1026
|
+
templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1064
1027
|
}
|
|
1065
1028
|
return templates;
|
|
1066
1029
|
};
|
|
1067
1030
|
return _a = {},
|
|
1068
|
-
_a[EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} =
|
|
1069
|
-
_a[EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} =
|
|
1031
|
+
_a[EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1032
|
+
_a[EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1070
1033
|
_a;
|
|
1071
1034
|
})();
|
|
1072
1035
|
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
@@ -1084,7 +1047,7 @@ var prepareTimeParams = function (value) {
|
|
|
1084
1047
|
eventNameFormula: value.eventNameFormula,
|
|
1085
1048
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1086
1049
|
filters: convertFiltersToFormula(value.filters),
|
|
1087
|
-
eventName: value.eventName,
|
|
1050
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1088
1051
|
};
|
|
1089
1052
|
};
|
|
1090
1053
|
|
|
@@ -1103,7 +1066,7 @@ function getDimensionFormula(_a) {
|
|
|
1103
1066
|
if (!templateFormula || !tableName || !columnName) {
|
|
1104
1067
|
return "";
|
|
1105
1068
|
}
|
|
1106
|
-
return
|
|
1069
|
+
return fillTemplateString(templateFormula, {
|
|
1107
1070
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1108
1071
|
});
|
|
1109
1072
|
}
|
|
@@ -1119,10 +1082,10 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1119
1082
|
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1120
1083
|
: null;
|
|
1121
1084
|
var columnFormula = innerTemplate
|
|
1122
|
-
?
|
|
1085
|
+
? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1123
1086
|
: preparedParams.columnFormula;
|
|
1124
1087
|
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1125
|
-
return
|
|
1088
|
+
return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1126
1089
|
}
|
|
1127
1090
|
if (value.mode === EWidgetIndicatorValueModes.START_TIME ||
|
|
1128
1091
|
value.mode === EWidgetIndicatorValueModes.END_TIME) {
|
|
@@ -1131,7 +1094,7 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1131
1094
|
return "";
|
|
1132
1095
|
}
|
|
1133
1096
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1134
|
-
return
|
|
1097
|
+
return fillTemplateString(templateFormula, preparedParams);
|
|
1135
1098
|
}
|
|
1136
1099
|
}
|
|
1137
1100
|
|
|
@@ -1152,7 +1115,6 @@ var EMeasureAggregationTemplateName;
|
|
|
1152
1115
|
})(EMeasureAggregationTemplateName || (EMeasureAggregationTemplateName = {}));
|
|
1153
1116
|
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1154
1117
|
var prepareMeasureAggregationParams = function (value) {
|
|
1155
|
-
var _a;
|
|
1156
1118
|
if ((!value.anyEvent && !value.eventName) ||
|
|
1157
1119
|
!value.caseCaseIdFormula ||
|
|
1158
1120
|
!value.eventNameFormula ||
|
|
@@ -1165,7 +1127,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1165
1127
|
outerAggregation: value.outerAggregation,
|
|
1166
1128
|
eventNameFormula: value.eventNameFormula,
|
|
1167
1129
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1168
|
-
eventName:
|
|
1130
|
+
eventName: value.eventName ? "'".concat(escapeSingularQuotes(value.eventName), "'") : "",
|
|
1169
1131
|
filters: convertFiltersToFormula(value.filters),
|
|
1170
1132
|
eventTimeFormula: "",
|
|
1171
1133
|
columnFormula: "",
|
|
@@ -1209,7 +1171,7 @@ var measureTemplateFormulas = (_a$3 = {},
|
|
|
1209
1171
|
_a$3);
|
|
1210
1172
|
|
|
1211
1173
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1212
|
-
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1174
|
+
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)";
|
|
1213
1175
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1214
1176
|
var prepareConversionParams = function (value) {
|
|
1215
1177
|
if (!value.startEventName ||
|
|
@@ -1227,11 +1189,11 @@ var prepareConversionParams = function (value) {
|
|
|
1227
1189
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1228
1190
|
startEventNameFormula: value.startEventNameFormula,
|
|
1229
1191
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1230
|
-
startEventName: value.startEventName,
|
|
1192
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1231
1193
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1232
1194
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1233
1195
|
endEventNameFormula: value.endEventNameFormula,
|
|
1234
|
-
endEventName: value.endEventName,
|
|
1196
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1235
1197
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1236
1198
|
};
|
|
1237
1199
|
};
|
|
@@ -1239,7 +1201,7 @@ var prepareConversionParams = function (value) {
|
|
|
1239
1201
|
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1240
1202
|
var durationTemplates = (function () {
|
|
1241
1203
|
var _a;
|
|
1242
|
-
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1204
|
+
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 ";
|
|
1243
1205
|
return _a = {},
|
|
1244
1206
|
_a[EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1245
1207
|
_a[EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
@@ -1265,12 +1227,12 @@ var prepareDurationParams = function (value) {
|
|
|
1265
1227
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1266
1228
|
startEventNameFormula: value.startEventNameFormula,
|
|
1267
1229
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1268
|
-
startEventName: value.startEventName,
|
|
1230
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1269
1231
|
startEventAggregationName: getAggregationNameByAppearances(value.startEventAppearances),
|
|
1270
1232
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1271
1233
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1272
1234
|
endEventNameFormula: value.endEventNameFormula,
|
|
1273
|
-
endEventName: value.endEventName,
|
|
1235
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1274
1236
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1275
1237
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1276
1238
|
};
|
|
@@ -1280,7 +1242,7 @@ function createAnyEventTemplate(aggregatePart) {
|
|
|
1280
1242
|
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1281
1243
|
}
|
|
1282
1244
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1283
|
-
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} =
|
|
1245
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula}))");
|
|
1284
1246
|
}
|
|
1285
1247
|
function createTopLikeTemplate(template) {
|
|
1286
1248
|
return function (outerAggregation) {
|
|
@@ -1354,14 +1316,14 @@ function getMeasureFormula(_a) {
|
|
|
1354
1316
|
if (!templateFormula || !tableName || !columnName) {
|
|
1355
1317
|
return "";
|
|
1356
1318
|
}
|
|
1357
|
-
return
|
|
1319
|
+
return fillTemplateString(templateFormula, {
|
|
1358
1320
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1359
1321
|
});
|
|
1360
1322
|
}
|
|
1361
1323
|
if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1362
1324
|
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1363
1325
|
return preparedParams
|
|
1364
|
-
?
|
|
1326
|
+
? fillTemplateString(createAggregationTemplate(value.templateName, {
|
|
1365
1327
|
outerAggregation: preparedParams.outerAggregation,
|
|
1366
1328
|
anyEvent: value.anyEvent,
|
|
1367
1329
|
}), preparedParams)
|
|
@@ -1372,14 +1334,14 @@ function getMeasureFormula(_a) {
|
|
|
1372
1334
|
if (!preparedParams) {
|
|
1373
1335
|
return "";
|
|
1374
1336
|
}
|
|
1375
|
-
return
|
|
1337
|
+
return fillTemplateString(conversionTemplate, preparedParams);
|
|
1376
1338
|
}
|
|
1377
1339
|
if (value.mode === EWidgetIndicatorValueModes.DURATION) {
|
|
1378
1340
|
var preparedParams = prepareDurationParams(value);
|
|
1379
1341
|
if (!preparedParams) {
|
|
1380
1342
|
return "";
|
|
1381
1343
|
}
|
|
1382
|
-
return
|
|
1344
|
+
return fillTemplateString(durationTemplates[value.templateName], preparedParams);
|
|
1383
1345
|
}
|
|
1384
1346
|
return "";
|
|
1385
1347
|
}
|
|
@@ -1405,7 +1367,7 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1405
1367
|
}
|
|
1406
1368
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1407
1369
|
var templateFormula = eventMeasureTemplateFormulas[value.templateName];
|
|
1408
|
-
return templateFormula &&
|
|
1370
|
+
return templateFormula && fillTemplateString(templateFormula, process);
|
|
1409
1371
|
}
|
|
1410
1372
|
return "";
|
|
1411
1373
|
}
|
|
@@ -1431,7 +1393,7 @@ function getTransitionMeasureFormula(_a, process) {
|
|
|
1431
1393
|
}
|
|
1432
1394
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1433
1395
|
var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
|
|
1434
|
-
return templateFormula &&
|
|
1396
|
+
return templateFormula && fillTemplateString(templateFormula, process);
|
|
1435
1397
|
}
|
|
1436
1398
|
return "";
|
|
1437
1399
|
}
|
|
@@ -1623,7 +1585,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
|
|
|
1623
1585
|
if (!isFormulaFilterValue(filterValue)) {
|
|
1624
1586
|
return {
|
|
1625
1587
|
dbDataType: EClickHouseBaseTypes.Bool,
|
|
1626
|
-
formula:
|
|
1588
|
+
formula: fillTemplateString(displayConditionTemplate, {
|
|
1627
1589
|
formula: prepareFormulaForSql(filterValue.formula),
|
|
1628
1590
|
}),
|
|
1629
1591
|
values: ["true"],
|
|
@@ -2192,4 +2154,4 @@ var getColorByIndex = function (index) {
|
|
|
2192
2154
|
return color;
|
|
2193
2155
|
};
|
|
2194
2156
|
|
|
2195
|
-
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,
|
|
2157
|
+
export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.js
CHANGED
|
@@ -133,35 +133,6 @@ function __rest(s, e) {
|
|
|
133
133
|
return t;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function __values(o) {
|
|
137
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
138
|
-
if (m) return m.call(o);
|
|
139
|
-
if (o && typeof o.length === "number") return {
|
|
140
|
-
next: function () {
|
|
141
|
-
if (o && i >= o.length) o = void 0;
|
|
142
|
-
return { value: o && o[i++], done: !o };
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function __read(o, n) {
|
|
149
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
150
|
-
if (!m) return o;
|
|
151
|
-
var i = m.call(o), r, ar = [], e;
|
|
152
|
-
try {
|
|
153
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
154
|
-
}
|
|
155
|
-
catch (error) { e = { error: error }; }
|
|
156
|
-
finally {
|
|
157
|
-
try {
|
|
158
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
159
|
-
}
|
|
160
|
-
finally { if (e) throw e.error; }
|
|
161
|
-
}
|
|
162
|
-
return ar;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
136
|
function __makeTemplateObject(cooked, raw) {
|
|
166
137
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
167
138
|
return cooked;
|
|
@@ -787,14 +758,14 @@ exports.EEventAppearances = void 0;
|
|
|
787
758
|
})(exports.EEventAppearances || (exports.EEventAppearances = {}));
|
|
788
759
|
|
|
789
760
|
function createAggregationTemplate$1(functionName, options) {
|
|
790
|
-
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} =
|
|
761
|
+
return "process(".concat(functionName, "(").concat((options === null || options === void 0 ? void 0 : options.distinct) ? "distinct " : "", "{columnFormula}, {eventNameFormula} ={eventName}{filters}), {caseCaseIdFormula})");
|
|
791
762
|
}
|
|
792
763
|
|
|
793
|
-
var countReworksTemplate = "process(if(countIf({eventNameFormula} =
|
|
794
|
-
var countExecutionsTemplate = "process(countIf({eventNameFormula} in
|
|
795
|
-
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
796
|
-
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} =
|
|
797
|
-
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} =
|
|
764
|
+
var countReworksTemplate = "process(if(countIf({eventNameFormula} = {eventName}{filters}) > 0, countIf({eventNameFormula} = {eventName}{filters}) - 1, 0), {caseCaseIdFormula})";
|
|
765
|
+
var countExecutionsTemplate = "process(countIf({eventNameFormula} in {eventName}{filters}), {caseCaseIdFormula})";
|
|
766
|
+
var lastValueTemplate = "process(argMaxIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
767
|
+
var firstValueTemplate = "process(argMinIf({columnFormula}, {eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})";
|
|
768
|
+
var topTemplate = "process(topKIf(1)({columnFormula}, {eventNameFormula} = {eventName}{filters})[1], {caseCaseIdFormula})";
|
|
798
769
|
var avgTemplate = createAggregationTemplate$1("avgIf");
|
|
799
770
|
var medianTemplate = createAggregationTemplate$1("medianIf");
|
|
800
771
|
var countTemplate = createAggregationTemplate$1("countIf");
|
|
@@ -803,6 +774,23 @@ var minTemplate = createAggregationTemplate$1("minIf");
|
|
|
803
774
|
var maxTemplate = createAggregationTemplate$1("maxIf");
|
|
804
775
|
var sumTemplate = createAggregationTemplate$1("sumIf");
|
|
805
776
|
|
|
777
|
+
function hasPossibleSingleLineComment(str) {
|
|
778
|
+
return str.indexOf("--") >= 0;
|
|
779
|
+
}
|
|
780
|
+
function sanitizeSingleLineComment(formula, wrapInBrackets) {
|
|
781
|
+
if (!hasPossibleSingleLineComment(formula)) {
|
|
782
|
+
return formula;
|
|
783
|
+
}
|
|
784
|
+
var lines = formula.split("\n");
|
|
785
|
+
var lastLine = lines[lines.length - 1];
|
|
786
|
+
// Кейс, когда хотим избежать повторного добавления переноса строки:
|
|
787
|
+
// уже есть переносы и после последнего переноса нет комментария
|
|
788
|
+
if (lines.length > 1 && lastLine && !hasPossibleSingleLineComment(lastLine)) {
|
|
789
|
+
return formula;
|
|
790
|
+
}
|
|
791
|
+
return wrapInBrackets ? "(".concat(formula, "\n)") : "".concat(formula, "\n");
|
|
792
|
+
}
|
|
793
|
+
|
|
806
794
|
/** @deprecated - следует использовать fillTemplateSql */
|
|
807
795
|
function fillTemplateString(templateString, params) {
|
|
808
796
|
return templateString.replace(/\{(.*?)\}/g, function (_, key) {
|
|
@@ -810,31 +798,6 @@ function fillTemplateString(templateString, params) {
|
|
|
810
798
|
return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
|
|
811
799
|
});
|
|
812
800
|
}
|
|
813
|
-
/** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
|
|
814
|
-
function fillTemplateSql(templateString, params) {
|
|
815
|
-
var e_1, _a;
|
|
816
|
-
var newParams = {};
|
|
817
|
-
try {
|
|
818
|
-
for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
819
|
-
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
820
|
-
/** Эвристическая проверка на возможное присутствие sql-комментария в значении подставляемом в template
|
|
821
|
-
*/
|
|
822
|
-
if (String(value).indexOf("--") >= 0) {
|
|
823
|
-
newParams[key] = "".concat(value, "\n");
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
newParams[key] = String(value);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
830
|
-
finally {
|
|
831
|
-
try {
|
|
832
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
833
|
-
}
|
|
834
|
-
finally { if (e_1) throw e_1.error; }
|
|
835
|
-
}
|
|
836
|
-
return fillTemplateString(templateString, newParams);
|
|
837
|
-
}
|
|
838
801
|
|
|
839
802
|
/** Создать функцию экранирования переданных `specialChars` внутри `str` */
|
|
840
803
|
var createEscaper = function (specialChars) { return function (str) {
|
|
@@ -907,7 +870,7 @@ var escapeSingularQuotes = function (formula) {
|
|
|
907
870
|
};
|
|
908
871
|
|
|
909
872
|
var prepareFormulaForSql = function (formula, simpleType) {
|
|
910
|
-
formula =
|
|
873
|
+
formula = sanitizeSingleLineComment(formula, true);
|
|
911
874
|
return simpleType === exports.ESimpleDataType.OTHER ? "toString(".concat(formula, ")") : formula;
|
|
912
875
|
};
|
|
913
876
|
var clearSingleLineComments = function (formula) {
|
|
@@ -1032,7 +995,7 @@ var prepareDimensionAggregationParams = function (value) {
|
|
|
1032
995
|
var commonParams = {
|
|
1033
996
|
eventNameFormula: value.eventNameFormula,
|
|
1034
997
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1035
|
-
eventName: value.eventName,
|
|
998
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1036
999
|
filters: convertFiltersToFormula(value.filters),
|
|
1037
1000
|
eventTimeFormula: "",
|
|
1038
1001
|
columnFormula: "",
|
|
@@ -1061,13 +1024,13 @@ var timeTemplates = (function () {
|
|
|
1061
1024
|
var generateTemplates = function (innerTemplate) {
|
|
1062
1025
|
var templates = {};
|
|
1063
1026
|
for (var key in dimensionTemplateFormulas) {
|
|
1064
|
-
templates[key] =
|
|
1027
|
+
templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
|
|
1065
1028
|
}
|
|
1066
1029
|
return templates;
|
|
1067
1030
|
};
|
|
1068
1031
|
return _a = {},
|
|
1069
|
-
_a[exports.EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} =
|
|
1070
|
-
_a[exports.EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} =
|
|
1032
|
+
_a[exports.EWidgetIndicatorValueModes.START_TIME] = generateTemplates("process(minIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1033
|
+
_a[exports.EWidgetIndicatorValueModes.END_TIME] = generateTemplates("process(maxIf({eventTimeFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula})"),
|
|
1071
1034
|
_a;
|
|
1072
1035
|
})();
|
|
1073
1036
|
/** На основе значения режимов START_TIME/END_TIME подготовить параметры для подстановки в шаблонную формулу */
|
|
@@ -1085,7 +1048,7 @@ var prepareTimeParams = function (value) {
|
|
|
1085
1048
|
eventNameFormula: value.eventNameFormula,
|
|
1086
1049
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1087
1050
|
filters: convertFiltersToFormula(value.filters),
|
|
1088
|
-
eventName: value.eventName,
|
|
1051
|
+
eventName: "'".concat(escapeSingularQuotes(value.eventName), "'"),
|
|
1089
1052
|
};
|
|
1090
1053
|
};
|
|
1091
1054
|
|
|
@@ -1104,7 +1067,7 @@ function getDimensionFormula(_a) {
|
|
|
1104
1067
|
if (!templateFormula || !tableName || !columnName) {
|
|
1105
1068
|
return "";
|
|
1106
1069
|
}
|
|
1107
|
-
return
|
|
1070
|
+
return fillTemplateString(templateFormula, {
|
|
1108
1071
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1109
1072
|
});
|
|
1110
1073
|
}
|
|
@@ -1120,10 +1083,10 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1120
1083
|
? dimensionTemplateFormulas[value.innerTemplateName]
|
|
1121
1084
|
: null;
|
|
1122
1085
|
var columnFormula = innerTemplate
|
|
1123
|
-
?
|
|
1086
|
+
? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
|
|
1124
1087
|
: preparedParams.columnFormula;
|
|
1125
1088
|
var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
|
|
1126
|
-
return
|
|
1089
|
+
return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
|
|
1127
1090
|
}
|
|
1128
1091
|
if (value.mode === exports.EWidgetIndicatorValueModes.START_TIME ||
|
|
1129
1092
|
value.mode === exports.EWidgetIndicatorValueModes.END_TIME) {
|
|
@@ -1132,7 +1095,7 @@ function getProcessDimensionValueFormula(value) {
|
|
|
1132
1095
|
return "";
|
|
1133
1096
|
}
|
|
1134
1097
|
var templateFormula = timeTemplates[value.mode][value.templateName];
|
|
1135
|
-
return
|
|
1098
|
+
return fillTemplateString(templateFormula, preparedParams);
|
|
1136
1099
|
}
|
|
1137
1100
|
}
|
|
1138
1101
|
|
|
@@ -1153,7 +1116,6 @@ exports.EMeasureAggregationTemplateName = void 0;
|
|
|
1153
1116
|
})(exports.EMeasureAggregationTemplateName || (exports.EMeasureAggregationTemplateName = {}));
|
|
1154
1117
|
/** На основе значения режима AGGREGATION подготовить параметры для подстановки в шаблонную формулу */
|
|
1155
1118
|
var prepareMeasureAggregationParams = function (value) {
|
|
1156
|
-
var _a;
|
|
1157
1119
|
if ((!value.anyEvent && !value.eventName) ||
|
|
1158
1120
|
!value.caseCaseIdFormula ||
|
|
1159
1121
|
!value.eventNameFormula ||
|
|
@@ -1166,7 +1128,7 @@ var prepareMeasureAggregationParams = function (value) {
|
|
|
1166
1128
|
outerAggregation: value.outerAggregation,
|
|
1167
1129
|
eventNameFormula: value.eventNameFormula,
|
|
1168
1130
|
caseCaseIdFormula: value.caseCaseIdFormula,
|
|
1169
|
-
eventName:
|
|
1131
|
+
eventName: value.eventName ? "'".concat(escapeSingularQuotes(value.eventName), "'") : "",
|
|
1170
1132
|
filters: convertFiltersToFormula(value.filters),
|
|
1171
1133
|
eventTimeFormula: "",
|
|
1172
1134
|
columnFormula: "",
|
|
@@ -1210,7 +1172,7 @@ var measureTemplateFormulas = (_a$3 = {},
|
|
|
1210
1172
|
_a$3);
|
|
1211
1173
|
|
|
1212
1174
|
/** Шаблон процессной метрики меры с режимом CONVERSION */
|
|
1213
|
-
var conversionTemplate = "countIf(\n process(\n minIf(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1175
|
+
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)";
|
|
1214
1176
|
/** На основе значения режима CONVERSION подготовить параметры для подстановки в шаблонную формулу */
|
|
1215
1177
|
var prepareConversionParams = function (value) {
|
|
1216
1178
|
if (!value.startEventName ||
|
|
@@ -1228,11 +1190,11 @@ var prepareConversionParams = function (value) {
|
|
|
1228
1190
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1229
1191
|
startEventNameFormula: value.startEventNameFormula,
|
|
1230
1192
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1231
|
-
startEventName: value.startEventName,
|
|
1193
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1232
1194
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1233
1195
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1234
1196
|
endEventNameFormula: value.endEventNameFormula,
|
|
1235
|
-
endEventName: value.endEventName,
|
|
1197
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1236
1198
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1237
1199
|
};
|
|
1238
1200
|
};
|
|
@@ -1240,7 +1202,7 @@ var prepareConversionParams = function (value) {
|
|
|
1240
1202
|
/** Шаблоны процессных метрик меры с режимом DURATION */
|
|
1241
1203
|
var durationTemplates = (function () {
|
|
1242
1204
|
var _a;
|
|
1243
|
-
var innerTemplate = "\n timeDiff(\n process(\n {startEventAggregationName}(\n {startEventTimeFormula}, \n {startEventNameFormula} =
|
|
1205
|
+
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 ";
|
|
1244
1206
|
return _a = {},
|
|
1245
1207
|
_a[exports.EDurationTemplateName.avg] = "avgIf(".concat(innerTemplate, ")"),
|
|
1246
1208
|
_a[exports.EDurationTemplateName.median] = "medianIf(".concat(innerTemplate, ")"),
|
|
@@ -1266,12 +1228,12 @@ var prepareDurationParams = function (value) {
|
|
|
1266
1228
|
startEventTimeFormula: value.startEventTimeFormula,
|
|
1267
1229
|
startEventNameFormula: value.startEventNameFormula,
|
|
1268
1230
|
startEventFilters: convertFiltersToFormula(value.startEventFilters),
|
|
1269
|
-
startEventName: value.startEventName,
|
|
1231
|
+
startEventName: "'".concat(escapeSingularQuotes(value.startEventName), "'"),
|
|
1270
1232
|
startEventAggregationName: getAggregationNameByAppearances(value.startEventAppearances),
|
|
1271
1233
|
endEventTimeFormula: value.endEventTimeFormula,
|
|
1272
1234
|
endCaseCaseIdFormula: value.endCaseCaseIdFormula,
|
|
1273
1235
|
endEventNameFormula: value.endEventNameFormula,
|
|
1274
|
-
endEventName: value.endEventName,
|
|
1236
|
+
endEventName: "'".concat(escapeSingularQuotes(value.endEventName), "'"),
|
|
1275
1237
|
endEventFilters: convertFiltersToFormula(value.endEventFilters),
|
|
1276
1238
|
endEventAggregationName: getAggregationNameByAppearances(value.endEventAppearances),
|
|
1277
1239
|
};
|
|
@@ -1281,7 +1243,7 @@ function createAnyEventTemplate(aggregatePart) {
|
|
|
1281
1243
|
return "{outerAggregation}(process(".concat(aggregatePart, ", {caseCaseIdFormula}))");
|
|
1282
1244
|
}
|
|
1283
1245
|
function createSpecificEventTemplate(fn, additionalFn) {
|
|
1284
|
-
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} =
|
|
1246
|
+
return "{outerAggregation}(process(".concat(fn, "(").concat(additionalFn ? "".concat(additionalFn, " ") : "", "{columnFormula}, {eventNameFormula} = {eventName}{filters}), {caseCaseIdFormula}))");
|
|
1285
1247
|
}
|
|
1286
1248
|
function createTopLikeTemplate(template) {
|
|
1287
1249
|
return function (outerAggregation) {
|
|
@@ -1355,14 +1317,14 @@ function getMeasureFormula(_a) {
|
|
|
1355
1317
|
if (!templateFormula || !tableName || !columnName) {
|
|
1356
1318
|
return "";
|
|
1357
1319
|
}
|
|
1358
|
-
return
|
|
1320
|
+
return fillTemplateString(templateFormula, {
|
|
1359
1321
|
columnFormula: generateColumnFormula(tableName, columnName),
|
|
1360
1322
|
});
|
|
1361
1323
|
}
|
|
1362
1324
|
if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
|
|
1363
1325
|
var preparedParams = prepareMeasureAggregationParams(value);
|
|
1364
1326
|
return preparedParams
|
|
1365
|
-
?
|
|
1327
|
+
? fillTemplateString(createAggregationTemplate(value.templateName, {
|
|
1366
1328
|
outerAggregation: preparedParams.outerAggregation,
|
|
1367
1329
|
anyEvent: value.anyEvent,
|
|
1368
1330
|
}), preparedParams)
|
|
@@ -1373,14 +1335,14 @@ function getMeasureFormula(_a) {
|
|
|
1373
1335
|
if (!preparedParams) {
|
|
1374
1336
|
return "";
|
|
1375
1337
|
}
|
|
1376
|
-
return
|
|
1338
|
+
return fillTemplateString(conversionTemplate, preparedParams);
|
|
1377
1339
|
}
|
|
1378
1340
|
if (value.mode === exports.EWidgetIndicatorValueModes.DURATION) {
|
|
1379
1341
|
var preparedParams = prepareDurationParams(value);
|
|
1380
1342
|
if (!preparedParams) {
|
|
1381
1343
|
return "";
|
|
1382
1344
|
}
|
|
1383
|
-
return
|
|
1345
|
+
return fillTemplateString(durationTemplates[value.templateName], preparedParams);
|
|
1384
1346
|
}
|
|
1385
1347
|
return "";
|
|
1386
1348
|
}
|
|
@@ -1406,7 +1368,7 @@ function getEventMeasureFormula(_a, process) {
|
|
|
1406
1368
|
}
|
|
1407
1369
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1408
1370
|
var templateFormula = eventMeasureTemplateFormulas[value.templateName];
|
|
1409
|
-
return templateFormula &&
|
|
1371
|
+
return templateFormula && fillTemplateString(templateFormula, process);
|
|
1410
1372
|
}
|
|
1411
1373
|
return "";
|
|
1412
1374
|
}
|
|
@@ -1432,7 +1394,7 @@ function getTransitionMeasureFormula(_a, process) {
|
|
|
1432
1394
|
}
|
|
1433
1395
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
1434
1396
|
var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
|
|
1435
|
-
return templateFormula &&
|
|
1397
|
+
return templateFormula && fillTemplateString(templateFormula, process);
|
|
1436
1398
|
}
|
|
1437
1399
|
return "";
|
|
1438
1400
|
}
|
|
@@ -1624,7 +1586,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
|
|
|
1624
1586
|
if (!isFormulaFilterValue(filterValue)) {
|
|
1625
1587
|
return {
|
|
1626
1588
|
dbDataType: exports.EClickHouseBaseTypes.Bool,
|
|
1627
|
-
formula:
|
|
1589
|
+
formula: fillTemplateString(displayConditionTemplate, {
|
|
1628
1590
|
formula: prepareFormulaForSql(filterValue.formula),
|
|
1629
1591
|
}),
|
|
1630
1592
|
values: ["true"],
|
|
@@ -2224,7 +2186,6 @@ exports.durationTemplates = durationTemplates;
|
|
|
2224
2186
|
exports.escapeCurlyBracketLinkName = escapeCurlyBracketLinkName;
|
|
2225
2187
|
exports.escapeDoubleQuoteLinkName = escapeDoubleQuoteLinkName;
|
|
2226
2188
|
exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
|
|
2227
|
-
exports.fillTemplateSql = fillTemplateSql;
|
|
2228
2189
|
exports.fillTemplateString = fillTemplateString;
|
|
2229
2190
|
exports.formattingConfig = formattingConfig;
|
|
2230
2191
|
exports.formulaFilterMethods = formulaFilterMethods;
|