@infomaximum/widget-sdk 3.37.1 → 3.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +294 -170
- package/dist/index.esm.js +57 -32
- package/dist/index.js +57 -32
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ interface IControlRecord<Settings extends object, Value, ControlType = EControlT
|
|
|
44
44
|
title?: string;
|
|
45
45
|
/** Тип используемого элемента управления настройкой из предложенных нашей системой */
|
|
46
46
|
type: ControlType | string;
|
|
47
|
+
marginTop?: number;
|
|
47
48
|
/** Объект дополнительных параметров элемента управления */
|
|
48
49
|
props?: object | ((settings: Settings) => object);
|
|
49
50
|
/** Описание доступа к значению настройки */
|
|
@@ -311,29 +312,38 @@ interface IProcessFilterValue {
|
|
|
311
312
|
* События, доступные при выборе процесса.
|
|
312
313
|
* Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
|
|
313
314
|
*/
|
|
314
|
-
|
|
315
|
+
eventsNamesByProcessNameMap?: Map<string, (string | null)[]>;
|
|
315
316
|
}
|
|
316
317
|
interface IProcessEventFilterValue extends IProcessFilterValue {
|
|
317
|
-
|
|
318
|
+
processName: string;
|
|
318
319
|
eventName: string;
|
|
319
320
|
}
|
|
320
321
|
interface IProcessTransitionFilterValue extends IProcessFilterValue {
|
|
321
|
-
|
|
322
|
+
startEventProcessName: string;
|
|
322
323
|
startEventName: string;
|
|
323
|
-
|
|
324
|
+
endEventProcessName: string;
|
|
324
325
|
endEventName: string;
|
|
325
326
|
}
|
|
327
|
+
interface IClickPosition {
|
|
328
|
+
x: number;
|
|
329
|
+
y: number;
|
|
330
|
+
elementWidth: number;
|
|
331
|
+
elementHeight: number;
|
|
332
|
+
}
|
|
333
|
+
interface IPositionConfig extends IClickPosition {
|
|
334
|
+
type: string;
|
|
335
|
+
}
|
|
326
336
|
interface IAddPresenceOfEventFilter {
|
|
327
|
-
(name: EProcessFilterNames.presenceOfEvent, value: IProcessEventFilterValue): void;
|
|
337
|
+
(name: EProcessFilterNames.presenceOfEvent, value: IProcessEventFilterValue, positionConfig?: IPositionConfig): void;
|
|
328
338
|
}
|
|
329
339
|
interface IAddRepetitionOfEventFilter {
|
|
330
|
-
(name: EProcessFilterNames.repetitionOfEvent, value: IProcessEventFilterValue): void;
|
|
340
|
+
(name: EProcessFilterNames.repetitionOfEvent, value: IProcessEventFilterValue, positionConfig?: IPositionConfig): void;
|
|
331
341
|
}
|
|
332
342
|
interface IAddPresenceOfTransitionFilter {
|
|
333
|
-
(name: EProcessFilterNames.presenceOfTransition, value: IProcessTransitionFilterValue): void;
|
|
343
|
+
(name: EProcessFilterNames.presenceOfTransition, value: IProcessTransitionFilterValue, positionConfig?: IPositionConfig): void;
|
|
334
344
|
}
|
|
335
345
|
interface IAddDurationOfTransitionFilter {
|
|
336
|
-
(name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue): void;
|
|
346
|
+
(name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue, positionConfig?: IPositionConfig): void;
|
|
337
347
|
}
|
|
338
348
|
declare enum EFormulaFilterFieldKeys {
|
|
339
349
|
date = "date",
|
|
@@ -373,6 +383,7 @@ interface IFormulaFilterValue {
|
|
|
373
383
|
}>;
|
|
374
384
|
}
|
|
375
385
|
interface IStagesFilterItem {
|
|
386
|
+
id: number;
|
|
376
387
|
/** Название этапа */
|
|
377
388
|
name: string;
|
|
378
389
|
/** Формула фильтра этапа */
|
|
@@ -407,13 +418,6 @@ interface IWidgetFiltration {
|
|
|
407
418
|
removeStagesFilter(widgetKey: string): void;
|
|
408
419
|
}
|
|
409
420
|
|
|
410
|
-
interface IPlacement {
|
|
411
|
-
left: number;
|
|
412
|
-
top: number;
|
|
413
|
-
width: number;
|
|
414
|
-
height: number;
|
|
415
|
-
zIndex: number;
|
|
416
|
-
}
|
|
417
421
|
declare enum EWidgetFilterMode {
|
|
418
422
|
DEFAULT = "DEFAULT",
|
|
419
423
|
SINGLE = "SINGLE",
|
|
@@ -498,7 +502,7 @@ type TDisplayCondition = {
|
|
|
498
502
|
formula: TNullable<string>;
|
|
499
503
|
} | {
|
|
500
504
|
mode: EDisplayConditionMode.VARIABLE;
|
|
501
|
-
|
|
505
|
+
variableName: TNullable<string>;
|
|
502
506
|
variableValue: TNullable<string>;
|
|
503
507
|
};
|
|
504
508
|
interface IRange {
|
|
@@ -507,6 +511,165 @@ interface IRange {
|
|
|
507
511
|
max?: number;
|
|
508
512
|
}
|
|
509
513
|
|
|
514
|
+
interface IWidgetTableColumn {
|
|
515
|
+
/** Имя колонки */
|
|
516
|
+
name: string;
|
|
517
|
+
/** Тип данных колонки */
|
|
518
|
+
dataType: ESimpleDataType;
|
|
519
|
+
}
|
|
520
|
+
interface IActionScript {
|
|
521
|
+
name: string | undefined;
|
|
522
|
+
fieldsNames: Set<string>;
|
|
523
|
+
}
|
|
524
|
+
interface IWidgetTable {
|
|
525
|
+
/** Имя таблицы */
|
|
526
|
+
name: string;
|
|
527
|
+
/** Колонки таблицы */
|
|
528
|
+
columns: Map<string, IWidgetTableColumn>;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* simplified - упрощенный для работы фильтрации в образах открытых в дровере/модальном окне
|
|
532
|
+
*
|
|
533
|
+
* full - полный
|
|
534
|
+
*/
|
|
535
|
+
type TFiltrationMode = "simplified" | "full";
|
|
536
|
+
/**
|
|
537
|
+
* preview - упрощенный
|
|
538
|
+
*
|
|
539
|
+
* full - полный
|
|
540
|
+
*/
|
|
541
|
+
type TDisplayMode = "preview" | "full";
|
|
542
|
+
interface IDisplayRule {
|
|
543
|
+
color: TColor;
|
|
544
|
+
}
|
|
545
|
+
interface IWidgetsContext {
|
|
546
|
+
/** используемый язык в системе */
|
|
547
|
+
language: ELanguages;
|
|
548
|
+
processes: Map<string, IWidgetProcess>;
|
|
549
|
+
reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
550
|
+
workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
551
|
+
/** Переменные отчета */
|
|
552
|
+
variables: Map<string, TWidgetVariable>;
|
|
553
|
+
/** Метод установки значения переменной отчета */
|
|
554
|
+
setVariableValue(name: string, value: TNullable<string> | string[]): void;
|
|
555
|
+
statesNames: Set<string>;
|
|
556
|
+
reportName: string;
|
|
557
|
+
/**
|
|
558
|
+
* режим дашборда
|
|
559
|
+
* @deprecated 2401 - необходимо использовать displayMode */
|
|
560
|
+
isViewMode: boolean;
|
|
561
|
+
/** Режим отображения виджета */
|
|
562
|
+
displayMode: TDisplayMode;
|
|
563
|
+
/** @deprecated необходимо получать из системной переменной "Login" */
|
|
564
|
+
userLogin: string;
|
|
565
|
+
scripts: Map<string, IActionScript>;
|
|
566
|
+
tables: Set<string>;
|
|
567
|
+
filtrationMode: TFiltrationMode;
|
|
568
|
+
reportDisplayRules: Map<string, IDisplayRule>;
|
|
569
|
+
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
570
|
+
viewKeyByName: Map<string, string>;
|
|
571
|
+
fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare enum EWidgetActionInputMode {
|
|
575
|
+
FROM_COLUMN = "FROM_COLUMN",
|
|
576
|
+
FROM_VARIABLE = "FROM_VARIABLE",
|
|
577
|
+
STATIC_LIST = "STATIC_LIST",
|
|
578
|
+
DYNAMIC_LIST = "DYNAMIC_LIST",
|
|
579
|
+
FORMULA = "FORMULA",
|
|
580
|
+
MANUALLY = "MANUALLY"
|
|
581
|
+
}
|
|
582
|
+
interface IActionCommon {
|
|
583
|
+
id: number;
|
|
584
|
+
name: string;
|
|
585
|
+
}
|
|
586
|
+
declare enum EActionTypes {
|
|
587
|
+
URL = "URL",
|
|
588
|
+
UPDATE_VARIABLE = "UPDATE_VARIABLE",
|
|
589
|
+
RUN_SCRIPT = "RUN_SCRIPT",
|
|
590
|
+
OPEN_VIEW = "OPEN_VIEW"
|
|
591
|
+
}
|
|
592
|
+
interface IActionGoToUrl extends IActionCommon {
|
|
593
|
+
type: EActionTypes.URL;
|
|
594
|
+
url: string;
|
|
595
|
+
targetBlank: boolean;
|
|
596
|
+
}
|
|
597
|
+
interface IActionScriptField {
|
|
598
|
+
name: string;
|
|
599
|
+
id: number;
|
|
600
|
+
value: TWidgetActionInputValue;
|
|
601
|
+
}
|
|
602
|
+
interface IActionRunScript extends IActionCommon {
|
|
603
|
+
description: string;
|
|
604
|
+
type: EActionTypes.RUN_SCRIPT;
|
|
605
|
+
filters: (IFormulaFilterValue | string)[];
|
|
606
|
+
inputs: IActionScriptField[];
|
|
607
|
+
scriptName: string;
|
|
608
|
+
shouldRefreshWidgetsAfterExecution: boolean;
|
|
609
|
+
}
|
|
610
|
+
interface IActionUpdateVariable extends IActionCommon {
|
|
611
|
+
type: EActionTypes.UPDATE_VARIABLE;
|
|
612
|
+
variables: Array<string>;
|
|
613
|
+
}
|
|
614
|
+
declare enum EViewType {
|
|
615
|
+
CREATED_VIEW = "CREATED_VIEW",
|
|
616
|
+
GENERATED_BY_SCRIPT = "GENERATED_BY_SCRIPT"
|
|
617
|
+
}
|
|
618
|
+
declare enum EOpenViewMode {
|
|
619
|
+
NEW_WINDOW = "NEW_WINDOW",
|
|
620
|
+
PLACEHOLDER = "PLACEHOLDER",
|
|
621
|
+
MODAL = "MODAL",
|
|
622
|
+
DRAWER = "DRAWER"
|
|
623
|
+
}
|
|
624
|
+
declare enum EDrawerPlacement {
|
|
625
|
+
LEFT = "LEFT",
|
|
626
|
+
RIGHT = "RIGHT"
|
|
627
|
+
}
|
|
628
|
+
interface IActionOpenView extends IActionCommon {
|
|
629
|
+
type: EActionTypes.OPEN_VIEW;
|
|
630
|
+
viewName: string;
|
|
631
|
+
viewKey: string;
|
|
632
|
+
openMode: EOpenViewMode;
|
|
633
|
+
viewType: EViewType;
|
|
634
|
+
drawerPlacement: EDrawerPlacement;
|
|
635
|
+
placeholderName: string;
|
|
636
|
+
inputs: IActionScriptField[];
|
|
637
|
+
isOpenInCurrentWindow?: boolean;
|
|
638
|
+
}
|
|
639
|
+
type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | IActionOpenView;
|
|
640
|
+
type TWidgetActionCommonInputValue = {
|
|
641
|
+
name: string;
|
|
642
|
+
isHidden: boolean;
|
|
643
|
+
};
|
|
644
|
+
type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
|
|
645
|
+
mode: EWidgetActionInputMode.FROM_COLUMN;
|
|
646
|
+
tableName: string;
|
|
647
|
+
columnName: string;
|
|
648
|
+
} | {
|
|
649
|
+
mode: EWidgetActionInputMode.FROM_VARIABLE;
|
|
650
|
+
sourceVariable: string;
|
|
651
|
+
} | {
|
|
652
|
+
mode: EWidgetActionInputMode.FORMULA;
|
|
653
|
+
formula: string;
|
|
654
|
+
} | {
|
|
655
|
+
mode: EWidgetActionInputMode.MANUALLY;
|
|
656
|
+
description: string;
|
|
657
|
+
} | {
|
|
658
|
+
mode: EWidgetActionInputMode.STATIC_LIST;
|
|
659
|
+
options: string[];
|
|
660
|
+
defaultOptionIndex: number;
|
|
661
|
+
} | {
|
|
662
|
+
mode: EWidgetActionInputMode.DYNAMIC_LIST;
|
|
663
|
+
formula: string;
|
|
664
|
+
defaultValue: string;
|
|
665
|
+
filters: (IFormulaFilterValue | string)[];
|
|
666
|
+
});
|
|
667
|
+
interface IWidgetActionInput {
|
|
668
|
+
name: string;
|
|
669
|
+
value: TWidgetActionInputValue;
|
|
670
|
+
}
|
|
671
|
+
declare const isActionValid: (action: TActionsOnClick, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
672
|
+
|
|
510
673
|
declare enum ESortDirection {
|
|
511
674
|
descend = "DESC",
|
|
512
675
|
ascend = "ASC",
|
|
@@ -533,7 +696,7 @@ type TWidgetSortingValue = {
|
|
|
533
696
|
formula: string;
|
|
534
697
|
} | TWidgetSortingValueRelatedWidgetIndicator | {
|
|
535
698
|
mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
|
|
536
|
-
|
|
699
|
+
name: string;
|
|
537
700
|
formula: string;
|
|
538
701
|
};
|
|
539
702
|
|
|
@@ -616,7 +779,6 @@ declare enum ESortingValueModes {
|
|
|
616
779
|
IN_WORKSPACE = "IN_WORKSPACE"
|
|
617
780
|
}
|
|
618
781
|
interface ICommonColumnIndicator {
|
|
619
|
-
guid: string;
|
|
620
782
|
name: string;
|
|
621
783
|
formula: string;
|
|
622
784
|
}
|
|
@@ -646,6 +808,7 @@ interface IWidgetColumnIndicator extends IWidgetIndicator {
|
|
|
646
808
|
formatting?: EFormattingPresets;
|
|
647
809
|
formattingTemplate?: string;
|
|
648
810
|
displayCondition?: TDisplayCondition;
|
|
811
|
+
onclick?: TActionsOnClick[];
|
|
649
812
|
}
|
|
650
813
|
interface IWidgetDimensionHierarchy<D extends IWidgetDimension = IWidgetDimension> {
|
|
651
814
|
/** Идентификатор, генерируемый на основе текущего времени */
|
|
@@ -731,125 +894,18 @@ type TWidgetVariable = {
|
|
|
731
894
|
};
|
|
732
895
|
declare function isHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
|
|
733
896
|
|
|
734
|
-
interface IWidgetTableColumn {
|
|
735
|
-
/** Имя колонки */
|
|
736
|
-
name: string;
|
|
737
|
-
/** Тип данных колонки */
|
|
738
|
-
dataType: ESimpleDataType;
|
|
739
|
-
}
|
|
740
|
-
interface IActionScript {
|
|
741
|
-
guid: string | undefined;
|
|
742
|
-
fieldsGuids: Set<string>;
|
|
743
|
-
}
|
|
744
|
-
interface IWidgetTable {
|
|
745
|
-
/** Имя таблицы */
|
|
746
|
-
name: string;
|
|
747
|
-
/** Колонки таблицы */
|
|
748
|
-
columns: Map<string, IWidgetTableColumn>;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* preview - упрощенный
|
|
752
|
-
*
|
|
753
|
-
* full - полный
|
|
754
|
-
*/
|
|
755
|
-
type TDisplayMode = "preview" | "full";
|
|
756
|
-
interface IDisplayRule {
|
|
757
|
-
color: TColor;
|
|
758
|
-
}
|
|
759
|
-
interface IWidgetsContext {
|
|
760
|
-
/** используемый язык в системе */
|
|
761
|
-
language: ELanguages;
|
|
762
|
-
processes: Map<string, IWidgetProcess>;
|
|
763
|
-
reportMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
764
|
-
workspaceMeasures: TNullable<Map<string, ICommonColumnIndicator>>;
|
|
765
|
-
/** Переменные отчета */
|
|
766
|
-
variables: Map<string, TWidgetVariable>;
|
|
767
|
-
/** Метод установки значения переменной отчета */
|
|
768
|
-
setVariableValue(guid: string, value: TNullable<string> | string[]): void;
|
|
769
|
-
statesGuids: Set<string>;
|
|
770
|
-
reportName: string;
|
|
771
|
-
/**
|
|
772
|
-
* режим дашборда
|
|
773
|
-
* @deprecated 2401 - необходимо использовать displayMode */
|
|
774
|
-
isViewMode: boolean;
|
|
775
|
-
/** Режим отображения виджета */
|
|
776
|
-
displayMode: TDisplayMode;
|
|
777
|
-
/** @deprecated необходимо получать из системной переменной "Login" */
|
|
778
|
-
userLogin: string;
|
|
779
|
-
scripts: Map<string, IActionScript>;
|
|
780
|
-
tables: Set<string>;
|
|
781
|
-
reportDisplayRules: Map<string, IDisplayRule>;
|
|
782
|
-
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
783
|
-
fetchColumnsByTableName(tableName: string): Promise<IWidgetTableColumn[] | undefined>;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
declare enum EWidgetActionInputMode {
|
|
787
|
-
FROM_COLUMN = "FROM_COLUMN",
|
|
788
|
-
FROM_VARIABLE = "FROM_VARIABLE",
|
|
789
|
-
STATIC_LIST = "STATIC_LIST",
|
|
790
|
-
DYNAMIC_LIST = "DYNAMIC_LIST",
|
|
791
|
-
FORMULA = "FORMULA",
|
|
792
|
-
MANUALLY = "MANUALLY"
|
|
793
|
-
}
|
|
794
|
-
type TWidgetActionCommonInputValue = {
|
|
795
|
-
name: string;
|
|
796
|
-
isHidden: boolean;
|
|
797
|
-
};
|
|
798
|
-
type TWidgetActionInputValue = TWidgetActionCommonInputValue & ({
|
|
799
|
-
mode: EWidgetActionInputMode.FROM_COLUMN;
|
|
800
|
-
tableName: string;
|
|
801
|
-
columnName: string;
|
|
802
|
-
} | {
|
|
803
|
-
mode: EWidgetActionInputMode.FROM_VARIABLE;
|
|
804
|
-
guid: string;
|
|
805
|
-
} | {
|
|
806
|
-
mode: EWidgetActionInputMode.FORMULA;
|
|
807
|
-
formula: string;
|
|
808
|
-
} | {
|
|
809
|
-
mode: EWidgetActionInputMode.MANUALLY;
|
|
810
|
-
description: string;
|
|
811
|
-
} | {
|
|
812
|
-
mode: EWidgetActionInputMode.STATIC_LIST;
|
|
813
|
-
options: string[];
|
|
814
|
-
defaultOptionIndex: number;
|
|
815
|
-
} | {
|
|
816
|
-
mode: EWidgetActionInputMode.DYNAMIC_LIST;
|
|
817
|
-
formula: string;
|
|
818
|
-
defaultValue: string;
|
|
819
|
-
filters: (IFormulaFilterValue | string)[];
|
|
820
|
-
});
|
|
821
|
-
interface IWidgetActionInput {
|
|
822
|
-
guid: string;
|
|
823
|
-
value: TWidgetActionInputValue;
|
|
824
|
-
}
|
|
825
|
-
interface IWidgetAction {
|
|
826
|
-
id: number;
|
|
827
|
-
name: string;
|
|
828
|
-
description: string;
|
|
829
|
-
filters: (IFormulaFilterValue | string)[];
|
|
830
|
-
scriptGuid?: string;
|
|
831
|
-
/** Поле name необходимо, чтобы показать название скрипта, который был удален */
|
|
832
|
-
scriptName?: string;
|
|
833
|
-
inputs: IWidgetActionInput[];
|
|
834
|
-
shouldRefreshWidgetsAfterExecution: boolean;
|
|
835
|
-
}
|
|
836
|
-
declare const isActionValid: (action: IWidgetAction, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
837
|
-
|
|
838
897
|
interface IBaseWidgetSettings {
|
|
839
|
-
apiVersion: string;
|
|
840
|
-
type: string;
|
|
841
898
|
header?: string;
|
|
842
899
|
headerSize?: number;
|
|
900
|
+
stateName?: string | null;
|
|
843
901
|
showMarkdown?: boolean;
|
|
844
902
|
markdownMeasures?: IMarkdownMeasure[];
|
|
845
903
|
markdownText?: string;
|
|
846
|
-
stateGuid?: string | null;
|
|
847
904
|
filters?: (IFormulaFilterValue | string)[];
|
|
848
905
|
filterMode?: EWidgetFilterMode;
|
|
849
906
|
ignoreFilters?: boolean;
|
|
850
|
-
placement: IPlacement;
|
|
851
907
|
sorting?: IWidgetSortingIndicator[];
|
|
852
|
-
actions?:
|
|
908
|
+
actions?: TActionsOnClick[];
|
|
853
909
|
displayCondition?: TDisplayCondition;
|
|
854
910
|
displayConditionComment?: string;
|
|
855
911
|
}
|
|
@@ -882,8 +938,9 @@ interface ISelectOption {
|
|
|
882
938
|
value: string;
|
|
883
939
|
label: string;
|
|
884
940
|
disabled?: boolean;
|
|
941
|
+
rightIcon?: "fx" | string;
|
|
885
942
|
}
|
|
886
|
-
declare enum
|
|
943
|
+
declare enum ESelectOptionTypes {
|
|
887
944
|
DIVIDER = "DIVIDER",
|
|
888
945
|
SYSTEM = "SYSTEM",
|
|
889
946
|
GROUP = "GROUP",
|
|
@@ -894,41 +951,44 @@ declare enum ECustomSelectTemplates {
|
|
|
894
951
|
FORMULA = "FORMULA",
|
|
895
952
|
DIMENSION_GROUPS = "DIMENSION_GROUPS"
|
|
896
953
|
}
|
|
897
|
-
interface
|
|
898
|
-
type:
|
|
954
|
+
interface ISelectDividerOption {
|
|
955
|
+
type: ESelectOptionTypes.DIVIDER;
|
|
899
956
|
}
|
|
900
|
-
interface
|
|
901
|
-
type:
|
|
902
|
-
template:
|
|
957
|
+
interface ISelectSystemOption<T extends string = string> {
|
|
958
|
+
type: ESelectOptionTypes.SYSTEM;
|
|
959
|
+
template: T;
|
|
903
960
|
}
|
|
904
|
-
interface
|
|
905
|
-
type:
|
|
961
|
+
interface ISelectGroupOption {
|
|
962
|
+
type: ESelectOptionTypes.GROUP;
|
|
906
963
|
label: string;
|
|
907
|
-
options:
|
|
964
|
+
options: IAddButtonSelectOption[];
|
|
908
965
|
icon: string;
|
|
909
966
|
}
|
|
910
|
-
type
|
|
911
|
-
type
|
|
912
|
-
interface
|
|
913
|
-
type:
|
|
967
|
+
type TSelectFetchOptions = () => Promise<IAddButtonSelectOption[]>;
|
|
968
|
+
type TSelectChildOptions = IAddButtonSelectOption[] | TSelectFetchOptions;
|
|
969
|
+
interface ISelectBranchOption {
|
|
970
|
+
type: ESelectOptionTypes.BRANCH;
|
|
914
971
|
label: string;
|
|
915
|
-
options:
|
|
972
|
+
options: TSelectChildOptions;
|
|
916
973
|
icon?: string;
|
|
917
974
|
disabled?: boolean;
|
|
918
975
|
}
|
|
919
|
-
interface
|
|
920
|
-
type:
|
|
976
|
+
interface ISelectLeafOption {
|
|
977
|
+
type: ESelectOptionTypes.LEAF;
|
|
921
978
|
label: string;
|
|
922
979
|
value: string;
|
|
923
980
|
onSelect: <T = object>(value: string, update: <R extends object>(f: (prevItems: (T | R)[]) => (T | R)[]) => void) => void;
|
|
981
|
+
/** Строка в формате base64 */
|
|
924
982
|
icon?: string;
|
|
925
983
|
disabled?: boolean;
|
|
926
984
|
}
|
|
927
|
-
type
|
|
985
|
+
type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption;
|
|
986
|
+
type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
|
|
987
|
+
type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
|
|
928
988
|
interface ICustomAddButtonProps {
|
|
929
|
-
options:
|
|
989
|
+
options: TSelectChildOptions;
|
|
930
990
|
hasDropdown?: boolean;
|
|
931
|
-
onClick?:
|
|
991
|
+
onClick?: ISelectLeafOption["onSelect"];
|
|
932
992
|
}
|
|
933
993
|
interface IWidgetIndicatorMenuConfig {
|
|
934
994
|
hideTablesColumnsOptions?: boolean;
|
|
@@ -936,6 +996,7 @@ interface IWidgetIndicatorMenuConfig {
|
|
|
936
996
|
hideQuantityOption?: boolean;
|
|
937
997
|
}
|
|
938
998
|
interface IMeasureMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
999
|
+
options?: TMeasureAddButtonSelectOption[];
|
|
939
1000
|
}
|
|
940
1001
|
interface ISortingMenuConfig extends IWidgetIndicatorMenuConfig {
|
|
941
1002
|
}
|
|
@@ -985,6 +1046,12 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
985
1046
|
isValid?(group: IGroupSettings): boolean;
|
|
986
1047
|
/** Находится ли группа в состоянии загрузки */
|
|
987
1048
|
isLoading?(group: IGroupSettings): boolean;
|
|
1049
|
+
/** Можно ли удалять группу по умолчанию true */
|
|
1050
|
+
isRemovable?(group: IGroupSettings): boolean;
|
|
1051
|
+
/** Можно ли сортировать группу по умолчанию true */
|
|
1052
|
+
isDraggable?: boolean;
|
|
1053
|
+
/** Опциональный верхний отступ для группы */
|
|
1054
|
+
marginTop?: number;
|
|
988
1055
|
}
|
|
989
1056
|
/** Конфигурация левой панели */
|
|
990
1057
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
@@ -1042,23 +1109,12 @@ interface IWidgetPlaceholderValues {
|
|
|
1042
1109
|
isOverlay: boolean;
|
|
1043
1110
|
}
|
|
1044
1111
|
|
|
1045
|
-
/** Вид переменной для калькулятора */
|
|
1046
|
-
interface ICalculatorVariable {
|
|
1047
|
-
dataType: ESimpleDataType;
|
|
1048
|
-
value: string | string[];
|
|
1049
|
-
}
|
|
1050
|
-
/** Коллекция значений переменных по их имени */
|
|
1051
|
-
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
1112
|
/** Формат входного параметра GeneralCalculator */
|
|
1055
1113
|
interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
1056
1114
|
/** Разрезы */
|
|
1057
1115
|
dimensions: ICalculatorDimensionInput[];
|
|
1058
1116
|
/** Меры */
|
|
1059
1117
|
measures: ICalculatorMeasureInput[];
|
|
1060
|
-
/** Значения переменных */
|
|
1061
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1062
1118
|
/** Фильтры, использующие WHERE */
|
|
1063
1119
|
filters: ICalculatorFilter[];
|
|
1064
1120
|
/** Фильтры, использующие HAVING */
|
|
@@ -1112,8 +1168,6 @@ interface IHistogramCalculatorInput {
|
|
|
1112
1168
|
dimensions: ICalculatorDimensionInput[];
|
|
1113
1169
|
/** Лимит корзин */
|
|
1114
1170
|
binsLimit: number;
|
|
1115
|
-
/** Значения переменных */
|
|
1116
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1117
1171
|
/** Формула условия отображения */
|
|
1118
1172
|
displayConditionFormula?: TNullable<string>;
|
|
1119
1173
|
/** Фильтры, использующие WHERE */
|
|
@@ -1158,7 +1212,7 @@ interface IEdge extends IGraphElement {
|
|
|
1158
1212
|
endName: string | null;
|
|
1159
1213
|
}
|
|
1160
1214
|
interface IProcessGraphCalculatorInput {
|
|
1161
|
-
|
|
1215
|
+
processName: string;
|
|
1162
1216
|
vertexLimit: number | null;
|
|
1163
1217
|
edgeLimit: number;
|
|
1164
1218
|
vertexMeasures: ICalculatorMeasureInput[];
|
|
@@ -1166,8 +1220,6 @@ interface IProcessGraphCalculatorInput {
|
|
|
1166
1220
|
filters: ICalculatorFilter[];
|
|
1167
1221
|
eventFilters?: ICalculatorFilter[];
|
|
1168
1222
|
displayConditionFormula?: TNullable<string>;
|
|
1169
|
-
/** Значения переменных */
|
|
1170
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1171
1223
|
}
|
|
1172
1224
|
interface IProcessGraphCalculatorOutput {
|
|
1173
1225
|
vertexMaxLimit: number;
|
|
@@ -1192,8 +1244,6 @@ interface ITwoLimitsCalculatorInput {
|
|
|
1192
1244
|
dimensionsSecondGroup: ICalculatorDimensionInput[];
|
|
1193
1245
|
/** Меры */
|
|
1194
1246
|
measures: ICalculatorMeasureInput[];
|
|
1195
|
-
/** Значения переменных */
|
|
1196
|
-
variablesValues?: ICalculatorVariablesValues;
|
|
1197
1247
|
/** Фильтры, использующие WHERE */
|
|
1198
1248
|
filters: ICalculatorFilter[];
|
|
1199
1249
|
/** Фильтры, использующие HAVING */
|
|
@@ -1238,7 +1288,6 @@ interface ITypeCalculatorInput {
|
|
|
1238
1288
|
alias: string;
|
|
1239
1289
|
formula: string;
|
|
1240
1290
|
}[];
|
|
1241
|
-
variablesValues: ICalculatorVariablesValues;
|
|
1242
1291
|
}
|
|
1243
1292
|
interface ITypeCalculatorOutput {
|
|
1244
1293
|
types: Map<string, ESimpleDataType>;
|
|
@@ -1248,8 +1297,6 @@ interface ITypeCalculator extends ICalculator<ITypeCalculatorInput, ITypeCalcula
|
|
|
1248
1297
|
|
|
1249
1298
|
declare const prepareValuesForSql: (dataType: ESimpleDataType, values: (string | null)[]) => (string | null)[];
|
|
1250
1299
|
|
|
1251
|
-
declare function mapVariablesToInputs(variables: Map<string, TWidgetVariable>): ICalculatorVariablesValues;
|
|
1252
|
-
|
|
1253
1300
|
declare function checkDisplayCondition(displayCondition: TNullable<TDisplayCondition>, variables: Map<string, TWidgetVariable>): boolean;
|
|
1254
1301
|
declare function getDisplayConditionFormula(displayCondition: TNullable<TDisplayCondition>): TNullable<string>;
|
|
1255
1302
|
declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimension: I, displayCondition: TNullable<TDisplayCondition>) => TNullable<I>;
|
|
@@ -1299,6 +1346,18 @@ declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorO
|
|
|
1299
1346
|
|
|
1300
1347
|
declare const escapeSpecialCharacters: (formula: string) => string;
|
|
1301
1348
|
|
|
1349
|
+
/** Удалить из строки символы экранирования */
|
|
1350
|
+
declare function unescapeSpecialCharacters(str: string): string;
|
|
1351
|
+
|
|
1352
|
+
/** Вид переменной для калькулятора */
|
|
1353
|
+
interface ICalculatorVariable {
|
|
1354
|
+
dataType: ESimpleDataType;
|
|
1355
|
+
value: string | string[];
|
|
1356
|
+
}
|
|
1357
|
+
/** Коллекция значений переменных по их имени */
|
|
1358
|
+
interface ICalculatorVariablesValues extends Map<string, ICalculatorVariable> {
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1302
1361
|
interface ICalculatorFactory {
|
|
1303
1362
|
general: () => IGeneralCalculator;
|
|
1304
1363
|
pie: () => IPieCalculator;
|
|
@@ -1319,12 +1378,73 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
|
|
|
1319
1378
|
getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
|
|
1320
1379
|
}
|
|
1321
1380
|
|
|
1381
|
+
type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
|
|
1382
|
+
event?: MouseEvent;
|
|
1383
|
+
placement?: "topRight" | "topLeft" | "bottomRight" | "bottomLeft";
|
|
1384
|
+
positionOrigin?: "frame" | "workArea";
|
|
1385
|
+
position?: {
|
|
1386
|
+
unitX?: TContextMenuPositionUnit;
|
|
1387
|
+
unitY?: TContextMenuPositionUnit;
|
|
1388
|
+
x?: number;
|
|
1389
|
+
y?: number;
|
|
1390
|
+
};
|
|
1391
|
+
};
|
|
1392
|
+
type TContextMenuPositionUnit = "%" | "px";
|
|
1393
|
+
type TContextMenuList = {
|
|
1394
|
+
type: "list";
|
|
1395
|
+
items: TContextMenuRow[];
|
|
1396
|
+
};
|
|
1397
|
+
type TContextMenuButtonGroup = {
|
|
1398
|
+
type: "buttonGroup";
|
|
1399
|
+
items: TContextMenuButton[];
|
|
1400
|
+
};
|
|
1401
|
+
type TContextMenuRow = {
|
|
1402
|
+
key: string;
|
|
1403
|
+
label: string;
|
|
1404
|
+
onClick: () => void;
|
|
1405
|
+
};
|
|
1406
|
+
type TContextMenuButton = TContextMenuButtonActions | TContextMenuButtonClose | TContextMenuButtonApply | TContextMenuButtonCustom | TContextMenuButtonOptions;
|
|
1407
|
+
type TContextMenuButtonActions = {
|
|
1408
|
+
type: "actions";
|
|
1409
|
+
actions: TActionsOnClick[];
|
|
1410
|
+
onClick: (action: TActionsOnClick) => void;
|
|
1411
|
+
};
|
|
1412
|
+
type TContextMenuButtonClose = {
|
|
1413
|
+
type: "close";
|
|
1414
|
+
onClick?: () => void;
|
|
1415
|
+
};
|
|
1416
|
+
type TContextMenuButtonApply = {
|
|
1417
|
+
type: "apply";
|
|
1418
|
+
onClick: () => void;
|
|
1419
|
+
};
|
|
1420
|
+
type TContextMenuButtonCustom = {
|
|
1421
|
+
key: string;
|
|
1422
|
+
type: "custom";
|
|
1423
|
+
icon: string;
|
|
1424
|
+
onClick: () => void;
|
|
1425
|
+
};
|
|
1426
|
+
type TContextMenuButtonOptions = {
|
|
1427
|
+
key: string;
|
|
1428
|
+
type: "options";
|
|
1429
|
+
icon: string;
|
|
1430
|
+
items: TContextMenuRow[];
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1322
1433
|
type TLaunchActionParams = {
|
|
1323
|
-
action:
|
|
1434
|
+
action: TActionsOnClick;
|
|
1324
1435
|
onSuccess: () => void;
|
|
1325
1436
|
filters: ICalculatorFilter[];
|
|
1326
1437
|
needConfirmation?: boolean;
|
|
1327
1438
|
};
|
|
1439
|
+
interface ILaunchActionSubscribers {
|
|
1440
|
+
onActionSuccess(callback: () => void): void;
|
|
1441
|
+
}
|
|
1442
|
+
type TWidgetContainer = {
|
|
1443
|
+
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
1444
|
+
isMaxHeightLimited: boolean;
|
|
1445
|
+
/** Установить минимальную высоту рабочей области виджета */
|
|
1446
|
+
setContentMinHeight(value: number): void;
|
|
1447
|
+
};
|
|
1328
1448
|
interface IWidgetPersistValue<T extends object = object> {
|
|
1329
1449
|
get(): T | null;
|
|
1330
1450
|
set(value: T | null): void;
|
|
@@ -1353,10 +1473,14 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1353
1473
|
placeholderValues: IWidgetPlaceholderValues;
|
|
1354
1474
|
/** Контекст виджета */
|
|
1355
1475
|
widgetsContext: IWidgetsContext;
|
|
1476
|
+
/** Данные о контейнере виджета */
|
|
1477
|
+
widgetContainer: TWidgetContainer;
|
|
1356
1478
|
/** Запуск действия */
|
|
1357
|
-
launchAction(params: TLaunchActionParams):
|
|
1479
|
+
launchAction(params: TLaunchActionParams): ILaunchActionSubscribers;
|
|
1358
1480
|
/** Значение, сохраняемое в localStorage и URL */
|
|
1359
1481
|
persistValue: IWidgetPersistValue;
|
|
1482
|
+
/** функция для управления контекстными меню */
|
|
1483
|
+
setContextMenu: (key: string, value: TContextMenu | null) => void;
|
|
1360
1484
|
}
|
|
1361
1485
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1362
1486
|
/** @deprecated - нужно использовать из widgetsContext */
|
|
@@ -1528,4 +1652,4 @@ declare global {
|
|
|
1528
1652
|
}
|
|
1529
1653
|
}
|
|
1530
1654
|
|
|
1531
|
-
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType,
|
|
1655
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionCommon, type IActionGoToUrl, type IActionOpenView, type IActionRunScript, type IActionScript, type IActionScriptField, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IBaseDimensionsAndMeasuresCalculator, type IBaseDimensionsAndMeasuresCalculatorInput, type IBaseDimensionsAndMeasuresCalculatorOutput, type IBaseWidgetSettings, type ICalculator, type ICalculatorDimensionInput, type ICalculatorDimensionOutput, type ICalculatorFactory, type ICalculatorFilter, type ICalculatorIndicatorInput, type ICalculatorIndicatorOutput, type ICalculatorMeasureInput, type ICalculatorMeasureOutput, type ICalculatorVariable, type ICalculatorVariablesValues, type IColoredValue, type ICommonColumnIndicator, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, type IDisplayRule, type IDivePanelDescription, type IDividerRecord, type IEdge, type IExportColumnOrder, type IFillSettings, type IFormulaFilterValue, type IGeneralCalculator, type IGeneralCalculatorExportInput, type IGeneralCalculatorInput, type IGeneralCalculatorOutput, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILaunchActionSubscribers, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingMenuConfig, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetIndicatorMenuConfig, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TActionsOnClick, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionCommonInputValue, type TWidgetActionInputValue, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.esm.js
CHANGED
|
@@ -71,24 +71,51 @@ var EWidgetActionInputMode;
|
|
|
71
71
|
EWidgetActionInputMode["FORMULA"] = "FORMULA";
|
|
72
72
|
EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
|
|
73
73
|
})(EWidgetActionInputMode || (EWidgetActionInputMode = {}));
|
|
74
|
+
var EActionTypes;
|
|
75
|
+
(function (EActionTypes) {
|
|
76
|
+
EActionTypes["URL"] = "URL";
|
|
77
|
+
EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
|
|
78
|
+
EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
|
|
79
|
+
EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
|
|
80
|
+
})(EActionTypes || (EActionTypes = {}));
|
|
81
|
+
var EViewType;
|
|
82
|
+
(function (EViewType) {
|
|
83
|
+
EViewType["CREATED_VIEW"] = "CREATED_VIEW";
|
|
84
|
+
EViewType["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
|
|
85
|
+
})(EViewType || (EViewType = {}));
|
|
86
|
+
var EOpenViewMode;
|
|
87
|
+
(function (EOpenViewMode) {
|
|
88
|
+
EOpenViewMode["NEW_WINDOW"] = "NEW_WINDOW";
|
|
89
|
+
EOpenViewMode["PLACEHOLDER"] = "PLACEHOLDER";
|
|
90
|
+
EOpenViewMode["MODAL"] = "MODAL";
|
|
91
|
+
EOpenViewMode["DRAWER"] = "DRAWER";
|
|
92
|
+
})(EOpenViewMode || (EOpenViewMode = {}));
|
|
93
|
+
var EDrawerPlacement;
|
|
94
|
+
(function (EDrawerPlacement) {
|
|
95
|
+
EDrawerPlacement["LEFT"] = "LEFT";
|
|
96
|
+
EDrawerPlacement["RIGHT"] = "RIGHT";
|
|
97
|
+
})(EDrawerPlacement || (EDrawerPlacement = {}));
|
|
74
98
|
var isActionValid = function (action, _a) {
|
|
75
99
|
var _b;
|
|
76
100
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
77
|
-
|
|
101
|
+
if (action.type !== EActionTypes.RUN_SCRIPT) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
78
105
|
if (!currentScript) {
|
|
79
106
|
return false;
|
|
80
107
|
}
|
|
81
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
82
|
-
if (actionInputsMap.size < currentScript.
|
|
108
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
109
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
83
110
|
return false;
|
|
84
111
|
}
|
|
85
|
-
return __spreadArray([], __read(currentScript.
|
|
86
|
-
var actionInput = actionInputsMap.get(
|
|
112
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
113
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
87
114
|
if (!actionInput) {
|
|
88
115
|
return false;
|
|
89
116
|
}
|
|
90
117
|
var value = actionInput.value;
|
|
91
|
-
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
118
|
+
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
|
|
92
119
|
return false;
|
|
93
120
|
}
|
|
94
121
|
if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -132,21 +159,6 @@ var escapeSingularQuotes = function (formula) {
|
|
|
132
159
|
return formula.replaceAll("'", "\\'");
|
|
133
160
|
};
|
|
134
161
|
|
|
135
|
-
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
136
|
-
var compactMap = function (items, f) {
|
|
137
|
-
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
138
|
-
};
|
|
139
|
-
var isNil = function (value) {
|
|
140
|
-
return value === null || value === undefined;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
function mapVariablesToInputs(variables) {
|
|
144
|
-
return new Map(compactMap(__spreadArray([], __read(variables.values()), false), function (_a) {
|
|
145
|
-
var name = _a.name, dataType = _a.dataType, value = _a.value;
|
|
146
|
-
return !isNil(value) ? [name, { dataType: dataType, value: value }] : null;
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
162
|
var ECalculatorFilterMethods;
|
|
151
163
|
(function (ECalculatorFilterMethods) {
|
|
152
164
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -192,6 +204,14 @@ var EFormulaFilterFieldKeys;
|
|
|
192
204
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
193
205
|
})(EFormulaFilterFieldKeys || (EFormulaFilterFieldKeys = {}));
|
|
194
206
|
|
|
207
|
+
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
208
|
+
var compactMap = function (items, f) {
|
|
209
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
210
|
+
};
|
|
211
|
+
var isNil = function (value) {
|
|
212
|
+
return value === null || value === undefined;
|
|
213
|
+
};
|
|
214
|
+
|
|
195
215
|
var EFormatTypes;
|
|
196
216
|
(function (EFormatTypes) {
|
|
197
217
|
/** Дата */
|
|
@@ -504,8 +524,8 @@ var EDisplayConditionMode;
|
|
|
504
524
|
function checkDisplayCondition(displayCondition, variables) {
|
|
505
525
|
var _a;
|
|
506
526
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === EDisplayConditionMode.VARIABLE) {
|
|
507
|
-
var
|
|
508
|
-
var currentVariableValue =
|
|
527
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
528
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
509
529
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
510
530
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
511
531
|
: currentVariableValue === variableValue;
|
|
@@ -940,6 +960,11 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
940
960
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
941
961
|
}
|
|
942
962
|
|
|
963
|
+
/** Удалить из строки символы экранирования */
|
|
964
|
+
function unescapeSpecialCharacters(str) {
|
|
965
|
+
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
966
|
+
}
|
|
967
|
+
|
|
943
968
|
var EControlType;
|
|
944
969
|
(function (EControlType) {
|
|
945
970
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -963,14 +988,14 @@ var EControlType;
|
|
|
963
988
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
964
989
|
})(EControlType || (EControlType = {}));
|
|
965
990
|
|
|
966
|
-
var
|
|
967
|
-
(function (
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
})(
|
|
991
|
+
var ESelectOptionTypes;
|
|
992
|
+
(function (ESelectOptionTypes) {
|
|
993
|
+
ESelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
994
|
+
ESelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
995
|
+
ESelectOptionTypes["GROUP"] = "GROUP";
|
|
996
|
+
ESelectOptionTypes["BRANCH"] = "BRANCH";
|
|
997
|
+
ESelectOptionTypes["LEAF"] = "LEAF";
|
|
998
|
+
})(ESelectOptionTypes || (ESelectOptionTypes = {}));
|
|
974
999
|
var ECustomSelectTemplates;
|
|
975
1000
|
(function (ECustomSelectTemplates) {
|
|
976
1001
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1079,4 +1104,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1079
1104
|
return localization.getLocalized(locObj, props);
|
|
1080
1105
|
};
|
|
1081
1106
|
|
|
1082
|
-
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType,
|
|
1107
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.js
CHANGED
|
@@ -72,24 +72,51 @@ exports.EWidgetActionInputMode = void 0;
|
|
|
72
72
|
EWidgetActionInputMode["FORMULA"] = "FORMULA";
|
|
73
73
|
EWidgetActionInputMode["MANUALLY"] = "MANUALLY";
|
|
74
74
|
})(exports.EWidgetActionInputMode || (exports.EWidgetActionInputMode = {}));
|
|
75
|
+
exports.EActionTypes = void 0;
|
|
76
|
+
(function (EActionTypes) {
|
|
77
|
+
EActionTypes["URL"] = "URL";
|
|
78
|
+
EActionTypes["UPDATE_VARIABLE"] = "UPDATE_VARIABLE";
|
|
79
|
+
EActionTypes["RUN_SCRIPT"] = "RUN_SCRIPT";
|
|
80
|
+
EActionTypes["OPEN_VIEW"] = "OPEN_VIEW";
|
|
81
|
+
})(exports.EActionTypes || (exports.EActionTypes = {}));
|
|
82
|
+
exports.EViewType = void 0;
|
|
83
|
+
(function (EViewType) {
|
|
84
|
+
EViewType["CREATED_VIEW"] = "CREATED_VIEW";
|
|
85
|
+
EViewType["GENERATED_BY_SCRIPT"] = "GENERATED_BY_SCRIPT";
|
|
86
|
+
})(exports.EViewType || (exports.EViewType = {}));
|
|
87
|
+
exports.EOpenViewMode = void 0;
|
|
88
|
+
(function (EOpenViewMode) {
|
|
89
|
+
EOpenViewMode["NEW_WINDOW"] = "NEW_WINDOW";
|
|
90
|
+
EOpenViewMode["PLACEHOLDER"] = "PLACEHOLDER";
|
|
91
|
+
EOpenViewMode["MODAL"] = "MODAL";
|
|
92
|
+
EOpenViewMode["DRAWER"] = "DRAWER";
|
|
93
|
+
})(exports.EOpenViewMode || (exports.EOpenViewMode = {}));
|
|
94
|
+
exports.EDrawerPlacement = void 0;
|
|
95
|
+
(function (EDrawerPlacement) {
|
|
96
|
+
EDrawerPlacement["LEFT"] = "LEFT";
|
|
97
|
+
EDrawerPlacement["RIGHT"] = "RIGHT";
|
|
98
|
+
})(exports.EDrawerPlacement || (exports.EDrawerPlacement = {}));
|
|
75
99
|
var isActionValid = function (action, _a) {
|
|
76
100
|
var _b;
|
|
77
101
|
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
78
|
-
|
|
102
|
+
if (action.type !== exports.EActionTypes.RUN_SCRIPT) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
79
106
|
if (!currentScript) {
|
|
80
107
|
return false;
|
|
81
108
|
}
|
|
82
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
83
|
-
if (actionInputsMap.size < currentScript.
|
|
109
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
110
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
84
111
|
return false;
|
|
85
112
|
}
|
|
86
|
-
return __spreadArray([], __read(currentScript.
|
|
87
|
-
var actionInput = actionInputsMap.get(
|
|
113
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
114
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
88
115
|
if (!actionInput) {
|
|
89
116
|
return false;
|
|
90
117
|
}
|
|
91
118
|
var value = actionInput.value;
|
|
92
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.
|
|
119
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.sourceVariable)) {
|
|
93
120
|
return false;
|
|
94
121
|
}
|
|
95
122
|
if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -133,21 +160,6 @@ var escapeSingularQuotes = function (formula) {
|
|
|
133
160
|
return formula.replaceAll("'", "\\'");
|
|
134
161
|
};
|
|
135
162
|
|
|
136
|
-
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
137
|
-
var compactMap = function (items, f) {
|
|
138
|
-
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
139
|
-
};
|
|
140
|
-
var isNil = function (value) {
|
|
141
|
-
return value === null || value === undefined;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
function mapVariablesToInputs(variables) {
|
|
145
|
-
return new Map(compactMap(__spreadArray([], __read(variables.values()), false), function (_a) {
|
|
146
|
-
var name = _a.name, dataType = _a.dataType, value = _a.value;
|
|
147
|
-
return !isNil(value) ? [name, { dataType: dataType, value: value }] : null;
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
163
|
exports.ECalculatorFilterMethods = void 0;
|
|
152
164
|
(function (ECalculatorFilterMethods) {
|
|
153
165
|
ECalculatorFilterMethods["EQUAL_TO"] = "EQUAL_TO";
|
|
@@ -193,6 +205,14 @@ exports.EFormulaFilterFieldKeys = void 0;
|
|
|
193
205
|
EFormulaFilterFieldKeys["durationUnit"] = "durationUnit";
|
|
194
206
|
})(exports.EFormulaFilterFieldKeys || (exports.EFormulaFilterFieldKeys = {}));
|
|
195
207
|
|
|
208
|
+
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
209
|
+
var compactMap = function (items, f) {
|
|
210
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
211
|
+
};
|
|
212
|
+
var isNil = function (value) {
|
|
213
|
+
return value === null || value === undefined;
|
|
214
|
+
};
|
|
215
|
+
|
|
196
216
|
exports.EFormatTypes = void 0;
|
|
197
217
|
(function (EFormatTypes) {
|
|
198
218
|
/** Дата */
|
|
@@ -505,8 +525,8 @@ exports.EDisplayConditionMode = void 0;
|
|
|
505
525
|
function checkDisplayCondition(displayCondition, variables) {
|
|
506
526
|
var _a;
|
|
507
527
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === exports.EDisplayConditionMode.VARIABLE) {
|
|
508
|
-
var
|
|
509
|
-
var currentVariableValue =
|
|
528
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
529
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
510
530
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
511
531
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
512
532
|
: currentVariableValue === variableValue;
|
|
@@ -941,6 +961,11 @@ function bindContentsWithIndicators(outputs, indicators) {
|
|
|
941
961
|
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
942
962
|
}
|
|
943
963
|
|
|
964
|
+
/** Удалить из строки символы экранирования */
|
|
965
|
+
function unescapeSpecialCharacters(str) {
|
|
966
|
+
return str.replace(/\\(?!\\)/g, "").replace(/\\\\/g, "\\");
|
|
967
|
+
}
|
|
968
|
+
|
|
944
969
|
exports.EControlType = void 0;
|
|
945
970
|
(function (EControlType) {
|
|
946
971
|
EControlType["inputNumber"] = "inputNumber";
|
|
@@ -964,14 +989,14 @@ exports.EControlType = void 0;
|
|
|
964
989
|
EControlType["eventsPicker"] = "eventsPicker";
|
|
965
990
|
})(exports.EControlType || (exports.EControlType = {}));
|
|
966
991
|
|
|
967
|
-
exports.
|
|
968
|
-
(function (
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
})(exports.
|
|
992
|
+
exports.ESelectOptionTypes = void 0;
|
|
993
|
+
(function (ESelectOptionTypes) {
|
|
994
|
+
ESelectOptionTypes["DIVIDER"] = "DIVIDER";
|
|
995
|
+
ESelectOptionTypes["SYSTEM"] = "SYSTEM";
|
|
996
|
+
ESelectOptionTypes["GROUP"] = "GROUP";
|
|
997
|
+
ESelectOptionTypes["BRANCH"] = "BRANCH";
|
|
998
|
+
ESelectOptionTypes["LEAF"] = "LEAF";
|
|
999
|
+
})(exports.ESelectOptionTypes || (exports.ESelectOptionTypes = {}));
|
|
975
1000
|
exports.ECustomSelectTemplates = void 0;
|
|
976
1001
|
(function (ECustomSelectTemplates) {
|
|
977
1002
|
ECustomSelectTemplates["FORMULA"] = "FORMULA";
|
|
@@ -1112,7 +1137,6 @@ exports.mapFormulaFiltersToInputs = mapFormulaFiltersToInputs;
|
|
|
1112
1137
|
exports.mapMeasuresToInputs = mapMeasuresToInputs;
|
|
1113
1138
|
exports.mapSortingToInputs = mapSortingToInputs;
|
|
1114
1139
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1115
|
-
exports.mapVariablesToInputs = mapVariablesToInputs;
|
|
1116
1140
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1117
1141
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1118
1142
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
@@ -1120,6 +1144,7 @@ exports.replaceFiltersBySelection = replaceFiltersBySelection;
|
|
|
1120
1144
|
exports.replaceHierarchiesWithDimensions = replaceHierarchiesWithDimensions;
|
|
1121
1145
|
exports.selectDimensionFromHierarchy = selectDimensionFromHierarchy;
|
|
1122
1146
|
exports.transitionMeasureTemplateFormulas = transitionMeasureTemplateFormulas;
|
|
1147
|
+
exports.unescapeSpecialCharacters = unescapeSpecialCharacters;
|
|
1123
1148
|
exports.updateDefaultModeSelection = updateDefaultModeSelection;
|
|
1124
1149
|
exports.updateMultiModeSelection = updateMultiModeSelection;
|
|
1125
1150
|
exports.updateSingleModeSelection = updateSingleModeSelection;
|