@infomaximum/widget-sdk 4.10.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -394,9 +394,9 @@ interface IFormulaFilterValue {
394
394
  /** Метод фильтрации */
395
395
  filteringMethod: valueof<typeof formulaFilterMethods>;
396
396
  /** Выбранные в списке значения в виде моделей */
397
- checkedValues: (string | null)[];
397
+ checkedValues?: (string | null)[];
398
398
  /** Значения полей формы редактора */
399
- formValues: Partial<{
399
+ formValues?: Partial<{
400
400
  [EFormulaFilterFieldKeys.date]: string | null;
401
401
  [EFormulaFilterFieldKeys.dateRange]: [string, string];
402
402
  [EFormulaFilterFieldKeys.duration]: string;
@@ -813,7 +813,6 @@ type TActionOpenView = IActionCommon & {
813
813
  }>));
814
814
  type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
815
815
  interface IWidgetAction extends IActionCommon {
816
- filters: TExtendedFormulaFilterValue[];
817
816
  parameters: TWidgetActionParameter[];
818
817
  type: EActionTypes.EXECUTE_SCRIPT;
819
818
  scriptKey: string;
@@ -1709,7 +1708,25 @@ interface IWidgetPlaceholderValues {
1709
1708
  isOverlay: boolean;
1710
1709
  }
1711
1710
 
1712
- interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1711
+ type TVersion = string;
1712
+ type TMigrationStruct = Record<string, any>;
1713
+ interface IWidgetStruct<Settings extends IBaseWidgetSettings = IBaseWidgetSettings> {
1714
+ key: string;
1715
+ apiVersion: string;
1716
+ type: string;
1717
+ settings: Settings;
1718
+ localApiVersion?: string;
1719
+ }
1720
+ type TMigrateProcessor<T extends TMigrationStruct> = (struct: T) => void;
1721
+ interface ISettingsMigratorParams {
1722
+ versions: ReadonlyArray<TVersion>;
1723
+ defaultVersion?: TVersion;
1724
+ }
1725
+ interface IWidgetMigrator<T extends TMigrationStruct = IWidgetStruct> {
1726
+ registerProcessor(version: TVersion, processor: TMigrateProcessor<T>, type?: string, versionPath?: string): void;
1727
+ }
1728
+
1729
+ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings, MigrationStruct extends TMigrationStruct = IWidgetStruct> {
1713
1730
  /** иконка виджета отображаемая в системе (в base64, svg или png) */
1714
1731
  icon?: string;
1715
1732
  /** возвращает конфигурацию настроек для отображения */
@@ -1718,6 +1735,12 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
1718
1735
  fillSettings: IFillSettings<WidgetSettings>;
1719
1736
  /** возвращает ключи показателей(разрезов или мер), для которых должна работать системная сортировка */
1720
1737
  getSortableIndicatorsKeys?(): Readonly<StringKeyOf<WidgetSettings>[]>;
1738
+ /** Регистрация системных миграторов виджета */
1739
+ registerSystemMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
1740
+ /** Регистрация собственных миграторов виджета */
1741
+ registerLocalMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
1742
+ /** Возвращает массив версий локальных миграций виджета */
1743
+ getLocalMigrateVersions(): string[];
1721
1744
  }
1722
1745
 
1723
1746
  type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
@@ -1978,4 +2001,4 @@ declare global {
1978
2001
  }
1979
2002
  }
1980
2003
 
1981
- export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, 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 IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, 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 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 TSystemVariable, 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, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
2004
+ export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, 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 IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, 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 IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, 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 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 TSystemVariable, 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, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.esm.js CHANGED
@@ -566,6 +566,9 @@ var getFormulaFilterValues = function (filterValue) {
566
566
  if (checkedValues && checkedValues.length) {
567
567
  return checkedValues;
568
568
  }
569
+ if (!formValues) {
570
+ return [];
571
+ }
569
572
  function stringifyNumbersRange(range) {
570
573
  if (range === void 0) { range = [undefined, undefined]; }
571
574
  return range.map(function (value, index) {
@@ -600,7 +603,7 @@ var getFormulaFilterValues = function (filterValue) {
600
603
  }
601
604
  return compact([datePickerValue]);
602
605
  case EFormatTypes.STRING:
603
- return compact([(_a = formValues === null || formValues === void 0 ? void 0 : formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
606
+ return compact([(_a = formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
604
607
  case EFormatTypes.NUMBER:
605
608
  case EFormatTypes.YEAR:
606
609
  case EFormatTypes.DAY_OF_MONTH:
package/dist/index.js CHANGED
@@ -567,6 +567,9 @@ var getFormulaFilterValues = function (filterValue) {
567
567
  if (checkedValues && checkedValues.length) {
568
568
  return checkedValues;
569
569
  }
570
+ if (!formValues) {
571
+ return [];
572
+ }
570
573
  function stringifyNumbersRange(range) {
571
574
  if (range === void 0) { range = [undefined, undefined]; }
572
575
  return range.map(function (value, index) {
@@ -601,7 +604,7 @@ var getFormulaFilterValues = function (filterValue) {
601
604
  }
602
605
  return compact([datePickerValue]);
603
606
  case exports.EFormatTypes.STRING:
604
- return compact([(_a = formValues === null || formValues === void 0 ? void 0 : formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
607
+ return compact([(_a = formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
605
608
  case exports.EFormatTypes.NUMBER:
606
609
  case exports.EFormatTypes.YEAR:
607
610
  case exports.EFormatTypes.DAY_OF_MONTH:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "4.10.0",
3
+ "version": "4.12.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",