@infomaximum/widget-sdk 3.38.0 → 3.38.1
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 +281 -166
- package/dist/index.esm.js +57 -32
- package/dist/index.js +57 -32
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ interface IControlRecord<Settings extends object, Value, ControlType = EControlT
|
|
|
44
44
|
title?: string;
|
|
45
45
|
/** Тип используемого элемента управления настройкой из предложенных нашей системой */
|
|
46
46
|
type: ControlType | string;
|
|
47
|
+
marginTop?: number;
|
|
47
48
|
/** Объект дополнительных параметров элемента управления */
|
|
48
49
|
props?: object | ((settings: Settings) => object);
|
|
49
50
|
/** Описание доступа к значению настройки */
|
|
@@ -311,16 +312,16 @@ interface IProcessFilterValue {
|
|
|
311
312
|
* События, доступные при выборе процесса.
|
|
312
313
|
* Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
|
|
313
314
|
*/
|
|
314
|
-
|
|
315
|
+
eventsNamesByProcessNameMap?: Map<string, (string | null)[]>;
|
|
315
316
|
}
|
|
316
317
|
interface IProcessEventFilterValue extends IProcessFilterValue {
|
|
317
|
-
|
|
318
|
+
processName: string;
|
|
318
319
|
eventName: string;
|
|
319
320
|
}
|
|
320
321
|
interface IProcessTransitionFilterValue extends IProcessFilterValue {
|
|
321
|
-
|
|
322
|
+
startEventProcessName: string;
|
|
322
323
|
startEventName: string;
|
|
323
|
-
|
|
324
|
+
endEventProcessName: string;
|
|
324
325
|
endEventName: string;
|
|
325
326
|
}
|
|
326
327
|
interface IClickPosition {
|
|
@@ -382,6 +383,7 @@ interface IFormulaFilterValue {
|
|
|
382
383
|
}>;
|
|
383
384
|
}
|
|
384
385
|
interface IStagesFilterItem {
|
|
386
|
+
id: number;
|
|
385
387
|
/** Название этапа */
|
|
386
388
|
name: string;
|
|
387
389
|
/** Формула фильтра этапа */
|
|
@@ -416,13 +418,6 @@ interface IWidgetFiltration {
|
|
|
416
418
|
removeStagesFilter(widgetKey: string): void;
|
|
417
419
|
}
|
|
418
420
|
|
|
419
|
-
interface IPlacement {
|
|
420
|
-
left: number;
|
|
421
|
-
top: number;
|
|
422
|
-
width: number;
|
|
423
|
-
height: number;
|
|
424
|
-
zIndex: number;
|
|
425
|
-
}
|
|
426
421
|
declare enum EWidgetFilterMode {
|
|
427
422
|
DEFAULT = "DEFAULT",
|
|
428
423
|
SINGLE = "SINGLE",
|
|
@@ -507,7 +502,7 @@ type TDisplayCondition = {
|
|
|
507
502
|
formula: TNullable<string>;
|
|
508
503
|
} | {
|
|
509
504
|
mode: EDisplayConditionMode.VARIABLE;
|
|
510
|
-
|
|
505
|
+
variableName: TNullable<string>;
|
|
511
506
|
variableValue: TNullable<string>;
|
|
512
507
|
};
|
|
513
508
|
interface IRange {
|
|
@@ -516,6 +511,165 @@ interface IRange {
|
|
|
516
511
|
max?: number;
|
|
517
512
|
}
|
|
518
513
|
|
|
514
|
+
interface IWidgetTableColumn {
|
|
515
|
+
/** Имя колонки */
|
|
516
|
+
name: string;
|
|
517
|
+
/** Тип данных колонки */
|
|
518
|
+
dataType: ESimpleDataType;
|
|
519
|
+
}
|
|
520
|
+
interface IActionScript {
|
|
521
|
+
name: string | undefined;
|
|
522
|
+
fieldsNames: Set<string>;
|
|
523
|
+
}
|
|
524
|
+
interface IWidgetTable {
|
|
525
|
+
/** Имя таблицы */
|
|
526
|
+
name: string;
|
|
527
|
+
/** Колонки таблицы */
|
|
528
|
+
columns: Map<string, IWidgetTableColumn>;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
|
|
532
|
+
*
|
|
533
|
+
* full - полный
|
|
534
|
+
*/
|
|
535
|
+
type TFiltrationMode = "simplified" | "full";
|
|
536
|
+
/**
|
|
537
|
+
* preview - упрощенный
|
|
538
|
+
*
|
|
539
|
+
* full - полный
|
|
540
|
+
*/
|
|
541
|
+
type TDisplayMode = "preview" | "full";
|
|
542
|
+
interface IDisplayRule {
|
|
543
|
+
color: TColor;
|
|
544
|
+
}
|
|
545
|
+
interface IWidgetsContext {
|
|
546
|
+
/** используемый язык в системе */
|
|
547
|
+
language: ELanguages;
|
|
548
|
+
processes: Map<string, IWidgetProcess>;
|
|
549
|
+
reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
550
|
+
workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
551
|
+
/** Переменные отчета */
|
|
552
|
+
variables: Map<string, TWidgetVariable>;
|
|
553
|
+
/** Метод установки значения переменной отчета */
|
|
554
|
+
setVariableValue(name: string, value: TNullable<string> | string[]): void;
|
|
555
|
+
statesNames: Set<string>;
|
|
556
|
+
reportName: string;
|
|
557
|
+
/**
|
|
558
|
+
* режим дашборда
|
|
559
|
+
* @deprecated 2401 - необходимо использовать displayMode */
|
|
560
|
+
isViewMode: boolean;
|
|
561
|
+
/** Режим отображения виджета */
|
|
562
|
+
displayMode: TDisplayMode;
|
|
563
|
+
/** @deprecated необходимо получать из системной переменной "Login" */
|
|
564
|
+
userLogin: string;
|
|
565
|
+
scripts: Map<string, IActionScript>;
|
|
566
|
+
tables: Set<string>;
|
|
567
|
+
filtrationMode: TFiltrationMode;
|
|
568
|
+
reportDisplayRules: Map<string, IDisplayRule>;
|
|
569
|
+
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
570
|
+
viewKeyByName: Map<string, string>;
|
|
571
|
+
fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare enum EWidgetActionInputMode {
|
|
575
|
+
FROM_COLUMN = "FROM_COLUMN",
|
|
576
|
+
FROM_VARIABLE = "FROM_VARIABLE",
|
|
577
|
+
STATIC_LIST = "STATIC_LIST",
|
|
578
|
+
DYNAMIC_LIST = "DYNAMIC_LIST",
|
|
579
|
+
FORMULA = "FORMULA",
|
|
580
|
+
MANUALLY = "MANUALLY"
|
|
581
|
+
}
|
|
582
|
+
interface IActionCommon {
|
|
583
|
+
id: number;
|
|
584
|
+
name: string;
|
|
585
|
+
}
|
|
586
|
+
declare enum EActionTypes {
|
|
587
|
+
URL = "URL",
|
|
588
|
+
UPDATE_VARIABLE = "UPDATE_VARIABLE",
|
|
589
|
+
RUN_SCRIPT = "RUN_SCRIPT",
|
|
590
|
+
OPEN_VIEW = "OPEN_VIEW"
|
|
591
|
+
}
|
|
592
|
+
interface IActionGoToUrl extends IActionCommon {
|
|
593
|
+
type: EActionTypes.URL;
|
|
594
|
+
url: string;
|
|
595
|
+
targetBlank: boolean;
|
|
596
|
+
}
|
|
597
|
+
interface IActionScriptField {
|
|
598
|
+
name: string;
|
|
599
|
+
id: number;
|
|
600
|
+
value: TWidgetActionInputValue;
|
|
601
|
+
}
|
|
602
|
+
interface IActionRunScript extends IActionCommon {
|
|
603
|
+
description: string;
|
|
604
|
+
type: EActionTypes.RUN_SCRIPT;
|
|
605
|
+
filters: (IFormulaFilterValue | string)[];
|
|
606
|
+
inputs: IActionScriptField[];
|
|
607
|
+
scriptName: string;
|
|
608
|
+
shouldRefreshWidgetsAfterExecution: boolean;
|
|
609
|
+
}
|
|
610
|
+
interface IActionUpdateVariable extends IActionCommon {
|
|
611
|
+
type: EActionTypes.UPDATE_VARIABLE;
|
|
612
|
+
variables: Array<string>;
|
|
613
|
+
}
|
|
614
|
+
declare enum EViewType {
|
|
615
|
+
CREATED_VIEW = "CREATED_VIEW",
|
|
616
|
+
GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
|
|
617
|
+
}
|
|
618
|
+
declare enum EOpenViewMode {
|
|
619
|
+
NEW_WINDOW = "NEW_WINDOW",
|
|
620
|
+
PLACEHOLDER = "PLACEHOLDER",
|
|
621
|
+
MODAL = "MODAL",
|
|
622
|
+
DRAWER = "DRAWER"
|
|
623
|
+
}
|
|
624
|
+
declare enum EDrawerPlacement {
|
|
625
|
+
LEFT = "LEFT",
|
|
626
|
+
RIGHT = "RIGHT"
|
|
627
|
+
}
|
|
628
|
+
interface IActionOpenView extends IActionCommon {
|
|
629
|
+
type: EActionTypes.OPEN_VIEW;
|
|
630
|
+
viewName: string;
|
|
631
|
+
viewKey: string;
|
|
632
|
+
openMode: EOpenViewMode;
|
|
633
|
+
viewType: EViewType;
|
|
634
|
+
drawerPlacement: EDrawerPlacement;
|
|
635
|
+
placeholderName: string;
|
|
636
|
+
inputs: IActionScriptField[];
|
|
637
|
+
isOpenInCurrentWindow?: boolean;
|
|
638
|
+
}
|
|
639
|
+
type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
|
|
640
|
+
type TWidgetActionCommonInputValue = {
|
|
641
|
+
name: string;
|
|
642
|
+
isHidden: boolean;
|
|
643
|
+
};
|
|
644
|
+
type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
|
|
645
|
+
mode: EWidgetActionInputMode.FROM_COLUMN;
|
|
646
|
+
tableName: string;
|
|
647
|
+
columnName: string;
|
|
648
|
+
} | {
|
|
649
|
+
mode: EWidgetActionInputMode.FROM_VARIABLE;
|
|
650
|
+
sourceVariable: string;
|
|
651
|
+
} | {
|
|
652
|
+
mode: EWidgetActionInputMode.FORMULA;
|
|
653
|
+
formula: string;
|
|
654
|
+
} | {
|
|
655
|
+
mode: EWidgetActionInputMode.MANUALLY;
|
|
656
|
+
description: string;
|
|
657
|
+
} | {
|
|
658
|
+
mode: EWidgetActionInputMode.STATIC_LIST;
|
|
659
|
+
options: string[];
|
|
660
|
+
defaultOptionIndex: number;
|
|
661
|
+
} | {
|
|
662
|
+
mode: EWidgetActionInputMode.DYNAMIC_LIST;
|
|
663
|
+
formula: string;
|
|
664
|
+
defaultValue: string;
|
|
665
|
+
filters: (IFormulaFilterValue | string)[];
|
|
666
|
+
});
|
|
667
|
+
interface IWidgetActionInput {
|
|
668
|
+
name: string;
|
|
669
|
+
value: TWidgetActionInputValue;
|
|
670
|
+
}
|
|
671
|
+
declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
672
|
+
|
|
519
673
|
declare enum ESortDirection {
|
|
520
674
|
descend = "DESC",
|
|
521
675
|
ascend = "ASC",
|
|
@@ -542,7 +696,7 @@ type TWidgetSortingValue = {
|
|
|
542
696
|
formula: string;
|
|
543
697
|
} | TWidgetSortingValueRelatedWidgetIndicator | {
|
|
544
698
|
mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
|
|
545
|
-
|
|
699
|
+
name: string;
|
|
546
700
|
formula: string;
|
|
547
701
|
};
|
|
548
702
|
|
|
@@ -625,7 +779,6 @@ declare enum ESortingValueModes {
|
|
|
625
779
|
IN_WORKSPACE = "IN_WORKSPACE"
|
|
626
780
|
}
|
|
627
781
|
interface ICommonColumnIndicator {
|
|
628
|
-
guid: string;
|
|
629
782
|
name: string;
|
|
630
783
|
formula: string;
|
|
631
784
|
}
|
|
@@ -655,6 +808,7 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
|
|
|
655
808
|
formatting?: EFormattingPresets;
|
|
656
809
|
formattingTemplate?: string;
|
|
657
810
|
displayCondition?: TDisplayCondition;
|
|
811
|
+
onclick?: TActionsOnClick[];
|
|
658
812
|
}
|
|
659
813
|
interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
|
|
660
814
|
/** Идентификатор, генерируемый на основе текущего времени */
|
|
@@ -740,125 +894,18 @@ type TWidgetVariable = {
|
|
|
740
894
|
};
|
|
741
895
|
declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
|
|
742
896
|
|
|
743
|
-
interface IWidgetTableColumn {
|
|
744
|
-
/** Имя колонки */
|
|
745
|
-
name: string;
|
|
746
|
-
/** Тип данных колонки */
|
|
747
|
-
dataType: ESimpleDataType;
|
|
748
|
-
}
|
|
749
|
-
interface IActionScript {
|
|
750
|
-
guid: string | undefined;
|
|
751
|
-
fieldsGuids: Set<string>;
|
|
752
|
-
}
|
|
753
|
-
interface IWidgetTable {
|
|
754
|
-
/** Имя таблицы */
|
|
755
|
-
name: string;
|
|
756
|
-
/** Колонки таблицы */
|
|
757
|
-
columns: Map<string, IWidgetTableColumn>;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* preview - упрощенный
|
|
761
|
-
*
|
|
762
|
-
* full - полный
|
|
763
|
-
*/
|
|
764
|
-
type TDisplayMode = "preview" | "full";
|
|
765
|
-
interface IDisplayRule {
|
|
766
|
-
color: TColor;
|
|
767
|
-
}
|
|
768
|
-
interface IWidgetsContext {
|
|
769
|
-
/** используемый язык в системе */
|
|
770
|
-
language: ELanguages;
|
|
771
|
-
processes: Map<string, IWidgetProcess>;
|
|
772
|
-
reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
773
|
-
workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
774
|
-
/** Переменные отчета */
|
|
775
|
-
variables: Map<string, TWidgetVariable>;
|
|
776
|
-
/** Метод установки значения переменной отчета */
|
|
777
|
-
setVariableValue(guid: string, value: TNullable<string> | string[]): void;
|
|
778
|
-
statesGuids: Set<string>;
|
|
779
|
-
reportName: string;
|
|
780
|
-
/**
|
|
781
|
-
* режим дашборда
|
|
782
|
-
* @deprecated 2401 - необходимо использовать displayMode */
|
|
783
|
-
isViewMode: boolean;
|
|
784
|
-
/** Режим отображения виджета */
|
|
785
|
-
displayMode: TDisplayMode;
|
|
786
|
-
/** @deprecated необходимо получать из системной переменной "Login" */
|
|
787
|
-
userLogin: string;
|
|
788
|
-
scripts: Map<string, IActionScript>;
|
|
789
|
-
tables: Set<string>;
|
|
790
|
-
reportDisplayRules: Map<string, IDisplayRule>;
|
|
791
|
-
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
792
|
-
fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
declare enum EWidgetActionInputMode {
|
|
796
|
-
FROM_COLUMN = "FROM_COLUMN",
|
|
797
|
-
FROM_VARIABLE = "FROM_VARIABLE",
|
|
798
|
-
STATIC_LIST = "STATIC_LIST",
|
|
799
|
-
DYNAMIC_LIST = "DYNAMIC_LIST",
|
|
800
|
-
FORMULA = "FORMULA",
|
|
801
|
-
MANUALLY = "MANUALLY"
|
|
802
|
-
}
|
|
803
|
-
type TWidgetActionCommonInputValue = {
|
|
804
|
-
name: string;
|
|
805
|
-
isHidden: boolean;
|
|
806
|
-
};
|
|
807
|
-
type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
|
|
808
|
-
mode: EWidgetActionInputMode.FROM_COLUMN;
|
|
809
|
-
tableName: string;
|
|
810
|
-
columnName: string;
|
|
811
|
-
} | {
|
|
812
|
-
mode: EWidgetActionInputMode.FROM_VARIABLE;
|
|
813
|
-
guid: string;
|
|
814
|
-
} | {
|
|
815
|
-
mode: EWidgetActionInputMode.FORMULA;
|
|
816
|
-
formula: string;
|
|
817
|
-
} | {
|
|
818
|
-
mode: EWidgetActionInputMode.MANUALLY;
|
|
819
|
-
description: string;
|
|
820
|
-
} | {
|
|
821
|
-
mode: EWidgetActionInputMode.STATIC_LIST;
|
|
822
|
-
options: string[];
|
|
823
|
-
defaultOptionIndex: number;
|
|
824
|
-
} | {
|
|
825
|
-
mode: EWidgetActionInputMode.DYNAMIC_LIST;
|
|
826
|
-
formula: string;
|
|
827
|
-
defaultValue: string;
|
|
828
|
-
filters: (IFormulaFilterValue | string)[];
|
|
829
|
-
});
|
|
830
|
-
interface IWidgetActionInput {
|
|
831
|
-
guid: string;
|
|
832
|
-
value: TWidgetActionInputValue;
|
|
833
|
-
}
|
|
834
|
-
interface IWidgetAction {
|
|
835
|
-
id: number;
|
|
836
|
-
name: string;
|
|
837
|
-
description: string;
|
|
838
|
-
filters: (IFormulaFilterValue | string)[];
|
|
839
|
-
scriptGuid?: string;
|
|
840
|
-
/** Поле name необходимо, чтобы показать название скрипта, который был удален */
|
|
841
|
-
scriptName?: string;
|
|
842
|
-
inputs: IWidgetActionInput[];
|
|
843
|
-
shouldRefreshWidgetsAfterExecution: boolean;
|
|
844
|
-
}
|
|
845
|
-
declare const isActionValid: (action: IWidgetAction, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
846
|
-
|
|
847
897
|
interface IBaseWidgetSettings {
|
|
848
|
-
apiVersion: string;
|
|
849
|
-
type: string;
|
|
850
898
|
header?: string;
|
|
851
899
|
headerSize?: number;
|
|
900
|
+
stateName?: string | null;
|
|
852
901
|
showMarkdown?: boolean;
|
|
853
902
|
markdownMeasures?: IMarkdownMeasure[];
|
|
854
903
|
markdownText?: string;
|
|
855
|
-
stateGuid?: string | null;
|
|
856
904
|
filters?: (IFormulaFilterValue | string)[];
|
|
857
905
|
filterMode?: EWidgetFilterMode;
|
|
858
906
|
ignoreFilters?: boolean;
|
|
859
|
-
placement: IPlacement;
|
|
860
907
|
sorting?: IWidgetSortingIndicator[];
|
|
861
|
-
actions?:
|
|
908
|
+
actions?: TActionsOnClick[];
|
|
862
909
|
displayCondition?: TDisplayCondition;
|
|
863
910
|
displayConditionComment?: string;
|
|
864
911
|
}
|
|
@@ -891,8 +938,9 @@ interface ISelectOption {
|
|
|
891
938
|
value: string;
|
|
892
939
|
label: string;
|
|
893
940
|
disabled?: boolean;
|
|
941
|
+
rightIcon?: "fx" | string;
|
|
894
942
|
}
|
|
895
|
-
declare enum
|
|
943
|
+
declare enum ESelectOptionTypes {
|
|
896
944
|
DIVIDER = "DIVIDER",
|
|
897
945
|
SYSTEM = "SYSTEM",
|
|
898
946
|
GROUP = "GROUP",
|
|
@@ -903,41 +951,44 @@ declare enum ECustomSelectTemplates {
|
|
|
903
951
|
FORMULA = "FORMULA",
|
|
904
952
|
DIMENSION_GROUPS = "DIMENSION_GROUPS"
|
|
905
953
|
}
|
|
906
|
-
interface
|
|
907
|
-
type:
|
|
954
|
+
interface ISelectDividerOption {
|
|
955
|
+
type: ESelectOptionTypes.DIVIDER;
|
|
908
956
|
}
|
|
909
|
-
interface
|
|
910
|
-
type:
|
|
911
|
-
template:
|
|
957
|
+
interface ISelectSystemOption<T extends string = string> {
|
|
958
|
+
type: ESelectOptionTypes.SYSTEM;
|
|
959
|
+
template: T;
|
|
912
960
|
}
|
|
913
|
-
interface
|
|
914
|
-
type:
|
|
961
|
+
interface ISelectGroupOption {
|
|
962
|
+
type: ESelectOptionTypes.GROUP;
|
|
915
963
|
label: string;
|
|
916
|
-
options:
|
|
964
|
+
options: IAddButtonSelectOption[];
|
|
917
965
|
icon: string;
|
|
918
966
|
}
|
|
919
|
-
type
|
|
920
|
-
type
|
|
921
|
-
interface
|
|
922
|
-
type:
|
|
967
|
+
type TSelectFetchOptions = () => Promise<IAddButtonSelectOption[]>;
|
|
968
|
+
type TSelectChildOptions = IAddButtonSelectOption[] | TSelectFetchOptions;
|
|
969
|
+
interface ISelectBranchOption {
|
|
970
|
+
type: ESelectOptionTypes.BRANCH;
|
|
923
971
|
label: string;
|
|
924
|
-
options:
|
|
972
|
+
options: TSelectChildOptions;
|
|
925
973
|
icon?: string;
|
|
926
974
|
disabled?: boolean;
|
|
927
975
|
}
|
|
928
|
-
interface
|
|
929
|
-
type:
|
|
976
|
+
interface ISelectLeafOption {
|
|
977
|
+
type: ESelectOptionTypes.LEAF;
|
|
930
978
|
label: string;
|
|
931
979
|
value: string;
|
|
932
980
|
onSelect: <T = object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
|
|
981
|
+
/** Строка в формате base64 */
|
|
933
982
|
icon?: string;
|
|
934
983
|
disabled?: boolean;
|
|
935
984
|
}
|
|
936
|
-
type
|
|
985
|
+
type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption;
|
|
986
|
+
type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
|
|
987
|
+
type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
|
|
937
988
|
interface ICustomAddButtonProps {
|
|
938
|
-
options:
|
|
989
|
+
options: TSelectChildOptions;
|
|
939
990
|
hasDropdown?: boolean;
|
|
940
|
-
onClick?:
|
|
991
|
+
onClick?: ISelectLeafOption["onSelect"];
|
|
941
992
|
}
|
|
942
993
|
interface IWidgetIndicatorMenuConfig {
|
|
943
994
|
hideTablesColumnsOptions?: boolean;
|
|
@@ -945,6 +996,7 @@ interface IWidgetIndicatorMenuConfig {
|
|
|
945
996
|
hideQuantityOption?: boolean;
|
|
946
997
|
}
|
|
947
998
|
interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
999
|
+
options?: TMeasureAddButtonSelectOption[];
|
|
948
1000
|
}
|
|
949
1001
|
interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
950
1002
|
}
|
|
@@ -994,6 +1046,12 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
994
1046
|
isValid?(group: IGroupSettings): boolean;
|
|
995
1047
|
/** Находится ли группа в состоянии загрузки */
|
|
996
1048
|
isLoading?(group: IGroupSettings): boolean;
|
|
1049
|
+
/** Можно ли удалять группу по умолчанию true */
|
|
1050
|
+
isRemovable?(group: IGroupSettings): boolean;
|
|
1051
|
+
/** Можно ли сортировать группу по умолчанию true */
|
|
1052
|
+
isDraggable?: boolean;
|
|
1053
|
+
/** Опциональный верхний отступ для группы */
|
|
1054
|
+
marginTop?: number;
|
|
997
1055
|
}
|
|
998
1056
|
/** Конфигурация левой панели */
|
|
999
1057
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
@@ -1051,23 +1109,12 @@ interface IWidgetPlaceholderValues {
|
|
|
1051
1109
|
isOverlay: boolean;
|
|
1052
1110
|
}
|
|
1053
1111
|
|
|
1054
|
-
/** Вид переменной для калькулятора */
|
|
1055
|
-
interface ICalculatorVariable {
|
|
1056
|
-
dataType: ESimpleDataType;
|
|
1057
|
-
value: string | string[];
|
|
1058
|
-
}
|
|
1059
|
-
/** Коллекция значений переменных по их имени */
|
|
1060
|
-
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
1112
|
/** Формат входного параметра GeneralCalculator */
|
|
1064
1113
|
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
1065
1114
|
/** Разрезы */
|
|
1066
1115
|
dimensions: ICalculatorDimensionInput[];
|
|
1067
1116
|
/** Меры */
|
|
1068
1117
|
measures: ICalculatorMeasureInput[];
|
|
1069
|
-
/** Значения переменных */
|
|
1070
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1071
1118
|
/** Фильтры, использующие WHERE */
|
|
1072
1119
|
filters: ICalculatorFilter[];
|
|
1073
1120
|
/** Фильтры, использующие HAVING */
|
|
@@ -1121,8 +1168,6 @@ interface IHistogramCalculatorInput {
|
|
|
1121
1168
|
dimensions: ICalculatorDimensionInput[];
|
|
1122
1169
|
/** Лимит корзин */
|
|
1123
1170
|
binsLimit: number;
|
|
1124
|
-
/** Значения переменных */
|
|
1125
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1126
1171
|
/** Формула условия отображения */
|
|
1127
1172
|
displayConditionFormula?: TNullable<string>;
|
|
1128
1173
|
/** Фильтры, использующие WHERE */
|
|
@@ -1167,7 +1212,7 @@ interface IEdge extends IGraphElement {
|
|
|
1167
1212
|
endName: string | null;
|
|
1168
1213
|
}
|
|
1169
1214
|
interface IProcessGraphCalculatorInput {
|
|
1170
|
-
|
|
1215
|
+
processName: string;
|
|
1171
1216
|
vertexLimit: number | null;
|
|
1172
1217
|
edgeLimit: number;
|
|
1173
1218
|
vertexMeasures: ICalculatorMeasureInput[];
|
|
@@ -1175,8 +1220,6 @@ interface IProcessGraphCalculatorInput {
|
|
|
1175
1220
|
filters: ICalculatorFilter[];
|
|
1176
1221
|
eventFilters?: ICalculatorFilter[];
|
|
1177
1222
|
displayConditionFormula?: TNullable<string>;
|
|
1178
|
-
/** Значения переменных */
|
|
1179
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1180
1223
|
}
|
|
1181
1224
|
interface IProcessGraphCalculatorOutput {
|
|
1182
1225
|
vertexMaxLimit: number;
|
|
@@ -1201,8 +1244,6 @@ interface ITwoLimitsCalculatorInput {
|
|
|
1201
1244
|
dimensionsSecondGroup: ICalculatorDimensionInput[];
|
|
1202
1245
|
/** Меры */
|
|
1203
1246
|
measures: ICalculatorMeasureInput[];
|
|
1204
|
-
/** Значения переменных */
|
|
1205
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1206
1247
|
/** Фильтры, использующие WHERE */
|
|
1207
1248
|
filters: ICalculatorFilter[];
|
|
1208
1249
|
/** Фильтры, использующие HAVING */
|
|
@@ -1247,7 +1288,6 @@ interface ITypeCalculatorInput {
|
|
|
1247
1288
|
alias: string;
|
|
1248
1289
|
formula: string;
|
|
1249
1290
|
}[];
|
|
1250
|
-
variablesValues: ICalculatorVariablesValues;
|
|
1251
1291
|
}
|
|
1252
1292
|
interface ITypeCalculatorOutput {
|
|
1253
1293
|
types: Map<string, ESimpleDataType>;
|
|
@@ -1257,8 +1297,6 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
|
|
|
1257
1297
|
|
|
1258
1298
|
declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
|
|
1259
1299
|
|
|
1260
|
-
declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
|
|
1261
|
-
|
|
1262
1300
|
declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
|
|
1263
1301
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1264
1302
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
@@ -1308,6 +1346,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
|
|
|
1308
1346
|
|
|
1309
1347
|
declare const escapeSpecialCharacters: (formula: string) => string;
|
|
1310
1348
|
|
|
1349
|
+
/** Удалить из строки символы экранирования */
|
|
1350
|
+
declare function unescapeSpecialCharacters(str: string): string;
|
|
1351
|
+
|
|
1352
|
+
/** Вид переменной для калькулятора */
|
|
1353
|
+
interface ICalculatorVariable {
|
|
1354
|
+
dataType: ESimpleDataType;
|
|
1355
|
+
value: string | string[];
|
|
1356
|
+
}
|
|
1357
|
+
/** Коллекция значений переменных по их имени */
|
|
1358
|
+
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1311
1361
|
interface ICalculatorFactory {
|
|
1312
1362
|
general: () => IGeneralCalculator;
|
|
1313
1363
|
pie: () => IPieCalculator;
|
|
@@ -1328,12 +1378,73 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
|
|
|
1328
1378
|
getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
|
|
1329
1379
|
}
|
|
1330
1380
|
|
|
1381
|
+
type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
|
|
1382
|
+
event?: MouseEvent;
|
|
1383
|
+
placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
|
|
1384
|
+
positionOrigin?: "frame" | "workArea";
|
|
1385
|
+
position?: {
|
|
1386
|
+
unitX?: TContextMenuPositionUnit;
|
|
1387
|
+
unitY?: TContextMenuPositionUnit;
|
|
1388
|
+
x?: number;
|
|
1389
|
+
y?: number;
|
|
1390
|
+
};
|
|
1391
|
+
};
|
|
1392
|
+
type TContextMenuPositionUnit = "%" | "px";
|
|
1393
|
+
type TContextMenuList = {
|
|
1394
|
+
type: "list";
|
|
1395
|
+
items: TContextMenuRow[];
|
|
1396
|
+
};
|
|
1397
|
+
type TContextMenuButtonGroup = {
|
|
1398
|
+
type: "buttonGroup";
|
|
1399
|
+
items: TContextMenuButton[];
|
|
1400
|
+
};
|
|
1401
|
+
type TContextMenuRow = {
|
|
1402
|
+
key: string;
|
|
1403
|
+
label: string;
|
|
1404
|
+
onClick: () => void;
|
|
1405
|
+
};
|
|
1406
|
+
type TContextMenuButton = TContextMenuButtonActions | TContextMenuButtonClose | TContextMenuButtonApply | TContextMenuButtonCustom | TContextMenuButtonOptions;
|
|
1407
|
+
type TContextMenuButtonActions = {
|
|
1408
|
+
type: "actions";
|
|
1409
|
+
actions: TActionsOnClick[];
|
|
1410
|
+
onClick: (action: TActionsOnClick) => void;
|
|
1411
|
+
};
|
|
1412
|
+
type TContextMenuButtonClose = {
|
|
1413
|
+
type: "close";
|
|
1414
|
+
onClick?: () => void;
|
|
1415
|
+
};
|
|
1416
|
+
type TContextMenuButtonApply = {
|
|
1417
|
+
type: "apply";
|
|
1418
|
+
onClick: () => void;
|
|
1419
|
+
};
|
|
1420
|
+
type TContextMenuButtonCustom = {
|
|
1421
|
+
key: string;
|
|
1422
|
+
type: "custom";
|
|
1423
|
+
icon: string;
|
|
1424
|
+
onClick: () => void;
|
|
1425
|
+
};
|
|
1426
|
+
type TContextMenuButtonOptions = {
|
|
1427
|
+
key: string;
|
|
1428
|
+
type: "options";
|
|
1429
|
+
icon: string;
|
|
1430
|
+
items: TContextMenuRow[];
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1331
1433
|
type TLaunchActionParams = {
|
|
1332
|
-
action:
|
|
1434
|
+
action: TActionsOnClick;
|
|
1333
1435
|
onSuccess: () => void;
|
|
1334
1436
|
filters: ICalculatorFilter[];
|
|
1335
1437
|
needConfirmation?: boolean;
|
|
1336
1438
|
};
|
|
1439
|
+
interface ILaunchActionSubscribers {
|
|
1440
|
+
onActionSuccess(callback: () => void): void;
|
|
1441
|
+
}
|
|
1442
|
+
type TWidgetContainer = {
|
|
1443
|
+
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
1444
|
+
isMaxHeightLimited: boolean;
|
|
1445
|
+
/** Установить минимальную высоту рабочей области виджета */
|
|
1446
|
+
setContentMinHeight(value: number): void;
|
|
1447
|
+
};
|
|
1337
1448
|
interface IWidgetPersistValue<T extends object = object> {
|
|
1338
1449
|
get(): T | null;
|
|
1339
1450
|
set(value: T | null): void;
|
|
@@ -1362,10 +1473,14 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1362
1473
|
placeholderValues: IWidgetPlaceholderValues;
|
|
1363
1474
|
/** Контекст виджета */
|
|
1364
1475
|
widgetsContext: IWidgetsContext;
|
|
1476
|
+
/** Данные о контейнере виджета */
|
|
1477
|
+
widgetContainer: TWidgetContainer;
|
|
1365
1478
|
/** Запуск действия */
|
|
1366
|
-
launchAction(params: TLaunchActionParams):
|
|
1479
|
+
launchAction(params: TLaunchActionParams): ILaunchActionSubscribers;
|
|
1367
1480
|
/** Значение, сохраняемое в localStorage и URL */
|
|
1368
1481
|
persistValue: IWidgetPersistValue;
|
|
1482
|
+
/** функция для управления контекстными меню */
|
|
1483
|
+
setContextMenu: (key: string, value: TContextMenu | null) => void;
|
|
1369
1484
|
}
|
|
1370
1485
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1371
1486
|
/** @deprecated - нужно использовать из widgetsContext */
|
|
@@ -1537,4 +1652,4 @@ declare global {
|
|
|
1537
1652
|
}
|
|
1538
1653
|
}
|
|
1539
1654
|
|
|
1540
|
-
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType,
|
|
1655
|
+
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 ILaunchActionSubscribers, 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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -71,24 +71,51 @@ var EWidgetActionInputMode;
|
|
|
71
71
|
EWidgetActionInputMode["FORMULA"] = "FORMULA";
|
|
72
72
|
EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
|
|
73
73
|
})(EWidgetActionInputMode || (EWidgetActionInputMode = {}));
|
|
74
|
+
var EActionTypes;
|
|
75
|
+
(function (EActionTypes) {
|
|
76
|
+
EActionTypes["URL"] = "URL";
|
|
77
|
+
EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
|
|
78
|
+
EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
|
|
79
|
+
EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
|
|
80
|
+
})(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 = {}));
|
|
93
|
+
var EDrawerPlacement;
|
|
94
|
+
(function (EDrawerPlacement) {
|
|
95
|
+
EDrawerPlacement["LEFT"] = "LEFT";
|
|
96
|
+
EDrawerPlacement["RIGHT"] = "RIGHT";
|
|
97
|
+
})(EDrawerPlacement || (EDrawerPlacement = {}));
|
|
74
98
|
var isActionValid = function (action, _a) {
|
|
75
99
|
var _b;
|
|
76
100
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
77
|
-
|
|
101
|
+
if (action.type !== EActionTypes.RUN_SCRIPT) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
78
105
|
if (!currentScript) {
|
|
79
106
|
return false;
|
|
80
107
|
}
|
|
81
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
82
|
-
if (actionInputsMap.size < currentScript.
|
|
108
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
109
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
83
110
|
return false;
|
|
84
111
|
}
|
|
85
|
-
return __spreadArray([], __read(currentScript.
|
|
86
|
-
var actionInput = actionInputsMap.get(
|
|
112
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
113
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
87
114
|
if (!actionInput) {
|
|
88
115
|
return false;
|
|
89
116
|
}
|
|
90
117
|
var value = actionInput.value;
|
|
91
|
-
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
118
|
+
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
|
|
92
119
|
return false;
|
|
93
120
|
}
|
|
94
121
|
if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -132,21 +159,6 @@ var escapeSingularQuotes = function (formula) {
|
|
|
132
159
|
return formula.replaceAll("'", "\\'");
|
|
133
160
|
};
|
|
134
161
|
|
|
135
|
-
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
136
|
-
var compactMap = function (items, f) {
|
|
137
|
-
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
138
|
-
};
|
|
139
|
-
var isNil = function (value) {
|
|
140
|
-
return value === null || value === undefined;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
function mapVariablesToInputs(variables) {
|
|
144
|
-
return new Map(compactMap(__spreadArray([], __read(variables.values()), false), function (_a) {
|
|
145
|
-
var name = _a.name, dataType = _a.dataType, value = _a.value;
|
|
146
|
-
return !isNil(value) ? [name, { dataType: dataType, value: value }] : null;
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
162
|
var ECalculatorFilterMethods;
|
|
151
163
|
(function (ECalculatorFilterMethods) {
|
|
152
164
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -192,6 +204,14 @@ var EFormulaFilterFieldKeys;
|
|
|
192
204
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
193
205
|
})(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
|
|
194
206
|
|
|
207
|
+
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
208
|
+
var compactMap = function (items, f) {
|
|
209
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
210
|
+
};
|
|
211
|
+
var isNil = function (value) {
|
|
212
|
+
return value === null || value === undefined;
|
|
213
|
+
};
|
|
214
|
+
|
|
195
215
|
var EFormatTypes;
|
|
196
216
|
(function (EFormatTypes) {
|
|
197
217
|
/** Дата */
|
|
@@ -504,8 +524,8 @@ var EDisplayConditionMode;
|
|
|
504
524
|
function checkDisplayCondition(displayCondition, variables) {
|
|
505
525
|
var _a;
|
|
506
526
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === EDisplayConditionMode.VARIABLE) {
|
|
507
|
-
var
|
|
508
|
-
var currentVariableValue =
|
|
527
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
528
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
509
529
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
510
530
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
511
531
|
: currentVariableValue === variableValue;
|
|
@@ -940,6 +960,11 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
940
960
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
941
961
|
}
|
|
942
962
|
|
|
963
|
+
/** Удалить из строки символы экранирования */
|
|
964
|
+
function unescapeSpecialCharacters(str) {
|
|
965
|
+
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
966
|
+
}
|
|
967
|
+
|
|
943
968
|
var EControlType;
|
|
944
969
|
(function (EControlType) {
|
|
945
970
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -963,14 +988,14 @@ var EControlType;
|
|
|
963
988
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
964
989
|
})(EControlType || (EControlType = {}));
|
|
965
990
|
|
|
966
|
-
var
|
|
967
|
-
(function (
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
})(
|
|
991
|
+
var ESelectOptionTypes;
|
|
992
|
+
(function (ESelectOptionTypes) {
|
|
993
|
+
ESelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
994
|
+
ESelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
995
|
+
ESelectOptionTypes["GROUP"] = "GROUP";
|
|
996
|
+
ESelectOptionTypes["BRANCH"] = "BRANCH";
|
|
997
|
+
ESelectOptionTypes["LEAF"] = "LEAF";
|
|
998
|
+
})(ESelectOptionTypes || (ESelectOptionTypes = {}));
|
|
974
999
|
var ECustomSelectTemplates;
|
|
975
1000
|
(function (ECustomSelectTemplates) {
|
|
976
1001
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1079,4 +1104,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1079
1104
|
return localization.getLocalized(locObj, props);
|
|
1080
1105
|
};
|
|
1081
1106
|
|
|
1082
|
-
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -72,24 +72,51 @@ exports.EWidgetActionInputMode = void 0;
|
|
|
72
72
|
EWidgetActionInputMode["FORMULA"] = "FORMULA";
|
|
73
73
|
EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
|
|
74
74
|
})(exports.EWidgetActionInputMode || (exports.EWidgetActionInputMode = {}));
|
|
75
|
+
exports.EActionTypes = void 0;
|
|
76
|
+
(function (EActionTypes) {
|
|
77
|
+
EActionTypes["URL"] = "URL";
|
|
78
|
+
EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
|
|
79
|
+
EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
|
|
80
|
+
EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
|
|
81
|
+
})(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 = {}));
|
|
94
|
+
exports.EDrawerPlacement = void 0;
|
|
95
|
+
(function (EDrawerPlacement) {
|
|
96
|
+
EDrawerPlacement["LEFT"] = "LEFT";
|
|
97
|
+
EDrawerPlacement["RIGHT"] = "RIGHT";
|
|
98
|
+
})(exports.EDrawerPlacement || (exports.EDrawerPlacement = {}));
|
|
75
99
|
var isActionValid = function (action, _a) {
|
|
76
100
|
var _b;
|
|
77
101
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
78
|
-
|
|
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 : "");
|
|
79
106
|
if (!currentScript) {
|
|
80
107
|
return false;
|
|
81
108
|
}
|
|
82
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
83
|
-
if (actionInputsMap.size < currentScript.
|
|
109
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
110
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
84
111
|
return false;
|
|
85
112
|
}
|
|
86
|
-
return __spreadArray([], __read(currentScript.
|
|
87
|
-
var actionInput = actionInputsMap.get(
|
|
113
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
114
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
88
115
|
if (!actionInput) {
|
|
89
116
|
return false;
|
|
90
117
|
}
|
|
91
118
|
var value = actionInput.value;
|
|
92
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
119
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
|
|
93
120
|
return false;
|
|
94
121
|
}
|
|
95
122
|
if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -133,21 +160,6 @@ var escapeSingularQuotes = function (formula) {
|
|
|
133
160
|
return formula.replaceAll("'", "\\'");
|
|
134
161
|
};
|
|
135
162
|
|
|
136
|
-
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
137
|
-
var compactMap = function (items, f) {
|
|
138
|
-
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
139
|
-
};
|
|
140
|
-
var isNil = function (value) {
|
|
141
|
-
return value === null || value === undefined;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
function mapVariablesToInputs(variables) {
|
|
145
|
-
return new Map(compactMap(__spreadArray([], __read(variables.values()), false), function (_a) {
|
|
146
|
-
var name = _a.name, dataType = _a.dataType, value = _a.value;
|
|
147
|
-
return !isNil(value) ? [name, { dataType: dataType, value: value }] : null;
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
163
|
exports.ECalculatorFilterMethods = void 0;
|
|
152
164
|
(function (ECalculatorFilterMethods) {
|
|
153
165
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -193,6 +205,14 @@ exports.EFormulaFilterFieldKeys = void 0;
|
|
|
193
205
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
194
206
|
})(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
|
|
195
207
|
|
|
208
|
+
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
209
|
+
var compactMap = function (items, f) {
|
|
210
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
211
|
+
};
|
|
212
|
+
var isNil = function (value) {
|
|
213
|
+
return value === null || value === undefined;
|
|
214
|
+
};
|
|
215
|
+
|
|
196
216
|
exports.EFormatTypes = void 0;
|
|
197
217
|
(function (EFormatTypes) {
|
|
198
218
|
/** Дата */
|
|
@@ -505,8 +525,8 @@ exports.EDisplayConditionMode = void 0;
|
|
|
505
525
|
function checkDisplayCondition(displayCondition, variables) {
|
|
506
526
|
var _a;
|
|
507
527
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === exports.EDisplayConditionMode.VARIABLE) {
|
|
508
|
-
var
|
|
509
|
-
var currentVariableValue =
|
|
528
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
529
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
510
530
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
511
531
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
512
532
|
: currentVariableValue === variableValue;
|
|
@@ -941,6 +961,11 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
941
961
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
942
962
|
}
|
|
943
963
|
|
|
964
|
+
/** Удалить из строки символы экранирования */
|
|
965
|
+
function unescapeSpecialCharacters(str) {
|
|
966
|
+
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
967
|
+
}
|
|
968
|
+
|
|
944
969
|
exports.EControlType = void 0;
|
|
945
970
|
(function (EControlType) {
|
|
946
971
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -964,14 +989,14 @@ exports.EControlType = void 0;
|
|
|
964
989
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
965
990
|
})(exports.EControlType || (exports.EControlType = {}));
|
|
966
991
|
|
|
967
|
-
exports.
|
|
968
|
-
(function (
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
})(exports.
|
|
992
|
+
exports.ESelectOptionTypes = void 0;
|
|
993
|
+
(function (ESelectOptionTypes) {
|
|
994
|
+
ESelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
995
|
+
ESelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
996
|
+
ESelectOptionTypes["GROUP"] = "GROUP";
|
|
997
|
+
ESelectOptionTypes["BRANCH"] = "BRANCH";
|
|
998
|
+
ESelectOptionTypes["LEAF"] = "LEAF";
|
|
999
|
+
})(exports.ESelectOptionTypes || (exports.ESelectOptionTypes = {}));
|
|
975
1000
|
exports.ECustomSelectTemplates = void 0;
|
|
976
1001
|
(function (ECustomSelectTemplates) {
|
|
977
1002
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1112,7 +1137,6 @@ exports.mapFormulaFiltersToInputs = mapFormulaFiltersToInputs;
|
|
|
1112
1137
|
exports.mapMeasuresToInputs = mapMeasuresToInputs;
|
|
1113
1138
|
exports.mapSortingToInputs = mapSortingToInputs;
|
|
1114
1139
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1115
|
-
exports.mapVariablesToInputs = mapVariablesToInputs;
|
|
1116
1140
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1117
1141
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1118
1142
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
@@ -1120,6 +1144,7 @@ exports.replaceFiltersBySelection = replaceFiltersBySelection;
|
|
|
1120
1144
|
exports.replaceHierarchiesWithDimensions = replaceHierarchiesWithDimensions;
|
|
1121
1145
|
exports.selectDimensionFromHierarchy = selectDimensionFromHierarchy;
|
|
1122
1146
|
exports.transitionMeasureTemplateFormulas = transitionMeasureTemplateFormulas;
|
|
1147
|
+
exports.unescapeSpecialCharacters = unescapeSpecialCharacters;
|
|
1123
1148
|
exports.updateDefaultModeSelection = updateDefaultModeSelection;
|
|
1124
1149
|
exports.updateMultiModeSelection = updateMultiModeSelection;
|
|
1125
1150
|
exports.updateSingleModeSelection = updateSingleModeSelection;
|