@infomaximum/widget-sdk 6.0.0-view-theme.1 → 6.0.0-view-theme.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,40 +2,85 @@
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.3](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-view-theme.2...v6.0.0-view-theme.3) (2025-10-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * добавлен disabled для Control используемых в панели отображения [BI-15509] ([6c58001](https://github.com/Infomaximum/widget-sdk/commit/6c58001f88648b48f81dd86480cc1ec25022493b))
11
+ * добавлена поддержка cleanupThemeProperties для кастомных виджетов [BI-15499] ([879c956](https://github.com/Infomaximum/widget-sdk/commit/879c956c9893b0379968eadd420912ccac8405fd))
12
+ * флаг useTheme перенесен в конфиг виджета [BI-15072] ([5d9c187](https://github.com/Infomaximum/widget-sdk/commit/5d9c187af2b1ebe39b66bbd5853c6112b603e6c7))
13
+
14
+ ## [6.0.0-view-theme.2](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-15...v6.0.0-view-theme.2) (2025-10-02)
15
+
16
+ ## [6.0.0-view-theme.1](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-14...v6.0.0-view-theme.1) (2025-10-01)
17
+
18
+ ## [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)
19
+
20
+
21
+ ### Features
22
+
23
+ * поддержен флаг для темы [BI-15496] ([5196fa6](https://github.com/Infomaximum/widget-sdk/commit/5196fa6c69a521c4529a355e674bcb1f8c1aac39))
24
+
5
25
  ## [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
26
 
7
- ## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.3...v6.0.0-13) (2025-10-01)
27
+ ## [6.0.0-15](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-14...v6.0.0-15) (2025-10-02)
8
28
 
29
+ ## [6.0.0-14](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.4...v6.0.0-14) (2025-10-01)
30
+
31
+ ## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.3...v6.0.0-13) (2025-10-01)
9
32
 
10
33
  ### Bug Fixes
11
34
 
12
- * исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
35
+ - исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
13
36
 
14
37
  ## [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)
15
38
 
16
39
  ## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
17
40
 
18
-
19
41
  ### Features
20
42
 
21
- * поддержен флаг для темы [BI-15496] ([5196fa6](https://github.com/Infomaximum/widget-sdk/commit/5196fa6c69a521c4529a355e674bcb1f8c1aac39))
43
+ - поддержен флаг для темы [BI-15496] ([5196fa6](https://github.com/Infomaximum/widget-sdk/commit/5196fa6c69a521c4529a355e674bcb1f8c1aac39))
22
44
 
23
45
  ## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.2...v6.0.0-11) (2025-09-23)
24
46
 
25
-
26
47
  ### Features
27
48
 
28
- * для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
29
- * удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
49
+ - для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
50
+ - удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
30
51
 
31
52
  ## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
32
53
 
33
54
  ## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
34
55
 
56
+ ### Bug Fixes
57
+
58
+ - исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
59
+
60
+ ## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
61
+
62
+ ## [6.0.0-13](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-12...v6.0.0-13) (2025-10-01)
63
+
64
+ ### Bug Fixes
65
+
66
+ - исправлены шаблоны формул и функции подготовки параметров наполнения шаблонов. Отказ от удаления однострочных и многострочных комментариев ([97332be](https://github.com/Infomaximum/widget-sdk/commit/97332be7bddd6942f3670ff806470b9c1a59c122))
67
+
68
+ ## [6.0.0-12](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-11...v6.0.0-12) (2025-09-29)
69
+
70
+ ## [6.0.0-11](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.2...v6.0.0-11) (2025-09-23)
71
+
72
+ ### Features
73
+
74
+ - для параметров действий образа добавлен id ([4b92d35](https://github.com/Infomaximum/widget-sdk/commit/4b92d3547a6048b8326db94ec360515d99e17b1a))
75
+ - удален флаг isBordered для IInputControl [BI-15461] ([d60c32d](https://github.com/Infomaximum/widget-sdk/commit/d60c32d02134c10b1aa799dc5a45e2656fe5aefd))
76
+
77
+ ## [6.0.0-10](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.1...v6.0.0-10) (2025-09-12)
78
+
79
+ ## [6.0.0-9](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-8...v6.0.0-9) (2025-09-12)
35
80
 
36
81
  ### Bug Fixes
37
82
 
38
- * исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
83
+ - исправлен баг с подстановкой значений в template строки ([12166b5](https://github.com/Infomaximum/widget-sdk/commit/12166b587b74e0ff912822b0d065463b8f23121e))
39
84
 
40
85
  ## [6.0.0-8](https://github.com/Infomaximum/widget-sdk/compare/v6.0.0-2508.0...v6.0.0-8) (2025-09-11)
41
86
 
package/dist/index.d.ts CHANGED
@@ -1424,6 +1424,7 @@ interface ISwitchControl {
1424
1424
  value: boolean;
1425
1425
  props: {
1426
1426
  size?: "small" | "default";
1427
+ disabled?: boolean;
1427
1428
  };
1428
1429
  }
1429
1430
  interface ISelectControl {
@@ -1565,6 +1566,7 @@ interface IColorPickerControl {
1565
1566
  /** Цвет по умолчанию для режима BASE при переключении с другого режима */
1566
1567
  defaultColor?: string;
1567
1568
  dimension?: IWidgetDimension;
1569
+ disabled?: boolean;
1568
1570
  };
1569
1571
  }
1570
1572
  interface ITagSetControl {
@@ -2089,6 +2091,8 @@ declare const countExecutionsTemplate = "process(countIf({eventNameFormula} in {
2089
2091
 
2090
2092
  /** @deprecated - следует использовать fillTemplateSql */
2091
2093
  declare function fillTemplateString(templateString: string, params: Record<string, any>): string;
2094
+ /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
2095
+ declare function fillTemplateSql(templateString: string, params: Record<string, string>): string;
2092
2096
 
2093
2097
  declare function generateColumnFormula(tableName: string, columnName: string): string;
2094
2098
 
@@ -2325,8 +2329,6 @@ interface IPanelDescription<Settings extends object, GroupSettings extends IGrou
2325
2329
  useTitle?: boolean;
2326
2330
  /** Добавить поле настройки описания */
2327
2331
  useMarkdown?: boolean;
2328
- /** Добавить переключатель темы */
2329
- useTheme?: boolean;
2330
2332
  /** Конфигурация вкладки настроек данных */
2331
2333
  dataRecords?: TWidgetLevelRecord<Settings>[];
2332
2334
  /** Конфигурация вкладки настроек отображения */
@@ -2430,6 +2432,8 @@ interface IWidgetMigrator<T extends TMigrationStruct = IWidgetStruct> {
2430
2432
  interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings, MigrationStruct extends TMigrationStruct = IWidgetStruct> {
2431
2433
  /** иконка виджета отображаемая в системе (в base64, svg или png) */
2432
2434
  icon?: string;
2435
+ /** метод удаляет настройки, наследуемые от темы и возвращает функцию отката, которая возвращает удаленные настройки */
2436
+ cleanupThemeProperties?: (settings: WidgetSettings) => (settings: WidgetSettings) => void;
2433
2437
  /** возвращает конфигурацию настроек для отображения */
2434
2438
  createPanelDescription: IPanelDescriptionCreator<WidgetSettings, GroupSettings>;
2435
2439
  /** заполняет настройки значениями по умолчанию */
@@ -2634,6 +2638,8 @@ interface IWidgetManifest {
2634
2638
  show_title?: boolean;
2635
2639
  /** Отображать ли markdown "описание" виджета (по умолчанию false) */
2636
2640
  show_markdown?: boolean;
2641
+ /** Отображать ли переключатель темы виджета (по умолчанию false) */
2642
+ use_theme?: boolean;
2637
2643
  };
2638
2644
  }
2639
2645
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
@@ -2753,4 +2759,4 @@ declare global {
2753
2759
  }
2754
2760
  }
2755
2761
 
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 };
2762
+ 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
@@ -132,6 +132,35 @@ 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
+
135
164
  function __makeTemplateObject(cooked, raw) {
136
165
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
137
166
  return cooked;
@@ -797,6 +826,32 @@ function fillTemplateString(templateString, params) {
797
826
  return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
798
827
  });
799
828
  }
829
+ /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
830
+ function fillTemplateSql(templateString, params) {
831
+ var e_1, _a;
832
+ var newParams = {};
833
+ if (templateString.indexOf("'{") >= 0) {
834
+ throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D: \u043F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440\u044B \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u044B \u0437\u0430\u043A\u043B\u044E\u0447\u0430\u0442\u044C\u0441\u044F \u0432 \u043E\u0434\u0438\u043D\u0430\u0440\u043D\u044B\u0435 \u043A\u0430\u0432\u044B\u0447\u043A\u0438.\n \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 {placeholder} \u0432\u043C\u0435\u0441\u0442\u043E '{placeholder}'.\n \u041A\u0430\u0432\u044B\u0447\u043A\u0438 \u0434\u043E\u043B\u0436\u043D\u044B \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0434\u043B\u044F \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u043F\u043E\u043B\u0435\u0439 \u043F\u0440\u0438 \u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.");
835
+ }
836
+ try {
837
+ for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
838
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
839
+ if (String(value).indexOf("--") >= 0) {
840
+ newParams[key] = "".concat(value, "\n");
841
+ continue;
842
+ }
843
+ newParams[key] = sanitizeSingleLineComment(String(value));
844
+ }
845
+ }
846
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
847
+ finally {
848
+ try {
849
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
850
+ }
851
+ finally { if (e_1) throw e_1.error; }
852
+ }
853
+ return fillTemplateString(templateString, newParams);
854
+ }
800
855
 
801
856
  /** Создать функцию экранирования переданных `specialChars` внутри `str` */
802
857
  var createEscaper = function (specialChars) { return function (str) {
@@ -1023,7 +1078,7 @@ var timeTemplates = (function () {
1023
1078
  var generateTemplates = function (innerTemplate) {
1024
1079
  var templates = {};
1025
1080
  for (var key in dimensionTemplateFormulas) {
1026
- templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
1081
+ templates[key] = fillTemplateSql(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
1027
1082
  }
1028
1083
  return templates;
1029
1084
  };
@@ -1066,7 +1121,7 @@ function getDimensionFormula(_a) {
1066
1121
  if (!templateFormula || !tableName || !columnName) {
1067
1122
  return "";
1068
1123
  }
1069
- return fillTemplateString(templateFormula, {
1124
+ return fillTemplateSql(templateFormula, {
1070
1125
  columnFormula: generateColumnFormula(tableName, columnName),
1071
1126
  });
1072
1127
  }
@@ -1082,10 +1137,10 @@ function getProcessDimensionValueFormula(value) {
1082
1137
  ? dimensionTemplateFormulas[value.innerTemplateName]
1083
1138
  : null;
1084
1139
  var columnFormula = innerTemplate
1085
- ? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
1140
+ ? fillTemplateSql(innerTemplate, { columnFormula: preparedParams.columnFormula })
1086
1141
  : preparedParams.columnFormula;
1087
1142
  var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
1088
- return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
1143
+ return fillTemplateSql(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
1089
1144
  }
1090
1145
  if (value.mode === EWidgetIndicatorValueModes.START_TIME ||
1091
1146
  value.mode === EWidgetIndicatorValueModes.END_TIME) {
@@ -1094,7 +1149,7 @@ function getProcessDimensionValueFormula(value) {
1094
1149
  return "";
1095
1150
  }
1096
1151
  var templateFormula = timeTemplates[value.mode][value.templateName];
1097
- return fillTemplateString(templateFormula, preparedParams);
1152
+ return fillTemplateSql(templateFormula, preparedParams);
1098
1153
  }
1099
1154
  }
1100
1155
 
@@ -1316,14 +1371,14 @@ function getMeasureFormula(_a) {
1316
1371
  if (!templateFormula || !tableName || !columnName) {
1317
1372
  return "";
1318
1373
  }
1319
- return fillTemplateString(templateFormula, {
1374
+ return fillTemplateSql(templateFormula, {
1320
1375
  columnFormula: generateColumnFormula(tableName, columnName),
1321
1376
  });
1322
1377
  }
1323
1378
  if (value.mode === EWidgetIndicatorValueModes.AGGREGATION) {
1324
1379
  var preparedParams = prepareMeasureAggregationParams(value);
1325
1380
  return preparedParams
1326
- ? fillTemplateString(createAggregationTemplate(value.templateName, {
1381
+ ? fillTemplateSql(createAggregationTemplate(value.templateName, {
1327
1382
  outerAggregation: preparedParams.outerAggregation,
1328
1383
  anyEvent: value.anyEvent,
1329
1384
  }), preparedParams)
@@ -1334,14 +1389,14 @@ function getMeasureFormula(_a) {
1334
1389
  if (!preparedParams) {
1335
1390
  return "";
1336
1391
  }
1337
- return fillTemplateString(conversionTemplate, preparedParams);
1392
+ return fillTemplateSql(conversionTemplate, preparedParams);
1338
1393
  }
1339
1394
  if (value.mode === EWidgetIndicatorValueModes.DURATION) {
1340
1395
  var preparedParams = prepareDurationParams(value);
1341
1396
  if (!preparedParams) {
1342
1397
  return "";
1343
1398
  }
1344
- return fillTemplateString(durationTemplates[value.templateName], preparedParams);
1399
+ return fillTemplateSql(durationTemplates[value.templateName], preparedParams);
1345
1400
  }
1346
1401
  return "";
1347
1402
  }
@@ -1367,7 +1422,7 @@ function getEventMeasureFormula(_a, process) {
1367
1422
  }
1368
1423
  if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
1369
1424
  var templateFormula = eventMeasureTemplateFormulas[value.templateName];
1370
- return templateFormula && fillTemplateString(templateFormula, process);
1425
+ return templateFormula && fillTemplateSql(templateFormula, process);
1371
1426
  }
1372
1427
  return "";
1373
1428
  }
@@ -1393,7 +1448,7 @@ function getTransitionMeasureFormula(_a, process) {
1393
1448
  }
1394
1449
  if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
1395
1450
  var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
1396
- return templateFormula && fillTemplateString(templateFormula, process);
1451
+ return templateFormula && fillTemplateSql(templateFormula, process);
1397
1452
  }
1398
1453
  return "";
1399
1454
  }
@@ -1585,7 +1640,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
1585
1640
  if (!isFormulaFilterValue(filterValue)) {
1586
1641
  return {
1587
1642
  dbDataType: EClickHouseBaseTypes.Bool,
1588
- formula: fillTemplateString(displayConditionTemplate, {
1643
+ formula: fillTemplateSql(displayConditionTemplate, {
1589
1644
  formula: prepareFormulaForSql(filterValue.formula),
1590
1645
  }),
1591
1646
  values: ["true"],
@@ -2154,4 +2209,4 @@ var getColorByIndex = function (index) {
2154
2209
  return color;
2155
2210
  };
2156
2211
 
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 };
2212
+ export { EActionButtonsTypes, EActionTypes, EActivateConditionMode, EAutoUpdateMode, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDataModelOption, EDimensionAggregationTemplateName, EDimensionProcessFilterTimeUnit, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationTemplateName, EDurationUnit, EEventAppearances, EEventMeasureTemplateNames, EFontWeight, EFormatOrFormattingMode, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureAggregationTemplateName, EMeasureTemplateNames, EOuterAggregation, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, OuterAggregation, applyIndexToArrayFormula, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, clearMultiLineComments, clearSingleLineComments, colors, conversionTemplate, convertFiltersToFormula, convertToFormulasChain, countExecutionsTemplate, createEscaper, createAggregationTemplate as createMeasureAggregationTemplate, curlyBracketsContentPattern, dashboardLinkRegExp, dimensionAggregationTemplates, dimensionTemplateFormulas, displayConditionTemplate, doubleQuoteContentPattern, durationTemplates, escapeCurlyBracketLinkName, escapeDoubleQuoteLinkName, eventMeasureTemplateFormulas, fillTemplateSql, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getProcessDimensionValueFormula, getRuleColor, getTransitionMeasureFormula, isDimensionProcessFilter, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSettingsFiltersToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareConversionParams, prepareDimensionAggregationParams, prepareDurationParams, prepareFormulaForSql, prepareMeasureAggregationParams, prepareSortOrders, prepareTimeParams, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, timeTemplates, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.js CHANGED
@@ -133,6 +133,35 @@ 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
+
136
165
  function __makeTemplateObject(cooked, raw) {
137
166
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
138
167
  return cooked;
@@ -798,6 +827,32 @@ function fillTemplateString(templateString, params) {
798
827
  return (_a = params[key]) !== null && _a !== void 0 ? _a : "";
799
828
  });
800
829
  }
830
+ /** Функция для безопасного заполнения SQL шаблонов с защитой от однострочных SQL комментариев в подставляемых значениях. */
831
+ function fillTemplateSql(templateString, params) {
832
+ var e_1, _a;
833
+ var newParams = {};
834
+ if (templateString.indexOf("'{") >= 0) {
835
+ throw new Error("\u041D\u0435\u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u044B\u0439 \u0448\u0430\u0431\u043B\u043E\u043D: \u043F\u043B\u0435\u0439\u0441\u0445\u043E\u043B\u0434\u0435\u0440\u044B \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u044B \u0437\u0430\u043A\u043B\u044E\u0447\u0430\u0442\u044C\u0441\u044F \u0432 \u043E\u0434\u0438\u043D\u0430\u0440\u043D\u044B\u0435 \u043A\u0430\u0432\u044B\u0447\u043A\u0438.\n \u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 {placeholder} \u0432\u043C\u0435\u0441\u0442\u043E '{placeholder}'.\n \u041A\u0430\u0432\u044B\u0447\u043A\u0438 \u0434\u043E\u043B\u0436\u043D\u044B \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0442\u044C\u0441\u044F \u0434\u043B\u044F \u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u0445 \u043F\u043E\u043B\u0435\u0439 \u043F\u0440\u0438 \u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438 \u043E\u0431\u044A\u0435\u043A\u0442\u0430 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.");
836
+ }
837
+ try {
838
+ for (var _b = __values(Object.entries(params)), _c = _b.next(); !_c.done; _c = _b.next()) {
839
+ var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
840
+ if (String(value).indexOf("--") >= 0) {
841
+ newParams[key] = "".concat(value, "\n");
842
+ continue;
843
+ }
844
+ newParams[key] = sanitizeSingleLineComment(String(value));
845
+ }
846
+ }
847
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
848
+ finally {
849
+ try {
850
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
851
+ }
852
+ finally { if (e_1) throw e_1.error; }
853
+ }
854
+ return fillTemplateString(templateString, newParams);
855
+ }
801
856
 
802
857
  /** Создать функцию экранирования переданных `specialChars` внутри `str` */
803
858
  var createEscaper = function (specialChars) { return function (str) {
@@ -1024,7 +1079,7 @@ var timeTemplates = (function () {
1024
1079
  var generateTemplates = function (innerTemplate) {
1025
1080
  var templates = {};
1026
1081
  for (var key in dimensionTemplateFormulas) {
1027
- templates[key] = fillTemplateString(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
1082
+ templates[key] = fillTemplateSql(dimensionTemplateFormulas[key], { columnFormula: innerTemplate });
1028
1083
  }
1029
1084
  return templates;
1030
1085
  };
@@ -1067,7 +1122,7 @@ function getDimensionFormula(_a) {
1067
1122
  if (!templateFormula || !tableName || !columnName) {
1068
1123
  return "";
1069
1124
  }
1070
- return fillTemplateString(templateFormula, {
1125
+ return fillTemplateSql(templateFormula, {
1071
1126
  columnFormula: generateColumnFormula(tableName, columnName),
1072
1127
  });
1073
1128
  }
@@ -1083,10 +1138,10 @@ function getProcessDimensionValueFormula(value) {
1083
1138
  ? dimensionTemplateFormulas[value.innerTemplateName]
1084
1139
  : null;
1085
1140
  var columnFormula = innerTemplate
1086
- ? fillTemplateString(innerTemplate, { columnFormula: preparedParams.columnFormula })
1141
+ ? fillTemplateSql(innerTemplate, { columnFormula: preparedParams.columnFormula })
1087
1142
  : preparedParams.columnFormula;
1088
1143
  var dimensionAggregationTemplate = dimensionAggregationTemplates[value.templateName];
1089
- return fillTemplateString(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
1144
+ return fillTemplateSql(dimensionAggregationTemplate, __assign(__assign({}, preparedParams), { columnFormula: columnFormula }));
1090
1145
  }
1091
1146
  if (value.mode === exports.EWidgetIndicatorValueModes.START_TIME ||
1092
1147
  value.mode === exports.EWidgetIndicatorValueModes.END_TIME) {
@@ -1095,7 +1150,7 @@ function getProcessDimensionValueFormula(value) {
1095
1150
  return "";
1096
1151
  }
1097
1152
  var templateFormula = timeTemplates[value.mode][value.templateName];
1098
- return fillTemplateString(templateFormula, preparedParams);
1153
+ return fillTemplateSql(templateFormula, preparedParams);
1099
1154
  }
1100
1155
  }
1101
1156
 
@@ -1317,14 +1372,14 @@ function getMeasureFormula(_a) {
1317
1372
  if (!templateFormula || !tableName || !columnName) {
1318
1373
  return "";
1319
1374
  }
1320
- return fillTemplateString(templateFormula, {
1375
+ return fillTemplateSql(templateFormula, {
1321
1376
  columnFormula: generateColumnFormula(tableName, columnName),
1322
1377
  });
1323
1378
  }
1324
1379
  if (value.mode === exports.EWidgetIndicatorValueModes.AGGREGATION) {
1325
1380
  var preparedParams = prepareMeasureAggregationParams(value);
1326
1381
  return preparedParams
1327
- ? fillTemplateString(createAggregationTemplate(value.templateName, {
1382
+ ? fillTemplateSql(createAggregationTemplate(value.templateName, {
1328
1383
  outerAggregation: preparedParams.outerAggregation,
1329
1384
  anyEvent: value.anyEvent,
1330
1385
  }), preparedParams)
@@ -1335,14 +1390,14 @@ function getMeasureFormula(_a) {
1335
1390
  if (!preparedParams) {
1336
1391
  return "";
1337
1392
  }
1338
- return fillTemplateString(conversionTemplate, preparedParams);
1393
+ return fillTemplateSql(conversionTemplate, preparedParams);
1339
1394
  }
1340
1395
  if (value.mode === exports.EWidgetIndicatorValueModes.DURATION) {
1341
1396
  var preparedParams = prepareDurationParams(value);
1342
1397
  if (!preparedParams) {
1343
1398
  return "";
1344
1399
  }
1345
- return fillTemplateString(durationTemplates[value.templateName], preparedParams);
1400
+ return fillTemplateSql(durationTemplates[value.templateName], preparedParams);
1346
1401
  }
1347
1402
  return "";
1348
1403
  }
@@ -1368,7 +1423,7 @@ function getEventMeasureFormula(_a, process) {
1368
1423
  }
1369
1424
  if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
1370
1425
  var templateFormula = eventMeasureTemplateFormulas[value.templateName];
1371
- return templateFormula && fillTemplateString(templateFormula, process);
1426
+ return templateFormula && fillTemplateSql(templateFormula, process);
1372
1427
  }
1373
1428
  return "";
1374
1429
  }
@@ -1394,7 +1449,7 @@ function getTransitionMeasureFormula(_a, process) {
1394
1449
  }
1395
1450
  if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
1396
1451
  var templateFormula = transitionMeasureTemplateFormulas[value.templateName];
1397
- return templateFormula && fillTemplateString(templateFormula, process);
1452
+ return templateFormula && fillTemplateSql(templateFormula, process);
1398
1453
  }
1399
1454
  return "";
1400
1455
  }
@@ -1586,7 +1641,7 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
1586
1641
  if (!isFormulaFilterValue(filterValue)) {
1587
1642
  return {
1588
1643
  dbDataType: exports.EClickHouseBaseTypes.Bool,
1589
- formula: fillTemplateString(displayConditionTemplate, {
1644
+ formula: fillTemplateSql(displayConditionTemplate, {
1590
1645
  formula: prepareFormulaForSql(filterValue.formula),
1591
1646
  }),
1592
1647
  values: ["true"],
@@ -2186,6 +2241,7 @@ exports.durationTemplates = durationTemplates;
2186
2241
  exports.escapeCurlyBracketLinkName = escapeCurlyBracketLinkName;
2187
2242
  exports.escapeDoubleQuoteLinkName = escapeDoubleQuoteLinkName;
2188
2243
  exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
2244
+ exports.fillTemplateSql = fillTemplateSql;
2189
2245
  exports.fillTemplateString = fillTemplateString;
2190
2246
  exports.formattingConfig = formattingConfig;
2191
2247
  exports.formulaFilterMethods = formulaFilterMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "6.0.0-view-theme.1",
3
+ "version": "6.0.0-view-theme.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",