@infomaximum/widget-sdk 3.38.1 → 3.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +362 -477
- 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,251 +740,170 @@ 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
|
}
|
|
912
865
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
866
|
+
/** Вид переменной для калькулятора */
|
|
867
|
+
interface ICalculatorVariable {
|
|
868
|
+
dataType: ESimpleDataType;
|
|
869
|
+
value: string | string[];
|
|
916
870
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
interface IDisplayPredicate<Settings> {
|
|
920
|
-
(s: Settings): boolean;
|
|
871
|
+
/** Коллекция значений переменных по их имени */
|
|
872
|
+
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
921
873
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
874
|
+
|
|
875
|
+
/** Формат входного параметра GeneralCalculator */
|
|
876
|
+
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
877
|
+
/** Разрезы */
|
|
878
|
+
dimensions: ICalculatorDimensionInput[];
|
|
879
|
+
/** Меры */
|
|
880
|
+
measures: ICalculatorMeasureInput[];
|
|
881
|
+
/** Значения переменных */
|
|
882
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
883
|
+
/** Фильтры, использующие WHERE */
|
|
884
|
+
filters: ICalculatorFilter[];
|
|
885
|
+
/** Фильтры, использующие HAVING */
|
|
886
|
+
postFilters?: ICalculatorFilter[];
|
|
887
|
+
/** Лимит мер (будут вычислены первые measuresLimit мер, попавшие под условие отображения) */
|
|
888
|
+
measuresLimit?: number;
|
|
889
|
+
/** Лимит разрезов (будут вычислены первые dimensionsLimit разрезов, попавшие под условие отображения) */
|
|
890
|
+
dimensionsLimit?: number;
|
|
891
|
+
/** Удалять ли строки, в которых значения всех мер пустые */
|
|
892
|
+
isHideEmptyMeasures?: boolean;
|
|
893
|
+
/**
|
|
894
|
+
* Направления сортировки (в качестве ключа - формула показателя)
|
|
895
|
+
* todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
|
|
896
|
+
* правильнее будет указывать его явно через массив.
|
|
897
|
+
*/
|
|
898
|
+
sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
|
|
899
|
+
/** Формула условия отображения */
|
|
900
|
+
displayConditionFormula?: TNullable<string>;
|
|
926
901
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
type TEmptyRecord = boolean | null | undefined;
|
|
933
|
-
/** Набор конфигураций, которые могут встречаться на уровне виджета */
|
|
934
|
-
type TWidgetLevelRecord<Settings extends object> = IControlRecord<Settings, any, EControlType> | IDividerRecord<Settings> | IGroupSetRecord | TEmptyRecord;
|
|
935
|
-
/** Набор конфигураций, которые могут встречаться на уровне группы */
|
|
936
|
-
type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<LevelGroupSettings, any, EControlType> | IDividerRecord<LevelGroupSettings> | TEmptyRecord;
|
|
937
|
-
interface ISelectOption {
|
|
938
|
-
value: string;
|
|
939
|
-
label: string;
|
|
940
|
-
disabled?: boolean;
|
|
941
|
-
rightIcon?: "fx" | string;
|
|
942
|
-
}
|
|
943
|
-
declare enum ESelectOptionTypes {
|
|
944
|
-
DIVIDER = "DIVIDER",
|
|
945
|
-
SYSTEM = "SYSTEM",
|
|
946
|
-
GROUP = "GROUP",
|
|
947
|
-
BRANCH = "BRANCH",
|
|
948
|
-
LEAF = "LEAF"
|
|
949
|
-
}
|
|
950
|
-
declare enum ECustomSelectTemplates {
|
|
951
|
-
FORMULA = "FORMULA",
|
|
952
|
-
DIMENSION_GROUPS = "DIMENSION_GROUPS"
|
|
953
|
-
}
|
|
954
|
-
interface ISelectDividerOption {
|
|
955
|
-
type: ESelectOptionTypes.DIVIDER;
|
|
956
|
-
}
|
|
957
|
-
interface ISelectSystemOption<T extends string = string> {
|
|
958
|
-
type: ESelectOptionTypes.SYSTEM;
|
|
959
|
-
template: T;
|
|
960
|
-
}
|
|
961
|
-
interface ISelectGroupOption {
|
|
962
|
-
type: ESelectOptionTypes.GROUP;
|
|
963
|
-
label: string;
|
|
964
|
-
options: IAddButtonSelectOption[];
|
|
965
|
-
icon: string;
|
|
966
|
-
}
|
|
967
|
-
type TSelectFetchOptions = () => Promise<IAddButtonSelectOption[]>;
|
|
968
|
-
type TSelectChildOptions = IAddButtonSelectOption[] | TSelectFetchOptions;
|
|
969
|
-
interface ISelectBranchOption {
|
|
970
|
-
type: ESelectOptionTypes.BRANCH;
|
|
971
|
-
label: string;
|
|
972
|
-
options: TSelectChildOptions;
|
|
973
|
-
icon?: string;
|
|
974
|
-
disabled?: boolean;
|
|
975
|
-
}
|
|
976
|
-
interface ISelectLeafOption {
|
|
977
|
-
type: ESelectOptionTypes.LEAF;
|
|
978
|
-
label: string;
|
|
979
|
-
value: string;
|
|
980
|
-
onSelect: <T = object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
|
|
981
|
-
/** Строка в формате base64 */
|
|
982
|
-
icon?: string;
|
|
983
|
-
disabled?: boolean;
|
|
984
|
-
}
|
|
985
|
-
type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption;
|
|
986
|
-
type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
|
|
987
|
-
type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
|
|
988
|
-
interface ICustomAddButtonProps {
|
|
989
|
-
options: TSelectChildOptions;
|
|
990
|
-
hasDropdown?: boolean;
|
|
991
|
-
onClick?: ISelectLeafOption["onSelect"];
|
|
992
|
-
}
|
|
993
|
-
interface IWidgetIndicatorMenuConfig {
|
|
994
|
-
hideTablesColumnsOptions?: boolean;
|
|
995
|
-
hideCommonOptions?: boolean;
|
|
996
|
-
hideQuantityOption?: boolean;
|
|
997
|
-
}
|
|
998
|
-
interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
999
|
-
options?: TMeasureAddButtonSelectOption[];
|
|
1000
|
-
}
|
|
1001
|
-
interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
1002
|
-
}
|
|
1003
|
-
/** Кнопка добавления группы в набор */
|
|
1004
|
-
type TAddButton = {
|
|
1005
|
-
title: string;
|
|
1006
|
-
indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM | EWidgetIndicatorType.MEASURE | EWidgetIndicatorType.SORTING>;
|
|
1007
|
-
} | {
|
|
1008
|
-
title: string;
|
|
1009
|
-
indicatorType: EWidgetIndicatorType.CUSTOM;
|
|
1010
|
-
props: ICustomAddButtonProps;
|
|
1011
|
-
} | {
|
|
1012
|
-
title: string;
|
|
1013
|
-
indicatorType: EWidgetIndicatorType.MEASURE;
|
|
1014
|
-
menuConfig?: IMeasureMenuConfig;
|
|
1015
|
-
} | {
|
|
1016
|
-
title: string;
|
|
1017
|
-
indicatorType: EWidgetIndicatorType.SORTING;
|
|
1018
|
-
menuConfig?: ISortingMenuConfig;
|
|
1019
|
-
};
|
|
1020
|
-
interface IAutoIdentifiedArrayItem {
|
|
1021
|
-
/**
|
|
1022
|
-
* Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
|
|
1023
|
-
* Гарантируется уникальность id в пределах settings виджета.
|
|
1024
|
-
*/
|
|
1025
|
-
id: number;
|
|
1026
|
-
}
|
|
1027
|
-
interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
|
|
1028
|
-
}
|
|
1029
|
-
/** Конфигурация набора групп */
|
|
1030
|
-
interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
|
|
1031
|
-
/** Заголовок */
|
|
1032
|
-
title: string;
|
|
1033
|
-
/** Максимальное количество групп в наборе */
|
|
1034
|
-
maxCount: number;
|
|
1035
|
-
/** Описание доступа к настройкам групп */
|
|
1036
|
-
accessor: TRecordAccessor<Settings, GroupSettings[]>;
|
|
1037
|
-
/** Кнопки добавления группы в набор */
|
|
1038
|
-
addButtons: TAddButton[];
|
|
1039
|
-
/** Создать элементы управления внутри группы (для вкладки настроек данных) */
|
|
1040
|
-
createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1041
|
-
/** Создать элементы управления внутри группы (для вкладки настроек отображения) */
|
|
1042
|
-
createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1043
|
-
/** Получить название для плашки */
|
|
1044
|
-
getGroupTitle?(group: IGroupSettings): string;
|
|
1045
|
-
/** Валидная ли группа */
|
|
1046
|
-
isValid?(group: IGroupSettings): boolean;
|
|
1047
|
-
/** Находится ли группа в состоянии загрузки */
|
|
1048
|
-
isLoading?(group: IGroupSettings): boolean;
|
|
1049
|
-
/** Можно ли удалять группу по умолчанию true */
|
|
1050
|
-
isRemovable?(group: IGroupSettings): boolean;
|
|
1051
|
-
/** Можно ли сортировать группу по умолчанию true */
|
|
1052
|
-
isDraggable?: boolean;
|
|
1053
|
-
/** Опциональный верхний отступ для группы */
|
|
1054
|
-
marginTop?: number;
|
|
1055
|
-
}
|
|
1056
|
-
/** Конфигурация левой панели */
|
|
1057
|
-
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
1058
|
-
/** Добавить заголовок для виджета */
|
|
1059
|
-
useHeader?: boolean;
|
|
1060
|
-
/** Добавить описание для виджета */
|
|
1061
|
-
useMarkdown?: boolean;
|
|
1062
|
-
/** Конфигурация настроек данных виджета */
|
|
1063
|
-
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
1064
|
-
/** Конфигурация настроек отображения виджета */
|
|
1065
|
-
displayRecords?: TWidgetLevelRecord<Settings>[];
|
|
1066
|
-
/** Конфигурации наборов групп */
|
|
1067
|
-
groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
|
|
1068
|
-
}
|
|
1069
|
-
interface IWidgetProcess {
|
|
1070
|
-
guid: string;
|
|
1071
|
-
/** Имя процесса */
|
|
1072
|
-
name: string;
|
|
1073
|
-
/** Формула имени события */
|
|
1074
|
-
eventNameFormula: string;
|
|
1075
|
-
/** Формула времени события */
|
|
1076
|
-
eventTimeFormula: string;
|
|
1077
|
-
/** Формула CaseId события */
|
|
1078
|
-
eventCaseIdFormula: string;
|
|
1079
|
-
/** Формула CaseId кейса */
|
|
1080
|
-
caseCaseIdFormula: string;
|
|
1081
|
-
/** Имя колонки CaseId события */
|
|
1082
|
-
eventCaseIdColumnName: string;
|
|
1083
|
-
/** Тип данных CaseId */
|
|
1084
|
-
caseIdDataType: ESimpleDataType;
|
|
1085
|
-
/** Тип данных времени события */
|
|
1086
|
-
eventTimeDataType: ESimpleDataType;
|
|
1087
|
-
/** Является ли процесс валидным */
|
|
1088
|
-
isValid: boolean;
|
|
1089
|
-
}
|
|
1090
|
-
/** Конфигурация левой панели при погружении на уровень вниз */
|
|
1091
|
-
interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
|
|
1092
|
-
}
|
|
1093
|
-
interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
|
|
1094
|
-
(context: IWidgetsContext, panelSettings: Settings): IPanelDescription<Settings, GroupSettings>;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
interface IWidgetPlaceholderController {
|
|
1098
|
-
setError(value: Error | null): void;
|
|
1099
|
-
setConfigured(value: boolean): void;
|
|
1100
|
-
setDisplay(value: boolean): void;
|
|
1101
|
-
setEmpty(value: boolean): void;
|
|
1102
|
-
setOverlay(value: boolean): void;
|
|
1103
|
-
}
|
|
1104
|
-
interface IWidgetPlaceholderValues {
|
|
1105
|
-
error: Error | null;
|
|
1106
|
-
isConfigured: boolean;
|
|
1107
|
-
isDisplay: boolean | undefined;
|
|
1108
|
-
isEmpty: boolean;
|
|
1109
|
-
isOverlay: boolean;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
/** Формат входного параметра GeneralCalculator */
|
|
1113
|
-
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
1114
|
-
/** Разрезы */
|
|
1115
|
-
dimensions: ICalculatorDimensionInput[];
|
|
1116
|
-
/** Меры */
|
|
1117
|
-
measures: ICalculatorMeasureInput[];
|
|
1118
|
-
/** Фильтры, использующие WHERE */
|
|
1119
|
-
filters: ICalculatorFilter[];
|
|
1120
|
-
/** Фильтры, использующие HAVING */
|
|
1121
|
-
postFilters?: ICalculatorFilter[];
|
|
1122
|
-
/** Лимит мер (будут вычислены первые measuresLimit мер, попавшие под условие отображения) */
|
|
1123
|
-
measuresLimit?: number;
|
|
1124
|
-
/** Лимит разрезов (будут вычислены первые dimensionsLimit разрезов, попавшие под условие отображения) */
|
|
1125
|
-
dimensionsLimit?: number;
|
|
1126
|
-
/** Удалять ли строки, в которых значения всех мер пустые */
|
|
1127
|
-
isHideEmptyMeasures?: boolean;
|
|
1128
|
-
/**
|
|
1129
|
-
* Направления сортировки (в качестве ключа - формула показателя)
|
|
1130
|
-
* todo: widgets - удалить вариант с Map, т.к. при сортировке важен порядок элементов,
|
|
1131
|
-
* правильнее будет указывать его явно через массив.
|
|
1132
|
-
*/
|
|
1133
|
-
sortOrders?: ISortOrder[] | Map<string, TSortDirection>;
|
|
1134
|
-
/** Формула условия отображения */
|
|
1135
|
-
displayConditionFormula?: TNullable<string>;
|
|
1136
|
-
}
|
|
1137
|
-
interface IBaseDimensionsAndMeasuresCalculatorOutput {
|
|
1138
|
-
dimensions: Map<string, ICalculatorDimensionOutput>;
|
|
1139
|
-
measures: Map<string, ICalculatorMeasureOutput>;
|
|
1140
|
-
isDisplay: boolean;
|
|
1141
|
-
isValuesEmpty: boolean;
|
|
902
|
+
interface IBaseDimensionsAndMeasuresCalculatorOutput {
|
|
903
|
+
dimensions: Map<string, ICalculatorDimensionOutput>;
|
|
904
|
+
measures: Map<string, ICalculatorMeasureOutput>;
|
|
905
|
+
isDisplay: boolean;
|
|
906
|
+
isValuesEmpty: boolean;
|
|
1142
907
|
}
|
|
1143
908
|
interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
|
|
1144
909
|
}
|
|
@@ -1168,6 +933,8 @@ interface IHistogramCalculatorInput {
|
|
|
1168
933
|
dimensions: ICalculatorDimensionInput[];
|
|
1169
934
|
/** Лимит корзин */
|
|
1170
935
|
binsLimit: number;
|
|
936
|
+
/** Значения переменных */
|
|
937
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1171
938
|
/** Формула условия отображения */
|
|
1172
939
|
displayConditionFormula?: TNullable<string>;
|
|
1173
940
|
/** Фильтры, использующие WHERE */
|
|
@@ -1212,7 +979,7 @@ interface IEdge extends IGraphElement {
|
|
|
1212
979
|
endName: string | null;
|
|
1213
980
|
}
|
|
1214
981
|
interface IProcessGraphCalculatorInput {
|
|
1215
|
-
|
|
982
|
+
processGuid: string;
|
|
1216
983
|
vertexLimit: number | null;
|
|
1217
984
|
edgeLimit: number;
|
|
1218
985
|
vertexMeasures: ICalculatorMeasureInput[];
|
|
@@ -1220,6 +987,8 @@ interface IProcessGraphCalculatorInput {
|
|
|
1220
987
|
filters: ICalculatorFilter[];
|
|
1221
988
|
eventFilters?: ICalculatorFilter[];
|
|
1222
989
|
displayConditionFormula?: TNullable<string>;
|
|
990
|
+
/** Значения переменных */
|
|
991
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1223
992
|
}
|
|
1224
993
|
interface IProcessGraphCalculatorOutput {
|
|
1225
994
|
vertexMaxLimit: number;
|
|
@@ -1244,6 +1013,8 @@ interface ITwoLimitsCalculatorInput {
|
|
|
1244
1013
|
dimensionsSecondGroup: ICalculatorDimensionInput[];
|
|
1245
1014
|
/** Меры */
|
|
1246
1015
|
measures: ICalculatorMeasureInput[];
|
|
1016
|
+
/** Значения переменных */
|
|
1017
|
+
variablesValues?: ICalculatorVariablesValues;
|
|
1247
1018
|
/** Фильтры, использующие WHERE */
|
|
1248
1019
|
filters: ICalculatorFilter[];
|
|
1249
1020
|
/** Фильтры, использующие HAVING */
|
|
@@ -1288,6 +1059,7 @@ interface ITypeCalculatorInput {
|
|
|
1288
1059
|
alias: string;
|
|
1289
1060
|
formula: string;
|
|
1290
1061
|
}[];
|
|
1062
|
+
variablesValues: ICalculatorVariablesValues;
|
|
1291
1063
|
}
|
|
1292
1064
|
interface ITypeCalculatorOutput {
|
|
1293
1065
|
types: Map<string, ESimpleDataType>;
|
|
@@ -1297,6 +1069,8 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
|
|
|
1297
1069
|
|
|
1298
1070
|
declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
|
|
1299
1071
|
|
|
1072
|
+
declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
|
|
1073
|
+
|
|
1300
1074
|
declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
|
|
1301
1075
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1302
1076
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
@@ -1346,18 +1120,6 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
|
|
|
1346
1120
|
|
|
1347
1121
|
declare const escapeSpecialCharacters: (formula: string) => string;
|
|
1348
1122
|
|
|
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
1123
|
interface ICalculatorFactory {
|
|
1362
1124
|
general: () => IGeneralCalculator;
|
|
1363
1125
|
pie: () => IPieCalculator;
|
|
@@ -1367,6 +1129,194 @@ interface ICalculatorFactory {
|
|
|
1367
1129
|
type: () => ITypeCalculator;
|
|
1368
1130
|
}
|
|
1369
1131
|
|
|
1132
|
+
interface ILens<T extends TNullable<object>, Value> {
|
|
1133
|
+
get(obj: T): TNullable<Value>;
|
|
1134
|
+
set(obj: T, value: Value): void;
|
|
1135
|
+
}
|
|
1136
|
+
type TValuePath = string | string[];
|
|
1137
|
+
type TRecordAccessor<Settings extends object, Value> = TValuePath | ILens<Settings, Value>;
|
|
1138
|
+
interface IDisplayPredicate<Settings> {
|
|
1139
|
+
(s: Settings): boolean;
|
|
1140
|
+
}
|
|
1141
|
+
/** Конфигурация разделителя */
|
|
1142
|
+
interface IDividerRecord<Settings extends object = object> {
|
|
1143
|
+
type: "divider";
|
|
1144
|
+
shouldDisplay?: IDisplayPredicate<Settings>;
|
|
1145
|
+
}
|
|
1146
|
+
/** Конфигурация набора групп */
|
|
1147
|
+
interface IGroupSetRecord {
|
|
1148
|
+
type: "groupSet";
|
|
1149
|
+
groupSetKey: string;
|
|
1150
|
+
}
|
|
1151
|
+
type TEmptyRecord = boolean | null | undefined;
|
|
1152
|
+
/** Набор конфигураций, которые могут встречаться на уровне виджета */
|
|
1153
|
+
type TWidgetLevelRecord<Settings extends object> = IControlRecord<Settings, any, EControlType> | IDividerRecord<Settings> | IGroupSetRecord | TEmptyRecord;
|
|
1154
|
+
/** Набор конфигураций, которые могут встречаться на уровне группы */
|
|
1155
|
+
type TGroupLevelRecord<LevelGroupSettings extends object> = IControlRecord<LevelGroupSettings, any, EControlType> | IDividerRecord<LevelGroupSettings> | TEmptyRecord;
|
|
1156
|
+
interface ISelectOption {
|
|
1157
|
+
value: string;
|
|
1158
|
+
label: string;
|
|
1159
|
+
disabled?: boolean;
|
|
1160
|
+
}
|
|
1161
|
+
declare enum ECustomSelectOptionTypes {
|
|
1162
|
+
DIVIDER = "DIVIDER",
|
|
1163
|
+
SYSTEM = "SYSTEM",
|
|
1164
|
+
GROUP = "GROUP",
|
|
1165
|
+
BRANCH = "BRANCH",
|
|
1166
|
+
LEAF = "LEAF"
|
|
1167
|
+
}
|
|
1168
|
+
declare enum ECustomSelectTemplates {
|
|
1169
|
+
FORMULA = "FORMULA",
|
|
1170
|
+
DIMENSION_GROUPS = "DIMENSION_GROUPS"
|
|
1171
|
+
}
|
|
1172
|
+
interface ICustomSelectDividerOption {
|
|
1173
|
+
type: ECustomSelectOptionTypes.DIVIDER;
|
|
1174
|
+
}
|
|
1175
|
+
interface ICustomSelectSystemOption {
|
|
1176
|
+
type: ECustomSelectOptionTypes.SYSTEM;
|
|
1177
|
+
template: ECustomSelectTemplates;
|
|
1178
|
+
}
|
|
1179
|
+
interface ICustomSelectGroupOption {
|
|
1180
|
+
type: ECustomSelectOptionTypes.GROUP;
|
|
1181
|
+
label: string;
|
|
1182
|
+
options: ICustomSelectOption[];
|
|
1183
|
+
icon: string;
|
|
1184
|
+
}
|
|
1185
|
+
type TCustomSelectFetchOptions = () => Promise<ICustomSelectOption[]>;
|
|
1186
|
+
type TCustomSelectChildOptions = ICustomSelectOption[] | TCustomSelectFetchOptions;
|
|
1187
|
+
interface ICustomSelectBranchOption {
|
|
1188
|
+
type: ECustomSelectOptionTypes.BRANCH;
|
|
1189
|
+
label: string;
|
|
1190
|
+
options: TCustomSelectChildOptions;
|
|
1191
|
+
icon?: string;
|
|
1192
|
+
disabled?: boolean;
|
|
1193
|
+
}
|
|
1194
|
+
interface ICustomSelectLeafOption {
|
|
1195
|
+
type: ECustomSelectOptionTypes.LEAF;
|
|
1196
|
+
label: string;
|
|
1197
|
+
value: string;
|
|
1198
|
+
onSelect: <T extends object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
|
|
1199
|
+
icon?: string;
|
|
1200
|
+
disabled?: boolean;
|
|
1201
|
+
}
|
|
1202
|
+
type ICustomSelectOption = ICustomSelectDividerOption | ICustomSelectSystemOption | ICustomSelectGroupOption | ICustomSelectBranchOption | ICustomSelectLeafOption;
|
|
1203
|
+
interface ICustomAddButtonProps {
|
|
1204
|
+
options: TCustomSelectChildOptions;
|
|
1205
|
+
hasDropdown?: boolean;
|
|
1206
|
+
onClick?: ICustomSelectLeafOption["onSelect"];
|
|
1207
|
+
}
|
|
1208
|
+
interface IWidgetIndicatorMenuConfig {
|
|
1209
|
+
hideTablesColumnsOptions?: boolean;
|
|
1210
|
+
hideCommonOptions?: boolean;
|
|
1211
|
+
hideQuantityOption?: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
1214
|
+
}
|
|
1215
|
+
interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
1216
|
+
}
|
|
1217
|
+
/** Кнопка добавления группы в набор */
|
|
1218
|
+
type TAddButton = {
|
|
1219
|
+
title: string;
|
|
1220
|
+
indicatorType: Exclude<EWidgetIndicatorType, EWidgetIndicatorType.CUSTOM | EWidgetIndicatorType.MEASURE | EWidgetIndicatorType.SORTING>;
|
|
1221
|
+
} | {
|
|
1222
|
+
title: string;
|
|
1223
|
+
indicatorType: EWidgetIndicatorType.CUSTOM;
|
|
1224
|
+
props: ICustomAddButtonProps;
|
|
1225
|
+
} | {
|
|
1226
|
+
title: string;
|
|
1227
|
+
indicatorType: EWidgetIndicatorType.MEASURE;
|
|
1228
|
+
menuConfig?: IMeasureMenuConfig;
|
|
1229
|
+
} | {
|
|
1230
|
+
title: string;
|
|
1231
|
+
indicatorType: EWidgetIndicatorType.SORTING;
|
|
1232
|
+
menuConfig?: ISortingMenuConfig;
|
|
1233
|
+
};
|
|
1234
|
+
interface IAutoIdentifiedArrayItem {
|
|
1235
|
+
/**
|
|
1236
|
+
* Идентификатор, добавляемый системой "на лету" для удобства разработки, не сохраняется на сервер.
|
|
1237
|
+
* Гарантируется уникальность id в пределах settings виджета.
|
|
1238
|
+
*/
|
|
1239
|
+
id: number;
|
|
1240
|
+
}
|
|
1241
|
+
interface IGroupSettings extends IAutoIdentifiedArrayItem, Record<string, any> {
|
|
1242
|
+
}
|
|
1243
|
+
/** Конфигурация набора групп */
|
|
1244
|
+
interface IGroupSetDescription<Settings extends object, GroupSettings extends object> {
|
|
1245
|
+
/** Заголовок */
|
|
1246
|
+
title: string;
|
|
1247
|
+
/** Максимальное количество групп в наборе */
|
|
1248
|
+
maxCount: number;
|
|
1249
|
+
/** Описание доступа к настройкам групп */
|
|
1250
|
+
accessor: TRecordAccessor<Settings, GroupSettings[]>;
|
|
1251
|
+
/** Кнопки добавления группы в набор */
|
|
1252
|
+
addButtons: TAddButton[];
|
|
1253
|
+
/** Создать элементы управления внутри группы (для вкладки настроек данных) */
|
|
1254
|
+
createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1255
|
+
/** Создать элементы управления внутри группы (для вкладки настроек отображения) */
|
|
1256
|
+
createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1257
|
+
/** Получить название для плашки */
|
|
1258
|
+
getGroupTitle?(group: IGroupSettings): string;
|
|
1259
|
+
/** Валидная ли группа */
|
|
1260
|
+
isValid?(group: IGroupSettings): boolean;
|
|
1261
|
+
/** Находится ли группа в состоянии загрузки */
|
|
1262
|
+
isLoading?(group: IGroupSettings): boolean;
|
|
1263
|
+
}
|
|
1264
|
+
/** Конфигурация левой панели */
|
|
1265
|
+
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
1266
|
+
/** Добавить заголовок для виджета */
|
|
1267
|
+
useHeader?: boolean;
|
|
1268
|
+
/** Добавить описание для виджета */
|
|
1269
|
+
useMarkdown?: boolean;
|
|
1270
|
+
/** Конфигурация настроек данных виджета */
|
|
1271
|
+
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
1272
|
+
/** Конфигурация настроек отображения виджета */
|
|
1273
|
+
displayRecords?: TWidgetLevelRecord<Settings>[];
|
|
1274
|
+
/** Конфигурации наборов групп */
|
|
1275
|
+
groupSetDescriptions?: Record<string, IGroupSetDescription<Settings, GroupSettings>>;
|
|
1276
|
+
}
|
|
1277
|
+
interface IWidgetProcess {
|
|
1278
|
+
guid: string;
|
|
1279
|
+
/** Имя процесса */
|
|
1280
|
+
name: string;
|
|
1281
|
+
/** Формула имени события */
|
|
1282
|
+
eventNameFormula: string;
|
|
1283
|
+
/** Формула времени события */
|
|
1284
|
+
eventTimeFormula: string;
|
|
1285
|
+
/** Формула CaseId события */
|
|
1286
|
+
eventCaseIdFormula: string;
|
|
1287
|
+
/** Формула CaseId кейса */
|
|
1288
|
+
caseCaseIdFormula: string;
|
|
1289
|
+
/** Имя колонки CaseId события */
|
|
1290
|
+
eventCaseIdColumnName: string;
|
|
1291
|
+
/** Тип данных CaseId */
|
|
1292
|
+
caseIdDataType: ESimpleDataType;
|
|
1293
|
+
/** Тип данных времени события */
|
|
1294
|
+
eventTimeDataType: ESimpleDataType;
|
|
1295
|
+
/** Является ли процесс валидным */
|
|
1296
|
+
isValid: boolean;
|
|
1297
|
+
}
|
|
1298
|
+
/** Конфигурация левой панели при погружении на уровень вниз */
|
|
1299
|
+
interface IDivePanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> extends IPanelDescription<Settings, GroupSettings> {
|
|
1300
|
+
}
|
|
1301
|
+
interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
|
|
1302
|
+
(context: IWidgetsContext, panelSettings: Settings, calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
interface IWidgetPlaceholderController {
|
|
1306
|
+
setError(value: Error | null): void;
|
|
1307
|
+
setConfigured(value: boolean): void;
|
|
1308
|
+
setDisplay(value: boolean): void;
|
|
1309
|
+
setEmpty(value: boolean): void;
|
|
1310
|
+
setOverlay(value: boolean): void;
|
|
1311
|
+
}
|
|
1312
|
+
interface IWidgetPlaceholderValues {
|
|
1313
|
+
error: Error | null;
|
|
1314
|
+
isConfigured: boolean;
|
|
1315
|
+
isDisplay: boolean | undefined;
|
|
1316
|
+
isEmpty: boolean;
|
|
1317
|
+
isOverlay: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1370
1320
|
interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
|
|
1371
1321
|
/** иконка виджета отображаемая в системе (в base64, svg или png) */
|
|
1372
1322
|
icon?: string;
|
|
@@ -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;
|