@infomaximum/widget-sdk 4.2.1 → 4.3.0-BI-13455-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -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
|
@@ -807,6 +807,9 @@ interface IWidgetAction extends IActionCommon {
|
|
|
807
807
|
scriptKey: string;
|
|
808
808
|
updateDashboard: boolean;
|
|
809
809
|
description: string;
|
|
810
|
+
blockingCondition: {
|
|
811
|
+
formula: string;
|
|
812
|
+
};
|
|
810
813
|
}
|
|
811
814
|
type TAction = TActionsOnClick | IWidgetAction;
|
|
812
815
|
type TActionValidator = (action: TAction) => boolean;
|
|
@@ -994,6 +997,8 @@ type TWidgetVariable = {
|
|
|
994
997
|
defaultValue: string;
|
|
995
998
|
/** Тип данных */
|
|
996
999
|
dataType: ESimpleDataType;
|
|
1000
|
+
/** Общее значения */
|
|
1001
|
+
isValueShared: boolean;
|
|
997
1002
|
/** @deprecated */
|
|
998
1003
|
guid: string;
|
|
999
1004
|
} | {
|
|
@@ -1011,6 +1016,8 @@ type TWidgetVariable = {
|
|
|
1011
1016
|
dataType: ESimpleDataType.STRING;
|
|
1012
1017
|
/** Множественный выбор */
|
|
1013
1018
|
multipleChoice: boolean;
|
|
1019
|
+
/** Общее значения */
|
|
1020
|
+
isValueShared: boolean;
|
|
1014
1021
|
/** @deprecated */
|
|
1015
1022
|
guid: string;
|
|
1016
1023
|
} | {
|
|
@@ -1028,6 +1035,8 @@ type TWidgetVariable = {
|
|
|
1028
1035
|
dataType: ESimpleDataType;
|
|
1029
1036
|
/** Множественный выбор */
|
|
1030
1037
|
multipleChoice: boolean;
|
|
1038
|
+
/** Общее значения */
|
|
1039
|
+
isValueShared: boolean;
|
|
1031
1040
|
/** Фильтры */
|
|
1032
1041
|
filters: TExtendedFormulaFilterValue[];
|
|
1033
1042
|
/** @deprecated */
|
|
@@ -1238,17 +1247,23 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
|
|
|
1238
1247
|
/** Конвертировать показатели процессных событий виджета во входы для вычислителя */
|
|
1239
1248
|
declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1240
1249
|
|
|
1250
|
+
interface IGetDefaultSortOrders {
|
|
1251
|
+
sortOrders: ISortOrder[];
|
|
1252
|
+
dimensions: IWidgetDimension[];
|
|
1253
|
+
measures: IWidgetMeasure[];
|
|
1254
|
+
}
|
|
1255
|
+
declare const getDefaultSortOrders: ({ sortOrders, dimensions, measures, }: IGetDefaultSortOrders) => ISortOrder[];
|
|
1241
1256
|
/** Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя */
|
|
1242
1257
|
interface IMapSortingToInputsParams<Settings, Indicator> {
|
|
1243
1258
|
settings: Settings;
|
|
1244
1259
|
variables: Map<string, TWidgetVariable>;
|
|
1245
1260
|
filters: ICalculatorFilter[];
|
|
1246
1261
|
getIndicatorType(key: string, indicator: Indicator): EWidgetIndicatorType.DIMENSION | EWidgetIndicatorType.MEASURE;
|
|
1247
|
-
/** При отсутствии сортировки использовать предустановленную сортировку(на основе sortableIndicatorsKeys) */
|
|
1248
|
-
withDefaultSortOrder?: boolean;
|
|
1249
|
-
sortableIndicatorsKeys?: Readonly<StringKeyOf<Settings>[]>;
|
|
1250
1262
|
}
|
|
1251
|
-
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType,
|
|
1263
|
+
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType, }: IMapSortingToInputsParams<Settings, Indicator>): ISortOrder[];
|
|
1264
|
+
interface IPrepareSortOrdersParams<Settings, Indicator> extends IMapSortingToInputsParams<Settings, Indicator>, Pick<IGetDefaultSortOrders, "dimensions" | "measures"> {
|
|
1265
|
+
}
|
|
1266
|
+
declare function prepareSortOrders<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ dimensions, measures, ...rest }: IPrepareSortOrdersParams<Settings, Indicator>): ISortOrder[];
|
|
1252
1267
|
|
|
1253
1268
|
/**
|
|
1254
1269
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1901,4 +1916,4 @@ declare global {
|
|
|
1901
1916
|
}
|
|
1902
1917
|
}
|
|
1903
1918
|
|
|
1904
|
-
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, 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 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 IWidgetManifest, 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 TActionValidator, 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, formattingConfig, 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 };
|
|
1919
|
+
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, 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 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 IWidgetManifest, 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 TActionValidator, 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, formattingConfig, 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
|
@@ -139,6 +139,18 @@ var __assign = function() {
|
|
|
139
139
|
return __assign.apply(this, arguments);
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
function __rest(s, e) {
|
|
143
|
+
var t = {};
|
|
144
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
145
|
+
t[p] = s[p];
|
|
146
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
147
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
148
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
149
|
+
t[p[i]] = s[p[i]];
|
|
150
|
+
}
|
|
151
|
+
return t;
|
|
152
|
+
}
|
|
153
|
+
|
|
142
154
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
143
155
|
var e = new Error(message);
|
|
144
156
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1044,13 +1056,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1044
1056
|
return hierarchyDimensions[0];
|
|
1045
1057
|
}
|
|
1046
1058
|
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1059
|
+
var getDefaultSortOrders = function (_a) {
|
|
1060
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1061
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1062
|
+
if (sortOrders.length > 0 ||
|
|
1063
|
+
dimensions.some(function (dimension) {
|
|
1064
|
+
return dimension.displayCondition &&
|
|
1065
|
+
dimension.displayCondition.mode !== EDisplayConditionMode.DISABLED;
|
|
1066
|
+
})) {
|
|
1067
|
+
return sortOrders;
|
|
1054
1068
|
}
|
|
1055
1069
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1056
1070
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1087,7 +1101,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1087
1101
|
};
|
|
1088
1102
|
function mapSortingToInputs(_a) {
|
|
1089
1103
|
var _b;
|
|
1090
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1104
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1091
1105
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1092
1106
|
var _b;
|
|
1093
1107
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1120,29 +1134,12 @@ function mapSortingToInputs(_a) {
|
|
|
1120
1134
|
direction: direction,
|
|
1121
1135
|
};
|
|
1122
1136
|
});
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
var dimensions = [];
|
|
1130
|
-
var measures = [];
|
|
1131
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
1132
|
-
var indicatorsGroup = settings[key];
|
|
1133
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
1134
|
-
if (getIndicatorType(key, indicator) === EWidgetIndicatorType.DIMENSION) {
|
|
1135
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
1136
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
1137
|
-
: indicator;
|
|
1138
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
1139
|
-
}
|
|
1140
|
-
else {
|
|
1141
|
-
measures.push(indicator);
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
});
|
|
1145
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
1137
|
+
return sortOrder;
|
|
1138
|
+
}
|
|
1139
|
+
function prepareSortOrders(_a) {
|
|
1140
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1141
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1142
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1146
1143
|
}
|
|
1147
1144
|
|
|
1148
1145
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1351,4 +1348,4 @@ var isValidColor = function (color, globalContext) {
|
|
|
1351
1348
|
return true;
|
|
1352
1349
|
};
|
|
1353
1350
|
|
|
1354
|
-
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, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, 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 };
|
|
1351
|
+
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, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, 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
|
@@ -140,6 +140,18 @@ var __assign = function() {
|
|
|
140
140
|
return __assign.apply(this, arguments);
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
+
function __rest(s, e) {
|
|
144
|
+
var t = {};
|
|
145
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
146
|
+
t[p] = s[p];
|
|
147
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
148
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
149
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
150
|
+
t[p[i]] = s[p[i]];
|
|
151
|
+
}
|
|
152
|
+
return t;
|
|
153
|
+
}
|
|
154
|
+
|
|
143
155
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
144
156
|
var e = new Error(message);
|
|
145
157
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1045,13 +1057,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1045
1057
|
return hierarchyDimensions[0];
|
|
1046
1058
|
}
|
|
1047
1059
|
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1060
|
+
var getDefaultSortOrders = function (_a) {
|
|
1061
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1062
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1063
|
+
if (sortOrders.length > 0 ||
|
|
1064
|
+
dimensions.some(function (dimension) {
|
|
1065
|
+
return dimension.displayCondition &&
|
|
1066
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
1067
|
+
})) {
|
|
1068
|
+
return sortOrders;
|
|
1055
1069
|
}
|
|
1056
1070
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1057
1071
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1088,7 +1102,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1088
1102
|
};
|
|
1089
1103
|
function mapSortingToInputs(_a) {
|
|
1090
1104
|
var _b;
|
|
1091
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1105
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1092
1106
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1093
1107
|
var _b;
|
|
1094
1108
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1121,29 +1135,12 @@ function mapSortingToInputs(_a) {
|
|
|
1121
1135
|
direction: direction,
|
|
1122
1136
|
};
|
|
1123
1137
|
});
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
}
|
|
1130
|
-
var dimensions = [];
|
|
1131
|
-
var measures = [];
|
|
1132
|
-
sortableIndicatorsKeys.forEach(function (key) {
|
|
1133
|
-
var indicatorsGroup = settings[key];
|
|
1134
|
-
indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup.forEach(function (indicator) {
|
|
1135
|
-
if (getIndicatorType(key, indicator) === exports.EWidgetIndicatorType.DIMENSION) {
|
|
1136
|
-
var activeDimensions = isDimensionsHierarchy(indicator)
|
|
1137
|
-
? selectDimensionFromHierarchy(indicator, filters)
|
|
1138
|
-
: indicator;
|
|
1139
|
-
activeDimensions && dimensions.push(activeDimensions);
|
|
1140
|
-
}
|
|
1141
|
-
else {
|
|
1142
|
-
measures.push(indicator);
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
});
|
|
1146
|
-
return getDefaultSortOrder(dimensions, measures);
|
|
1138
|
+
return sortOrder;
|
|
1139
|
+
}
|
|
1140
|
+
function prepareSortOrders(_a) {
|
|
1141
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1142
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1143
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1147
1144
|
}
|
|
1148
1145
|
|
|
1149
1146
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1371,6 +1368,7 @@ exports.fillTemplateString = fillTemplateString;
|
|
|
1371
1368
|
exports.formattingConfig = formattingConfig;
|
|
1372
1369
|
exports.formulaFilterMethods = formulaFilterMethods;
|
|
1373
1370
|
exports.generateColumnFormula = generateColumnFormula;
|
|
1371
|
+
exports.getDefaultSortOrders = getDefaultSortOrders;
|
|
1374
1372
|
exports.getDimensionFormula = getDimensionFormula;
|
|
1375
1373
|
exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
1376
1374
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
@@ -1392,6 +1390,7 @@ exports.mapSortingToInputs = mapSortingToInputs;
|
|
|
1392
1390
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1393
1391
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1394
1392
|
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1393
|
+
exports.prepareSortOrders = prepareSortOrders;
|
|
1395
1394
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1396
1395
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1397
1396
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|