@infomaximum/widget-sdk 5.0.0-beta1 → 5.0.0-beta10

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/README.md CHANGED
@@ -11,6 +11,6 @@
11
11
  | Версия `widget-sdk` | Версия системы |
12
12
  | ------------------- | -------------- |
13
13
  | 3.x.x | 2401 - 2407 |
14
- | 4.x.x | 2408 - latest |
15
-
14
+ | 4.x.x | 2408 - 2410 |
15
+ | 5.x.x | 2411 - latest |
16
16
  ---
package/dist/index.d.ts CHANGED
@@ -383,9 +383,9 @@ interface IFormulaFilterValue {
383
383
  /** Метод фильтрации */
384
384
  filteringMethod: valueof<typeof formulaFilterMethods>;
385
385
  /** Выбранные в списке значения в виде моделей */
386
- checkedValues: (string | null)[];
386
+ checkedValues?: (string | null)[];
387
387
  /** Значения полей формы редактора */
388
- formValues: Partial<{
388
+ formValues?: Partial<{
389
389
  [EFormulaFilterFieldKeys.date]: string | null;
390
390
  [EFormulaFilterFieldKeys.dateRange]: [string, string];
391
391
  [EFormulaFilterFieldKeys.duration]: string;
@@ -416,7 +416,7 @@ interface IStagesFilterValue {
416
416
  /** Этапы */
417
417
  stages: IStagesFilterItem[];
418
418
  }
419
- type TWidgetFilterValue = IFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
419
+ type TWidgetFilterValue = TExtendedFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
420
420
  interface IWidgetFilter {
421
421
  /** Значение фильтра */
422
422
  filterValue: TWidgetFilterValue;
@@ -664,8 +664,6 @@ interface IBaseWidgetSettings {
664
664
  ignoreFilters?: boolean;
665
665
  sorting?: IWidgetSortingIndicator[];
666
666
  actions?: IWidgetAction[];
667
- displayCondition?: TDisplayCondition;
668
- displayConditionComment?: string;
669
667
  appearance?: TAppearanceSettings;
670
668
  }
671
669
 
@@ -727,17 +725,21 @@ interface IParameterFromEndEvent {
727
725
  interface IParameterFromManualInput {
728
726
  inputMethod: EWidgetActionInputMethod.MANUALLY;
729
727
  description: string;
728
+ defaultValue?: string;
729
+ filterByRows?: boolean;
730
730
  }
731
731
  interface IParameterFromStaticList {
732
732
  inputMethod: EWidgetActionInputMethod.STATIC_LIST;
733
- options: string[];
734
- defaultOptionIndex: number;
733
+ options: string;
734
+ defaultOptionIndexes: number[];
735
735
  }
736
736
  interface IParameterFromDynamicList {
737
737
  inputMethod: EWidgetActionInputMethod.DYNAMIC_LIST;
738
- formula: string;
738
+ options: string;
739
739
  defaultValue: string;
740
+ displayOptions: string;
740
741
  filters: TExtendedFormulaFilterValue[];
742
+ filterByRows?: boolean;
741
743
  }
742
744
  interface IWidgetActionParameterCommon {
743
745
  name: string;
@@ -799,7 +801,6 @@ type TActionOpenView = IActionCommon & {
799
801
  }>));
800
802
  type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
801
803
  interface IWidgetAction extends IActionCommon {
802
- filters: TExtendedFormulaFilterValue[];
803
804
  parameters: TWidgetActionParameter[];
804
805
  type: EActionTypes.EXECUTE_SCRIPT;
805
806
  scriptKey: string;
@@ -829,13 +830,19 @@ declare enum ESortDirection {
829
830
  }
830
831
  type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
831
832
  interface ISortOrder {
833
+ /** Формула сортировки */
832
834
  formula: string;
835
+ /** Тип данных формулы */
836
+ dbDataType: TNullable<string>;
837
+ /** Направление сортировки */
833
838
  direction: TSortDirection;
839
+ /** Условие применения сортировки */
834
840
  displayCondition?: TNullable<string>;
835
841
  }
836
842
  type TWidgetSortingValue = {
837
843
  mode: ESortingValueModes.FORMULA;
838
844
  formula: string;
845
+ dbDataType: string;
839
846
  } | {
840
847
  mode: ESortingValueModes.IN_WIDGET;
841
848
  group: string;
@@ -908,15 +915,15 @@ interface ICommonDimensions {
908
915
  }
909
916
  type TColumnIndicatorValue = {
910
917
  mode: EWidgetIndicatorValueModes.FORMULA;
911
- formula: string;
918
+ formula?: string;
912
919
  } | {
913
920
  mode: EWidgetIndicatorValueModes.TEMPLATE;
914
921
  /** Имя шаблонной формулы, использующей колонку таблицы */
915
- templateName: string;
922
+ templateName?: string;
916
923
  /** Имя таблицы */
917
- tableName: string;
924
+ tableName?: string;
918
925
  /** Имя колонки */
919
- columnName: string;
926
+ columnName?: string;
920
927
  };
921
928
  /** Общий интерфейс разреза и меры */
922
929
  interface IWidgetColumnIndicator extends IWidgetIndicator {
@@ -952,6 +959,8 @@ declare enum EIndicatorType {
952
959
  STATIC_LIST = "STATIC_LIST",
953
960
  /** Динамический список */
954
961
  DYNAMIC_LIST = "DYNAMIC_LIST",
962
+ /** Список колонок */
963
+ COLUMN_LIST = "COLUMN_LIST",
955
964
  /** Разрез */
956
965
  DIMENSION = "DIMENSION",
957
966
  /** Мера */
@@ -1012,7 +1021,15 @@ interface IWidgetDynamicListVariable extends IBaseWidgetVariable {
1012
1021
  /** Фильтры */
1013
1022
  filters: TExtendedFormulaFilterValue[];
1014
1023
  }
1015
- type TWidgetVariable = IWidgetStaticVariable | IWidgetStaticListVariable | IWidgetDynamicListVariable;
1024
+ interface IWidgetColumnListVariable extends IBaseWidgetVariable {
1025
+ /** Тип переменной */
1026
+ type: EIndicatorType.COLUMN_LIST;
1027
+ /** Имя таблицы */
1028
+ tableName: string;
1029
+ /** Значение (имя колонки) */
1030
+ value: string;
1031
+ }
1032
+ type TWidgetVariable = IWidgetStaticVariable | IWidgetStaticListVariable | IWidgetDynamicListVariable | IWidgetColumnListVariable;
1016
1033
  declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
1017
1034
 
1018
1035
  /** Формат входного параметра GeneralCalculator */
@@ -1033,13 +1050,10 @@ interface IBaseDimensionsAndMeasuresCalculatorInput {
1033
1050
  isHideEmptyMeasures?: boolean;
1034
1051
  /** Сортировка */
1035
1052
  sortOrders?: ISortOrder[];
1036
- /** Формула условия отображения */
1037
- displayConditionFormula?: TNullable<string>;
1038
1053
  }
1039
1054
  interface IBaseDimensionsAndMeasuresCalculatorOutput {
1040
1055
  dimensions: Map<string, ICalculatorDimensionOutput>;
1041
1056
  measures: Map<string, ICalculatorMeasureOutput>;
1042
- isDisplay: boolean;
1043
1057
  isValuesEmpty: boolean;
1044
1058
  }
1045
1059
  interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
@@ -1070,8 +1084,6 @@ interface IHistogramCalculatorInput {
1070
1084
  dimensions: ICalculatorDimensionInput[];
1071
1085
  /** Лимит корзин */
1072
1086
  binsLimit: number;
1073
- /** Формула условия отображения */
1074
- displayConditionFormula?: TNullable<string>;
1075
1087
  /** Фильтры, использующие WHERE */
1076
1088
  filters: ICalculatorFilter[];
1077
1089
  /** Имя таблицы */
@@ -1084,7 +1096,6 @@ interface IHistogramBin {
1084
1096
  }
1085
1097
  interface IHistogramCalculatorOutput {
1086
1098
  bins: IHistogramBin[];
1087
- isDisplay: boolean;
1088
1099
  dimensionAlias: string;
1089
1100
  }
1090
1101
  interface IHistogramCalculator extends ICalculator<IHistogramCalculatorInput, IHistogramCalculatorOutput> {
@@ -1121,7 +1132,6 @@ interface IProcessGraphCalculatorInput {
1121
1132
  edgeMeasures: ICalculatorMeasureInput[];
1122
1133
  filters: ICalculatorFilter[];
1123
1134
  eventFilters?: ICalculatorFilter[];
1124
- displayConditionFormula?: TNullable<string>;
1125
1135
  }
1126
1136
  interface IProcessGraphCalculatorOutput {
1127
1137
  vertexMaxLimit: number;
@@ -1134,7 +1144,6 @@ interface IProcessGraphCalculatorOutput {
1134
1144
  /** alias'ы мер, попавших под условие отображения */
1135
1145
  edgeMeasuresAliases: Set<string>;
1136
1146
  edges: IEdge[];
1137
- isDisplay: boolean;
1138
1147
  }
1139
1148
  interface IProcessGraphCalculator extends ICalculator<IProcessGraphCalculatorInput, IProcessGraphCalculatorOutput> {
1140
1149
  }
@@ -1156,8 +1165,6 @@ interface ITwoLimitsCalculatorInput {
1156
1165
  isHideEmptyMeasures?: boolean;
1157
1166
  /** Сортировка */
1158
1167
  sortOrders?: ISortOrder[];
1159
- /** Формула условия отображения */
1160
- displayConditionFormula?: TNullable<string>;
1161
1168
  /** Лимит строк */
1162
1169
  limit?: number;
1163
1170
  /** Второй лимит */
@@ -1172,7 +1179,6 @@ interface ITwoLimitsCalculatorExportInput extends ITwoLimitsCalculatorInput {
1172
1179
  interface ITwoLimitsCalculatorOutput {
1173
1180
  dimensions: Map<string, ICalculatorDimensionOutput>;
1174
1181
  measures: Map<string, ICalculatorMeasureOutput>;
1175
- isDisplay: boolean;
1176
1182
  isValuesEmpty: boolean;
1177
1183
  }
1178
1184
  interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, ITwoLimitsCalculatorOutput> {
@@ -1495,22 +1501,22 @@ interface ISelectBranchOption {
1495
1501
  icon?: string;
1496
1502
  disabled?: boolean;
1497
1503
  }
1498
- interface ISelectLeafOption {
1504
+ interface ISelectLeafOption<U extends object> {
1499
1505
  type: ESelectOptionTypes.LEAF;
1500
1506
  label: string;
1501
1507
  value: string;
1502
- onSelect: <T extends object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
1508
+ onSelect: (value: string, update: (f: (prevItems: U) => U) => void) => void;
1503
1509
  /** Строка в формате base64 */
1504
1510
  icon?: string;
1505
1511
  disabled?: boolean;
1506
1512
  }
1507
- type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption;
1513
+ type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption<object[]>;
1508
1514
  type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
1509
1515
  type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
1510
1516
  interface ICustomAddButtonProps {
1511
1517
  options: TSelectChildOptions;
1512
1518
  hasDropdown?: boolean;
1513
- onClick?: ISelectLeafOption["onSelect"];
1519
+ onClick?: ISelectLeafOption<object[]>["onSelect"];
1514
1520
  }
1515
1521
  interface IWidgetIndicatorAddButtonProps {
1516
1522
  hideTablesColumnsOptions?: boolean;
@@ -1567,7 +1573,7 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
1567
1573
  /** Конфигурация кнопок добавления группы в набор */
1568
1574
  addButtons: TAddButton[];
1569
1575
  /** Получить название, отображаемое на плашке (по умолчанию используется поле name из группы) */
1570
- getGroupTitle?(group: IGroupSettings): string;
1576
+ getGroupTitle?(group: IGroupSettings, index: number): string;
1571
1577
  /**
1572
1578
  * Получить описание показателя для группы, если группа описывает системный показатель.
1573
1579
  *
@@ -1578,9 +1584,9 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
1578
1584
  */
1579
1585
  getIndicatorData?: (settings: IInitialSettings) => EWidgetIndicatorType | TWidgetIndicatorData;
1580
1586
  /** Создать конфигурацию группы для вкладки настроек данных */
1581
- createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1587
+ createDataRecords?(group: IGroupSettings, index: number): TGroupLevelRecord<GroupSettings>[];
1582
1588
  /** Создать конфигурацию группы для вкладки настроек отображения */
1583
- createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
1589
+ createDisplayRecords?(group: IGroupSettings, index: number): TGroupLevelRecord<GroupSettings>[];
1584
1590
  /** Находится ли группа в состоянии загрузки (по умолчанию false) */
1585
1591
  isLoading?(group: IGroupSettings): boolean;
1586
1592
  /** Является ли группа валидной (по умолчанию true) */
@@ -1656,11 +1662,9 @@ declare enum ESystemRecordKey {
1656
1662
 
1657
1663
  interface IWidgetPlaceholderController {
1658
1664
  setError(value: Error | null): void;
1659
- setConfigured(value: boolean): void;
1660
1665
  /**
1661
- * Устанавливает состояние видимости виджета.
1666
+ * Сообщает о готовности виджета к отображению.
1662
1667
  *
1663
- * После вызова данного метода виджет станет доступен для отображения.
1664
1668
  * Это предотвращает мерцание при первом появлении виджета на экране.
1665
1669
  * Метод должен быть вызван после полной готовности виджета: все необходимые данные загружены, высота установлена.
1666
1670
  */
@@ -1670,21 +1674,57 @@ interface IWidgetPlaceholderController {
1670
1674
  }
1671
1675
  interface IWidgetPlaceholderValues {
1672
1676
  error: Error | null;
1673
- isConfigured: boolean;
1674
1677
  isDisplay: boolean | undefined;
1675
1678
  isEmpty: boolean;
1676
1679
  isOverlay: boolean;
1677
1680
  }
1678
1681
 
1679
- interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1682
+ interface IWidgetPresetSettings {
1683
+ appearance: TAppearanceSettings;
1684
+ filterMode: EWidgetFilterMode;
1685
+ ignoreFilters: boolean;
1686
+ stateName: string | null;
1687
+ titleColor: TColor;
1688
+ titleSize: number;
1689
+ titleWeight: EFontWeight;
1690
+ textSize: number;
1691
+ }
1692
+
1693
+ type TVersion = string;
1694
+ type TMigrationStruct = Record<string, any>;
1695
+ interface IWidgetStruct<Settings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1696
+ key: string;
1697
+ apiVersion: string;
1698
+ type: string;
1699
+ settings: Settings;
1700
+ localApiVersion?: string;
1701
+ }
1702
+ type TMigrateProcessor<T extends TMigrationStruct> = (struct: T) => void;
1703
+ interface ISettingsMigratorParams {
1704
+ versions: ReadonlyArray<TVersion>;
1705
+ defaultVersion?: TVersion;
1706
+ }
1707
+ interface IWidgetMigrator<T extends TMigrationStruct = IWidgetStruct> {
1708
+ registerProcessor(version: TVersion, processor: TMigrateProcessor<T>, type?: string, versionPath?: string): void;
1709
+ }
1710
+
1711
+ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings, MigrationStruct extends TMigrationStruct = IWidgetStruct> {
1680
1712
  /** иконка виджета отображаемая в системе (в base64, svg или png) */
1681
1713
  icon?: string;
1682
1714
  /** возвращает конфигурацию настроек для отображения */
1683
1715
  createPanelDescription: IPanelDescriptionCreator<WidgetSettings, GroupSettings>;
1684
1716
  /** заполняет настройки значениями по умолчанию */
1685
1717
  fillSettings: IFillSettings<WidgetSettings>;
1718
+ /** получить начальные настройки виджета, используя заданный пользователем шаблон настроек */
1719
+ getInitialSettings?: (settings: Partial<IWidgetPresetSettings>) => Partial<IBaseWidgetSettings>;
1686
1720
  /** возвращает ключи показателей(разрезов или мер), для которых должна работать системная сортировка */
1687
1721
  getSortableIndicatorsKeys?(): Readonly<StringKeyOf<WidgetSettings>[]>;
1722
+ /** Регистрация системных миграторов виджета */
1723
+ registerSystemMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
1724
+ /** Регистрация собственных миграторов виджета */
1725
+ registerLocalMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
1726
+ /** Возвращает массив версий локальных миграций виджета */
1727
+ getLocalMigrateVersions(): string[];
1688
1728
  }
1689
1729
 
1690
1730
  type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
@@ -1767,6 +1807,8 @@ type TLaunchActionParams = {
1767
1807
  filters: ICalculatorFilter[];
1768
1808
  /** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
1769
1809
  eventNames?: [string] | [string, string];
1810
+ /** Callback вызывается при успешном открытии модального окна подтверждения или при прерывании открытия */
1811
+ onConfirmationOpenSettled?: () => void;
1770
1812
  };
1771
1813
  type TWidgetContainer = {
1772
1814
  /** Имеет ли контейнер виджета ограниченную максимальную высоту */
@@ -1896,7 +1938,7 @@ interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
1896
1938
  unmount(container: HTMLElement): void;
1897
1939
  }
1898
1940
  interface IFillSettings<WidgetSettings extends IBaseWidgetSettings> {
1899
- (settings: Partial<WidgetSettings>, context: IGlobalContext): void;
1941
+ (settings: Partial<WidgetSettings>, context: IGlobalContext, prevSettings: Partial<WidgetSettings> | undefined): void;
1900
1942
  }
1901
1943
  interface IWidgetEntity<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1902
1944
  new (): IWidget<WidgetSettings>;
@@ -1967,4 +2009,4 @@ declare global {
1967
2009
  }
1968
2010
  }
1969
2011
 
1970
- export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TAppearanceSettings, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorData, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, colors, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
2012
+ export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TAppearanceSettings, type TBoundedContentWithIndicator, type TColor, type TColorBase, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorData, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, colors, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.esm.js CHANGED
@@ -646,6 +646,9 @@ var getFormulaFilterValues = function (filterValue) {
646
646
  if (checkedValues && checkedValues.length) {
647
647
  return checkedValues;
648
648
  }
649
+ if (!formValues) {
650
+ return [];
651
+ }
649
652
  function stringifyNumbersRange(range) {
650
653
  if (range === void 0) { range = [undefined, undefined]; }
651
654
  return range.map(function (value, index) {
@@ -680,7 +683,7 @@ var getFormulaFilterValues = function (filterValue) {
680
683
  }
681
684
  return compact([datePickerValue]);
682
685
  case EFormatTypes.STRING:
683
- return compact([(_a = formValues === null || formValues === void 0 ? void 0 : formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
686
+ return compact([(_a = formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
684
687
  case EFormatTypes.NUMBER:
685
688
  case EFormatTypes.YEAR:
686
689
  case EFormatTypes.DAY_OF_MONTH:
@@ -821,6 +824,8 @@ var EIndicatorType;
821
824
  EIndicatorType["STATIC_LIST"] = "STATIC_LIST";
822
825
  /** Динамический список */
823
826
  EIndicatorType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
827
+ /** Список колонок */
828
+ EIndicatorType["COLUMN_LIST"] = "COLUMN_LIST";
824
829
  /** Разрез */
825
830
  EIndicatorType["DIMENSION"] = "DIMENSION";
826
831
  /** Мера */
@@ -877,17 +882,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
877
882
  _a$3[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
878
883
  _a$3);
879
884
  function getDimensionFormula(_a) {
885
+ var _b;
880
886
  var value = _a.value;
881
887
  if (!value) {
882
888
  return "";
883
889
  }
884
890
  if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
885
- return value.formula;
891
+ return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
886
892
  }
887
893
  if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
888
894
  var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
889
895
  var templateFormula = dimensionTemplateFormulas[templateName];
890
- if (!templateFormula) {
896
+ if (!templateFormula || !tableName || !columnName) {
891
897
  return "";
892
898
  }
893
899
  return fillTemplateString(templateFormula, {
@@ -918,17 +924,18 @@ var measureTemplateFormulas = (_a$2 = {},
918
924
  _a$2[EMeasureTemplateNames.sum] = "sum({columnFormula})",
919
925
  _a$2);
920
926
  function getMeasureFormula(_a) {
927
+ var _b;
921
928
  var value = _a.value;
922
929
  if (!value) {
923
930
  return "";
924
931
  }
925
932
  if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
926
- return value.formula;
933
+ return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
927
934
  }
928
935
  if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
929
936
  var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
930
937
  var templateFormula = measureTemplateFormulas[templateName];
931
- if (!templateFormula) {
938
+ if (!templateFormula || !tableName || !columnName) {
932
939
  return "";
933
940
  }
934
941
  return fillTemplateString(templateFormula, {
@@ -1179,7 +1186,13 @@ var getDefaultSortOrders = function (_a) {
1179
1186
  ].includes(dimension.format);
1180
1187
  });
1181
1188
  if (timeDimension) {
1182
- return [{ formula: getDimensionFormula(timeDimension), direction: ESortDirection.ascend }];
1189
+ return [
1190
+ {
1191
+ formula: getDimensionFormula(timeDimension),
1192
+ dbDataType: timeDimension.dbDataType,
1193
+ direction: ESortDirection.ascend,
1194
+ },
1195
+ ];
1183
1196
  }
1184
1197
  if (measures.length > 0) {
1185
1198
  var firstMeasure = measures[0];
@@ -1188,6 +1201,7 @@ var getDefaultSortOrders = function (_a) {
1188
1201
  {
1189
1202
  direction: ESortDirection.descend,
1190
1203
  formula: getMeasureFormula(firstMeasure),
1204
+ dbDataType: firstMeasure.dbDataType,
1191
1205
  },
1192
1206
  ];
1193
1207
  }
@@ -1201,7 +1215,9 @@ function mapSortingToInputs(_a) {
1201
1215
  var _b;
1202
1216
  var direction = _a.direction, value = _a.value;
1203
1217
  if (value.mode === ESortingValueModes.FORMULA) {
1204
- return value.formula ? { formula: value.formula, direction: direction } : undefined;
1218
+ return value.formula
1219
+ ? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
1220
+ : undefined;
1205
1221
  }
1206
1222
  var indicatorsGroup = settings[value.group];
1207
1223
  var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
@@ -1219,6 +1235,7 @@ function mapSortingToInputs(_a) {
1219
1235
  return {
1220
1236
  formula: formula,
1221
1237
  direction: direction,
1238
+ dbDataType: activeDimensions.dbDataType,
1222
1239
  displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === EDisplayConditionMode.FORMULA
1223
1240
  ? indicator.displayCondition.formula
1224
1241
  : undefined,
@@ -1227,6 +1244,7 @@ function mapSortingToInputs(_a) {
1227
1244
  return {
1228
1245
  formula: getMeasureFormula(indicator),
1229
1246
  direction: direction,
1247
+ dbDataType: indicator.dbDataType,
1230
1248
  };
1231
1249
  });
1232
1250
  return sortOrder;
package/dist/index.js CHANGED
@@ -647,6 +647,9 @@ var getFormulaFilterValues = function (filterValue) {
647
647
  if (checkedValues && checkedValues.length) {
648
648
  return checkedValues;
649
649
  }
650
+ if (!formValues) {
651
+ return [];
652
+ }
650
653
  function stringifyNumbersRange(range) {
651
654
  if (range === void 0) { range = [undefined, undefined]; }
652
655
  return range.map(function (value, index) {
@@ -681,7 +684,7 @@ var getFormulaFilterValues = function (filterValue) {
681
684
  }
682
685
  return compact([datePickerValue]);
683
686
  case exports.EFormatTypes.STRING:
684
- return compact([(_a = formValues === null || formValues === void 0 ? void 0 : formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
687
+ return compact([(_a = formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
685
688
  case exports.EFormatTypes.NUMBER:
686
689
  case exports.EFormatTypes.YEAR:
687
690
  case exports.EFormatTypes.DAY_OF_MONTH:
@@ -822,6 +825,8 @@ exports.EIndicatorType = void 0;
822
825
  EIndicatorType["STATIC_LIST"] = "STATIC_LIST";
823
826
  /** Динамический список */
824
827
  EIndicatorType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
828
+ /** Список колонок */
829
+ EIndicatorType["COLUMN_LIST"] = "COLUMN_LIST";
825
830
  /** Разрез */
826
831
  EIndicatorType["DIMENSION"] = "DIMENSION";
827
832
  /** Мера */
@@ -878,17 +883,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
878
883
  _a$3[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
879
884
  _a$3);
880
885
  function getDimensionFormula(_a) {
886
+ var _b;
881
887
  var value = _a.value;
882
888
  if (!value) {
883
889
  return "";
884
890
  }
885
891
  if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
886
- return value.formula;
892
+ return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
887
893
  }
888
894
  if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
889
895
  var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
890
896
  var templateFormula = dimensionTemplateFormulas[templateName];
891
- if (!templateFormula) {
897
+ if (!templateFormula || !tableName || !columnName) {
892
898
  return "";
893
899
  }
894
900
  return fillTemplateString(templateFormula, {
@@ -919,17 +925,18 @@ var measureTemplateFormulas = (_a$2 = {},
919
925
  _a$2[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
920
926
  _a$2);
921
927
  function getMeasureFormula(_a) {
928
+ var _b;
922
929
  var value = _a.value;
923
930
  if (!value) {
924
931
  return "";
925
932
  }
926
933
  if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
927
- return value.formula;
934
+ return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
928
935
  }
929
936
  if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
930
937
  var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
931
938
  var templateFormula = measureTemplateFormulas[templateName];
932
- if (!templateFormula) {
939
+ if (!templateFormula || !tableName || !columnName) {
933
940
  return "";
934
941
  }
935
942
  return fillTemplateString(templateFormula, {
@@ -1180,7 +1187,13 @@ var getDefaultSortOrders = function (_a) {
1180
1187
  ].includes(dimension.format);
1181
1188
  });
1182
1189
  if (timeDimension) {
1183
- return [{ formula: getDimensionFormula(timeDimension), direction: exports.ESortDirection.ascend }];
1190
+ return [
1191
+ {
1192
+ formula: getDimensionFormula(timeDimension),
1193
+ dbDataType: timeDimension.dbDataType,
1194
+ direction: exports.ESortDirection.ascend,
1195
+ },
1196
+ ];
1184
1197
  }
1185
1198
  if (measures.length > 0) {
1186
1199
  var firstMeasure = measures[0];
@@ -1189,6 +1202,7 @@ var getDefaultSortOrders = function (_a) {
1189
1202
  {
1190
1203
  direction: exports.ESortDirection.descend,
1191
1204
  formula: getMeasureFormula(firstMeasure),
1205
+ dbDataType: firstMeasure.dbDataType,
1192
1206
  },
1193
1207
  ];
1194
1208
  }
@@ -1202,7 +1216,9 @@ function mapSortingToInputs(_a) {
1202
1216
  var _b;
1203
1217
  var direction = _a.direction, value = _a.value;
1204
1218
  if (value.mode === exports.ESortingValueModes.FORMULA) {
1205
- return value.formula ? { formula: value.formula, direction: direction } : undefined;
1219
+ return value.formula
1220
+ ? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
1221
+ : undefined;
1206
1222
  }
1207
1223
  var indicatorsGroup = settings[value.group];
1208
1224
  var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
@@ -1220,6 +1236,7 @@ function mapSortingToInputs(_a) {
1220
1236
  return {
1221
1237
  formula: formula,
1222
1238
  direction: direction,
1239
+ dbDataType: activeDimensions.dbDataType,
1223
1240
  displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
1224
1241
  ? indicator.displayCondition.formula
1225
1242
  : undefined,
@@ -1228,6 +1245,7 @@ function mapSortingToInputs(_a) {
1228
1245
  return {
1229
1246
  formula: getMeasureFormula(indicator),
1230
1247
  direction: direction,
1248
+ dbDataType: indicator.dbDataType,
1231
1249
  };
1232
1250
  });
1233
1251
  return sortOrder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "5.0.0-beta1",
3
+ "version": "5.0.0-beta10",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -9,6 +9,7 @@
9
9
  "dist/",
10
10
  "LICENSE"
11
11
  ],
12
+ "sideEffects": false,
12
13
  "scripts": {
13
14
  "build": "rollup -c",
14
15
  "lint": "tsc --noEmit",