@infomaximum/widget-sdk 5.0.0-beta1 → 5.0.0-beta11
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/README.md +2 -2
- package/dist/index.d.ts +100 -66
- package/dist/index.esm.js +29 -15
- package/dist/index.js +29 -15
- package/package.json +2 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -363,8 +363,6 @@ interface IAddDurationOfTransitionFilter {
|
|
|
363
363
|
declare enum EFormulaFilterFieldKeys {
|
|
364
364
|
date = "date",
|
|
365
365
|
dateRange = "dateRange",
|
|
366
|
-
duration = "duration",
|
|
367
|
-
number = "number",
|
|
368
366
|
numberRange = "numberRange",
|
|
369
367
|
string = "string",
|
|
370
368
|
lastTimeValue = "lastTimeValue",
|
|
@@ -383,13 +381,11 @@ interface IFormulaFilterValue {
|
|
|
383
381
|
/** Метод фильтрации */
|
|
384
382
|
filteringMethod: valueof<typeof formulaFilterMethods>;
|
|
385
383
|
/** Выбранные в списке значения в виде моделей */
|
|
386
|
-
checkedValues
|
|
384
|
+
checkedValues?: (string | null)[];
|
|
387
385
|
/** Значения полей формы редактора */
|
|
388
|
-
formValues
|
|
386
|
+
formValues?: Partial<{
|
|
389
387
|
[EFormulaFilterFieldKeys.date]: string | null;
|
|
390
388
|
[EFormulaFilterFieldKeys.dateRange]: [string, string];
|
|
391
|
-
[EFormulaFilterFieldKeys.duration]: string;
|
|
392
|
-
[EFormulaFilterFieldKeys.number]: number;
|
|
393
389
|
[EFormulaFilterFieldKeys.numberRange]: Partial<[number, number]>;
|
|
394
390
|
[EFormulaFilterFieldKeys.string]: string;
|
|
395
391
|
[EFormulaFilterFieldKeys.lastTimeValue]: number;
|
|
@@ -416,7 +412,7 @@ interface IStagesFilterValue {
|
|
|
416
412
|
/** Этапы */
|
|
417
413
|
stages: IStagesFilterItem[];
|
|
418
414
|
}
|
|
419
|
-
type TWidgetFilterValue =
|
|
415
|
+
type TWidgetFilterValue = TExtendedFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
|
|
420
416
|
interface IWidgetFilter {
|
|
421
417
|
/** Значение фильтра */
|
|
422
418
|
filterValue: TWidgetFilterValue;
|
|
@@ -524,18 +520,6 @@ interface IWidgetTable {
|
|
|
524
520
|
/** Колонки таблицы */
|
|
525
521
|
columns: Map<string, IWidgetTableColumn>;
|
|
526
522
|
}
|
|
527
|
-
/**
|
|
528
|
-
* simplified - упрощенный (для работы фильтрации в образах, открытых в модальном/боковом окне)
|
|
529
|
-
*
|
|
530
|
-
* full - полный
|
|
531
|
-
*/
|
|
532
|
-
type TFiltrationMode = "simplified" | "full";
|
|
533
|
-
/**
|
|
534
|
-
* preview - упрощенный
|
|
535
|
-
*
|
|
536
|
-
* full - полный
|
|
537
|
-
*/
|
|
538
|
-
type TDisplayMode = "preview" | "full";
|
|
539
523
|
interface IDisplayRule {
|
|
540
524
|
color: TColor;
|
|
541
525
|
}
|
|
@@ -546,10 +530,6 @@ interface IGlobalContext {
|
|
|
546
530
|
reportName: string;
|
|
547
531
|
/** Имена образов по их ключу(в текущем отчете) */
|
|
548
532
|
viewNameByKey: Map<string, string>;
|
|
549
|
-
/** Режим отображения виджетов */
|
|
550
|
-
displayMode: TDisplayMode;
|
|
551
|
-
/** Режим фильтрации виджетов */
|
|
552
|
-
filtrationMode: TFiltrationMode;
|
|
553
533
|
/** @deprecated имя группы пространства по ее id */
|
|
554
534
|
workspaceGroupNameById: Map<number, string>;
|
|
555
535
|
/** Меры уровня отчета */
|
|
@@ -664,8 +644,6 @@ interface IBaseWidgetSettings {
|
|
|
664
644
|
ignoreFilters?: boolean;
|
|
665
645
|
sorting?: IWidgetSortingIndicator[];
|
|
666
646
|
actions?: IWidgetAction[];
|
|
667
|
-
displayCondition?: TDisplayCondition;
|
|
668
|
-
displayConditionComment?: string;
|
|
669
647
|
appearance?: TAppearanceSettings;
|
|
670
648
|
}
|
|
671
649
|
|
|
@@ -727,17 +705,21 @@ interface IParameterFromEndEvent {
|
|
|
727
705
|
interface IParameterFromManualInput {
|
|
728
706
|
inputMethod: EWidgetActionInputMethod.MANUALLY;
|
|
729
707
|
description: string;
|
|
708
|
+
defaultValue?: string;
|
|
709
|
+
filterByRows?: boolean;
|
|
730
710
|
}
|
|
731
711
|
interface IParameterFromStaticList {
|
|
732
712
|
inputMethod: EWidgetActionInputMethod.STATIC_LIST;
|
|
733
|
-
options: string
|
|
734
|
-
|
|
713
|
+
options: string;
|
|
714
|
+
defaultOptionIndexes: number[];
|
|
735
715
|
}
|
|
736
716
|
interface IParameterFromDynamicList {
|
|
737
717
|
inputMethod: EWidgetActionInputMethod.DYNAMIC_LIST;
|
|
738
|
-
|
|
718
|
+
options: string;
|
|
739
719
|
defaultValue: string;
|
|
720
|
+
displayOptions: string;
|
|
740
721
|
filters: TExtendedFormulaFilterValue[];
|
|
722
|
+
filterByRows?: boolean;
|
|
741
723
|
}
|
|
742
724
|
interface IWidgetActionParameterCommon {
|
|
743
725
|
name: string;
|
|
@@ -799,7 +781,6 @@ type TActionOpenView = IActionCommon & {
|
|
|
799
781
|
}>));
|
|
800
782
|
type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
|
|
801
783
|
interface IWidgetAction extends IActionCommon {
|
|
802
|
-
filters: TExtendedFormulaFilterValue[];
|
|
803
784
|
parameters: TWidgetActionParameter[];
|
|
804
785
|
type: EActionTypes.EXECUTE_SCRIPT;
|
|
805
786
|
scriptKey: string;
|
|
@@ -829,13 +810,19 @@ declare enum ESortDirection {
|
|
|
829
810
|
}
|
|
830
811
|
type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
|
|
831
812
|
interface ISortOrder {
|
|
813
|
+
/** Формула сортировки */
|
|
832
814
|
formula: string;
|
|
815
|
+
/** Тип данных формулы */
|
|
816
|
+
dbDataType: TNullable<string>;
|
|
817
|
+
/** Направление сортировки */
|
|
833
818
|
direction: TSortDirection;
|
|
819
|
+
/** Условие применения сортировки */
|
|
834
820
|
displayCondition?: TNullable<string>;
|
|
835
821
|
}
|
|
836
822
|
type TWidgetSortingValue = {
|
|
837
823
|
mode: ESortingValueModes.FORMULA;
|
|
838
824
|
formula: string;
|
|
825
|
+
dbDataType: string;
|
|
839
826
|
} | {
|
|
840
827
|
mode: ESortingValueModes.IN_WIDGET;
|
|
841
828
|
group: string;
|
|
@@ -908,15 +895,15 @@ interface ICommonDimensions {
|
|
|
908
895
|
}
|
|
909
896
|
type TColumnIndicatorValue = {
|
|
910
897
|
mode: EWidgetIndicatorValueModes.FORMULA;
|
|
911
|
-
formula
|
|
898
|
+
formula?: string;
|
|
912
899
|
} | {
|
|
913
900
|
mode: EWidgetIndicatorValueModes.TEMPLATE;
|
|
914
901
|
/** Имя шаблонной формулы, использующей колонку таблицы */
|
|
915
|
-
templateName
|
|
902
|
+
templateName?: string;
|
|
916
903
|
/** Имя таблицы */
|
|
917
|
-
tableName
|
|
904
|
+
tableName?: string;
|
|
918
905
|
/** Имя колонки */
|
|
919
|
-
columnName
|
|
906
|
+
columnName?: string;
|
|
920
907
|
};
|
|
921
908
|
/** Общий интерфейс разреза и меры */
|
|
922
909
|
interface IWidgetColumnIndicator extends IWidgetIndicator {
|
|
@@ -952,6 +939,8 @@ declare enum EIndicatorType {
|
|
|
952
939
|
STATIC_LIST = "STATIC_LIST",
|
|
953
940
|
/** Динамический список */
|
|
954
941
|
DYNAMIC_LIST = "DYNAMIC_LIST",
|
|
942
|
+
/** Список колонок */
|
|
943
|
+
COLUMN_LIST = "COLUMN_LIST",
|
|
955
944
|
/** Разрез */
|
|
956
945
|
DIMENSION = "DIMENSION",
|
|
957
946
|
/** Мера */
|
|
@@ -1012,7 +1001,15 @@ interface IWidgetDynamicListVariable extends IBaseWidgetVariable {
|
|
|
1012
1001
|
/** Фильтры */
|
|
1013
1002
|
filters: TExtendedFormulaFilterValue[];
|
|
1014
1003
|
}
|
|
1015
|
-
|
|
1004
|
+
interface IWidgetColumnListVariable extends IBaseWidgetVariable {
|
|
1005
|
+
/** Тип переменной */
|
|
1006
|
+
type: EIndicatorType.COLUMN_LIST;
|
|
1007
|
+
/** Имя таблицы */
|
|
1008
|
+
tableName: string;
|
|
1009
|
+
/** Значение (имя колонки) */
|
|
1010
|
+
value: string;
|
|
1011
|
+
}
|
|
1012
|
+
type TWidgetVariable = IWidgetStaticVariable | IWidgetStaticListVariable | IWidgetDynamicListVariable | IWidgetColumnListVariable;
|
|
1016
1013
|
declare function isDimensionsHierarchy(indicator: IWidgetColumnIndicator): indicator is IWidgetDimensionHierarchy;
|
|
1017
1014
|
|
|
1018
1015
|
/** Формат входного параметра GeneralCalculator */
|
|
@@ -1033,13 +1030,10 @@ interface IBaseDimensionsAndMeasuresCalculatorInput {
|
|
|
1033
1030
|
isHideEmptyMeasures?: boolean;
|
|
1034
1031
|
/** Сортировка */
|
|
1035
1032
|
sortOrders?: ISortOrder[];
|
|
1036
|
-
/** Формула условия отображения */
|
|
1037
|
-
displayConditionFormula?: TNullable<string>;
|
|
1038
1033
|
}
|
|
1039
1034
|
interface IBaseDimensionsAndMeasuresCalculatorOutput {
|
|
1040
1035
|
dimensions: Map<string, ICalculatorDimensionOutput>;
|
|
1041
1036
|
measures: Map<string, ICalculatorMeasureOutput>;
|
|
1042
|
-
isDisplay: boolean;
|
|
1043
1037
|
isValuesEmpty: boolean;
|
|
1044
1038
|
}
|
|
1045
1039
|
interface IBaseDimensionsAndMeasuresCalculator<Input extends IBaseDimensionsAndMeasuresCalculatorInput, Output extends IBaseDimensionsAndMeasuresCalculatorOutput> extends ICalculator<Input, Output> {
|
|
@@ -1070,8 +1064,6 @@ interface IHistogramCalculatorInput {
|
|
|
1070
1064
|
dimensions: ICalculatorDimensionInput[];
|
|
1071
1065
|
/** Лимит корзин */
|
|
1072
1066
|
binsLimit: number;
|
|
1073
|
-
/** Формула условия отображения */
|
|
1074
|
-
displayConditionFormula?: TNullable<string>;
|
|
1075
1067
|
/** Фильтры, использующие WHERE */
|
|
1076
1068
|
filters: ICalculatorFilter[];
|
|
1077
1069
|
/** Имя таблицы */
|
|
@@ -1084,7 +1076,6 @@ interface IHistogramBin {
|
|
|
1084
1076
|
}
|
|
1085
1077
|
interface IHistogramCalculatorOutput {
|
|
1086
1078
|
bins: IHistogramBin[];
|
|
1087
|
-
isDisplay: boolean;
|
|
1088
1079
|
dimensionAlias: string;
|
|
1089
1080
|
}
|
|
1090
1081
|
interface IHistogramCalculator extends ICalculator<IHistogramCalculatorInput, IHistogramCalculatorOutput> {
|
|
@@ -1121,7 +1112,6 @@ interface IProcessGraphCalculatorInput {
|
|
|
1121
1112
|
edgeMeasures: ICalculatorMeasureInput[];
|
|
1122
1113
|
filters: ICalculatorFilter[];
|
|
1123
1114
|
eventFilters?: ICalculatorFilter[];
|
|
1124
|
-
displayConditionFormula?: TNullable<string>;
|
|
1125
1115
|
}
|
|
1126
1116
|
interface IProcessGraphCalculatorOutput {
|
|
1127
1117
|
vertexMaxLimit: number;
|
|
@@ -1134,7 +1124,6 @@ interface IProcessGraphCalculatorOutput {
|
|
|
1134
1124
|
/** alias'ы мер, попавших под условие отображения */
|
|
1135
1125
|
edgeMeasuresAliases: Set<string>;
|
|
1136
1126
|
edges: IEdge[];
|
|
1137
|
-
isDisplay: boolean;
|
|
1138
1127
|
}
|
|
1139
1128
|
interface IProcessGraphCalculator extends ICalculator<IProcessGraphCalculatorInput, IProcessGraphCalculatorOutput> {
|
|
1140
1129
|
}
|
|
@@ -1156,8 +1145,6 @@ interface ITwoLimitsCalculatorInput {
|
|
|
1156
1145
|
isHideEmptyMeasures?: boolean;
|
|
1157
1146
|
/** Сортировка */
|
|
1158
1147
|
sortOrders?: ISortOrder[];
|
|
1159
|
-
/** Формула условия отображения */
|
|
1160
|
-
displayConditionFormula?: TNullable<string>;
|
|
1161
1148
|
/** Лимит строк */
|
|
1162
1149
|
limit?: number;
|
|
1163
1150
|
/** Второй лимит */
|
|
@@ -1172,7 +1159,6 @@ interface ITwoLimitsCalculatorExportInput extends ITwoLimitsCalculatorInput {
|
|
|
1172
1159
|
interface ITwoLimitsCalculatorOutput {
|
|
1173
1160
|
dimensions: Map<string, ICalculatorDimensionOutput>;
|
|
1174
1161
|
measures: Map<string, ICalculatorMeasureOutput>;
|
|
1175
|
-
isDisplay: boolean;
|
|
1176
1162
|
isValuesEmpty: boolean;
|
|
1177
1163
|
}
|
|
1178
1164
|
interface ITwoLimitsCalculator extends ICalculator<ITwoLimitsCalculatorInput, ITwoLimitsCalculatorOutput> {
|
|
@@ -1480,14 +1466,12 @@ interface ISelectGroupOption {
|
|
|
1480
1466
|
options: IAddButtonSelectOption[];
|
|
1481
1467
|
icon: string;
|
|
1482
1468
|
}
|
|
1483
|
-
/** @deprecated необходимо использовать TSelectFetchNodes*/
|
|
1484
|
-
type TSelectFetchOptions = (searchText?: string) => Promise<TCustomAddButtonSelectOption[]>;
|
|
1485
1469
|
interface ISelectNode {
|
|
1486
1470
|
options: TCustomAddButtonSelectOption[];
|
|
1487
1471
|
isAllRequested: boolean;
|
|
1488
1472
|
}
|
|
1489
1473
|
type TSelectFetchNodes = (searchText?: string) => Promise<ISelectNode>;
|
|
1490
|
-
type TSelectChildOptions = TCustomAddButtonSelectOption[] | TSelectFetchNodes
|
|
1474
|
+
type TSelectChildOptions = TCustomAddButtonSelectOption[] | TSelectFetchNodes;
|
|
1491
1475
|
interface ISelectBranchOption {
|
|
1492
1476
|
type: ESelectOptionTypes.BRANCH;
|
|
1493
1477
|
label: string;
|
|
@@ -1495,22 +1479,22 @@ interface ISelectBranchOption {
|
|
|
1495
1479
|
icon?: string;
|
|
1496
1480
|
disabled?: boolean;
|
|
1497
1481
|
}
|
|
1498
|
-
interface ISelectLeafOption {
|
|
1482
|
+
interface ISelectLeafOption<U extends object> {
|
|
1499
1483
|
type: ESelectOptionTypes.LEAF;
|
|
1500
1484
|
label: string;
|
|
1501
1485
|
value: string;
|
|
1502
|
-
onSelect:
|
|
1486
|
+
onSelect: (value: string, update: (f: (prevItems: U) => U) => void) => void;
|
|
1503
1487
|
/** Строка в формате base64 */
|
|
1504
1488
|
icon?: string;
|
|
1505
1489
|
disabled?: boolean;
|
|
1506
1490
|
}
|
|
1507
|
-
type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption
|
|
1491
|
+
type IAddButtonSelectOption = ISelectDividerOption | ISelectGroupOption | ISelectBranchOption | ISelectLeafOption<object[]>;
|
|
1508
1492
|
type TCustomAddButtonSelectOption = ISelectSystemOption<ECustomSelectTemplates> | IAddButtonSelectOption;
|
|
1509
1493
|
type TMeasureAddButtonSelectOption = IAddButtonSelectOption;
|
|
1510
1494
|
interface ICustomAddButtonProps {
|
|
1511
1495
|
options: TSelectChildOptions;
|
|
1512
1496
|
hasDropdown?: boolean;
|
|
1513
|
-
onClick?: ISelectLeafOption["onSelect"];
|
|
1497
|
+
onClick?: ISelectLeafOption<object[]>["onSelect"];
|
|
1514
1498
|
}
|
|
1515
1499
|
interface IWidgetIndicatorAddButtonProps {
|
|
1516
1500
|
hideTablesColumnsOptions?: boolean;
|
|
@@ -1567,7 +1551,7 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
1567
1551
|
/** Конфигурация кнопок добавления группы в набор */
|
|
1568
1552
|
addButtons: TAddButton[];
|
|
1569
1553
|
/** Получить название, отображаемое на плашке (по умолчанию используется поле name из группы) */
|
|
1570
|
-
getGroupTitle?(group: IGroupSettings): string;
|
|
1554
|
+
getGroupTitle?(group: IGroupSettings, index: number): string;
|
|
1571
1555
|
/**
|
|
1572
1556
|
* Получить описание показателя для группы, если группа описывает системный показатель.
|
|
1573
1557
|
*
|
|
@@ -1578,9 +1562,9 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
1578
1562
|
*/
|
|
1579
1563
|
getIndicatorData?: (settings: IInitialSettings) => EWidgetIndicatorType | TWidgetIndicatorData;
|
|
1580
1564
|
/** Создать конфигурацию группы для вкладки настроек данных */
|
|
1581
|
-
createDataRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1565
|
+
createDataRecords?(group: IGroupSettings, index: number): TGroupLevelRecord<GroupSettings>[];
|
|
1582
1566
|
/** Создать конфигурацию группы для вкладки настроек отображения */
|
|
1583
|
-
createDisplayRecords?(group: IGroupSettings): TGroupLevelRecord<GroupSettings>[];
|
|
1567
|
+
createDisplayRecords?(group: IGroupSettings, index: number): TGroupLevelRecord<GroupSettings>[];
|
|
1584
1568
|
/** Находится ли группа в состоянии загрузки (по умолчанию false) */
|
|
1585
1569
|
isLoading?(group: IGroupSettings): boolean;
|
|
1586
1570
|
/** Является ли группа валидной (по умолчанию true) */
|
|
@@ -1656,11 +1640,9 @@ declare enum ESystemRecordKey {
|
|
|
1656
1640
|
|
|
1657
1641
|
interface IWidgetPlaceholderController {
|
|
1658
1642
|
setError(value: Error | null): void;
|
|
1659
|
-
setConfigured(value: boolean): void;
|
|
1660
1643
|
/**
|
|
1661
|
-
*
|
|
1644
|
+
* Сообщает о готовности виджета к отображению.
|
|
1662
1645
|
*
|
|
1663
|
-
* После вызова данного метода виджет станет доступен для отображения.
|
|
1664
1646
|
* Это предотвращает мерцание при первом появлении виджета на экране.
|
|
1665
1647
|
* Метод должен быть вызван после полной готовности виджета: все необходимые данные загружены, высота установлена.
|
|
1666
1648
|
*/
|
|
@@ -1670,21 +1652,57 @@ interface IWidgetPlaceholderController {
|
|
|
1670
1652
|
}
|
|
1671
1653
|
interface IWidgetPlaceholderValues {
|
|
1672
1654
|
error: Error | null;
|
|
1673
|
-
isConfigured: boolean;
|
|
1674
1655
|
isDisplay: boolean | undefined;
|
|
1675
1656
|
isEmpty: boolean;
|
|
1676
1657
|
isOverlay: boolean;
|
|
1677
1658
|
}
|
|
1678
1659
|
|
|
1679
|
-
interface
|
|
1660
|
+
interface IWidgetPresetSettings {
|
|
1661
|
+
appearance: TAppearanceSettings;
|
|
1662
|
+
filterMode: EWidgetFilterMode;
|
|
1663
|
+
ignoreFilters: boolean;
|
|
1664
|
+
stateName: string | null;
|
|
1665
|
+
titleColor: TColor;
|
|
1666
|
+
titleSize: number;
|
|
1667
|
+
titleWeight: EFontWeight;
|
|
1668
|
+
textSize: number;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
type TVersion = string;
|
|
1672
|
+
type TMigrationStruct = Record<string, any>;
|
|
1673
|
+
interface IWidgetStruct<Settings extends IBaseWidgetSettings = IBaseWidgetSettings> {
|
|
1674
|
+
key: string;
|
|
1675
|
+
apiVersion: string;
|
|
1676
|
+
type: string;
|
|
1677
|
+
settings: Settings;
|
|
1678
|
+
localApiVersion?: string;
|
|
1679
|
+
}
|
|
1680
|
+
type TMigrateProcessor<T extends TMigrationStruct> = (struct: T) => void;
|
|
1681
|
+
interface ISettingsMigratorParams {
|
|
1682
|
+
versions: ReadonlyArray<TVersion>;
|
|
1683
|
+
defaultVersion?: TVersion;
|
|
1684
|
+
}
|
|
1685
|
+
interface IWidgetMigrator<T extends TMigrationStruct = IWidgetStruct> {
|
|
1686
|
+
registerProcessor(version: TVersion, processor: TMigrateProcessor<T>, type?: string, versionPath?: string): void;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings, MigrationStruct extends TMigrationStruct = IWidgetStruct> {
|
|
1680
1690
|
/** иконка виджета отображаемая в системе (в base64, svg или png) */
|
|
1681
1691
|
icon?: string;
|
|
1682
1692
|
/** возвращает конфигурацию настроек для отображения */
|
|
1683
1693
|
createPanelDescription: IPanelDescriptionCreator<WidgetSettings, GroupSettings>;
|
|
1684
1694
|
/** заполняет настройки значениями по умолчанию */
|
|
1685
1695
|
fillSettings: IFillSettings<WidgetSettings>;
|
|
1696
|
+
/** получить начальные настройки виджета, используя заданный пользователем шаблон настроек */
|
|
1697
|
+
getInitialSettings?: (settings: Partial<IWidgetPresetSettings>) => Partial<IBaseWidgetSettings>;
|
|
1686
1698
|
/** возвращает ключи показателей(разрезов или мер), для которых должна работать системная сортировка */
|
|
1687
1699
|
getSortableIndicatorsKeys?(): Readonly<StringKeyOf<WidgetSettings>[]>;
|
|
1700
|
+
/** Регистрация системных миграторов виджета */
|
|
1701
|
+
registerSystemMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
|
|
1702
|
+
/** Регистрация собственных миграторов виджета */
|
|
1703
|
+
registerLocalMigrateProcessors?(migrator: IWidgetMigrator<MigrationStruct>, globalContext: IGlobalContext): void;
|
|
1704
|
+
/** Возвращает массив версий локальных миграций виджета */
|
|
1705
|
+
getLocalMigrateVersions(): string[];
|
|
1688
1706
|
}
|
|
1689
1707
|
|
|
1690
1708
|
type TContextMenu = (TContextMenuList | TContextMenuButtonGroup) & {
|
|
@@ -1767,6 +1785,8 @@ type TLaunchActionParams = {
|
|
|
1767
1785
|
filters: ICalculatorFilter[];
|
|
1768
1786
|
/** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
|
|
1769
1787
|
eventNames?: [string] | [string, string];
|
|
1788
|
+
/** Callback вызывается при успешном открытии модального окна подтверждения или при прерывании открытия */
|
|
1789
|
+
onConfirmationOpenSettled?: () => void;
|
|
1770
1790
|
};
|
|
1771
1791
|
type TWidgetContainer = {
|
|
1772
1792
|
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
@@ -1778,9 +1798,21 @@ interface IWidgetPersistValue<T extends object = object> {
|
|
|
1778
1798
|
get(): T | null;
|
|
1779
1799
|
set(value: T | null): void;
|
|
1780
1800
|
}
|
|
1801
|
+
/**
|
|
1802
|
+
* simplified - упрощенный (для работы фильтрации в образах, открытых в модальном/боковом окне)
|
|
1803
|
+
*
|
|
1804
|
+
* full - полный
|
|
1805
|
+
*/
|
|
1806
|
+
type TFiltrationAccessibility = "simplified" | "full";
|
|
1807
|
+
/**
|
|
1808
|
+
* preview - упрощенный
|
|
1809
|
+
*
|
|
1810
|
+
* full - полный
|
|
1811
|
+
*/
|
|
1812
|
+
type TDisplayMode = "preview" | "full";
|
|
1781
1813
|
interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
|
|
1782
|
-
/**
|
|
1783
|
-
|
|
1814
|
+
/** Ключ виджета */
|
|
1815
|
+
widgetKey: string;
|
|
1784
1816
|
/** Настройки виджета */
|
|
1785
1817
|
settings: WidgetSettings;
|
|
1786
1818
|
/** Фабрика для создания вычислителей */
|
|
@@ -1814,6 +1846,10 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1814
1846
|
actionValidator: TActionValidator;
|
|
1815
1847
|
/** Аксессор для persist-значения виджета, хранимого в localStorage и URL */
|
|
1816
1848
|
persistValue: IWidgetPersistValue;
|
|
1849
|
+
/** Режим отображения виджета */
|
|
1850
|
+
displayMode: TDisplayMode;
|
|
1851
|
+
/** Доступность фильтрации */
|
|
1852
|
+
filtrationAccessibility: TFiltrationAccessibility;
|
|
1817
1853
|
}
|
|
1818
1854
|
/** Манифест виджета */
|
|
1819
1855
|
interface IWidgetManifest {
|
|
@@ -1841,8 +1877,6 @@ interface IWidgetManifest {
|
|
|
1841
1877
|
};
|
|
1842
1878
|
/** Параметры контейнера виджета */
|
|
1843
1879
|
container_params?: {
|
|
1844
|
-
/** @deprecated необходимо использовать show_title */
|
|
1845
|
-
show_header?: boolean;
|
|
1846
1880
|
/** Отображать ли системный заголовок виджета (по умолчанию false) */
|
|
1847
1881
|
show_title?: boolean;
|
|
1848
1882
|
/** Отображать ли markdown "описание" виджета (по умолчанию false) */
|
|
@@ -1896,7 +1930,7 @@ interface IWidget<WidgetSettings extends IBaseWidgetSettings> {
|
|
|
1896
1930
|
unmount(container: HTMLElement): void;
|
|
1897
1931
|
}
|
|
1898
1932
|
interface IFillSettings<WidgetSettings extends IBaseWidgetSettings> {
|
|
1899
|
-
(settings: Partial<WidgetSettings>, context: IGlobalContext): void;
|
|
1933
|
+
(settings: Partial<WidgetSettings>, context: IGlobalContext, prevSettings: Partial<WidgetSettings> | undefined): void;
|
|
1900
1934
|
}
|
|
1901
1935
|
interface IWidgetEntity<WidgetSettings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
|
|
1902
1936
|
new (): IWidget<WidgetSettings>;
|
|
@@ -1967,4 +2001,4 @@ declare global {
|
|
|
1967
2001
|
}
|
|
1968
2002
|
}
|
|
1969
2003
|
|
|
1970
|
-
export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, 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 IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, 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 IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, 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 ISelectNode, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TAppearanceSettings, 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 TExtendedFormulaFilterValue, type
|
|
2004
|
+
export { EActionButtonsTypes, EActionTypes, ECalculatorFilterMethods, EClickHouseBaseTypes, EColorMode, EControlType, ECustomSelectTemplates, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESimpleInputType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAutoIdentifiedArrayItem, 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 IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, 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 IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, 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 ISelectNode, type ISelectOption, type ISelectSystemOption, type ISettingsMigratorParams, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetColumnListVariable, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetDynamicListVariable, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetManifest, type IWidgetMeasure, type IWidgetMigrator, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetPresetSettings, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetStaticListVariable, type IWidgetStaticVariable, type IWidgetStruct, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TAppearanceSettings, type TBoundedContentWithIndicator, type TColor, type TColorBase, 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 TExtendedFormulaFilterValue, type TFiltrationAccessibility, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TMigrateProcessor, type TMigrationStruct, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchNodes, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TVersion, type TWidgetActionParameter, type TWidgetContainer, type TWidgetDimensionData, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetIndicatorData, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, colors, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseClickHouseType, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -156,8 +156,6 @@ var EFormulaFilterFieldKeys;
|
|
|
156
156
|
(function (EFormulaFilterFieldKeys) {
|
|
157
157
|
EFormulaFilterFieldKeys["date"] = "date";
|
|
158
158
|
EFormulaFilterFieldKeys["dateRange"] = "dateRange";
|
|
159
|
-
EFormulaFilterFieldKeys["duration"] = "duration";
|
|
160
|
-
EFormulaFilterFieldKeys["number"] = "number";
|
|
161
159
|
EFormulaFilterFieldKeys["numberRange"] = "numberRange";
|
|
162
160
|
EFormulaFilterFieldKeys["string"] = "string";
|
|
163
161
|
EFormulaFilterFieldKeys["lastTimeValue"] = "lastTimeValue";
|
|
@@ -646,6 +644,9 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
646
644
|
if (checkedValues && checkedValues.length) {
|
|
647
645
|
return checkedValues;
|
|
648
646
|
}
|
|
647
|
+
if (!formValues) {
|
|
648
|
+
return [];
|
|
649
|
+
}
|
|
649
650
|
function stringifyNumbersRange(range) {
|
|
650
651
|
if (range === void 0) { range = [undefined, undefined]; }
|
|
651
652
|
return range.map(function (value, index) {
|
|
@@ -680,21 +681,19 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
680
681
|
}
|
|
681
682
|
return compact([datePickerValue]);
|
|
682
683
|
case EFormatTypes.STRING:
|
|
683
|
-
return compact([(_a = formValues
|
|
684
|
+
return compact([(_a = formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
|
|
684
685
|
case EFormatTypes.NUMBER:
|
|
685
686
|
case EFormatTypes.YEAR:
|
|
686
687
|
case EFormatTypes.DAY_OF_MONTH:
|
|
687
688
|
case EFormatTypes.WEEK:
|
|
688
689
|
case EFormatTypes.HOUR:
|
|
689
|
-
var _g = formValues, _h = EFormulaFilterFieldKeys.
|
|
690
|
-
return isRangeFilteringMethod(filteringMethod)
|
|
691
|
-
? stringifyNumbersRange(numberRange)
|
|
692
|
-
: [String(number !== null && number !== void 0 ? number : 0)];
|
|
690
|
+
var _g = formValues, _h = EFormulaFilterFieldKeys.numberRange, numberRange = _g[_h];
|
|
691
|
+
return isRangeFilteringMethod(filteringMethod) ? stringifyNumbersRange(numberRange) : [];
|
|
693
692
|
case EFormatTypes.DURATION:
|
|
694
|
-
var
|
|
693
|
+
var _j = formValues, _k = EFormulaFilterFieldKeys.numberRange, durationRange = _j[_k], _l = EFormulaFilterFieldKeys.durationUnit, durationUnit = _j[_l];
|
|
695
694
|
return isRangeFilteringMethod(filteringMethod)
|
|
696
695
|
? convertDurationRangeToSecond(durationRange, durationUnit)
|
|
697
|
-
: [
|
|
696
|
+
: [];
|
|
698
697
|
}
|
|
699
698
|
return [];
|
|
700
699
|
};
|
|
@@ -821,6 +820,8 @@ var EIndicatorType;
|
|
|
821
820
|
EIndicatorType["STATIC_LIST"] = "STATIC_LIST";
|
|
822
821
|
/** Динамический список */
|
|
823
822
|
EIndicatorType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
|
|
823
|
+
/** Список колонок */
|
|
824
|
+
EIndicatorType["COLUMN_LIST"] = "COLUMN_LIST";
|
|
824
825
|
/** Разрез */
|
|
825
826
|
EIndicatorType["DIMENSION"] = "DIMENSION";
|
|
826
827
|
/** Мера */
|
|
@@ -877,17 +878,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
|
|
|
877
878
|
_a$3[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
878
879
|
_a$3);
|
|
879
880
|
function getDimensionFormula(_a) {
|
|
881
|
+
var _b;
|
|
880
882
|
var value = _a.value;
|
|
881
883
|
if (!value) {
|
|
882
884
|
return "";
|
|
883
885
|
}
|
|
884
886
|
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
885
|
-
return value.formula;
|
|
887
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
886
888
|
}
|
|
887
889
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
888
890
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
889
891
|
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
890
|
-
if (!templateFormula) {
|
|
892
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
891
893
|
return "";
|
|
892
894
|
}
|
|
893
895
|
return fillTemplateString(templateFormula, {
|
|
@@ -918,17 +920,18 @@ var measureTemplateFormulas = (_a$2 = {},
|
|
|
918
920
|
_a$2[EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
919
921
|
_a$2);
|
|
920
922
|
function getMeasureFormula(_a) {
|
|
923
|
+
var _b;
|
|
921
924
|
var value = _a.value;
|
|
922
925
|
if (!value) {
|
|
923
926
|
return "";
|
|
924
927
|
}
|
|
925
928
|
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
926
|
-
return value.formula;
|
|
929
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
927
930
|
}
|
|
928
931
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
929
932
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
930
933
|
var templateFormula = measureTemplateFormulas[templateName];
|
|
931
|
-
if (!templateFormula) {
|
|
934
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
932
935
|
return "";
|
|
933
936
|
}
|
|
934
937
|
return fillTemplateString(templateFormula, {
|
|
@@ -1179,7 +1182,13 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1179
1182
|
].includes(dimension.format);
|
|
1180
1183
|
});
|
|
1181
1184
|
if (timeDimension) {
|
|
1182
|
-
return [
|
|
1185
|
+
return [
|
|
1186
|
+
{
|
|
1187
|
+
formula: getDimensionFormula(timeDimension),
|
|
1188
|
+
dbDataType: timeDimension.dbDataType,
|
|
1189
|
+
direction: ESortDirection.ascend,
|
|
1190
|
+
},
|
|
1191
|
+
];
|
|
1183
1192
|
}
|
|
1184
1193
|
if (measures.length > 0) {
|
|
1185
1194
|
var firstMeasure = measures[0];
|
|
@@ -1188,6 +1197,7 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1188
1197
|
{
|
|
1189
1198
|
direction: ESortDirection.descend,
|
|
1190
1199
|
formula: getMeasureFormula(firstMeasure),
|
|
1200
|
+
dbDataType: firstMeasure.dbDataType,
|
|
1191
1201
|
},
|
|
1192
1202
|
];
|
|
1193
1203
|
}
|
|
@@ -1201,7 +1211,9 @@ function mapSortingToInputs(_a) {
|
|
|
1201
1211
|
var _b;
|
|
1202
1212
|
var direction = _a.direction, value = _a.value;
|
|
1203
1213
|
if (value.mode === ESortingValueModes.FORMULA) {
|
|
1204
|
-
return value.formula
|
|
1214
|
+
return value.formula
|
|
1215
|
+
? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
|
|
1216
|
+
: undefined;
|
|
1205
1217
|
}
|
|
1206
1218
|
var indicatorsGroup = settings[value.group];
|
|
1207
1219
|
var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
|
|
@@ -1219,6 +1231,7 @@ function mapSortingToInputs(_a) {
|
|
|
1219
1231
|
return {
|
|
1220
1232
|
formula: formula,
|
|
1221
1233
|
direction: direction,
|
|
1234
|
+
dbDataType: activeDimensions.dbDataType,
|
|
1222
1235
|
displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === EDisplayConditionMode.FORMULA
|
|
1223
1236
|
? indicator.displayCondition.formula
|
|
1224
1237
|
: undefined,
|
|
@@ -1227,6 +1240,7 @@ function mapSortingToInputs(_a) {
|
|
|
1227
1240
|
return {
|
|
1228
1241
|
formula: getMeasureFormula(indicator),
|
|
1229
1242
|
direction: direction,
|
|
1243
|
+
dbDataType: indicator.dbDataType,
|
|
1230
1244
|
};
|
|
1231
1245
|
});
|
|
1232
1246
|
return sortOrder;
|
package/dist/index.js
CHANGED
|
@@ -157,8 +157,6 @@ exports.EFormulaFilterFieldKeys = void 0;
|
|
|
157
157
|
(function (EFormulaFilterFieldKeys) {
|
|
158
158
|
EFormulaFilterFieldKeys["date"] = "date";
|
|
159
159
|
EFormulaFilterFieldKeys["dateRange"] = "dateRange";
|
|
160
|
-
EFormulaFilterFieldKeys["duration"] = "duration";
|
|
161
|
-
EFormulaFilterFieldKeys["number"] = "number";
|
|
162
160
|
EFormulaFilterFieldKeys["numberRange"] = "numberRange";
|
|
163
161
|
EFormulaFilterFieldKeys["string"] = "string";
|
|
164
162
|
EFormulaFilterFieldKeys["lastTimeValue"] = "lastTimeValue";
|
|
@@ -647,6 +645,9 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
647
645
|
if (checkedValues && checkedValues.length) {
|
|
648
646
|
return checkedValues;
|
|
649
647
|
}
|
|
648
|
+
if (!formValues) {
|
|
649
|
+
return [];
|
|
650
|
+
}
|
|
650
651
|
function stringifyNumbersRange(range) {
|
|
651
652
|
if (range === void 0) { range = [undefined, undefined]; }
|
|
652
653
|
return range.map(function (value, index) {
|
|
@@ -681,21 +682,19 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
681
682
|
}
|
|
682
683
|
return compact([datePickerValue]);
|
|
683
684
|
case exports.EFormatTypes.STRING:
|
|
684
|
-
return compact([(_a = formValues
|
|
685
|
+
return compact([(_a = formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
|
|
685
686
|
case exports.EFormatTypes.NUMBER:
|
|
686
687
|
case exports.EFormatTypes.YEAR:
|
|
687
688
|
case exports.EFormatTypes.DAY_OF_MONTH:
|
|
688
689
|
case exports.EFormatTypes.WEEK:
|
|
689
690
|
case exports.EFormatTypes.HOUR:
|
|
690
|
-
var _g = formValues, _h = exports.EFormulaFilterFieldKeys.
|
|
691
|
-
return isRangeFilteringMethod(filteringMethod)
|
|
692
|
-
? stringifyNumbersRange(numberRange)
|
|
693
|
-
: [String(number !== null && number !== void 0 ? number : 0)];
|
|
691
|
+
var _g = formValues, _h = exports.EFormulaFilterFieldKeys.numberRange, numberRange = _g[_h];
|
|
692
|
+
return isRangeFilteringMethod(filteringMethod) ? stringifyNumbersRange(numberRange) : [];
|
|
694
693
|
case exports.EFormatTypes.DURATION:
|
|
695
|
-
var
|
|
694
|
+
var _j = formValues, _k = exports.EFormulaFilterFieldKeys.numberRange, durationRange = _j[_k], _l = exports.EFormulaFilterFieldKeys.durationUnit, durationUnit = _j[_l];
|
|
696
695
|
return isRangeFilteringMethod(filteringMethod)
|
|
697
696
|
? convertDurationRangeToSecond(durationRange, durationUnit)
|
|
698
|
-
: [
|
|
697
|
+
: [];
|
|
699
698
|
}
|
|
700
699
|
return [];
|
|
701
700
|
};
|
|
@@ -822,6 +821,8 @@ exports.EIndicatorType = void 0;
|
|
|
822
821
|
EIndicatorType["STATIC_LIST"] = "STATIC_LIST";
|
|
823
822
|
/** Динамический список */
|
|
824
823
|
EIndicatorType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
|
|
824
|
+
/** Список колонок */
|
|
825
|
+
EIndicatorType["COLUMN_LIST"] = "COLUMN_LIST";
|
|
825
826
|
/** Разрез */
|
|
826
827
|
EIndicatorType["DIMENSION"] = "DIMENSION";
|
|
827
828
|
/** Мера */
|
|
@@ -878,17 +879,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
|
|
|
878
879
|
_a$3[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
879
880
|
_a$3);
|
|
880
881
|
function getDimensionFormula(_a) {
|
|
882
|
+
var _b;
|
|
881
883
|
var value = _a.value;
|
|
882
884
|
if (!value) {
|
|
883
885
|
return "";
|
|
884
886
|
}
|
|
885
887
|
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
886
|
-
return value.formula;
|
|
888
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
887
889
|
}
|
|
888
890
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
889
891
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
890
892
|
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
891
|
-
if (!templateFormula) {
|
|
893
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
892
894
|
return "";
|
|
893
895
|
}
|
|
894
896
|
return fillTemplateString(templateFormula, {
|
|
@@ -919,17 +921,18 @@ var measureTemplateFormulas = (_a$2 = {},
|
|
|
919
921
|
_a$2[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
920
922
|
_a$2);
|
|
921
923
|
function getMeasureFormula(_a) {
|
|
924
|
+
var _b;
|
|
922
925
|
var value = _a.value;
|
|
923
926
|
if (!value) {
|
|
924
927
|
return "";
|
|
925
928
|
}
|
|
926
929
|
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
927
|
-
return value.formula;
|
|
930
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
928
931
|
}
|
|
929
932
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
930
933
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
931
934
|
var templateFormula = measureTemplateFormulas[templateName];
|
|
932
|
-
if (!templateFormula) {
|
|
935
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
933
936
|
return "";
|
|
934
937
|
}
|
|
935
938
|
return fillTemplateString(templateFormula, {
|
|
@@ -1180,7 +1183,13 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1180
1183
|
].includes(dimension.format);
|
|
1181
1184
|
});
|
|
1182
1185
|
if (timeDimension) {
|
|
1183
|
-
return [
|
|
1186
|
+
return [
|
|
1187
|
+
{
|
|
1188
|
+
formula: getDimensionFormula(timeDimension),
|
|
1189
|
+
dbDataType: timeDimension.dbDataType,
|
|
1190
|
+
direction: exports.ESortDirection.ascend,
|
|
1191
|
+
},
|
|
1192
|
+
];
|
|
1184
1193
|
}
|
|
1185
1194
|
if (measures.length > 0) {
|
|
1186
1195
|
var firstMeasure = measures[0];
|
|
@@ -1189,6 +1198,7 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1189
1198
|
{
|
|
1190
1199
|
direction: exports.ESortDirection.descend,
|
|
1191
1200
|
formula: getMeasureFormula(firstMeasure),
|
|
1201
|
+
dbDataType: firstMeasure.dbDataType,
|
|
1192
1202
|
},
|
|
1193
1203
|
];
|
|
1194
1204
|
}
|
|
@@ -1202,7 +1212,9 @@ function mapSortingToInputs(_a) {
|
|
|
1202
1212
|
var _b;
|
|
1203
1213
|
var direction = _a.direction, value = _a.value;
|
|
1204
1214
|
if (value.mode === exports.ESortingValueModes.FORMULA) {
|
|
1205
|
-
return value.formula
|
|
1215
|
+
return value.formula
|
|
1216
|
+
? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
|
|
1217
|
+
: undefined;
|
|
1206
1218
|
}
|
|
1207
1219
|
var indicatorsGroup = settings[value.group];
|
|
1208
1220
|
var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
|
|
@@ -1220,6 +1232,7 @@ function mapSortingToInputs(_a) {
|
|
|
1220
1232
|
return {
|
|
1221
1233
|
formula: formula,
|
|
1222
1234
|
direction: direction,
|
|
1235
|
+
dbDataType: activeDimensions.dbDataType,
|
|
1223
1236
|
displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
1224
1237
|
? indicator.displayCondition.formula
|
|
1225
1238
|
: undefined,
|
|
@@ -1228,6 +1241,7 @@ function mapSortingToInputs(_a) {
|
|
|
1228
1241
|
return {
|
|
1229
1242
|
formula: getMeasureFormula(indicator),
|
|
1230
1243
|
direction: direction,
|
|
1244
|
+
dbDataType: indicator.dbDataType,
|
|
1231
1245
|
};
|
|
1232
1246
|
});
|
|
1233
1247
|
return sortOrder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infomaximum/widget-sdk",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-beta11",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"dist/",
|
|
10
10
|
"LICENSE"
|
|
11
11
|
],
|
|
12
|
+
"sideEffects": false,
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "rollup -c",
|
|
14
15
|
"lint": "tsc --noEmit",
|