@infomaximum/widget-sdk 4.0.0-beta56 → 4.0.0-beta58
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 +12 -2
- package/dist/index.esm.js +55 -10
- package/dist/index.js +55 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1214,7 +1214,7 @@ declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicator
|
|
|
1214
1214
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
1215
1215
|
* @returns
|
|
1216
1216
|
*/
|
|
1217
|
-
declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable
|
|
1217
|
+
declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable>, withDefaultSortOrder?: boolean): ISortOrder[];
|
|
1218
1218
|
|
|
1219
1219
|
/**
|
|
1220
1220
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1531,6 +1531,14 @@ type TContextMenuButtonOptions = {
|
|
|
1531
1531
|
items: TContextMenuRow[];
|
|
1532
1532
|
};
|
|
1533
1533
|
|
|
1534
|
+
interface IViewInputValue {
|
|
1535
|
+
value: TNullable<string> | TNullable<string>[];
|
|
1536
|
+
dataType: ESimpleDataType;
|
|
1537
|
+
}
|
|
1538
|
+
interface IViewContext {
|
|
1539
|
+
variables: Map<string, IViewInputValue>;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1534
1542
|
type TLaunchActionParams = {
|
|
1535
1543
|
action: TAction;
|
|
1536
1544
|
onSuccess: () => void;
|
|
@@ -1572,6 +1580,8 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1572
1580
|
placeholderValues: IWidgetPlaceholderValues;
|
|
1573
1581
|
/** Контекст виджета */
|
|
1574
1582
|
widgetsContext: IWidgetsContext;
|
|
1583
|
+
/**Контекст образа */
|
|
1584
|
+
viewContext: IViewContext;
|
|
1575
1585
|
/** Данные о контейнере виджета */
|
|
1576
1586
|
widgetContainer: TWidgetContainer;
|
|
1577
1587
|
/** Запуск действия */
|
|
@@ -1751,4 +1761,4 @@ declare global {
|
|
|
1751
1761
|
}
|
|
1752
1762
|
}
|
|
1753
1763
|
|
|
1754
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, 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 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 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 IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type 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 IWidgetAction, 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 IWorkspaceDisplayRule, type TAction, type TActionOnClickParameter, type TActionOpenView, 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 TExtendedFormulaFilterValue, 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 TWidgetActionParameter, 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, isExecuteScriptActionValid, isFormulaFilterValue, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
|
1764
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, 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 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 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 IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type ILens, type IMarkdownMeasure, type IMeasureMenuConfig, type IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type 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 IViewContext, type IViewInputValue, type IWidget, type IWidgetAction, 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 IWorkspaceDisplayRule, type TAction, type TActionOnClickParameter, type TActionOpenView, 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 TExtendedFormulaFilterValue, 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 TWidgetActionParameter, 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, isExecuteScriptActionValid, isFormulaFilterValue, 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
|
@@ -845,6 +845,55 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
845
845
|
});
|
|
846
846
|
}
|
|
847
847
|
|
|
848
|
+
var ESortDirection;
|
|
849
|
+
(function (ESortDirection) {
|
|
850
|
+
ESortDirection["descend"] = "DESC";
|
|
851
|
+
ESortDirection["ascend"] = "ASC";
|
|
852
|
+
ESortDirection["ASC"] = "ascend";
|
|
853
|
+
ESortDirection["DESC"] = "descend";
|
|
854
|
+
})(ESortDirection || (ESortDirection = {}));
|
|
855
|
+
|
|
856
|
+
var getDefaultSortOrder = function (dimensions, measures) {
|
|
857
|
+
/** Если есть условие отображения, то не делаем автосортировку */
|
|
858
|
+
if (dimensions.some(function (dimension) {
|
|
859
|
+
return dimension.displayCondition &&
|
|
860
|
+
dimension.displayCondition.mode !== EDisplayConditionMode.DISABLED;
|
|
861
|
+
})) {
|
|
862
|
+
return [];
|
|
863
|
+
}
|
|
864
|
+
/** Если есть временной разрез, то автосортировка по первому такому разрезу (по возрастанию) */
|
|
865
|
+
var timeDimension = dimensions.find(function (dimension) {
|
|
866
|
+
return dimension.format &&
|
|
867
|
+
[
|
|
868
|
+
EFormatTypes.DATE,
|
|
869
|
+
EFormatTypes.MONTH,
|
|
870
|
+
EFormatTypes.DATETIME,
|
|
871
|
+
EFormatTypes.DAY_OF_WEEK,
|
|
872
|
+
EFormatTypes.HOUR,
|
|
873
|
+
EFormatTypes.MONTH_YEAR,
|
|
874
|
+
EFormatTypes.YEAR,
|
|
875
|
+
EFormatTypes.QUARTER,
|
|
876
|
+
EFormatTypes.QUARTER_YEAR,
|
|
877
|
+
EFormatTypes.DAY_OF_MONTH,
|
|
878
|
+
EFormatTypes.WEEK,
|
|
879
|
+
].includes(dimension.format);
|
|
880
|
+
});
|
|
881
|
+
if (timeDimension) {
|
|
882
|
+
return [{ formula: getDimensionFormula(timeDimension), direction: ESortDirection.ascend }];
|
|
883
|
+
}
|
|
884
|
+
if (measures.length > 0) {
|
|
885
|
+
var firstMeasure = measures[0];
|
|
886
|
+
if (firstMeasure) {
|
|
887
|
+
return [
|
|
888
|
+
{
|
|
889
|
+
direction: ESortDirection.descend,
|
|
890
|
+
formula: getMeasureFormula(firstMeasure),
|
|
891
|
+
},
|
|
892
|
+
];
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return [];
|
|
896
|
+
};
|
|
848
897
|
/**
|
|
849
898
|
* Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя
|
|
850
899
|
* @param sortingIndicators объекты сортировок из settings виджета
|
|
@@ -852,11 +901,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
852
901
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
853
902
|
* @returns
|
|
854
903
|
*/
|
|
855
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
904
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables, withDefaultSortOrder) {
|
|
856
905
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
857
906
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
858
907
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
859
|
-
|
|
908
|
+
if (withDefaultSortOrder === void 0) { withDefaultSortOrder = true; }
|
|
909
|
+
var sortOrder = compactMap(sortingIndicators, function (_a) {
|
|
860
910
|
var _b;
|
|
861
911
|
var value = _a.value, direction = _a.direction;
|
|
862
912
|
if (value.mode === ESortingValueModes.FORMULA ||
|
|
@@ -888,6 +938,9 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
888
938
|
return measure && { formula: getMeasureFormula(measure), direction: direction };
|
|
889
939
|
}
|
|
890
940
|
});
|
|
941
|
+
return withDefaultSortOrder && sortOrder.length === 0
|
|
942
|
+
? getDefaultSortOrder(dimensionsInOriginalOrder, measuresInOriginalOrder)
|
|
943
|
+
: sortOrder;
|
|
891
944
|
}
|
|
892
945
|
|
|
893
946
|
/**
|
|
@@ -992,14 +1045,6 @@ var ECustomSelectTemplates;
|
|
|
992
1045
|
ECustomSelectTemplates["DIMENSION_GROUPS"] = "DIMENSION_GROUPS";
|
|
993
1046
|
})(ECustomSelectTemplates || (ECustomSelectTemplates = {}));
|
|
994
1047
|
|
|
995
|
-
var ESortDirection;
|
|
996
|
-
(function (ESortDirection) {
|
|
997
|
-
ESortDirection["descend"] = "DESC";
|
|
998
|
-
ESortDirection["ascend"] = "ASC";
|
|
999
|
-
ESortDirection["ASC"] = "ascend";
|
|
1000
|
-
ESortDirection["DESC"] = "descend";
|
|
1001
|
-
})(ESortDirection || (ESortDirection = {}));
|
|
1002
|
-
|
|
1003
1048
|
var findFilterByFormula = function (filters, formula) {
|
|
1004
1049
|
var _a;
|
|
1005
1050
|
return ((_a = filters.find(function (filter) {
|
package/dist/index.js
CHANGED
|
@@ -846,6 +846,55 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
846
846
|
});
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
+
exports.ESortDirection = void 0;
|
|
850
|
+
(function (ESortDirection) {
|
|
851
|
+
ESortDirection["descend"] = "DESC";
|
|
852
|
+
ESortDirection["ascend"] = "ASC";
|
|
853
|
+
ESortDirection["ASC"] = "ascend";
|
|
854
|
+
ESortDirection["DESC"] = "descend";
|
|
855
|
+
})(exports.ESortDirection || (exports.ESortDirection = {}));
|
|
856
|
+
|
|
857
|
+
var getDefaultSortOrder = function (dimensions, measures) {
|
|
858
|
+
/** Если есть условие отображения, то не делаем автосортировку */
|
|
859
|
+
if (dimensions.some(function (dimension) {
|
|
860
|
+
return dimension.displayCondition &&
|
|
861
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
862
|
+
})) {
|
|
863
|
+
return [];
|
|
864
|
+
}
|
|
865
|
+
/** Если есть временной разрез, то автосортировка по первому такому разрезу (по возрастанию) */
|
|
866
|
+
var timeDimension = dimensions.find(function (dimension) {
|
|
867
|
+
return dimension.format &&
|
|
868
|
+
[
|
|
869
|
+
exports.EFormatTypes.DATE,
|
|
870
|
+
exports.EFormatTypes.MONTH,
|
|
871
|
+
exports.EFormatTypes.DATETIME,
|
|
872
|
+
exports.EFormatTypes.DAY_OF_WEEK,
|
|
873
|
+
exports.EFormatTypes.HOUR,
|
|
874
|
+
exports.EFormatTypes.MONTH_YEAR,
|
|
875
|
+
exports.EFormatTypes.YEAR,
|
|
876
|
+
exports.EFormatTypes.QUARTER,
|
|
877
|
+
exports.EFormatTypes.QUARTER_YEAR,
|
|
878
|
+
exports.EFormatTypes.DAY_OF_MONTH,
|
|
879
|
+
exports.EFormatTypes.WEEK,
|
|
880
|
+
].includes(dimension.format);
|
|
881
|
+
});
|
|
882
|
+
if (timeDimension) {
|
|
883
|
+
return [{ formula: getDimensionFormula(timeDimension), direction: exports.ESortDirection.ascend }];
|
|
884
|
+
}
|
|
885
|
+
if (measures.length > 0) {
|
|
886
|
+
var firstMeasure = measures[0];
|
|
887
|
+
if (firstMeasure) {
|
|
888
|
+
return [
|
|
889
|
+
{
|
|
890
|
+
direction: exports.ESortDirection.descend,
|
|
891
|
+
formula: getMeasureFormula(firstMeasure),
|
|
892
|
+
},
|
|
893
|
+
];
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return [];
|
|
897
|
+
};
|
|
849
898
|
/**
|
|
850
899
|
* Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя
|
|
851
900
|
* @param sortingIndicators объекты сортировок из settings виджета
|
|
@@ -853,11 +902,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
853
902
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
854
903
|
* @returns
|
|
855
904
|
*/
|
|
856
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
905
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables, withDefaultSortOrder) {
|
|
857
906
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
858
907
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
859
908
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
860
|
-
|
|
909
|
+
if (withDefaultSortOrder === void 0) { withDefaultSortOrder = true; }
|
|
910
|
+
var sortOrder = compactMap(sortingIndicators, function (_a) {
|
|
861
911
|
var _b;
|
|
862
912
|
var value = _a.value, direction = _a.direction;
|
|
863
913
|
if (value.mode === exports.ESortingValueModes.FORMULA ||
|
|
@@ -889,6 +939,9 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
889
939
|
return measure && { formula: getMeasureFormula(measure), direction: direction };
|
|
890
940
|
}
|
|
891
941
|
});
|
|
942
|
+
return withDefaultSortOrder && sortOrder.length === 0
|
|
943
|
+
? getDefaultSortOrder(dimensionsInOriginalOrder, measuresInOriginalOrder)
|
|
944
|
+
: sortOrder;
|
|
892
945
|
}
|
|
893
946
|
|
|
894
947
|
/**
|
|
@@ -993,14 +1046,6 @@ exports.ECustomSelectTemplates = void 0;
|
|
|
993
1046
|
ECustomSelectTemplates["DIMENSION_GROUPS"] = "DIMENSION_GROUPS";
|
|
994
1047
|
})(exports.ECustomSelectTemplates || (exports.ECustomSelectTemplates = {}));
|
|
995
1048
|
|
|
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
1049
|
var findFilterByFormula = function (filters, formula) {
|
|
1005
1050
|
var _a;
|
|
1006
1051
|
return ((_a = filters.find(function (filter) {
|