@infomaximum/widget-sdk 4.0.0-beta34 → 4.0.0-beta36

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +161 -160
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -502,6 +502,165 @@ interface IRange {
502
502
  max?: number;
503
503
  }
504
504
 
505
+ interface IWidgetTableColumn {
506
+ /** Имя колонки */
507
+ name: string;
508
+ /** Тип данных колонки */
509
+ dataType: ESimpleDataType;
510
+ }
511
+ interface IActionScript {
512
+ name: string | undefined;
513
+ fieldsNames: Set<string>;
514
+ }
515
+ interface IWidgetTable {
516
+ /** Имя таблицы */
517
+ name: string;
518
+ /** Колонки таблицы */
519
+ columns: Map<string, IWidgetTableColumn>;
520
+ }
521
+ /**
522
+ * simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
523
+ *
524
+ * full - полный
525
+ */
526
+ type TFiltrationMode = "simplified" | "full";
527
+ /**
528
+ * preview - упрощенный
529
+ *
530
+ * full - полный
531
+ */
532
+ type TDisplayMode = "preview" | "full";
533
+ interface IDisplayRule {
534
+ color: TColor;
535
+ }
536
+ interface IWidgetsContext {
537
+ /** используемый язык в системе */
538
+ language: ELanguages;
539
+ processes: Map<string, IWidgetProcess>;
540
+ reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
541
+ workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
542
+ /** Переменные отчета */
543
+ variables: Map<string, TWidgetVariable>;
544
+ /** Метод установки значения переменной отчета */
545
+ setVariableValue(name: string, value: TNullable<string> | string[]): void;
546
+ statesNames: Set<string>;
547
+ reportName: string;
548
+ /**
549
+ * режим дашборда
550
+ * @deprecated 2401 - необходимо использовать displayMode */
551
+ isViewMode: boolean;
552
+ /** Режим отображения виджета */
553
+ displayMode: TDisplayMode;
554
+ /** @deprecated необходимо получать из системной переменной "Login" */
555
+ userLogin: string;
556
+ scripts: Map<string, IActionScript>;
557
+ tables: Set<string>;
558
+ filtrationMode: TFiltrationMode;
559
+ reportDisplayRules: Map<string, IDisplayRule>;
560
+ workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
561
+ viewKeyByName: Map<string, string>;
562
+ fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
563
+ }
564
+
565
+ declare enum EWidgetActionInputMode {
566
+ FROM_COLUMN = "FROM_COLUMN",
567
+ FROM_VARIABLE = "FROM_VARIABLE",
568
+ STATIC_LIST = "STATIC_LIST",
569
+ DYNAMIC_LIST = "DYNAMIC_LIST",
570
+ FORMULA = "FORMULA",
571
+ MANUALLY = "MANUALLY"
572
+ }
573
+ interface IActionCommon {
574
+ id: number;
575
+ name: string;
576
+ }
577
+ declare enum EActionTypes {
578
+ URL = "URL",
579
+ UPDATE_VARIABLE = "UPDATE_VARIABLE",
580
+ RUN_SCRIPT = "RUN_SCRIPT",
581
+ OPEN_VIEW = "OPEN_VIEW"
582
+ }
583
+ interface IActionGoToUrl extends IActionCommon {
584
+ type: EActionTypes.URL;
585
+ url: string;
586
+ targetBlank: boolean;
587
+ }
588
+ interface IActionScriptField {
589
+ name: string;
590
+ id: number;
591
+ value: TWidgetActionInputValue;
592
+ }
593
+ interface IActionRunScript extends IActionCommon {
594
+ description: string;
595
+ type: EActionTypes.RUN_SCRIPT;
596
+ filters: (IFormulaFilterValue | string)[];
597
+ inputs: IActionScriptField[];
598
+ scriptName: string;
599
+ shouldRefreshWidgetsAfterExecution: boolean;
600
+ }
601
+ interface IActionUpdateVariable extends IActionCommon {
602
+ type: EActionTypes.UPDATE_VARIABLE;
603
+ variables: Array<string>;
604
+ }
605
+ declare enum EViewType {
606
+ CREATED_VIEW = "CREATED_VIEW",
607
+ GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
608
+ }
609
+ declare enum EOpenViewMode {
610
+ NEW_WINDOW = "NEW_WINDOW",
611
+ PLACEHOLDER = "PLACEHOLDER",
612
+ MODAL = "MODAL",
613
+ DRAWER = "DRAWER"
614
+ }
615
+ declare enum EDrawerPlacement {
616
+ LEFT = "LEFT",
617
+ RIGHT = "RIGHT"
618
+ }
619
+ interface IActionOpenView extends IActionCommon {
620
+ type: EActionTypes.OPEN_VIEW;
621
+ viewName: string;
622
+ viewKey: string;
623
+ openMode: EOpenViewMode;
624
+ viewType: EViewType;
625
+ drawerPlacement: EDrawerPlacement;
626
+ placeholderName: string;
627
+ inputs: IActionScriptField[];
628
+ isOpenInCurrentWindow?: boolean;
629
+ }
630
+ type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
631
+ type TWidgetActionCommonInputValue = {
632
+ name: string;
633
+ isHidden: boolean;
634
+ };
635
+ type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
636
+ mode: EWidgetActionInputMode.FROM_COLUMN;
637
+ tableName: string;
638
+ columnName: string;
639
+ } | {
640
+ mode: EWidgetActionInputMode.FROM_VARIABLE;
641
+ sourceVariable: string;
642
+ } | {
643
+ mode: EWidgetActionInputMode.FORMULA;
644
+ formula: string;
645
+ } | {
646
+ mode: EWidgetActionInputMode.MANUALLY;
647
+ description: string;
648
+ } | {
649
+ mode: EWidgetActionInputMode.STATIC_LIST;
650
+ options: string[];
651
+ defaultOptionIndex: number;
652
+ } | {
653
+ mode: EWidgetActionInputMode.DYNAMIC_LIST;
654
+ formula: string;
655
+ defaultValue: string;
656
+ filters: (IFormulaFilterValue | string)[];
657
+ });
658
+ interface IWidgetActionInput {
659
+ name: string;
660
+ value: TWidgetActionInputValue;
661
+ }
662
+ declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
663
+
505
664
  declare enum ESortDirection {
506
665
  descend = "DESC",
507
666
  ascend = "ASC",
@@ -640,6 +799,7 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
640
799
  formatting?: EFormattingPresets;
641
800
  formattingTemplate?: string;
642
801
  displayCondition?: TDisplayCondition;
802
+ onclick?: TActionsOnClick[];
643
803
  }
644
804
  interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
645
805
  /** Идентификатор, генерируемый на основе текущего времени */
@@ -725,165 +885,6 @@ type TWidgetVariable = {
725
885
  };
726
886
  declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
727
887
 
728
- interface IWidgetTableColumn {
729
- /** Имя колонки */
730
- name: string;
731
- /** Тип данных колонки */
732
- dataType: ESimpleDataType;
733
- }
734
- interface IActionScript {
735
- name: string | undefined;
736
- fieldsNames: Set<string>;
737
- }
738
- interface IWidgetTable {
739
- /** Имя таблицы */
740
- name: string;
741
- /** Колонки таблицы */
742
- columns: Map<string, IWidgetTableColumn>;
743
- }
744
- /**
745
- * simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
746
- *
747
- * full - полный
748
- */
749
- type TFiltrationMode = "simplified" | "full";
750
- /**
751
- * preview - упрощенный
752
- *
753
- * full - полный
754
- */
755
- type TDisplayMode = "preview" | "full";
756
- interface IDisplayRule {
757
- color: TColor;
758
- }
759
- interface IWidgetsContext {
760
- /** используемый язык в системе */
761
- language: ELanguages;
762
- processes: Map<string, IWidgetProcess>;
763
- reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
764
- workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
765
- /** Переменные отчета */
766
- variables: Map<string, TWidgetVariable>;
767
- /** Метод установки значения переменной отчета */
768
- setVariableValue(name: string, value: TNullable<string> | string[]): void;
769
- statesNames: Set<string>;
770
- reportName: string;
771
- /**
772
- * режим дашборда
773
- * @deprecated 2401 - необходимо использовать displayMode */
774
- isViewMode: boolean;
775
- /** Режим отображения виджета */
776
- displayMode: TDisplayMode;
777
- /** @deprecated необходимо получать из системной переменной "Login" */
778
- userLogin: string;
779
- scripts: Map<string, IActionScript>;
780
- tables: Set<string>;
781
- filtrationMode: TFiltrationMode;
782
- reportDisplayRules: Map<string, IDisplayRule>;
783
- workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
784
- viewKeyByName: Map<string, string>;
785
- fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
786
- }
787
-
788
- declare enum EWidgetActionInputMode {
789
- FROM_COLUMN = "FROM_COLUMN",
790
- FROM_VARIABLE = "FROM_VARIABLE",
791
- STATIC_LIST = "STATIC_LIST",
792
- DYNAMIC_LIST = "DYNAMIC_LIST",
793
- FORMULA = "FORMULA",
794
- MANUALLY = "MANUALLY"
795
- }
796
- interface IActionCommon {
797
- id: number;
798
- name: string;
799
- }
800
- declare enum EActionTypes {
801
- URL = "URL",
802
- UPDATE_VARIABLE = "UPDATE_VARIABLE",
803
- RUN_SCRIPT = "RUN_SCRIPT",
804
- OPEN_VIEW = "OPEN_VIEW"
805
- }
806
- interface IActionGoToUrl extends IActionCommon {
807
- type: EActionTypes.URL;
808
- url: string;
809
- targetBlank: boolean;
810
- }
811
- interface IActionScriptField {
812
- name: string;
813
- id: number;
814
- value: TWidgetActionInputValue;
815
- }
816
- interface IActionRunScript extends IActionCommon {
817
- description: string;
818
- type: EActionTypes.RUN_SCRIPT;
819
- filters: (IFormulaFilterValue | string)[];
820
- inputs: IActionScriptField[];
821
- scriptName: string;
822
- shouldRefreshWidgetsAfterExecution: boolean;
823
- }
824
- interface IActionUpdateVariable extends IActionCommon {
825
- type: EActionTypes.UPDATE_VARIABLE;
826
- variables: Array<string>;
827
- }
828
- declare enum EViewType {
829
- CREATED_VIEW = "CREATED_VIEW",
830
- GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
831
- }
832
- declare enum EOpenViewMode {
833
- NEW_WINDOW = "NEW_WINDOW",
834
- PLACEHOLDER = "PLACEHOLDER",
835
- MODAL = "MODAL",
836
- DRAWER = "DRAWER"
837
- }
838
- declare enum EDrawerPlacement {
839
- LEFT = "LEFT",
840
- RIGHT = "RIGHT"
841
- }
842
- interface IActionOpenView extends IActionCommon {
843
- type: EActionTypes.OPEN_VIEW;
844
- viewName: string;
845
- viewKey: string;
846
- openMode: EOpenViewMode;
847
- viewType: EViewType;
848
- drawerPlacement: EDrawerPlacement;
849
- placeholderName: string;
850
- inputs: IActionScriptField[];
851
- isOpenInCurrentWindow?: boolean;
852
- }
853
- type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
854
- type TWidgetActionCommonInputValue = {
855
- name: string;
856
- isHidden: boolean;
857
- };
858
- type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
859
- mode: EWidgetActionInputMode.FROM_COLUMN;
860
- tableName: string;
861
- columnName: string;
862
- } | {
863
- mode: EWidgetActionInputMode.FROM_VARIABLE;
864
- sourceVariable: string;
865
- } | {
866
- mode: EWidgetActionInputMode.FORMULA;
867
- formula: string;
868
- } | {
869
- mode: EWidgetActionInputMode.MANUALLY;
870
- description: string;
871
- } | {
872
- mode: EWidgetActionInputMode.STATIC_LIST;
873
- options: string[];
874
- defaultOptionIndex: number;
875
- } | {
876
- mode: EWidgetActionInputMode.DYNAMIC_LIST;
877
- formula: string;
878
- defaultValue: string;
879
- filters: (IFormulaFilterValue | string)[];
880
- });
881
- interface IWidgetActionInput {
882
- name: string;
883
- value: TWidgetActionInputValue;
884
- }
885
- declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
886
-
887
888
  interface IBaseWidgetSettings {
888
889
  header?: string;
889
890
  headerSize?: number;
@@ -1367,7 +1368,6 @@ type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
1367
1368
  x?: number;
1368
1369
  y?: number;
1369
1370
  };
1370
- onClose?: () => void;
1371
1371
  };
1372
1372
  type TContextMenuPositionUnit = "%" | "px";
1373
1373
  type TContextMenuList = {
@@ -1391,6 +1391,7 @@ type TContextMenuButtonActions = {
1391
1391
  };
1392
1392
  type TContextMenuButtonClose = {
1393
1393
  type: "close";
1394
+ onClick?: () => void;
1394
1395
  };
1395
1396
  type TContextMenuButtonApply = {
1396
1397
  type: "apply";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "4.0.0-beta34",
3
+ "version": "4.0.0-beta36",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",