@infomaximum/widget-sdk 4.0.0-next5 → 4.0.0-p1
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 +11 -5
- package/dist/index.esm.js +29 -32
- package/dist/index.js +30 -31
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1169,17 +1169,23 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
|
|
|
1169
1169
|
/** Конвертировать показатели процессных событий виджета во входы для вычислителя */
|
|
1170
1170
|
declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1171
1171
|
|
|
1172
|
+
interface IGetDefaultSortOrders {
|
|
1173
|
+
sortOrders: ISortOrder[];
|
|
1174
|
+
dimensions: IWidgetDimension[];
|
|
1175
|
+
measures: IWidgetMeasure[];
|
|
1176
|
+
}
|
|
1177
|
+
declare const getDefaultSortOrders: ({ sortOrders, dimensions, measures, }: IGetDefaultSortOrders) => ISortOrder[];
|
|
1172
1178
|
/** Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя */
|
|
1173
1179
|
interface IMapSortingToInputsParams<Settings, Indicator> {
|
|
1174
1180
|
settings: Settings;
|
|
1175
1181
|
variables: Map<string, TWidgetVariable>;
|
|
1176
1182
|
filters: ICalculatorFilter[];
|
|
1177
1183
|
getIndicatorType(key: string, indicator: Indicator): EWidgetIndicatorType.DIMENSION | EWidgetIndicatorType.MEASURE;
|
|
1178
|
-
/** При отсутствии сортировки использовать предустановленную сортировку(на основе sortableIndicatorsKeys) */
|
|
1179
|
-
withDefaultSortOrder?: boolean;
|
|
1180
|
-
sortableIndicatorsKeys?: Readonly<StringKeyOf<Settings>[]>;
|
|
1181
1184
|
}
|
|
1182
|
-
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType,
|
|
1185
|
+
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType, }: IMapSortingToInputsParams<Settings, Indicator>): ISortOrder[];
|
|
1186
|
+
interface IPrepareSortOrdersParams<Settings, Indicator> extends IMapSortingToInputsParams<Settings, Indicator>, Pick<IGetDefaultSortOrders, "dimensions" | "measures"> {
|
|
1187
|
+
}
|
|
1188
|
+
declare function prepareSortOrders<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ dimensions, measures, ...rest }: IPrepareSortOrdersParams<Settings, Indicator>): ISortOrder[];
|
|
1183
1189
|
|
|
1184
1190
|
/**
|
|
1185
1191
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1731,4 +1737,4 @@ declare global {
|
|
|
1731
1737
|
}
|
|
1732
1738
|
}
|
|
1733
1739
|
|
|
1734
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, 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 IAppearanceSettings, 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 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 IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionsOnClick, type TAddButton, 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 TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
1740
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, 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 IAppearanceSettings, 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 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 IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionsOnClick, type TAddButton, 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 TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.esm.js
CHANGED
|
@@ -135,6 +135,18 @@ var __assign = function() {
|
|
|
135
135
|
return __assign.apply(this, arguments);
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
function __rest(s, e) {
|
|
139
|
+
var t = {};
|
|
140
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
141
|
+
t[p] = s[p];
|
|
142
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
143
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
144
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
145
|
+
t[p[i]] = s[p[i]];
|
|
146
|
+
}
|
|
147
|
+
return t;
|
|
148
|
+
}
|
|
149
|
+
|
|
138
150
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
139
151
|
var e = new Error(message);
|
|
140
152
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -889,13 +901,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
889
901
|
return hierarchyDimensions[0];
|
|
890
902
|
}
|
|
891
903
|
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
904
|
+
var getDefaultSortOrders = function (_a) {
|
|
905
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
906
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
907
|
+
if (sortOrders.length > 0 ||
|
|
908
|
+
dimensions.some(function (dimension) {
|
|
909
|
+
return dimension.displayCondition &&
|
|
910
|
+
dimension.displayCondition.mode !== EDisplayConditionMode.DISABLED;
|
|
911
|
+
})) {
|
|
912
|
+
return sortOrders;
|
|
899
913
|
}
|
|
900
914
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
901
915
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -932,7 +946,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
932
946
|
};
|
|
933
947
|
function mapSortingToInputs(_a) {
|
|
934
948
|
var _b;
|
|
935
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
949
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
936
950
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
937
951
|
var _b;
|
|
938
952
|
var direction = _a.direction, value = _a.value;
|
|
@@ -965,29 +979,12 @@ function mapSortingToInputs(_a) {
|
|
|
965
979
|
direction: direction,
|
|
966
980
|
};
|
|
967
981
|
});
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}
|
|
974
|
-
var dimensions = [];
|
|
975
|
-
var measures = [];
|
|
976
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
977
|
-
var indicatorsGroup = settings[key];
|
|
978
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
979
|
-
if (getIndicatorType(key, indicator) === EWidgetIndicatorType.DIMENSION) {
|
|
980
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
981
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
982
|
-
: indicator;
|
|
983
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
984
|
-
}
|
|
985
|
-
else {
|
|
986
|
-
measures.push(indicator);
|
|
987
|
-
}
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
982
|
+
return sortOrder;
|
|
983
|
+
}
|
|
984
|
+
function prepareSortOrders(_a) {
|
|
985
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
986
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
987
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
991
988
|
}
|
|
992
989
|
|
|
993
990
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1190,4 +1187,4 @@ var isValidColor = function (color, globalContext) {
|
|
|
1190
1187
|
return true;
|
|
1191
1188
|
};
|
|
1192
1189
|
|
|
1193
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, 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, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
|
1190
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, 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, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDefaultSortOrders, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareSortOrders, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,18 @@ var __assign = function() {
|
|
|
136
136
|
return __assign.apply(this, arguments);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
+
function __rest(s, e) {
|
|
140
|
+
var t = {};
|
|
141
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
142
|
+
t[p] = s[p];
|
|
143
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
144
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
145
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
146
|
+
t[p[i]] = s[p[i]];
|
|
147
|
+
}
|
|
148
|
+
return t;
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
140
152
|
var e = new Error(message);
|
|
141
153
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -890,13 +902,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
890
902
|
return hierarchyDimensions[0];
|
|
891
903
|
}
|
|
892
904
|
|
|
893
|
-
var
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
905
|
+
var getDefaultSortOrders = function (_a) {
|
|
906
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
907
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
908
|
+
if (sortOrders.length > 0 ||
|
|
909
|
+
dimensions.some(function (dimension) {
|
|
910
|
+
return dimension.displayCondition &&
|
|
911
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
912
|
+
})) {
|
|
913
|
+
return sortOrders;
|
|
900
914
|
}
|
|
901
915
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
902
916
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -933,7 +947,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
933
947
|
};
|
|
934
948
|
function mapSortingToInputs(_a) {
|
|
935
949
|
var _b;
|
|
936
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
950
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
937
951
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
938
952
|
var _b;
|
|
939
953
|
var direction = _a.direction, value = _a.value;
|
|
@@ -966,29 +980,12 @@ function mapSortingToInputs(_a) {
|
|
|
966
980
|
direction: direction,
|
|
967
981
|
};
|
|
968
982
|
});
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
var dimensions = [];
|
|
976
|
-
var measures = [];
|
|
977
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
978
|
-
var indicatorsGroup = settings[key];
|
|
979
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
980
|
-
if (getIndicatorType(key, indicator) === exports.EWidgetIndicatorType.DIMENSION) {
|
|
981
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
982
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
983
|
-
: indicator;
|
|
984
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
985
|
-
}
|
|
986
|
-
else {
|
|
987
|
-
measures.push(indicator);
|
|
988
|
-
}
|
|
989
|
-
});
|
|
990
|
-
});
|
|
991
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
983
|
+
return sortOrder;
|
|
984
|
+
}
|
|
985
|
+
function prepareSortOrders(_a) {
|
|
986
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
987
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
988
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
992
989
|
}
|
|
993
990
|
|
|
994
991
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1209,6 +1206,7 @@ exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
|
|
|
1209
1206
|
exports.fillTemplateString = fillTemplateString;
|
|
1210
1207
|
exports.formulaFilterMethods = formulaFilterMethods;
|
|
1211
1208
|
exports.generateColumnFormula = generateColumnFormula;
|
|
1209
|
+
exports.getDefaultSortOrders = getDefaultSortOrders;
|
|
1212
1210
|
exports.getDimensionFormula = getDimensionFormula;
|
|
1213
1211
|
exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
1214
1212
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
@@ -1230,6 +1228,7 @@ exports.mapSortingToInputs = mapSortingToInputs;
|
|
|
1230
1228
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1231
1229
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1232
1230
|
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1231
|
+
exports.prepareSortOrders = prepareSortOrders;
|
|
1233
1232
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1234
1233
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1235
1234
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|