@infomaximum/widget-sdk 4.0.0-beta46 → 4.0.0-beta48

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
@@ -250,7 +250,7 @@ declare enum EFormattingPresets {
250
250
  "R[-]YY" = "R[-]YY"
251
251
  }
252
252
  interface IWidgetFormatting {
253
- getFormattedValue: (value: string, formatType: EFormatTypes, formatTemplate: TNullable<string>) => string;
253
+ getFormattedValue: (value: string, formatType: EFormatTypes, formatting: EFormattingPresets, formatTemplate: TNullable<string>) => string;
254
254
  }
255
255
 
256
256
  declare enum ELastTimeUnit {
@@ -264,8 +264,8 @@ declare enum EDurationUnit {
264
264
  MINUTES = "MINUTES",
265
265
  SECONDS = "SECONDS"
266
266
  }
267
- declare const mapFormulaFilterToCalculatorInput: (filterValue: IFormulaFilterValue | string) => TNullable<ICalculatorFilter>;
268
- declare const mapFormulaFiltersToInputs: (filters: (string | IFormulaFilterValue)[]) => ICalculatorFilter[];
267
+ declare const mapFormulaFilterToCalculatorInput: (filterValue: TExtendedFormulaFilterValue) => TNullable<ICalculatorFilter>;
268
+ declare const mapFormulaFiltersToInputs: (filters: TExtendedFormulaFilterValue[]) => ICalculatorFilter[];
269
269
 
270
270
  type TSelectivePartial<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
271
271
  declare const formulaFilterMethods: {
@@ -384,6 +384,9 @@ interface IFormulaFilterValue {
384
384
  [EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
385
385
  }>;
386
386
  }
387
+ type TExtendedFormulaFilterValue = {
388
+ formula: string;
389
+ } | IFormulaFilterValue;
387
390
  interface IStagesFilterItem {
388
391
  id: number;
389
392
  /** Название этапа */
@@ -419,6 +422,7 @@ interface IWidgetFiltration {
419
422
  /** Удалить фильтр по этапам */
420
423
  removeStagesFilter(widgetKey: string): void;
421
424
  }
425
+ declare const isFormulaFilterValue: (value: TExtendedFormulaFilterValue) => value is IFormulaFilterValue;
422
426
 
423
427
  declare enum EWidgetFilterMode {
424
428
  DEFAULT = "DEFAULT",
@@ -520,9 +524,15 @@ interface IWidgetTableColumn {
520
524
  /** Тип данных колонки */
521
525
  dataType: ESimpleDataType;
522
526
  }
527
+ interface IScripField {
528
+ guid: string;
529
+ name: string;
530
+ dataType: ESimpleDataType;
531
+ }
523
532
  interface IActionScript {
524
- name: string | undefined;
525
- fieldsNames: Set<string>;
533
+ key: string;
534
+ name: string;
535
+ fields: IScripField[];
526
536
  }
527
537
  interface IWidgetTable {
528
538
  /** Имя таблицы */
@@ -574,104 +584,146 @@ interface IWidgetsContext {
574
584
  fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
575
585
  }
576
586
 
577
- declare enum EWidgetActionInputMode {
578
- FROM_COLUMN = "FROM_COLUMN",
579
- FROM_VARIABLE = "FROM_VARIABLE",
587
+ declare enum EWidgetActionInputMethod {
588
+ COLUMN = "COLUMN",
589
+ VARIABLE = "VARIABLE",
580
590
  STATIC_LIST = "STATIC_LIST",
581
591
  DYNAMIC_LIST = "DYNAMIC_LIST",
582
592
  FORMULA = "FORMULA",
583
- MANUALLY = "MANUALLY"
584
- }
585
- interface IActionCommon {
586
- id: number;
587
- name: string;
593
+ MANUALLY = "MANUALLY",
594
+ EVENT = "EVENT",
595
+ START_EVENT = "START_EVENT",
596
+ FINISH_EVENT = "FINISH_EVENT"
588
597
  }
589
598
  declare enum EActionTypes {
590
- URL = "URL",
599
+ OPEN_URL = "OPEN_URL",
591
600
  UPDATE_VARIABLE = "UPDATE_VARIABLE",
592
- RUN_SCRIPT = "RUN_SCRIPT",
601
+ EXECUTE_SCRIPT = "EXECUTE_SCRIPT",
593
602
  OPEN_VIEW = "OPEN_VIEW"
594
603
  }
595
- interface IActionGoToUrl extends IActionCommon {
596
- type: EActionTypes.URL;
597
- url: string;
598
- targetBlank: boolean;
599
- }
600
- interface IActionScriptField {
601
- name: string;
602
- id: number;
603
- value: TWidgetActionInputValue;
604
- }
605
- interface IActionRunScript extends IActionCommon {
606
- description: string;
607
- type: EActionTypes.RUN_SCRIPT;
608
- filters: (IFormulaFilterValue | string)[];
609
- inputs: IActionScriptField[];
610
- scriptName: string;
611
- shouldRefreshWidgetsAfterExecution: boolean;
612
- }
613
- interface IActionUpdateVariable extends IActionCommon {
614
- type: EActionTypes.UPDATE_VARIABLE;
615
- variables: Array<string>;
616
- }
617
- declare enum EViewType {
618
- CREATED_VIEW = "CREATED_VIEW",
604
+ declare enum EViewMode {
605
+ EXISTED_VIEW = "EXISTED_VIEW",
619
606
  GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
620
607
  }
621
- declare enum EOpenViewMode {
608
+ declare enum EViewOpenIn {
622
609
  NEW_WINDOW = "NEW_WINDOW",
610
+ CURRENT_WINDOW = "CURRENT_WINDOW",
623
611
  PLACEHOLDER = "PLACEHOLDER",
624
- MODAL = "MODAL",
625
- DRAWER = "DRAWER"
612
+ MODAL_WINDOW = "MODAL_WINDOW",
613
+ DRAWER_WINDOW = "DRAWER_WINDOW"
626
614
  }
627
615
  declare enum EDrawerPlacement {
628
616
  LEFT = "LEFT",
629
617
  RIGHT = "RIGHT"
630
618
  }
631
- interface IActionOpenView extends IActionCommon {
632
- type: EActionTypes.OPEN_VIEW;
633
- viewName: string;
634
- viewKey: string;
635
- openMode: EOpenViewMode;
636
- viewType: EViewType;
637
- drawerPlacement: EDrawerPlacement;
638
- placeholderName: string;
639
- inputs: IActionScriptField[];
640
- isOpenInCurrentWindow?: boolean;
641
- }
642
- type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
643
- type TWidgetActionCommonInputValue = {
644
- name: string;
645
- isHidden: boolean;
646
- };
647
- type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
648
- mode: EWidgetActionInputMode.FROM_COLUMN;
619
+ interface IParameterFromColumn {
620
+ inputMethod: EWidgetActionInputMethod.COLUMN;
649
621
  tableName: string;
650
622
  columnName: string;
651
- } | {
652
- mode: EWidgetActionInputMode.FROM_VARIABLE;
623
+ }
624
+ interface IParameterFromVariable {
625
+ inputMethod: EWidgetActionInputMethod.VARIABLE;
653
626
  sourceVariable: string;
654
- } | {
655
- mode: EWidgetActionInputMode.FORMULA;
627
+ }
628
+ interface IParameterFromFormula {
629
+ inputMethod: EWidgetActionInputMethod.FORMULA;
656
630
  formula: string;
657
- } | {
658
- mode: EWidgetActionInputMode.MANUALLY;
631
+ }
632
+ interface IParameterFromEvent {
633
+ inputMethod: EWidgetActionInputMethod.EVENT;
634
+ }
635
+ interface IParameterFromStartEvent {
636
+ inputMethod: EWidgetActionInputMethod.START_EVENT;
637
+ }
638
+ interface IParameterFromEndEvent {
639
+ inputMethod: EWidgetActionInputMethod.FINISH_EVENT;
640
+ }
641
+ interface IParameterFromManualInput {
642
+ inputMethod: EWidgetActionInputMethod.MANUALLY;
659
643
  description: string;
660
- } | {
661
- mode: EWidgetActionInputMode.STATIC_LIST;
644
+ }
645
+ interface IParameterFromStaticList {
646
+ inputMethod: EWidgetActionInputMethod.STATIC_LIST;
662
647
  options: string[];
663
648
  defaultOptionIndex: number;
664
- } | {
665
- mode: EWidgetActionInputMode.DYNAMIC_LIST;
649
+ }
650
+ interface IParameterFromDynamicList {
651
+ inputMethod: EWidgetActionInputMethod.DYNAMIC_LIST;
666
652
  formula: string;
667
653
  defaultValue: string;
668
- filters: (IFormulaFilterValue | string)[];
669
- });
670
- interface IWidgetActionInput {
654
+ filters: TExtendedFormulaFilterValue[];
655
+ }
656
+ interface IWidgetActionParameterCommon {
657
+ name: string;
658
+ displayName: string;
659
+ isHidden: boolean;
660
+ }
661
+ type TWidgetActionParameter = IWidgetActionParameterCommon & (IParameterFromColumn | IParameterFromVariable | IParameterFromFormula | IParameterFromManualInput | IParameterFromStaticList | IParameterFromDynamicList);
662
+ interface IActionOnClickParameterCommon {
663
+ /** @deprecated удалить [BI-13546] */
664
+ id: number;
671
665
  name: string;
672
- value: TWidgetActionInputValue;
673
666
  }
674
- declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
667
+ type TActionOnClickParameter = IActionOnClickParameterCommon & (IParameterFromColumn | IParameterFromVariable | IParameterFromFormula | IParameterFromEvent | IParameterFromStartEvent | IParameterFromEndEvent);
668
+ interface IActionCommon {
669
+ /** @deprecated удалить [BI-13546] */
670
+ id: number;
671
+ name: string;
672
+ }
673
+ interface IActionGoToUrl extends IActionCommon {
674
+ type: EActionTypes.OPEN_URL;
675
+ url: string;
676
+ newWindow: boolean;
677
+ }
678
+ interface IActionRunScript extends IActionCommon {
679
+ type: EActionTypes.EXECUTE_SCRIPT;
680
+ parameters: TActionOnClickParameter[];
681
+ scriptKey: string;
682
+ updateDashboard: boolean;
683
+ }
684
+ interface IActionUpdateVariable extends IActionCommon {
685
+ type: EActionTypes.UPDATE_VARIABLE;
686
+ variables: TActionOnClickParameter[];
687
+ }
688
+ type TActionOpenViewMode = {
689
+ mode: EViewMode.GENERATED_BY_SCRIPT;
690
+ scriptKey: string;
691
+ parameters: TActionOnClickParameter[];
692
+ displayName: string;
693
+ } | {
694
+ mode: EViewMode.EXISTED_VIEW;
695
+ viewKey: string;
696
+ parameters: TActionOnClickParameter[];
697
+ };
698
+ type TActionOpenIn = {
699
+ openIn: EViewOpenIn.DRAWER_WINDOW;
700
+ alignment: EDrawerPlacement;
701
+ } | {
702
+ openIn: EViewOpenIn.PLACEHOLDER;
703
+ placeholderName: string;
704
+ } | {
705
+ openIn: EViewOpenIn.NEW_WINDOW;
706
+ } | {
707
+ openIn: EViewOpenIn.MODAL_WINDOW;
708
+ } | {
709
+ openIn: EViewOpenIn.CURRENT_WINDOW;
710
+ };
711
+ type TActionOpenView = {
712
+ type: EActionTypes.OPEN_VIEW;
713
+ } & TActionOpenViewMode & TActionOpenIn & IActionCommon;
714
+ type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
715
+ interface IWidgetAction extends IActionCommon {
716
+ filters: TExtendedFormulaFilterValue[];
717
+ parameters: TWidgetActionParameter[];
718
+ type: EActionTypes.EXECUTE_SCRIPT;
719
+ scriptKey: string;
720
+ updateDashboard: boolean;
721
+ description: string;
722
+ }
723
+ type TAction = TActionsOnClick | IWidgetAction;
724
+ declare const isExecuteScriptActionValid: (action: Extract<TAction, {
725
+ type: EActionTypes.EXECUTE_SCRIPT;
726
+ }>, { scripts, tables, variables }: IWidgetsContext) => boolean;
675
727
 
676
728
  declare enum ESortDirection {
677
729
  descend = "DESC",
@@ -862,6 +914,8 @@ type TWidgetVariable = {
862
914
  defaultValue: string;
863
915
  /** Тип данных */
864
916
  dataType: ESimpleDataType;
917
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
918
+ guid: string;
865
919
  } | {
866
920
  /** Тип переменной */
867
921
  type: EIndicatorType.STATIC_LIST;
@@ -877,6 +931,8 @@ type TWidgetVariable = {
877
931
  dataType: ESimpleDataType.STRING;
878
932
  /** Множественный выбор */
879
933
  multipleChoice: boolean;
934
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
935
+ guid: string;
880
936
  } | {
881
937
  /** Тип переменной */
882
938
  type: EIndicatorType.DYNAMIC_LIST;
@@ -893,22 +949,24 @@ type TWidgetVariable = {
893
949
  /** Множественный выбор */
894
950
  multipleChoice: boolean;
895
951
  /** Фильтры */
896
- filters: (string | IFormulaFilterValue)[];
952
+ filters: TExtendedFormulaFilterValue[];
953
+ /** @deprecated удалить после выполнения BI-13602, задача BI-13650 */
954
+ guid: string;
897
955
  };
898
956
  declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
899
957
 
900
958
  interface IBaseWidgetSettings {
901
- header?: string;
902
- headerSize?: number;
959
+ title?: string;
960
+ titleSize?: number;
903
961
  stateName?: string | null;
904
962
  showMarkdown?: boolean;
905
963
  markdownMeasures?: IMarkdownMeasure[];
906
964
  markdownText?: string;
907
- filters?: (IFormulaFilterValue | string)[];
965
+ filters?: TExtendedFormulaFilterValue[];
908
966
  filterMode?: EWidgetFilterMode;
909
967
  ignoreFilters?: boolean;
910
968
  sorting?: IWidgetSortingIndicator[];
911
- actions?: TActionsOnClick[];
969
+ actions?: IWidgetAction[];
912
970
  displayCondition?: TDisplayCondition;
913
971
  displayConditionComment?: string;
914
972
  }
@@ -1317,7 +1375,7 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
1317
1375
  /** Конфигурация левой панели */
1318
1376
  interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
1319
1377
  /** Добавить заголовок для виджета */
1320
- useHeader?: boolean;
1378
+ useTitle?: boolean;
1321
1379
  /** Добавить описание для виджета */
1322
1380
  useMarkdown?: boolean;
1323
1381
  /** Конфигурация настроек данных виджета */
@@ -1438,10 +1496,11 @@ type TContextMenuButtonOptions = {
1438
1496
  };
1439
1497
 
1440
1498
  type TLaunchActionParams = {
1441
- action: TActionsOnClick;
1499
+ action: TAction;
1442
1500
  onSuccess: () => void;
1443
1501
  filters: ICalculatorFilter[];
1444
1502
  needConfirmation?: boolean;
1503
+ eventNames?: [string] | [string, string];
1445
1504
  };
1446
1505
  type TWidgetContainer = {
1447
1506
  /** Имеет ли контейнер виджета ограниченную максимальную высоту */
@@ -1656,4 +1715,4 @@ declare global {
1656
1715
  }
1657
1716
  }
1658
1717
 
1659
- export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionCommon, type IActionGoToUrl, type IActionOpenView, type IActionRunScript, type IActionScript, type IActionScriptField, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, 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 ICalculatorVariable, type ICalculatorVariablesValues, type IColoredValue, type ICommonColumnIndicator, 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 IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, 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 ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingMenuConfig, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetIndicatorMenuConfig, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TActionsOnClick, 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 TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionCommonInputValue, type TWidgetActionInputValue, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
1718
+ export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, 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 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 ICalculatorVariable, type ICalculatorVariablesValues, type IColoredValue, type ICommonColumnIndicator, 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 IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, 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 ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingMenuConfig, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetIndicatorMenuConfig, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionsOnClick, 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 TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isExecuteScriptActionValid, isFormulaFilterValue, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
package/dist/index.esm.js CHANGED
@@ -2,129 +2,72 @@ import { Localization } from '@infomaximum/localization';
2
2
  export { ELanguages } from '@infomaximum/localization';
3
3
  export { EFilteringMethodValues } from '@infomaximum/base-filter';
4
4
 
5
- /******************************************************************************
6
- Copyright (c) Microsoft Corporation.
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any
9
- purpose with or without fee is hereby granted.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
- PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */
19
- /* global Reflect, Promise, SuppressedError, Symbol */
20
-
21
-
22
- var __assign = function() {
23
- __assign = Object.assign || function __assign(t) {
24
- for (var s, i = 1, n = arguments.length; i < n; i++) {
25
- s = arguments[i];
26
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
27
- }
28
- return t;
29
- };
30
- return __assign.apply(this, arguments);
31
- };
32
-
33
- function __read(o, n) {
34
- var m = typeof Symbol === "function" && o[Symbol.iterator];
35
- if (!m) return o;
36
- var i = m.call(o), r, ar = [], e;
37
- try {
38
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39
- }
40
- catch (error) { e = { error: error }; }
41
- finally {
42
- try {
43
- if (r && !r.done && (m = i["return"])) m.call(i);
44
- }
45
- finally { if (e) throw e.error; }
46
- }
47
- return ar;
48
- }
49
-
50
- function __spreadArray(to, from, pack) {
51
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
52
- if (ar || !(i in from)) {
53
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
54
- ar[i] = from[i];
55
- }
56
- }
57
- return to.concat(ar || Array.prototype.slice.call(from));
58
- }
59
-
60
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
61
- var e = new Error(message);
62
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
63
- };
64
-
65
- var EWidgetActionInputMode;
66
- (function (EWidgetActionInputMode) {
67
- EWidgetActionInputMode["FROM_COLUMN"] = "FROM_COLUMN";
68
- EWidgetActionInputMode["FROM_VARIABLE"] = "FROM_VARIABLE";
69
- EWidgetActionInputMode["STATIC_LIST"] = "STATIC_LIST";
70
- EWidgetActionInputMode["DYNAMIC_LIST"] = "DYNAMIC_LIST";
71
- EWidgetActionInputMode["FORMULA"] = "FORMULA";
72
- EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
73
- })(EWidgetActionInputMode || (EWidgetActionInputMode = {}));
5
+ var EWidgetActionInputMethod;
6
+ (function (EWidgetActionInputMethod) {
7
+ EWidgetActionInputMethod["COLUMN"] = "COLUMN";
8
+ EWidgetActionInputMethod["VARIABLE"] = "VARIABLE";
9
+ EWidgetActionInputMethod["STATIC_LIST"] = "STATIC_LIST";
10
+ EWidgetActionInputMethod["DYNAMIC_LIST"] = "DYNAMIC_LIST";
11
+ EWidgetActionInputMethod["FORMULA"] = "FORMULA";
12
+ EWidgetActionInputMethod["MANUALLY"] = "MANUALLY";
13
+ EWidgetActionInputMethod["EVENT"] = "EVENT";
14
+ EWidgetActionInputMethod["START_EVENT"] = "START_EVENT";
15
+ EWidgetActionInputMethod["FINISH_EVENT"] = "FINISH_EVENT";
16
+ })(EWidgetActionInputMethod || (EWidgetActionInputMethod = {}));
74
17
  var EActionTypes;
75
18
  (function (EActionTypes) {
76
- EActionTypes["URL"] = "URL";
19
+ EActionTypes["OPEN_URL"] = "OPEN_URL";
77
20
  EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
78
- EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
21
+ EActionTypes["EXECUTE_SCRIPT"] = "EXECUTE_SCRIPT";
79
22
  EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
80
23
  })(EActionTypes || (EActionTypes = {}));
81
- var EViewType;
82
- (function (EViewType) {
83
- EViewType["CREATED_VIEW"] = "CREATED_VIEW";
84
- EViewType["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
85
- })(EViewType || (EViewType = {}));
86
- var EOpenViewMode;
87
- (function (EOpenViewMode) {
88
- EOpenViewMode["NEW_WINDOW"] = "NEW_WINDOW";
89
- EOpenViewMode["PLACEHOLDER"] = "PLACEHOLDER";
90
- EOpenViewMode["MODAL"] = "MODAL";
91
- EOpenViewMode["DRAWER"] = "DRAWER";
92
- })(EOpenViewMode || (EOpenViewMode = {}));
24
+ var EViewMode;
25
+ (function (EViewMode) {
26
+ EViewMode["EXISTED_VIEW"] = "EXISTED_VIEW";
27
+ EViewMode["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
28
+ })(EViewMode || (EViewMode = {}));
29
+ var EViewOpenIn;
30
+ (function (EViewOpenIn) {
31
+ EViewOpenIn["NEW_WINDOW"] = "NEW_WINDOW";
32
+ EViewOpenIn["CURRENT_WINDOW"] = "CURRENT_WINDOW";
33
+ EViewOpenIn["PLACEHOLDER"] = "PLACEHOLDER";
34
+ EViewOpenIn["MODAL_WINDOW"] = "MODAL_WINDOW";
35
+ EViewOpenIn["DRAWER_WINDOW"] = "DRAWER_WINDOW";
36
+ })(EViewOpenIn || (EViewOpenIn = {}));
93
37
  var EDrawerPlacement;
94
38
  (function (EDrawerPlacement) {
95
39
  EDrawerPlacement["LEFT"] = "LEFT";
96
40
  EDrawerPlacement["RIGHT"] = "RIGHT";
97
41
  })(EDrawerPlacement || (EDrawerPlacement = {}));
98
- var isActionValid = function (action, _a) {
42
+ var isExecuteScriptActionValid = function (action, _a) {
99
43
  var _b;
100
44
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
101
- if (action.type !== EActionTypes.RUN_SCRIPT) {
102
- return false;
103
- }
104
- var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
45
+ var currentScript = scripts.get((_b = action.scriptKey) !== null && _b !== void 0 ? _b : "");
105
46
  if (!currentScript) {
106
47
  return false;
107
48
  }
108
- var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
109
- if (actionInputsMap.size < currentScript.fieldsNames.size) {
49
+ var actionInputsMap = new Map(action.parameters.map(function (parameter) { return [parameter.name, parameter]; }));
50
+ if (actionInputsMap.size < currentScript.fields.length) {
110
51
  return false;
111
52
  }
112
- return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
53
+ return currentScript.fields.every(function (_a) {
54
+ var name = _a.name;
113
55
  var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
114
56
  if (!actionInput) {
115
57
  return false;
116
58
  }
117
- var value = actionInput.value;
118
- if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
59
+ if (actionInput.inputMethod === EWidgetActionInputMethod.VARIABLE &&
60
+ !variables.has(actionInput.sourceVariable)) {
119
61
  return false;
120
62
  }
121
- if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
63
+ if (actionInput.inputMethod === EWidgetActionInputMethod.FORMULA && !actionInput.formula) {
122
64
  return false;
123
65
  }
124
- if (value.mode === EWidgetActionInputMode.DYNAMIC_LIST && !value.formula) {
66
+ if (actionInput.inputMethod === EWidgetActionInputMethod.DYNAMIC_LIST && !actionInput.formula) {
125
67
  return false;
126
68
  }
127
- if (value.mode === EWidgetActionInputMode.FROM_COLUMN && !tables.has(value.tableName)) {
69
+ if (actionInput.inputMethod === EWidgetActionInputMethod.COLUMN &&
70
+ !tables.has(actionInput.tableName)) {
128
71
  return false;
129
72
  }
130
73
  return true;
@@ -159,6 +102,39 @@ var escapeSingularQuotes = function (formula) {
159
102
  return formula.replaceAll("'", "\\'");
160
103
  };
161
104
 
105
+ /******************************************************************************
106
+ Copyright (c) Microsoft Corporation.
107
+
108
+ Permission to use, copy, modify, and/or distribute this software for any
109
+ purpose with or without fee is hereby granted.
110
+
111
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
112
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
113
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
114
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
115
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
116
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
117
+ PERFORMANCE OF THIS SOFTWARE.
118
+ ***************************************************************************** */
119
+ /* global Reflect, Promise, SuppressedError, Symbol */
120
+
121
+
122
+ var __assign = function() {
123
+ __assign = Object.assign || function __assign(t) {
124
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
125
+ s = arguments[i];
126
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
127
+ }
128
+ return t;
129
+ };
130
+ return __assign.apply(this, arguments);
131
+ };
132
+
133
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
134
+ var e = new Error(message);
135
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
136
+ };
137
+
162
138
  var ECalculatorFilterMethods;
163
139
  (function (ECalculatorFilterMethods) {
164
140
  ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
@@ -203,6 +179,9 @@ var EFormulaFilterFieldKeys;
203
179
  EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
204
180
  EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
205
181
  })(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
182
+ var isFormulaFilterValue = function (value) {
183
+ return "filteringMethod" in value;
184
+ };
206
185
 
207
186
  var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
208
187
  var compactMap = function (items, f) {
@@ -465,10 +444,10 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
465
444
  if (!filterValue) {
466
445
  return null;
467
446
  }
468
- if (typeof filterValue === "string") {
447
+ if (!isFormulaFilterValue(filterValue)) {
469
448
  return {
470
449
  dataType: ESimpleDataType.OTHER,
471
- formula: filterValue,
450
+ formula: filterValue.formula,
472
451
  values: ["1"],
473
452
  filteringMethod: formulaFilterMethods.EQUAL_TO,
474
453
  };
@@ -1104,4 +1083,4 @@ var getLocalizedText = function (language, locObj, props) {
1104
1083
  return localization.getLocalized(locObj, props);
1105
1084
  };
1106
1085
 
1107
- export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
1086
+ export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isExecuteScriptActionValid, isFormulaFilterValue, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
package/dist/index.js CHANGED
@@ -3,129 +3,72 @@
3
3
  var localization$1 = require('@infomaximum/localization');
4
4
  var baseFilter = require('@infomaximum/base-filter');
5
5
 
6
- /******************************************************************************
7
- Copyright (c) Microsoft Corporation.
8
-
9
- Permission to use, copy, modify, and/or distribute this software for any
10
- purpose with or without fee is hereby granted.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
- PERFORMANCE OF THIS SOFTWARE.
19
- ***************************************************************************** */
20
- /* global Reflect, Promise, SuppressedError, Symbol */
21
-
22
-
23
- var __assign = function() {
24
- __assign = Object.assign || function __assign(t) {
25
- for (var s, i = 1, n = arguments.length; i < n; i++) {
26
- s = arguments[i];
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
28
- }
29
- return t;
30
- };
31
- return __assign.apply(this, arguments);
32
- };
33
-
34
- function __read(o, n) {
35
- var m = typeof Symbol === "function" && o[Symbol.iterator];
36
- if (!m) return o;
37
- var i = m.call(o), r, ar = [], e;
38
- try {
39
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
40
- }
41
- catch (error) { e = { error: error }; }
42
- finally {
43
- try {
44
- if (r && !r.done && (m = i["return"])) m.call(i);
45
- }
46
- finally { if (e) throw e.error; }
47
- }
48
- return ar;
49
- }
50
-
51
- function __spreadArray(to, from, pack) {
52
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
53
- if (ar || !(i in from)) {
54
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
55
- ar[i] = from[i];
56
- }
57
- }
58
- return to.concat(ar || Array.prototype.slice.call(from));
59
- }
60
-
61
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
62
- var e = new Error(message);
63
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
64
- };
65
-
66
- exports.EWidgetActionInputMode = void 0;
67
- (function (EWidgetActionInputMode) {
68
- EWidgetActionInputMode["FROM_COLUMN"] = "FROM_COLUMN";
69
- EWidgetActionInputMode["FROM_VARIABLE"] = "FROM_VARIABLE";
70
- EWidgetActionInputMode["STATIC_LIST"] = "STATIC_LIST";
71
- EWidgetActionInputMode["DYNAMIC_LIST"] = "DYNAMIC_LIST";
72
- EWidgetActionInputMode["FORMULA"] = "FORMULA";
73
- EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
74
- })(exports.EWidgetActionInputMode || (exports.EWidgetActionInputMode = {}));
6
+ exports.EWidgetActionInputMethod = void 0;
7
+ (function (EWidgetActionInputMethod) {
8
+ EWidgetActionInputMethod["COLUMN"] = "COLUMN";
9
+ EWidgetActionInputMethod["VARIABLE"] = "VARIABLE";
10
+ EWidgetActionInputMethod["STATIC_LIST"] = "STATIC_LIST";
11
+ EWidgetActionInputMethod["DYNAMIC_LIST"] = "DYNAMIC_LIST";
12
+ EWidgetActionInputMethod["FORMULA"] = "FORMULA";
13
+ EWidgetActionInputMethod["MANUALLY"] = "MANUALLY";
14
+ EWidgetActionInputMethod["EVENT"] = "EVENT";
15
+ EWidgetActionInputMethod["START_EVENT"] = "START_EVENT";
16
+ EWidgetActionInputMethod["FINISH_EVENT"] = "FINISH_EVENT";
17
+ })(exports.EWidgetActionInputMethod || (exports.EWidgetActionInputMethod = {}));
75
18
  exports.EActionTypes = void 0;
76
19
  (function (EActionTypes) {
77
- EActionTypes["URL"] = "URL";
20
+ EActionTypes["OPEN_URL"] = "OPEN_URL";
78
21
  EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
79
- EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
22
+ EActionTypes["EXECUTE_SCRIPT"] = "EXECUTE_SCRIPT";
80
23
  EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
81
24
  })(exports.EActionTypes || (exports.EActionTypes = {}));
82
- exports.EViewType = void 0;
83
- (function (EViewType) {
84
- EViewType["CREATED_VIEW"] = "CREATED_VIEW";
85
- EViewType["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
86
- })(exports.EViewType || (exports.EViewType = {}));
87
- exports.EOpenViewMode = void 0;
88
- (function (EOpenViewMode) {
89
- EOpenViewMode["NEW_WINDOW"] = "NEW_WINDOW";
90
- EOpenViewMode["PLACEHOLDER"] = "PLACEHOLDER";
91
- EOpenViewMode["MODAL"] = "MODAL";
92
- EOpenViewMode["DRAWER"] = "DRAWER";
93
- })(exports.EOpenViewMode || (exports.EOpenViewMode = {}));
25
+ exports.EViewMode = void 0;
26
+ (function (EViewMode) {
27
+ EViewMode["EXISTED_VIEW"] = "EXISTED_VIEW";
28
+ EViewMode["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
29
+ })(exports.EViewMode || (exports.EViewMode = {}));
30
+ exports.EViewOpenIn = void 0;
31
+ (function (EViewOpenIn) {
32
+ EViewOpenIn["NEW_WINDOW"] = "NEW_WINDOW";
33
+ EViewOpenIn["CURRENT_WINDOW"] = "CURRENT_WINDOW";
34
+ EViewOpenIn["PLACEHOLDER"] = "PLACEHOLDER";
35
+ EViewOpenIn["MODAL_WINDOW"] = "MODAL_WINDOW";
36
+ EViewOpenIn["DRAWER_WINDOW"] = "DRAWER_WINDOW";
37
+ })(exports.EViewOpenIn || (exports.EViewOpenIn = {}));
94
38
  exports.EDrawerPlacement = void 0;
95
39
  (function (EDrawerPlacement) {
96
40
  EDrawerPlacement["LEFT"] = "LEFT";
97
41
  EDrawerPlacement["RIGHT"] = "RIGHT";
98
42
  })(exports.EDrawerPlacement || (exports.EDrawerPlacement = {}));
99
- var isActionValid = function (action, _a) {
43
+ var isExecuteScriptActionValid = function (action, _a) {
100
44
  var _b;
101
45
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
102
- if (action.type !== exports.EActionTypes.RUN_SCRIPT) {
103
- return false;
104
- }
105
- var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
46
+ var currentScript = scripts.get((_b = action.scriptKey) !== null && _b !== void 0 ? _b : "");
106
47
  if (!currentScript) {
107
48
  return false;
108
49
  }
109
- var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
110
- if (actionInputsMap.size < currentScript.fieldsNames.size) {
50
+ var actionInputsMap = new Map(action.parameters.map(function (parameter) { return [parameter.name, parameter]; }));
51
+ if (actionInputsMap.size < currentScript.fields.length) {
111
52
  return false;
112
53
  }
113
- return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
54
+ return currentScript.fields.every(function (_a) {
55
+ var name = _a.name;
114
56
  var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
115
57
  if (!actionInput) {
116
58
  return false;
117
59
  }
118
- var value = actionInput.value;
119
- if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
60
+ if (actionInput.inputMethod === exports.EWidgetActionInputMethod.VARIABLE &&
61
+ !variables.has(actionInput.sourceVariable)) {
120
62
  return false;
121
63
  }
122
- if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
64
+ if (actionInput.inputMethod === exports.EWidgetActionInputMethod.FORMULA && !actionInput.formula) {
123
65
  return false;
124
66
  }
125
- if (value.mode === exports.EWidgetActionInputMode.DYNAMIC_LIST && !value.formula) {
67
+ if (actionInput.inputMethod === exports.EWidgetActionInputMethod.DYNAMIC_LIST && !actionInput.formula) {
126
68
  return false;
127
69
  }
128
- if (value.mode === exports.EWidgetActionInputMode.FROM_COLUMN && !tables.has(value.tableName)) {
70
+ if (actionInput.inputMethod === exports.EWidgetActionInputMethod.COLUMN &&
71
+ !tables.has(actionInput.tableName)) {
129
72
  return false;
130
73
  }
131
74
  return true;
@@ -160,6 +103,39 @@ var escapeSingularQuotes = function (formula) {
160
103
  return formula.replaceAll("'", "\\'");
161
104
  };
162
105
 
106
+ /******************************************************************************
107
+ Copyright (c) Microsoft Corporation.
108
+
109
+ Permission to use, copy, modify, and/or distribute this software for any
110
+ purpose with or without fee is hereby granted.
111
+
112
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
113
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
114
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
115
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
116
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
117
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
118
+ PERFORMANCE OF THIS SOFTWARE.
119
+ ***************************************************************************** */
120
+ /* global Reflect, Promise, SuppressedError, Symbol */
121
+
122
+
123
+ var __assign = function() {
124
+ __assign = Object.assign || function __assign(t) {
125
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
126
+ s = arguments[i];
127
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
128
+ }
129
+ return t;
130
+ };
131
+ return __assign.apply(this, arguments);
132
+ };
133
+
134
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
135
+ var e = new Error(message);
136
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
137
+ };
138
+
163
139
  exports.ECalculatorFilterMethods = void 0;
164
140
  (function (ECalculatorFilterMethods) {
165
141
  ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
@@ -204,6 +180,9 @@ exports.EFormulaFilterFieldKeys = void 0;
204
180
  EFormulaFilterFieldKeys["lastTimeUnit"] = "lastTimeUnit";
205
181
  EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
206
182
  })(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
183
+ var isFormulaFilterValue = function (value) {
184
+ return "filteringMethod" in value;
185
+ };
207
186
 
208
187
  var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
209
188
  var compactMap = function (items, f) {
@@ -466,10 +445,10 @@ var mapFormulaFilterToCalculatorInput = function (filterValue) {
466
445
  if (!filterValue) {
467
446
  return null;
468
447
  }
469
- if (typeof filterValue === "string") {
448
+ if (!isFormulaFilterValue(filterValue)) {
470
449
  return {
471
450
  dataType: exports.ESimpleDataType.OTHER,
472
- formula: filterValue,
451
+ formula: filterValue.formula,
473
452
  values: ["1"],
474
453
  filteringMethod: formulaFilterMethods.EQUAL_TO,
475
454
  };
@@ -1128,7 +1107,8 @@ exports.getEventMeasureFormula = getEventMeasureFormula;
1128
1107
  exports.getLocalizedText = getLocalizedText;
1129
1108
  exports.getMeasureFormula = getMeasureFormula;
1130
1109
  exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
1131
- exports.isActionValid = isActionValid;
1110
+ exports.isExecuteScriptActionValid = isExecuteScriptActionValid;
1111
+ exports.isFormulaFilterValue = isFormulaFilterValue;
1132
1112
  exports.isHierarchy = isHierarchy;
1133
1113
  exports.mapDimensionsToInputs = mapDimensionsToInputs;
1134
1114
  exports.mapEventMeasuresToInputs = mapEventMeasuresToInputs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "4.0.0-beta46",
3
+ "version": "4.0.0-beta48",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",