@infomaximum/widget-sdk 3.38.1 → 3.38.2
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 +166 -281
- package/dist/index.esm.js +32 -57
- package/dist/index.js +32 -57
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,6 @@ interface IControlRecord<Settings extends object, Value, ControlType = EControlT
|
|
|
44
44
|
title?: string;
|
|
45
45
|
/** Тип используемого элемента управления настройкой из предложенных нашей системой */
|
|
46
46
|
type: ControlType | string;
|
|
47
|
-
marginTop?: number;
|
|
48
47
|
/** Объект дополнительных параметров элемента управления */
|
|
49
48
|
props?: object | ((settings: Settings) => object);
|
|
50
49
|
/** Описание доступа к значению настройки */
|
|
@@ -312,16 +311,16 @@ interface IProcessFilterValue {
|
|
|
312
311
|
* События, доступные при выборе процесса.
|
|
313
312
|
* Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
|
|
314
313
|
*/
|
|
315
|
-
|
|
314
|
+
eventsNamesByProcessGuidMap?: Map<string, (string | null)[]>;
|
|
316
315
|
}
|
|
317
316
|
interface IProcessEventFilterValue extends IProcessFilterValue {
|
|
318
|
-
|
|
317
|
+
processGuid: string;
|
|
319
318
|
eventName: string;
|
|
320
319
|
}
|
|
321
320
|
interface IProcessTransitionFilterValue extends IProcessFilterValue {
|
|
322
|
-
|
|
321
|
+
startEventProcessGuid: string;
|
|
323
322
|
startEventName: string;
|
|
324
|
-
|
|
323
|
+
endEventProcessGuid: string;
|
|
325
324
|
endEventName: string;
|
|
326
325
|
}
|
|
327
326
|
interface IClickPosition {
|
|
@@ -383,7 +382,6 @@ interface IFormulaFilterValue {
|
|
|
383
382
|
}>;
|
|
384
383
|
}
|
|
385
384
|
interface IStagesFilterItem {
|
|
386
|
-
id: number;
|
|
387
385
|
/** Название этапа */
|
|
388
386
|
name: string;
|
|
389
387
|
/** Формула фильтра этапа */
|
|
@@ -418,6 +416,13 @@ interface IWidgetFiltration {
|
|
|
418
416
|
removeStagesFilter(widgetKey: string): void;
|
|
419
417
|
}
|
|
420
418
|
|
|
419
|
+
interface IPlacement {
|
|
420
|
+
left: number;
|
|
421
|
+
top: number;
|
|
422
|
+
width: number;
|
|
423
|
+
height: number;
|
|
424
|
+
zIndex: number;
|
|
425
|
+
}
|
|
421
426
|
declare enum EWidgetFilterMode {
|
|
422
427
|
DEFAULT = "DEFAULT",
|
|
423
428
|
SINGLE = "SINGLE",
|
|
@@ -502,7 +507,7 @@ type TDisplayCondition = {
|
|
|
502
507
|
formula: TNullable<string>;
|
|
503
508
|
} | {
|
|
504
509
|
mode: EDisplayConditionMode.VARIABLE;
|
|
505
|
-
|
|
510
|
+
variableGuid: TNullable<string>;
|
|
506
511
|
variableValue: TNullable<string>;
|
|
507
512
|
};
|
|
508
513
|
interface IRange {
|
|
@@ -511,165 +516,6 @@ interface IRange {
|
|
|
511
516
|
max?: number;
|
|
512
517
|
}
|
|
513
518
|
|
|
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
|
-
|
|
673
519
|
declare enum ESortDirection {
|
|
674
520
|
descend = "DESC",
|
|
675
521
|
ascend = "ASC",
|
|
@@ -696,7 +542,7 @@ type TWidgetSortingValue = {
|
|
|
696
542
|
formula: string;
|
|
697
543
|
} | TWidgetSortingValueRelatedWidgetIndicator | {
|
|
698
544
|
mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
|
|
699
|
-
|
|
545
|
+
guid: string;
|
|
700
546
|
formula: string;
|
|
701
547
|
};
|
|
702
548
|
|
|
@@ -779,6 +625,7 @@ declare enum ESortingValueModes {
|
|
|
779
625
|
IN_WORKSPACE = "IN_WORKSPACE"
|
|
780
626
|
}
|
|
781
627
|
interface ICommonColumnIndicator {
|
|
628
|
+
guid: string;
|
|
782
629
|
name: string;
|
|
783
630
|
formula: string;
|
|
784
631
|
}
|
|
@@ -808,7 +655,6 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
|
|
|
808
655
|
formatting?: EFormattingPresets;
|
|
809
656
|
formattingTemplate?: string;
|
|
810
657
|
displayCondition?: TDisplayCondition;
|
|
811
|
-
onclick?: TActionsOnClick[];
|
|
812
658
|
}
|
|
813
659
|
interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
|
|
814
660
|
/** Идентификатор, генерируемый на основе текущего времени */
|
|
@@ -894,18 +740,125 @@ type TWidgetVariable = {
|
|
|
894
740
|
};
|
|
895
741
|
declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
|
|
896
742
|
|
|
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
|
+
|
|
897
847
|
interface IBaseWidgetSettings {
|
|
848
|
+
apiVersion: string;
|
|
849
|
+
type: string;
|
|
898
850
|
header?: string;
|
|
899
851
|
headerSize?: number;
|
|
900
|
-
stateName?: string | null;
|
|
901
852
|
showMarkdown?: boolean;
|
|
902
853
|
markdownMeasures?: IMarkdownMeasure[];
|
|
903
854
|
markdownText?: string;
|
|
855
|
+
stateGuid?: string | null;
|
|
904
856
|
filters?: (IFormulaFilterValue | string)[];
|
|
905
857
|
filterMode?: EWidgetFilterMode;
|
|
906
858
|
ignoreFilters?: boolean;
|
|
859
|
+
placement: IPlacement;
|
|
907
860
|
sorting?: IWidgetSortingIndicator[];
|
|
908
|
-
actions?:
|
|
861
|
+
actions?: IWidgetAction[];
|
|
909
862
|
displayCondition?: TDisplayCondition;
|
|
910
863
|
displayConditionComment?: string;
|
|
911
864
|
}
|
|
@@ -938,9 +891,8 @@ interface ISelectOption {
|
|
|
938
891
|
value: string;
|
|
939
892
|
label: string;
|
|
940
893
|
disabled?: boolean;
|
|
941
|
-
rightIcon?: "fx" | string;
|
|
942
894
|
}
|
|
943
|
-
declare enum
|
|
895
|
+
declare enum ECustomSelectOptionTypes {
|
|
944
896
|
DIVIDER = "DIVIDER",
|
|
945
897
|
SYSTEM = "SYSTEM",
|
|
946
898
|
GROUP = "GROUP",
|
|
@@ -951,44 +903,41 @@ declare enum ECustomSelectTemplates {
|
|
|
951
903
|
FORMULA = "FORMULA",
|
|
952
904
|
DIMENSION_GROUPS = "DIMENSION_GROUPS"
|
|
953
905
|
}
|
|
954
|
-
interface
|
|
955
|
-
type:
|
|
906
|
+
interface ICustomSelectDividerOption {
|
|
907
|
+
type: ECustomSelectOptionTypes.DIVIDER;
|
|
956
908
|
}
|
|
957
|
-
interface
|
|
958
|
-
type:
|
|
959
|
-
template:
|
|
909
|
+
interface ICustomSelectSystemOption {
|
|
910
|
+
type: ECustomSelectOptionTypes.SYSTEM;
|
|
911
|
+
template: ECustomSelectTemplates;
|
|
960
912
|
}
|
|
961
|
-
interface
|
|
962
|
-
type:
|
|
913
|
+
interface ICustomSelectGroupOption {
|
|
914
|
+
type: ECustomSelectOptionTypes.GROUP;
|
|
963
915
|
label: string;
|
|
964
|
-
options:
|
|
916
|
+
options: ICustomSelectOption[];
|
|
965
917
|
icon: string;
|
|
966
918
|
}
|
|
967
|
-
type
|
|
968
|
-
type
|
|
969
|
-
interface
|
|
970
|
-
type:
|
|
919
|
+
type TCustomSelectFetchOptions = () => Promise<ICustomSelectOption[]>;
|
|
920
|
+
type TCustomSelectChildOptions = ICustomSelectOption[] | TCustomSelectFetchOptions;
|
|
921
|
+
interface ICustomSelectBranchOption {
|
|
922
|
+
type: ECustomSelectOptionTypes.BRANCH;
|
|
971
923
|
label: string;
|
|
972
|
-
options:
|
|
924
|
+
options: TCustomSelectChildOptions;
|
|
973
925
|
icon?: string;
|
|
974
926
|
disabled?: boolean;
|
|
975
927
|
}
|
|
976
|
-
interface
|
|
977
|
-
type:
|
|
928
|
+
interface ICustomSelectLeafOption {
|
|
929
|
+
type: ECustomSelectOptionTypes.LEAF;
|
|
978
930
|
label: string;
|
|
979
931
|
value: string;
|
|
980
932
|
onSelect: <T = object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
|
|
981
|
-
/** Строка в формате base64 */
|
|
982
933
|
icon?: string;
|
|
983
934
|
disabled?: boolean;
|
|
984
935
|
}
|
|
985
|
-
type
|
|
986
|
-
type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
|
|
987
|
-
type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
|
|
936
|
+
type ICustomSelectOption = ICustomSelectDividerOption | ICustomSelectSystemOption | ICustomSelectGroupOption | ICustomSelectBranchOption | ICustomSelectLeafOption;
|
|
988
937
|
interface ICustomAddButtonProps {
|
|
989
|
-
options:
|
|
938
|
+
options: TCustomSelectChildOptions;
|
|
990
939
|
hasDropdown?: boolean;
|
|
991
|
-
onClick?:
|
|
940
|
+
onClick?: ICustomSelectLeafOption["onSelect"];
|
|
992
941
|
}
|
|
993
942
|
interface IWidgetIndicatorMenuConfig {
|
|
994
943
|
hideTablesColumnsOptions?: boolean;
|
|
@@ -996,7 +945,6 @@ interface IWidgetIndicatorMenuConfig {
|
|
|
996
945
|
hideQuantityOption?: boolean;
|
|
997
946
|
}
|
|
998
947
|
interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
999
|
-
options?: TMeasureAddButtonSelectOption[];
|
|
1000
948
|
}
|
|
1001
949
|
interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
1002
950
|
}
|
|
@@ -1046,12 +994,6 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
1046
994
|
isValid?(group: IGroupSettings): boolean;
|
|
1047
995
|
/** Находится ли группа в состоянии загрузки */
|
|
1048
996
|
isLoading?(group: IGroupSettings): boolean;
|
|
1049
|
-
/** Можно ли удалять группу по умолчанию true */
|
|
1050
|
-
isRemovable?(group: IGroupSettings): boolean;
|
|
1051
|
-
/** Можно ли сортировать группу по умолчанию true */
|
|
1052
|
-
isDraggable?: boolean;
|
|
1053
|
-
/** Опциональный верхний отступ для группы */
|
|
1054
|
-
marginTop?: number;
|
|
1055
997
|
}
|
|
1056
998
|
/** Конфигурация левой панели */
|
|
1057
999
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
@@ -1109,12 +1051,23 @@ interface IWidgetPlaceholderValues {
|
|
|
1109
1051
|
isOverlay: boolean;
|
|
1110
1052
|
}
|
|
1111
1053
|
|
|
1054
|
+
/** Вид переменной для калькулятора */
|
|
1055
|
+
interface ICalculatorVariable {
|
|
1056
|
+
dataType: ESimpleDataType;
|
|
1057
|
+
value: string | string[];
|
|
1058
|
+
}
|
|
1059
|
+
/** Коллекция значений переменных по их имени */
|
|
1060
|
+
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1112
1063
|
/** Формат входного параметра GeneralCalculator */
|
|
1113
1064
|
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
1114
1065
|
/** Разрезы */
|
|
1115
1066
|
dimensions: ICalculatorDimensionInput[];
|
|
1116
1067
|
/** Меры */
|
|
1117
1068
|
measures: ICalculatorMeasureInput[];
|
|
1069
|
+
/** Значения переменных */
|
|
1070
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1118
1071
|
/** Фильтры, использующие WHERE */
|
|
1119
1072
|
filters: ICalculatorFilter[];
|
|
1120
1073
|
/** Фильтры, использующие HAVING */
|
|
@@ -1168,6 +1121,8 @@ interface IHistogramCalculatorInput {
|
|
|
1168
1121
|
dimensions: ICalculatorDimensionInput[];
|
|
1169
1122
|
/** Лимит корзин */
|
|
1170
1123
|
binsLimit: number;
|
|
1124
|
+
/** Значения переменных */
|
|
1125
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1171
1126
|
/** Формула условия отображения */
|
|
1172
1127
|
displayConditionFormula?: TNullable<string>;
|
|
1173
1128
|
/** Фильтры, использующие WHERE */
|
|
@@ -1212,7 +1167,7 @@ interface IEdge extends IGraphElement {
|
|
|
1212
1167
|
endName: string | null;
|
|
1213
1168
|
}
|
|
1214
1169
|
interface IProcessGraphCalculatorInput {
|
|
1215
|
-
|
|
1170
|
+
processGuid: string;
|
|
1216
1171
|
vertexLimit: number | null;
|
|
1217
1172
|
edgeLimit: number;
|
|
1218
1173
|
vertexMeasures: ICalculatorMeasureInput[];
|
|
@@ -1220,6 +1175,8 @@ interface IProcessGraphCalculatorInput {
|
|
|
1220
1175
|
filters: ICalculatorFilter[];
|
|
1221
1176
|
eventFilters?: ICalculatorFilter[];
|
|
1222
1177
|
displayConditionFormula?: TNullable<string>;
|
|
1178
|
+
/** Значения переменных */
|
|
1179
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1223
1180
|
}
|
|
1224
1181
|
interface IProcessGraphCalculatorOutput {
|
|
1225
1182
|
vertexMaxLimit: number;
|
|
@@ -1244,6 +1201,8 @@ interface ITwoLimitsCalculatorInput {
|
|
|
1244
1201
|
dimensionsSecondGroup: ICalculatorDimensionInput[];
|
|
1245
1202
|
/** Меры */
|
|
1246
1203
|
measures: ICalculatorMeasureInput[];
|
|
1204
|
+
/** Значения переменных */
|
|
1205
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1247
1206
|
/** Фильтры, использующие WHERE */
|
|
1248
1207
|
filters: ICalculatorFilter[];
|
|
1249
1208
|
/** Фильтры, использующие HAVING */
|
|
@@ -1288,6 +1247,7 @@ interface ITypeCalculatorInput {
|
|
|
1288
1247
|
alias: string;
|
|
1289
1248
|
formula: string;
|
|
1290
1249
|
}[];
|
|
1250
|
+
variablesValues: ICalculatorVariablesValues;
|
|
1291
1251
|
}
|
|
1292
1252
|
interface ITypeCalculatorOutput {
|
|
1293
1253
|
types: Map<string, ESimpleDataType>;
|
|
@@ -1297,6 +1257,8 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
|
|
|
1297
1257
|
|
|
1298
1258
|
declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
|
|
1299
1259
|
|
|
1260
|
+
declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
|
|
1261
|
+
|
|
1300
1262
|
declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
|
|
1301
1263
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1302
1264
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
@@ -1346,18 +1308,6 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
|
|
|
1346
1308
|
|
|
1347
1309
|
declare const escapeSpecialCharacters: (formula: string) => string;
|
|
1348
1310
|
|
|
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
|
-
|
|
1361
1311
|
interface ICalculatorFactory {
|
|
1362
1312
|
general: () => IGeneralCalculator;
|
|
1363
1313
|
pie: () => IPieCalculator;
|
|
@@ -1378,73 +1328,12 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
|
|
|
1378
1328
|
getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
|
|
1379
1329
|
}
|
|
1380
1330
|
|
|
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
|
-
|
|
1433
1331
|
type TLaunchActionParams = {
|
|
1434
|
-
action:
|
|
1332
|
+
action: IWidgetAction;
|
|
1435
1333
|
onSuccess: () => void;
|
|
1436
1334
|
filters: ICalculatorFilter[];
|
|
1437
1335
|
needConfirmation?: boolean;
|
|
1438
1336
|
};
|
|
1439
|
-
interface ILaunchActionSubscribers {
|
|
1440
|
-
onActionSuccess(callback: () => void): void;
|
|
1441
|
-
}
|
|
1442
|
-
type TWidgetContainer = {
|
|
1443
|
-
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
1444
|
-
isMaxHeightLimited: boolean;
|
|
1445
|
-
/** Установить минимальную высоту рабочей области виджета */
|
|
1446
|
-
setContentMinHeight(value: number): void;
|
|
1447
|
-
};
|
|
1448
1337
|
interface IWidgetPersistValue<T extends object = object> {
|
|
1449
1338
|
get(): T | null;
|
|
1450
1339
|
set(value: T | null): void;
|
|
@@ -1473,14 +1362,10 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1473
1362
|
placeholderValues: IWidgetPlaceholderValues;
|
|
1474
1363
|
/** Контекст виджета */
|
|
1475
1364
|
widgetsContext: IWidgetsContext;
|
|
1476
|
-
/** Данные о контейнере виджета */
|
|
1477
|
-
widgetContainer: TWidgetContainer;
|
|
1478
1365
|
/** Запуск действия */
|
|
1479
|
-
launchAction(params: TLaunchActionParams):
|
|
1366
|
+
launchAction(params: TLaunchActionParams): void;
|
|
1480
1367
|
/** Значение, сохраняемое в localStorage и URL */
|
|
1481
1368
|
persistValue: IWidgetPersistValue;
|
|
1482
|
-
/** функция для управления контекстными меню */
|
|
1483
|
-
setContextMenu: (key: string, value: TContextMenu | null) => void;
|
|
1484
1369
|
}
|
|
1485
1370
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1486
1371
|
/** @deprecated - нужно использовать из widgetsContext */
|
|
@@ -1652,4 +1537,4 @@ declare global {
|
|
|
1652
1537
|
}
|
|
1653
1538
|
}
|
|
1654
1539
|
|
|
1655
|
-
export {
|
|
1540
|
+
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectOptionTypes, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionScript, 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 ICustomSelectBranchOption, type ICustomSelectDividerOption, type ICustomSelectGroupOption, type ICustomSelectLeafOption, type ICustomSelectOption, type ICustomSelectSystemOption, 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 IPlacement, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectOption, 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 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 TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TCustomSelectChildOptions, type TCustomSelectFetchOptions, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TGroupLevelRecord, type TLaunchActionParams, type TProcessIndicatorValue, type TRecordAccessor, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionCommonInputValue, type TWidgetActionInputValue, 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, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.esm.js
CHANGED
|
@@ -71,51 +71,24 @@ 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 = {}));
|
|
98
74
|
var isActionValid = function (action, _a) {
|
|
99
75
|
var _b;
|
|
100
76
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
101
|
-
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
77
|
+
var currentScript = scripts.get((_b = action.scriptGuid) !== null && _b !== void 0 ? _b : "");
|
|
105
78
|
if (!currentScript) {
|
|
106
79
|
return false;
|
|
107
80
|
}
|
|
108
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
109
|
-
if (actionInputsMap.size < currentScript.
|
|
81
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.guid, input]; }));
|
|
82
|
+
if (actionInputsMap.size < currentScript.fieldsGuids.size) {
|
|
110
83
|
return false;
|
|
111
84
|
}
|
|
112
|
-
return __spreadArray([], __read(currentScript.
|
|
113
|
-
var actionInput = actionInputsMap.get(
|
|
85
|
+
return __spreadArray([], __read(currentScript.fieldsGuids), false).every(function (guid) {
|
|
86
|
+
var actionInput = actionInputsMap.get(guid !== null && guid !== void 0 ? guid : "");
|
|
114
87
|
if (!actionInput) {
|
|
115
88
|
return false;
|
|
116
89
|
}
|
|
117
90
|
var value = actionInput.value;
|
|
118
|
-
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
91
|
+
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.guid)) {
|
|
119
92
|
return false;
|
|
120
93
|
}
|
|
121
94
|
if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -159,6 +132,21 @@ var escapeSingularQuotes = function (formula) {
|
|
|
159
132
|
return formula.replaceAll("'", "\\'");
|
|
160
133
|
};
|
|
161
134
|
|
|
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
|
+
|
|
162
150
|
var ECalculatorFilterMethods;
|
|
163
151
|
(function (ECalculatorFilterMethods) {
|
|
164
152
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -204,14 +192,6 @@ var EFormulaFilterFieldKeys;
|
|
|
204
192
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
205
193
|
})(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
|
|
206
194
|
|
|
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
|
-
|
|
215
195
|
var EFormatTypes;
|
|
216
196
|
(function (EFormatTypes) {
|
|
217
197
|
/** Дата */
|
|
@@ -524,8 +504,8 @@ var EDisplayConditionMode;
|
|
|
524
504
|
function checkDisplayCondition(displayCondition, variables) {
|
|
525
505
|
var _a;
|
|
526
506
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === EDisplayConditionMode.VARIABLE) {
|
|
527
|
-
var
|
|
528
|
-
var currentVariableValue =
|
|
507
|
+
var variableGuid = displayCondition.variableGuid, variableValue = displayCondition.variableValue;
|
|
508
|
+
var currentVariableValue = variableGuid && ((_a = variables.get(variableGuid)) === null || _a === void 0 ? void 0 : _a.value);
|
|
529
509
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
530
510
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
531
511
|
: currentVariableValue === variableValue;
|
|
@@ -960,11 +940,6 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
960
940
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
961
941
|
}
|
|
962
942
|
|
|
963
|
-
/** Удалить из строки символы экранирования */
|
|
964
|
-
function unescapeSpecialCharacters(str) {
|
|
965
|
-
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
966
|
-
}
|
|
967
|
-
|
|
968
943
|
var EControlType;
|
|
969
944
|
(function (EControlType) {
|
|
970
945
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -988,14 +963,14 @@ var EControlType;
|
|
|
988
963
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
989
964
|
})(EControlType || (EControlType = {}));
|
|
990
965
|
|
|
991
|
-
var
|
|
992
|
-
(function (
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
})(
|
|
966
|
+
var ECustomSelectOptionTypes;
|
|
967
|
+
(function (ECustomSelectOptionTypes) {
|
|
968
|
+
ECustomSelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
969
|
+
ECustomSelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
970
|
+
ECustomSelectOptionTypes["GROUP"] = "GROUP";
|
|
971
|
+
ECustomSelectOptionTypes["BRANCH"] = "BRANCH";
|
|
972
|
+
ECustomSelectOptionTypes["LEAF"] = "LEAF";
|
|
973
|
+
})(ECustomSelectOptionTypes || (ECustomSelectOptionTypes = {}));
|
|
999
974
|
var ECustomSelectTemplates;
|
|
1000
975
|
(function (ECustomSelectTemplates) {
|
|
1001
976
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1104,4 +1079,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1104
1079
|
return localization.getLocalized(locObj, props);
|
|
1105
1080
|
};
|
|
1106
1081
|
|
|
1107
|
-
export {
|
|
1082
|
+
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectOptionTypes, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, 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, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.js
CHANGED
|
@@ -72,51 +72,24 @@ 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 = {}));
|
|
99
75
|
var isActionValid = function (action, _a) {
|
|
100
76
|
var _b;
|
|
101
77
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
102
|
-
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
78
|
+
var currentScript = scripts.get((_b = action.scriptGuid) !== null && _b !== void 0 ? _b : "");
|
|
106
79
|
if (!currentScript) {
|
|
107
80
|
return false;
|
|
108
81
|
}
|
|
109
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
110
|
-
if (actionInputsMap.size < currentScript.
|
|
82
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.guid, input]; }));
|
|
83
|
+
if (actionInputsMap.size < currentScript.fieldsGuids.size) {
|
|
111
84
|
return false;
|
|
112
85
|
}
|
|
113
|
-
return __spreadArray([], __read(currentScript.
|
|
114
|
-
var actionInput = actionInputsMap.get(
|
|
86
|
+
return __spreadArray([], __read(currentScript.fieldsGuids), false).every(function (guid) {
|
|
87
|
+
var actionInput = actionInputsMap.get(guid !== null && guid !== void 0 ? guid : "");
|
|
115
88
|
if (!actionInput) {
|
|
116
89
|
return false;
|
|
117
90
|
}
|
|
118
91
|
var value = actionInput.value;
|
|
119
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
92
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.guid)) {
|
|
120
93
|
return false;
|
|
121
94
|
}
|
|
122
95
|
if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -160,6 +133,21 @@ var escapeSingularQuotes = function (formula) {
|
|
|
160
133
|
return formula.replaceAll("'", "\\'");
|
|
161
134
|
};
|
|
162
135
|
|
|
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
|
+
|
|
163
151
|
exports.ECalculatorFilterMethods = void 0;
|
|
164
152
|
(function (ECalculatorFilterMethods) {
|
|
165
153
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -205,14 +193,6 @@ exports.EFormulaFilterFieldKeys = void 0;
|
|
|
205
193
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
206
194
|
})(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
|
|
207
195
|
|
|
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
|
-
|
|
216
196
|
exports.EFormatTypes = void 0;
|
|
217
197
|
(function (EFormatTypes) {
|
|
218
198
|
/** Дата */
|
|
@@ -525,8 +505,8 @@ exports.EDisplayConditionMode = void 0;
|
|
|
525
505
|
function checkDisplayCondition(displayCondition, variables) {
|
|
526
506
|
var _a;
|
|
527
507
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === exports.EDisplayConditionMode.VARIABLE) {
|
|
528
|
-
var
|
|
529
|
-
var currentVariableValue =
|
|
508
|
+
var variableGuid = displayCondition.variableGuid, variableValue = displayCondition.variableValue;
|
|
509
|
+
var currentVariableValue = variableGuid && ((_a = variables.get(variableGuid)) === null || _a === void 0 ? void 0 : _a.value);
|
|
530
510
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
531
511
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
532
512
|
: currentVariableValue === variableValue;
|
|
@@ -961,11 +941,6 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
961
941
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
962
942
|
}
|
|
963
943
|
|
|
964
|
-
/** Удалить из строки символы экранирования */
|
|
965
|
-
function unescapeSpecialCharacters(str) {
|
|
966
|
-
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
967
|
-
}
|
|
968
|
-
|
|
969
944
|
exports.EControlType = void 0;
|
|
970
945
|
(function (EControlType) {
|
|
971
946
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -989,14 +964,14 @@ exports.EControlType = void 0;
|
|
|
989
964
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
990
965
|
})(exports.EControlType || (exports.EControlType = {}));
|
|
991
966
|
|
|
992
|
-
exports.
|
|
993
|
-
(function (
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
})(exports.
|
|
967
|
+
exports.ECustomSelectOptionTypes = void 0;
|
|
968
|
+
(function (ECustomSelectOptionTypes) {
|
|
969
|
+
ECustomSelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
970
|
+
ECustomSelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
971
|
+
ECustomSelectOptionTypes["GROUP"] = "GROUP";
|
|
972
|
+
ECustomSelectOptionTypes["BRANCH"] = "BRANCH";
|
|
973
|
+
ECustomSelectOptionTypes["LEAF"] = "LEAF";
|
|
974
|
+
})(exports.ECustomSelectOptionTypes || (exports.ECustomSelectOptionTypes = {}));
|
|
1000
975
|
exports.ECustomSelectTemplates = void 0;
|
|
1001
976
|
(function (ECustomSelectTemplates) {
|
|
1002
977
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1137,6 +1112,7 @@ exports.mapFormulaFiltersToInputs = mapFormulaFiltersToInputs;
|
|
|
1137
1112
|
exports.mapMeasuresToInputs = mapMeasuresToInputs;
|
|
1138
1113
|
exports.mapSortingToInputs = mapSortingToInputs;
|
|
1139
1114
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1115
|
+
exports.mapVariablesToInputs = mapVariablesToInputs;
|
|
1140
1116
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1141
1117
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1142
1118
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
@@ -1144,7 +1120,6 @@ exports.replaceFiltersBySelection = replaceFiltersBySelection;
|
|
|
1144
1120
|
exports.replaceHierarchiesWithDimensions = replaceHierarchiesWithDimensions;
|
|
1145
1121
|
exports.selectDimensionFromHierarchy = selectDimensionFromHierarchy;
|
|
1146
1122
|
exports.transitionMeasureTemplateFormulas = transitionMeasureTemplateFormulas;
|
|
1147
|
-
exports.unescapeSpecialCharacters = unescapeSpecialCharacters;
|
|
1148
1123
|
exports.updateDefaultModeSelection = updateDefaultModeSelection;
|
|
1149
1124
|
exports.updateMultiModeSelection = updateMultiModeSelection;
|
|
1150
1125
|
exports.updateSingleModeSelection = updateSingleModeSelection;
|