@infomaximum/widget-sdk 4.0.0-beta57 → 4.0.0-beta59
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 +185 -226
- package/dist/index.esm.js +195 -106
- package/dist/index.js +201 -106
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -230,7 +230,7 @@ exports.EFormattingPresets = void 0;
|
|
|
230
230
|
(function (EFormattingPresets) {
|
|
231
231
|
//Общая группа шаблонов
|
|
232
232
|
EFormattingPresets["AUTO"] = "AUTO";
|
|
233
|
-
EFormattingPresets["
|
|
233
|
+
EFormattingPresets["CUSTOM"] = "CUSTOM";
|
|
234
234
|
//Группа шаблонов для формата DATE
|
|
235
235
|
EFormattingPresets["DD/M/YYYY"] = "DD/M/YYYY";
|
|
236
236
|
EFormattingPresets["DD-MM-YYYY"] = "DD-MM-YYYY";
|
|
@@ -474,22 +474,6 @@ exports.EWidgetFilterMode = void 0;
|
|
|
474
474
|
EWidgetFilterMode["MULTI"] = "MULTI";
|
|
475
475
|
EWidgetFilterMode["DISABLED"] = "DISABLED";
|
|
476
476
|
})(exports.EWidgetFilterMode || (exports.EWidgetFilterMode = {}));
|
|
477
|
-
exports.EColorMode = void 0;
|
|
478
|
-
(function (EColorMode) {
|
|
479
|
-
EColorMode["DISABLED"] = "DISABLED";
|
|
480
|
-
EColorMode["FORMULA"] = "FORMULA";
|
|
481
|
-
EColorMode["BASE"] = "BASE";
|
|
482
|
-
EColorMode["GRADIENT"] = "GRADIENT";
|
|
483
|
-
EColorMode["AUTO"] = "AUTO";
|
|
484
|
-
EColorMode["RULE"] = "RULE";
|
|
485
|
-
EColorMode["VALUES"] = "VALUES";
|
|
486
|
-
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
487
|
-
})(exports.EColorMode || (exports.EColorMode = {}));
|
|
488
|
-
exports.EColorScope = void 0;
|
|
489
|
-
(function (EColorScope) {
|
|
490
|
-
EColorScope["WORKSPACE"] = "WORKSPACE";
|
|
491
|
-
EColorScope["DASHBOARD"] = "DASHBOARD";
|
|
492
|
-
})(exports.EColorScope || (exports.EColorScope = {}));
|
|
493
477
|
exports.EMarkdownDisplayMode = void 0;
|
|
494
478
|
(function (EMarkdownDisplayMode) {
|
|
495
479
|
EMarkdownDisplayMode["NONE"] = "NONE";
|
|
@@ -552,9 +536,7 @@ exports.EWidgetIndicatorType = void 0;
|
|
|
552
536
|
EWidgetIndicatorType["EVENT_INDICATOR"] = "EVENT_INDICATOR";
|
|
553
537
|
EWidgetIndicatorType["TRANSITION_INDICATOR"] = "TRANSITION_INDICATOR";
|
|
554
538
|
EWidgetIndicatorType["DIMENSION"] = "DIMENSION";
|
|
555
|
-
EWidgetIndicatorType["DIMENSION_HIERARCHY"] = "DIMENSION_HIERARCHY";
|
|
556
539
|
EWidgetIndicatorType["SORTING"] = "SORTING";
|
|
557
|
-
EWidgetIndicatorType["CUSTOM"] = "CUSTOM";
|
|
558
540
|
})(exports.EWidgetIndicatorType || (exports.EWidgetIndicatorType = {}));
|
|
559
541
|
exports.EDbType = void 0;
|
|
560
542
|
(function (EDbType) {
|
|
@@ -574,18 +556,8 @@ exports.ESortingValueModes = void 0;
|
|
|
574
556
|
(function (ESortingValueModes) {
|
|
575
557
|
/** Сортировка по формуле */
|
|
576
558
|
ESortingValueModes["FORMULA"] = "FORMULA";
|
|
577
|
-
/**
|
|
578
|
-
ESortingValueModes["
|
|
579
|
-
/** @deprecated Для сортировки по иерархии используется режим DIMENSION_IN_WIDGET */
|
|
580
|
-
ESortingValueModes["HIERARCHY"] = "HIERARCHY";
|
|
581
|
-
/** Сортировка по мере виджета */
|
|
582
|
-
ESortingValueModes["MEASURE_IN_WIDGET"] = "MEASURE_IN_WIDGET";
|
|
583
|
-
/** Сортировка по разрезу(в т.ч. по иерархии) виджета */
|
|
584
|
-
ESortingValueModes["DIMENSION_IN_WIDGET"] = "DIMENSION_IN_WIDGET";
|
|
585
|
-
/** Сортировка по мере отчета */
|
|
586
|
-
ESortingValueModes["IN_DASHBOARD"] = "IN_DASHBOARD";
|
|
587
|
-
/** Сортировка по мере пространства */
|
|
588
|
-
ESortingValueModes["IN_WORKSPACE"] = "IN_WORKSPACE";
|
|
559
|
+
/** Сортировка по показателю(разрезу или мере) виджета */
|
|
560
|
+
ESortingValueModes["IN_WIDGET"] = "IN_WIDGET";
|
|
589
561
|
})(exports.ESortingValueModes || (exports.ESortingValueModes = {}));
|
|
590
562
|
/** Тип показателя */
|
|
591
563
|
exports.EIndicatorType = void 0;
|
|
@@ -607,8 +579,8 @@ exports.EIndicatorType = void 0;
|
|
|
607
579
|
/** Пользовательская сортировка */
|
|
608
580
|
EIndicatorType["USER_SORTING"] = "USER_SORTING";
|
|
609
581
|
})(exports.EIndicatorType || (exports.EIndicatorType = {}));
|
|
610
|
-
function
|
|
611
|
-
return
|
|
582
|
+
function isDimensionsHierarchy(indicator) {
|
|
583
|
+
return "hierarchyDimensions" in indicator;
|
|
612
584
|
}
|
|
613
585
|
|
|
614
586
|
var _a$3;
|
|
@@ -704,11 +676,11 @@ function getMeasureFormula(_a) {
|
|
|
704
676
|
var _a$1;
|
|
705
677
|
exports.EEventMeasureTemplateNames = void 0;
|
|
706
678
|
(function (EEventMeasureTemplateNames) {
|
|
707
|
-
EEventMeasureTemplateNames["
|
|
679
|
+
EEventMeasureTemplateNames["eventsCount"] = "eventsCount";
|
|
708
680
|
EEventMeasureTemplateNames["reworksCount"] = "reworksCount";
|
|
709
681
|
})(exports.EEventMeasureTemplateNames || (exports.EEventMeasureTemplateNames = {}));
|
|
710
682
|
var eventMeasureTemplateFormulas = (_a$1 = {},
|
|
711
|
-
_a$1[exports.EEventMeasureTemplateNames.
|
|
683
|
+
_a$1[exports.EEventMeasureTemplateNames.eventsCount] = "count()",
|
|
712
684
|
_a$1[exports.EEventMeasureTemplateNames.reworksCount] = "count() - uniqExact({caseCaseIdFormula})",
|
|
713
685
|
_a$1);
|
|
714
686
|
function getEventMeasureFormula(_a, process) {
|
|
@@ -729,11 +701,11 @@ function getEventMeasureFormula(_a, process) {
|
|
|
729
701
|
var _a;
|
|
730
702
|
exports.ETransitionMeasureTemplateNames = void 0;
|
|
731
703
|
(function (ETransitionMeasureTemplateNames) {
|
|
732
|
-
ETransitionMeasureTemplateNames["
|
|
704
|
+
ETransitionMeasureTemplateNames["transitionsCount"] = "transitionsCount";
|
|
733
705
|
ETransitionMeasureTemplateNames["medianTime"] = "medianTime";
|
|
734
706
|
})(exports.ETransitionMeasureTemplateNames || (exports.ETransitionMeasureTemplateNames = {}));
|
|
735
707
|
var transitionMeasureTemplateFormulas = (_a = {},
|
|
736
|
-
_a[exports.ETransitionMeasureTemplateNames.
|
|
708
|
+
_a[exports.ETransitionMeasureTemplateNames.transitionsCount] = "count()",
|
|
737
709
|
_a[exports.ETransitionMeasureTemplateNames.medianTime] = "medianExact(date_diff(second, begin({eventTimeFormula}), end({eventTimeFormula})))",
|
|
738
710
|
_a);
|
|
739
711
|
function getTransitionMeasureFormula(_a, process) {
|
|
@@ -751,6 +723,32 @@ function getTransitionMeasureFormula(_a, process) {
|
|
|
751
723
|
return "";
|
|
752
724
|
}
|
|
753
725
|
|
|
726
|
+
/**
|
|
727
|
+
* Регулярное выражение для поиска имени ссылки внутри формулы.
|
|
728
|
+
* Учитывает, что имя внутри формулы содержит экраны.
|
|
729
|
+
*
|
|
730
|
+
* Принцип работы:
|
|
731
|
+
* Пробовать следующие вхождения:
|
|
732
|
+
* - \\\\ - экранированный символ обратного слэша.
|
|
733
|
+
* - Иначе \\" - экранированный символ кавычки.
|
|
734
|
+
* - Иначе [^"] - любой символ кроме кавычки.
|
|
735
|
+
* Если встречается любой другой символ, то это закрывающая кавычка имени переменной.
|
|
736
|
+
*/
|
|
737
|
+
var linkNameRegExp = "(?:\\\\\\\\|\\\\\"|[^\"])+";
|
|
738
|
+
var dashboardLinkRegExp = new RegExp("link: \"(".concat(linkNameRegExp, ")\"(?!\\.\"").concat(linkNameRegExp, "\")"), "g");
|
|
739
|
+
var workspaceLinkRegExp = new RegExp("link: \"(".concat(linkNameRegExp, ")\"\\.\"(").concat(linkNameRegExp, ")\""), "g");
|
|
740
|
+
var parseIndicatorLink = function (formula) {
|
|
741
|
+
var dashboardMatch = formula.match(dashboardLinkRegExp.source);
|
|
742
|
+
if (dashboardMatch) {
|
|
743
|
+
return { scopeName: null, indicatorName: dashboardMatch[1] };
|
|
744
|
+
}
|
|
745
|
+
var workspaceMatch = formula.match(workspaceLinkRegExp.source);
|
|
746
|
+
if (workspaceMatch) {
|
|
747
|
+
return { scopeName: workspaceMatch[1], indicatorName: workspaceMatch[2] };
|
|
748
|
+
}
|
|
749
|
+
return null;
|
|
750
|
+
};
|
|
751
|
+
|
|
754
752
|
function mapMeasureToInput(measure, variables, addFormulas) {
|
|
755
753
|
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
756
754
|
var mainFormula = getMeasureFormula(measure);
|
|
@@ -773,8 +771,7 @@ function mapMeasuresToInputs(measures, variables, addFormulas) {
|
|
|
773
771
|
return compactMap(measures, function (measure) { return mapMeasureToInput(measure, variables, addFormulas); });
|
|
774
772
|
}
|
|
775
773
|
|
|
776
|
-
function mapDimensionToInput(dimension, variables
|
|
777
|
-
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
774
|
+
function mapDimensionToInput(dimension, variables) {
|
|
778
775
|
var formula = getDimensionFormula(dimension);
|
|
779
776
|
if (!formula) {
|
|
780
777
|
return null;
|
|
@@ -788,14 +785,11 @@ function mapDimensionToInput(dimension, variables, addFormulas) {
|
|
|
788
785
|
dataType: dimension.dataType,
|
|
789
786
|
hideEmpty: dimension.hideEmptyValues,
|
|
790
787
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
791
|
-
additionalFormulas: addFormulas(dimension),
|
|
792
788
|
};
|
|
793
789
|
}
|
|
794
790
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
795
|
-
function mapDimensionsToInputs(dimensions, variables
|
|
796
|
-
return compactMap(dimensions, function (dimension) {
|
|
797
|
-
return mapDimensionToInput(dimension, variables, addFormulas);
|
|
798
|
-
});
|
|
791
|
+
function mapDimensionsToInputs(dimensions, variables) {
|
|
792
|
+
return compactMap(dimensions, function (dimension) { return mapDimensionToInput(dimension, variables); });
|
|
799
793
|
}
|
|
800
794
|
|
|
801
795
|
function mapTransitionMeasureToInput(indicator, process, variables, addFormulas) {
|
|
@@ -846,50 +840,13 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
846
840
|
});
|
|
847
841
|
}
|
|
848
842
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
857
|
-
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
858
|
-
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
859
|
-
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
860
|
-
return compactMap(sortingIndicators, function (_a) {
|
|
861
|
-
var _b;
|
|
862
|
-
var value = _a.value, direction = _a.direction;
|
|
863
|
-
if (value.mode === exports.ESortingValueModes.FORMULA ||
|
|
864
|
-
value.mode === exports.ESortingValueModes.QUANTITY ||
|
|
865
|
-
value.mode === exports.ESortingValueModes.IN_DASHBOARD ||
|
|
866
|
-
value.mode === exports.ESortingValueModes.IN_WORKSPACE) {
|
|
867
|
-
return value.formula ? { formula: value.formula, direction: direction } : undefined;
|
|
868
|
-
}
|
|
869
|
-
if (value.mode === exports.ESortingValueModes.DIMENSION_IN_WIDGET ||
|
|
870
|
-
value.mode === exports.ESortingValueModes.HIERARCHY) {
|
|
871
|
-
var dimension = dimensionsInOriginalOrder[value.index];
|
|
872
|
-
if (!dimension) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
var formula = getDimensionFormula(dimension);
|
|
876
|
-
if (!formula || !checkDisplayCondition(dimension.displayCondition, variables)) {
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
return {
|
|
880
|
-
formula: getDimensionFormula(dimension),
|
|
881
|
-
direction: direction,
|
|
882
|
-
displayCondition: ((_b = dimension.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
883
|
-
? dimension.displayCondition.formula
|
|
884
|
-
: undefined,
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
if (value.mode === exports.ESortingValueModes.MEASURE_IN_WIDGET) {
|
|
888
|
-
var measure = measuresInOriginalOrder[value.index];
|
|
889
|
-
return measure && { formula: getMeasureFormula(measure), direction: direction };
|
|
890
|
-
}
|
|
891
|
-
});
|
|
892
|
-
}
|
|
843
|
+
exports.ESortDirection = void 0;
|
|
844
|
+
(function (ESortDirection) {
|
|
845
|
+
ESortDirection["descend"] = "DESC";
|
|
846
|
+
ESortDirection["ascend"] = "ASC";
|
|
847
|
+
ESortDirection["ASC"] = "ascend";
|
|
848
|
+
ESortDirection["DESC"] = "descend";
|
|
849
|
+
})(exports.ESortDirection || (exports.ESortDirection = {}));
|
|
893
850
|
|
|
894
851
|
/**
|
|
895
852
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -898,9 +855,9 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
898
855
|
* Если к разрезу иерархии применяется INCLUDE-фильтр с несколькими значениями - выбираем данный разрез
|
|
899
856
|
*/
|
|
900
857
|
function selectDimensionFromHierarchy(_a, filters) {
|
|
901
|
-
var
|
|
858
|
+
var hierarchyDimensions = _a.hierarchyDimensions;
|
|
902
859
|
var _loop_1 = function (i) {
|
|
903
|
-
var dimension =
|
|
860
|
+
var dimension = hierarchyDimensions[i];
|
|
904
861
|
// todo: widgets - возможно, стоит использовать Map фильтров для быстрого поиска
|
|
905
862
|
var matchedFilter = filters.find(function (_a) {
|
|
906
863
|
var formula = _a.formula, filteringMethod = _a.filteringMethod;
|
|
@@ -910,20 +867,121 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
910
867
|
if (!matchedFilter) {
|
|
911
868
|
return "continue";
|
|
912
869
|
}
|
|
913
|
-
var selectionIndex = matchedFilter.values.length > 1 ? i : Math.min(i + 1,
|
|
914
|
-
return { value:
|
|
870
|
+
var selectionIndex = matchedFilter.values.length > 1 ? i : Math.min(i + 1, hierarchyDimensions.length - 1);
|
|
871
|
+
return { value: hierarchyDimensions[selectionIndex] };
|
|
915
872
|
};
|
|
916
|
-
for (var i =
|
|
873
|
+
for (var i = hierarchyDimensions.length - 1; i >= 0; i--) {
|
|
917
874
|
var state_1 = _loop_1(i);
|
|
918
875
|
if (typeof state_1 === "object")
|
|
919
876
|
return state_1.value;
|
|
920
877
|
}
|
|
921
|
-
return
|
|
878
|
+
return hierarchyDimensions[0];
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
var getDefaultSortOrder = function (dimensions, measures) {
|
|
882
|
+
/** Если есть условие отображения, то не делаем авто-сортировку */
|
|
883
|
+
if (dimensions.some(function (dimension) {
|
|
884
|
+
return dimension.displayCondition &&
|
|
885
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
886
|
+
})) {
|
|
887
|
+
return [];
|
|
888
|
+
}
|
|
889
|
+
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
890
|
+
var timeDimension = dimensions.find(function (dimension) {
|
|
891
|
+
return dimension.format &&
|
|
892
|
+
[
|
|
893
|
+
exports.EFormatTypes.DATE,
|
|
894
|
+
exports.EFormatTypes.MONTH,
|
|
895
|
+
exports.EFormatTypes.DATETIME,
|
|
896
|
+
exports.EFormatTypes.DAY_OF_WEEK,
|
|
897
|
+
exports.EFormatTypes.HOUR,
|
|
898
|
+
exports.EFormatTypes.MONTH_YEAR,
|
|
899
|
+
exports.EFormatTypes.YEAR,
|
|
900
|
+
exports.EFormatTypes.QUARTER,
|
|
901
|
+
exports.EFormatTypes.QUARTER_YEAR,
|
|
902
|
+
exports.EFormatTypes.DAY_OF_MONTH,
|
|
903
|
+
exports.EFormatTypes.WEEK,
|
|
904
|
+
].includes(dimension.format);
|
|
905
|
+
});
|
|
906
|
+
if (timeDimension) {
|
|
907
|
+
return [{ formula: getDimensionFormula(timeDimension), direction: exports.ESortDirection.ascend }];
|
|
908
|
+
}
|
|
909
|
+
if (measures.length > 0) {
|
|
910
|
+
var firstMeasure = measures[0];
|
|
911
|
+
if (firstMeasure) {
|
|
912
|
+
return [
|
|
913
|
+
{
|
|
914
|
+
direction: exports.ESortDirection.descend,
|
|
915
|
+
formula: getMeasureFormula(firstMeasure),
|
|
916
|
+
},
|
|
917
|
+
];
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return [];
|
|
921
|
+
};
|
|
922
|
+
function mapSortingToInputs(_a) {
|
|
923
|
+
var _b;
|
|
924
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType, _c = _a.withDefaultSortOrder, withDefaultSortOrder = _c === void 0 ? true : _c, _d = _a.sortableIndicatorsKeys, sortableIndicatorsKeys = _d === void 0 ? [] : _d;
|
|
925
|
+
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
926
|
+
var _b;
|
|
927
|
+
var direction = _a.direction, value = _a.value;
|
|
928
|
+
if (value.mode === exports.ESortingValueModes.FORMULA) {
|
|
929
|
+
return value.formula ? { formula: value.formula, direction: direction } : undefined;
|
|
930
|
+
}
|
|
931
|
+
var indicatorsGroup = settings[value.group];
|
|
932
|
+
var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
|
|
933
|
+
if (!indicator) {
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
if (getIndicatorType(value.group, indicator) === exports.EWidgetIndicatorType.DIMENSION) {
|
|
937
|
+
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
938
|
+
? selectDimensionFromHierarchy(indicator, filters)
|
|
939
|
+
: indicator;
|
|
940
|
+
var formula = activeDimensions && getDimensionFormula(activeDimensions);
|
|
941
|
+
if (!formula || !checkDisplayCondition(indicator.displayCondition, variables)) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
return {
|
|
945
|
+
formula: formula,
|
|
946
|
+
direction: direction,
|
|
947
|
+
displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
948
|
+
? indicator.displayCondition.formula
|
|
949
|
+
: undefined,
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
return {
|
|
953
|
+
formula: getMeasureFormula(indicator),
|
|
954
|
+
direction: direction,
|
|
955
|
+
};
|
|
956
|
+
});
|
|
957
|
+
if (sortOrder.length > 0) {
|
|
958
|
+
return sortOrder;
|
|
959
|
+
}
|
|
960
|
+
if (sortableIndicatorsKeys.length === 0 || withDefaultSortOrder === false) {
|
|
961
|
+
return [];
|
|
962
|
+
}
|
|
963
|
+
var dimensions = [];
|
|
964
|
+
var measures = [];
|
|
965
|
+
sortableIndicatorsKeys.forEach(function (key) {
|
|
966
|
+
var indicatorsGroup = settings[key];
|
|
967
|
+
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
968
|
+
if (getIndicatorType(key, indicator) === exports.EWidgetIndicatorType.DIMENSION) {
|
|
969
|
+
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
970
|
+
? selectDimensionFromHierarchy(indicator, filters)
|
|
971
|
+
: indicator;
|
|
972
|
+
activeDimensions && dimensions.push(activeDimensions);
|
|
973
|
+
}
|
|
974
|
+
else {
|
|
975
|
+
measures.push(indicator);
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
return getDefaultSortOrder(dimensions, measures);
|
|
922
980
|
}
|
|
923
981
|
|
|
924
982
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
925
983
|
return compactMap(dimensions, function (indicator) {
|
|
926
|
-
if (
|
|
984
|
+
if (isDimensionsHierarchy(indicator)) {
|
|
927
985
|
var selectedDimension = selectDimensionFromHierarchy(indicator, filters);
|
|
928
986
|
return (selectedDimension && replaceDisplayCondition(selectedDimension, indicator.displayCondition));
|
|
929
987
|
}
|
|
@@ -968,8 +1026,6 @@ exports.EControlType = void 0;
|
|
|
968
1026
|
EControlType["typedFormula"] = "typedFormula";
|
|
969
1027
|
EControlType["inputRange"] = "inputRange";
|
|
970
1028
|
EControlType["colorPicker"] = "colorPicker";
|
|
971
|
-
/** @deprecated - удалится в ближайшее время */
|
|
972
|
-
EControlType["filterMode"] = "filterMode";
|
|
973
1029
|
EControlType["displayCondition"] = "displayCondition";
|
|
974
1030
|
EControlType["eventsColor"] = "eventsColor";
|
|
975
1031
|
EControlType["inputMarkdown"] = "inputMarkdown";
|
|
@@ -993,14 +1049,6 @@ exports.ECustomSelectTemplates = void 0;
|
|
|
993
1049
|
ECustomSelectTemplates["DIMENSION_GROUPS"] = "DIMENSION_GROUPS";
|
|
994
1050
|
})(exports.ECustomSelectTemplates || (exports.ECustomSelectTemplates = {}));
|
|
995
1051
|
|
|
996
|
-
exports.ESortDirection = void 0;
|
|
997
|
-
(function (ESortDirection) {
|
|
998
|
-
ESortDirection["descend"] = "DESC";
|
|
999
|
-
ESortDirection["ascend"] = "ASC";
|
|
1000
|
-
ESortDirection["ASC"] = "ascend";
|
|
1001
|
-
ESortDirection["DESC"] = "descend";
|
|
1002
|
-
})(exports.ESortDirection || (exports.ESortDirection = {}));
|
|
1003
|
-
|
|
1004
1052
|
var findFilterByFormula = function (filters, formula) {
|
|
1005
1053
|
var _a;
|
|
1006
1054
|
return ((_a = filters.find(function (filter) {
|
|
@@ -1095,6 +1143,47 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1095
1143
|
return localization.getLocalized(locObj, props);
|
|
1096
1144
|
};
|
|
1097
1145
|
|
|
1146
|
+
exports.EColorMode = void 0;
|
|
1147
|
+
(function (EColorMode) {
|
|
1148
|
+
/** Окрашивание отключено */
|
|
1149
|
+
EColorMode["DISABLED"] = "DISABLED";
|
|
1150
|
+
/** Цвет каждого значения вычисляется по формуле */
|
|
1151
|
+
EColorMode["FORMULA"] = "FORMULA";
|
|
1152
|
+
/** Один цвет для всех значений */
|
|
1153
|
+
EColorMode["BASE"] = "BASE";
|
|
1154
|
+
/** Окрашивание каждого значения по градиенту относительно минимального и максимального значений */
|
|
1155
|
+
EColorMode["GRADIENT"] = "GRADIENT";
|
|
1156
|
+
/** Использовать автоматический цвет: по умолчанию определяется порядковым номером показателя */
|
|
1157
|
+
EColorMode["AUTO"] = "AUTO";
|
|
1158
|
+
/** Использовать цвет из правила отображения (в правиле отображения рекурсивно определен цвет) */
|
|
1159
|
+
EColorMode["RULE"] = "RULE";
|
|
1160
|
+
/** Задать цвет конкретным значениям разреза */
|
|
1161
|
+
EColorMode["VALUES"] = "VALUES";
|
|
1162
|
+
/** Задать цвет конкретным значениям общего разреза. Режим используется только для настроек правила отображения */
|
|
1163
|
+
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
1164
|
+
})(exports.EColorMode || (exports.EColorMode = {}));
|
|
1165
|
+
var getRuleColor = function (ruleFormula, globalContext) {
|
|
1166
|
+
var _a, _b;
|
|
1167
|
+
var link = parseIndicatorLink(ruleFormula);
|
|
1168
|
+
if (!link) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
var _c = link.scopeName, scopeName = _c === void 0 ? null : _c, ruleName = link.indicatorName;
|
|
1172
|
+
var rulesByScope = isNil(scopeName)
|
|
1173
|
+
? globalContext.reportDisplayRules
|
|
1174
|
+
: (_a = globalContext.workspaceDisplayRules) === null || _a === void 0 ? void 0 : _a.get(scopeName);
|
|
1175
|
+
return (_b = rulesByScope === null || rulesByScope === void 0 ? void 0 : rulesByScope.get(ruleName)) === null || _b === void 0 ? void 0 : _b.color;
|
|
1176
|
+
};
|
|
1177
|
+
var isValidColor = function (color, globalContext) {
|
|
1178
|
+
if (color.mode === exports.EColorMode.RULE) {
|
|
1179
|
+
return !color.formula || Boolean(getRuleColor(color.formula, globalContext));
|
|
1180
|
+
}
|
|
1181
|
+
if (color.mode === exports.EColorMode.VALUES) {
|
|
1182
|
+
return color.items.every(function (item) { return isValidColor(item.color, globalContext); });
|
|
1183
|
+
}
|
|
1184
|
+
return true;
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1098
1187
|
Object.defineProperty(exports, "ELanguages", {
|
|
1099
1188
|
enumerable: true,
|
|
1100
1189
|
get: function () { return localization$1.ELanguages; }
|
|
@@ -1106,6 +1195,7 @@ Object.defineProperty(exports, "EFilteringMethodValues", {
|
|
|
1106
1195
|
exports.bindContentWithIndicator = bindContentWithIndicator;
|
|
1107
1196
|
exports.bindContentsWithIndicators = bindContentsWithIndicators;
|
|
1108
1197
|
exports.checkDisplayCondition = checkDisplayCondition;
|
|
1198
|
+
exports.dashboardLinkRegExp = dashboardLinkRegExp;
|
|
1109
1199
|
exports.dimensionTemplateFormulas = dimensionTemplateFormulas;
|
|
1110
1200
|
exports.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
1111
1201
|
exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
|
|
@@ -1117,10 +1207,13 @@ exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
|
1117
1207
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
1118
1208
|
exports.getLocalizedText = getLocalizedText;
|
|
1119
1209
|
exports.getMeasureFormula = getMeasureFormula;
|
|
1210
|
+
exports.getRuleColor = getRuleColor;
|
|
1120
1211
|
exports.getTransitionMeasureFormula = getTransitionMeasureFormula;
|
|
1212
|
+
exports.isDimensionsHierarchy = isDimensionsHierarchy;
|
|
1121
1213
|
exports.isExecuteScriptActionValid = isExecuteScriptActionValid;
|
|
1122
1214
|
exports.isFormulaFilterValue = isFormulaFilterValue;
|
|
1123
|
-
exports.
|
|
1215
|
+
exports.isValidColor = isValidColor;
|
|
1216
|
+
exports.linkNameRegExp = linkNameRegExp;
|
|
1124
1217
|
exports.mapDimensionsToInputs = mapDimensionsToInputs;
|
|
1125
1218
|
exports.mapEventMeasuresToInputs = mapEventMeasuresToInputs;
|
|
1126
1219
|
exports.mapFormulaFilterToCalculatorInput = mapFormulaFilterToCalculatorInput;
|
|
@@ -1129,6 +1222,7 @@ exports.mapMeasuresToInputs = mapMeasuresToInputs;
|
|
|
1129
1222
|
exports.mapSortingToInputs = mapSortingToInputs;
|
|
1130
1223
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1131
1224
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1225
|
+
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1132
1226
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1133
1227
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1134
1228
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|
|
@@ -1139,3 +1233,4 @@ exports.unescapeSpecialCharacters = unescapeSpecialCharacters;
|
|
|
1139
1233
|
exports.updateDefaultModeSelection = updateDefaultModeSelection;
|
|
1140
1234
|
exports.updateMultiModeSelection = updateMultiModeSelection;
|
|
1141
1235
|
exports.updateSingleModeSelection = updateSingleModeSelection;
|
|
1236
|
+
exports.workspaceLinkRegExp = workspaceLinkRegExp;
|