@infomaximum/widget-sdk 4.2.1 → 4.3.0-BI-13455-2
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 +62 -12
- package/dist/index.esm.js +80 -32
- package/dist/index.js +83 -31
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -499,12 +499,16 @@ declare enum EFontWeight {
|
|
|
499
499
|
NORMAL = "NORMAL",
|
|
500
500
|
BOLD = "BOLD"
|
|
501
501
|
}
|
|
502
|
-
interface
|
|
503
|
-
enabled
|
|
504
|
-
horizontalPaddings
|
|
505
|
-
verticalPaddings
|
|
506
|
-
cornerRadius
|
|
502
|
+
interface IAppearanceEnabledSettings {
|
|
503
|
+
enabled: true;
|
|
504
|
+
horizontalPaddings: string | number;
|
|
505
|
+
verticalPaddings: string | number;
|
|
506
|
+
cornerRadius: string | number;
|
|
507
507
|
}
|
|
508
|
+
interface IAppearanceDisabledSettings {
|
|
509
|
+
enabled: false;
|
|
510
|
+
}
|
|
511
|
+
type TAppearanceSettings = IAppearanceEnabledSettings | IAppearanceDisabledSettings;
|
|
508
512
|
|
|
509
513
|
interface IWidgetTableColumn {
|
|
510
514
|
/** Имя колонки */
|
|
@@ -644,6 +648,12 @@ type TColor = {
|
|
|
644
648
|
};
|
|
645
649
|
declare const getRuleColor: (ruleFormula: string, globalContext: Pick<IGlobalContext, "reportDisplayRules" | "workspaceDisplayRules">) => TColor | undefined;
|
|
646
650
|
declare const isValidColor: (color: TColor, globalContext: Pick<IGlobalContext, "reportDisplayRules" | "workspaceDisplayRules">) => boolean;
|
|
651
|
+
declare const colors: string[];
|
|
652
|
+
/**
|
|
653
|
+
* Получить цвет по индексу элемента
|
|
654
|
+
* @param index - индекс элемента, которому требуется цвет
|
|
655
|
+
*/
|
|
656
|
+
declare const getColorByIndex: (index: number) => string;
|
|
647
657
|
|
|
648
658
|
interface IAutoIdentifiedArrayItem {
|
|
649
659
|
/**
|
|
@@ -668,7 +678,7 @@ interface IBaseWidgetSettings {
|
|
|
668
678
|
actions?: IWidgetAction[];
|
|
669
679
|
displayCondition?: TDisplayCondition;
|
|
670
680
|
displayConditionComment?: string;
|
|
671
|
-
appearance?:
|
|
681
|
+
appearance?: TAppearanceSettings;
|
|
672
682
|
}
|
|
673
683
|
|
|
674
684
|
declare enum EWidgetActionInputMethod {
|
|
@@ -807,6 +817,13 @@ interface IWidgetAction extends IActionCommon {
|
|
|
807
817
|
scriptKey: string;
|
|
808
818
|
updateDashboard: boolean;
|
|
809
819
|
description: string;
|
|
820
|
+
blockingCondition: {
|
|
821
|
+
formula: string;
|
|
822
|
+
};
|
|
823
|
+
buttonType: EActionButtonsTypes;
|
|
824
|
+
backgroundColor?: TColor;
|
|
825
|
+
borderColor?: TColor;
|
|
826
|
+
color: TColor;
|
|
810
827
|
}
|
|
811
828
|
type TAction = TActionsOnClick | IWidgetAction;
|
|
812
829
|
type TActionValidator = (action: TAction) => boolean;
|
|
@@ -817,6 +834,11 @@ type TActionValidator = (action: TAction) => boolean;
|
|
|
817
834
|
declare const isExecuteScriptActionValid: (action: Extract<TAction, {
|
|
818
835
|
type: EActionTypes.EXECUTE_SCRIPT;
|
|
819
836
|
}>, { scripts, tables, variables, systemVariables, }: Pick<IGlobalContext, "scripts" | "tables" | "variables" | "systemVariables">) => boolean;
|
|
837
|
+
declare enum EActionButtonsTypes {
|
|
838
|
+
LINK = "link",
|
|
839
|
+
BASE = "primary",
|
|
840
|
+
SECONDARY = "primary-outlined"
|
|
841
|
+
}
|
|
820
842
|
|
|
821
843
|
declare enum ESortDirection {
|
|
822
844
|
descend = "DESC",
|
|
@@ -994,6 +1016,8 @@ type TWidgetVariable = {
|
|
|
994
1016
|
defaultValue: string;
|
|
995
1017
|
/** Тип данных */
|
|
996
1018
|
dataType: ESimpleDataType;
|
|
1019
|
+
/** Общее значения */
|
|
1020
|
+
isValueShared: boolean;
|
|
997
1021
|
/** @deprecated */
|
|
998
1022
|
guid: string;
|
|
999
1023
|
} | {
|
|
@@ -1011,6 +1035,8 @@ type TWidgetVariable = {
|
|
|
1011
1035
|
dataType: ESimpleDataType.STRING;
|
|
1012
1036
|
/** Множественный выбор */
|
|
1013
1037
|
multipleChoice: boolean;
|
|
1038
|
+
/** Общее значения */
|
|
1039
|
+
isValueShared: boolean;
|
|
1014
1040
|
/** @deprecated */
|
|
1015
1041
|
guid: string;
|
|
1016
1042
|
} | {
|
|
@@ -1028,6 +1054,8 @@ type TWidgetVariable = {
|
|
|
1028
1054
|
dataType: ESimpleDataType;
|
|
1029
1055
|
/** Множественный выбор */
|
|
1030
1056
|
multipleChoice: boolean;
|
|
1057
|
+
/** Общее значения */
|
|
1058
|
+
isValueShared: boolean;
|
|
1031
1059
|
/** Фильтры */
|
|
1032
1060
|
filters: TExtendedFormulaFilterValue[];
|
|
1033
1061
|
/** @deprecated */
|
|
@@ -1238,17 +1266,23 @@ declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indi
|
|
|
1238
1266
|
/** Конвертировать показатели процессных событий виджета во входы для вычислителя */
|
|
1239
1267
|
declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1240
1268
|
|
|
1269
|
+
interface IGetDefaultSortOrders {
|
|
1270
|
+
sortOrders: ISortOrder[];
|
|
1271
|
+
dimensions: IWidgetDimension[];
|
|
1272
|
+
measures: IWidgetMeasure[];
|
|
1273
|
+
}
|
|
1274
|
+
declare const getDefaultSortOrders: ({ sortOrders, dimensions, measures, }: IGetDefaultSortOrders) => ISortOrder[];
|
|
1241
1275
|
/** Преобразовать объекты сортировок из settings виджета в sortOrders вычислителя */
|
|
1242
1276
|
interface IMapSortingToInputsParams<Settings, Indicator> {
|
|
1243
1277
|
settings: Settings;
|
|
1244
1278
|
variables: Map<string, TWidgetVariable>;
|
|
1245
1279
|
filters: ICalculatorFilter[];
|
|
1246
1280
|
getIndicatorType(key: string, indicator: Indicator): EWidgetIndicatorType.DIMENSION | EWidgetIndicatorType.MEASURE;
|
|
1247
|
-
/** При отсутствии сортировки использовать предустановленную сортировку(на основе sortableIndicatorsKeys) */
|
|
1248
|
-
withDefaultSortOrder?: boolean;
|
|
1249
|
-
sortableIndicatorsKeys?: Readonly<StringKeyOf<Settings>[]>;
|
|
1250
1281
|
}
|
|
1251
|
-
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType,
|
|
1282
|
+
declare function mapSortingToInputs<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ settings, variables, filters, getIndicatorType, }: IMapSortingToInputsParams<Settings, Indicator>): ISortOrder[];
|
|
1283
|
+
interface IPrepareSortOrdersParams<Settings, Indicator> extends IMapSortingToInputsParams<Settings, Indicator>, Pick<IGetDefaultSortOrders, "dimensions" | "measures"> {
|
|
1284
|
+
}
|
|
1285
|
+
declare function prepareSortOrders<Settings extends IBaseWidgetSettings = IBaseWidgetSettings, Indicator extends IWidgetColumnIndicator = IWidgetColumnIndicator>({ dimensions, measures, ...rest }: IPrepareSortOrdersParams<Settings, Indicator>): ISortOrder[];
|
|
1252
1286
|
|
|
1253
1287
|
/**
|
|
1254
1288
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1714,13 +1748,29 @@ interface IWidgetManifest {
|
|
|
1714
1748
|
en: string;
|
|
1715
1749
|
}>;
|
|
1716
1750
|
/** Мажорная версия widget-sdk, использованная при разработке виджета */
|
|
1717
|
-
sdk_version
|
|
1751
|
+
sdk_version?: number;
|
|
1718
1752
|
/** Путь до js-файла, который является входной точкой виджета */
|
|
1719
1753
|
entry: string;
|
|
1720
1754
|
/** Путь до иконки(svg или png) */
|
|
1721
1755
|
icon?: string;
|
|
1722
1756
|
/** Находится ли виджет на beta-стадии разработки */
|
|
1723
1757
|
is_beta?: boolean;
|
|
1758
|
+
/** Размер колонки с виджетом */
|
|
1759
|
+
default_size?: {
|
|
1760
|
+
/** Минимальная высота колонки с виджетом (по умолчанию 70) */
|
|
1761
|
+
min_height?: number;
|
|
1762
|
+
/** Минимальная ширина колонки с виджетом (по умолчанию 180) */
|
|
1763
|
+
min_width?: number;
|
|
1764
|
+
};
|
|
1765
|
+
/** Параметры контейнера виджета */
|
|
1766
|
+
container_params?: {
|
|
1767
|
+
/** @deprecated необходимо использовать show_title */
|
|
1768
|
+
show_header?: boolean;
|
|
1769
|
+
/** Отображать ли системный заголовок виджета (по умолчанию false) */
|
|
1770
|
+
show_title?: boolean;
|
|
1771
|
+
/** Отображать ли markdown "описание" виджета (по умолчанию false) */
|
|
1772
|
+
show_markdown?: boolean;
|
|
1773
|
+
};
|
|
1724
1774
|
}
|
|
1725
1775
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1726
1776
|
/** Манифест виджета */
|
|
@@ -1901,4 +1951,4 @@ declare global {
|
|
|
1901
1951
|
}
|
|
1902
1952
|
}
|
|
1903
1953
|
|
|
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
|
|
1954
|
+
export { EActionButtonsTypes, 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 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 TAppearanceSettings, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type 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, colors, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, 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
|
@@ -82,6 +82,12 @@ var isExecuteScriptActionValid = function (action, _a) {
|
|
|
82
82
|
return true;
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
+
var EActionButtonsTypes;
|
|
86
|
+
(function (EActionButtonsTypes) {
|
|
87
|
+
EActionButtonsTypes["LINK"] = "link";
|
|
88
|
+
EActionButtonsTypes["BASE"] = "primary";
|
|
89
|
+
EActionButtonsTypes["SECONDARY"] = "primary-outlined";
|
|
90
|
+
})(EActionButtonsTypes || (EActionButtonsTypes = {}));
|
|
85
91
|
|
|
86
92
|
var ESimpleDataType;
|
|
87
93
|
(function (ESimpleDataType) {
|
|
@@ -139,6 +145,18 @@ var __assign = function() {
|
|
|
139
145
|
return __assign.apply(this, arguments);
|
|
140
146
|
};
|
|
141
147
|
|
|
148
|
+
function __rest(s, e) {
|
|
149
|
+
var t = {};
|
|
150
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
151
|
+
t[p] = s[p];
|
|
152
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
153
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
154
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
155
|
+
t[p[i]] = s[p[i]];
|
|
156
|
+
}
|
|
157
|
+
return t;
|
|
158
|
+
}
|
|
159
|
+
|
|
142
160
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
143
161
|
var e = new Error(message);
|
|
144
162
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1044,13 +1062,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1044
1062
|
return hierarchyDimensions[0];
|
|
1045
1063
|
}
|
|
1046
1064
|
|
|
1047
|
-
var
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1065
|
+
var getDefaultSortOrders = function (_a) {
|
|
1066
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1067
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1068
|
+
if (sortOrders.length > 0 ||
|
|
1069
|
+
dimensions.some(function (dimension) {
|
|
1070
|
+
return dimension.displayCondition &&
|
|
1071
|
+
dimension.displayCondition.mode !== EDisplayConditionMode.DISABLED;
|
|
1072
|
+
})) {
|
|
1073
|
+
return sortOrders;
|
|
1054
1074
|
}
|
|
1055
1075
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1056
1076
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1087,7 +1107,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1087
1107
|
};
|
|
1088
1108
|
function mapSortingToInputs(_a) {
|
|
1089
1109
|
var _b;
|
|
1090
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1110
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1091
1111
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1092
1112
|
var _b;
|
|
1093
1113
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1120,29 +1140,12 @@ function mapSortingToInputs(_a) {
|
|
|
1120
1140
|
direction: direction,
|
|
1121
1141
|
};
|
|
1122
1142
|
});
|
|
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);
|
|
1143
|
+
return sortOrder;
|
|
1144
|
+
}
|
|
1145
|
+
function prepareSortOrders(_a) {
|
|
1146
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1147
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1148
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1146
1149
|
}
|
|
1147
1150
|
|
|
1148
1151
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1350,5 +1353,50 @@ var isValidColor = function (color, globalContext) {
|
|
|
1350
1353
|
}
|
|
1351
1354
|
return true;
|
|
1352
1355
|
};
|
|
1356
|
+
var colors = [
|
|
1357
|
+
"#222F3E",
|
|
1358
|
+
"#00D2D3",
|
|
1359
|
+
"#5F27CD",
|
|
1360
|
+
"#FECA57",
|
|
1361
|
+
"#078936",
|
|
1362
|
+
"#E51320",
|
|
1363
|
+
"#96AABF",
|
|
1364
|
+
"#1C55E7",
|
|
1365
|
+
"#341F97",
|
|
1366
|
+
"#FFDD59",
|
|
1367
|
+
"#D82C46",
|
|
1368
|
+
"#0BE881",
|
|
1369
|
+
"#0ABDE3",
|
|
1370
|
+
"#FF9F43",
|
|
1371
|
+
"#EC41D4",
|
|
1372
|
+
"#117F8E",
|
|
1373
|
+
"#B9B9B9",
|
|
1374
|
+
"#505BF1",
|
|
1375
|
+
"#64FFB6",
|
|
1376
|
+
"#485460",
|
|
1377
|
+
"#FFD32A",
|
|
1378
|
+
"#C74E1A",
|
|
1379
|
+
"#6E70A6",
|
|
1380
|
+
"#3C40C6",
|
|
1381
|
+
"#48DBFB",
|
|
1382
|
+
"#486179",
|
|
1383
|
+
"#FF9FF3",
|
|
1384
|
+
"#1DD1A1",
|
|
1385
|
+
"#BCC8D4",
|
|
1386
|
+
"#BA46AA",
|
|
1387
|
+
];
|
|
1388
|
+
/**
|
|
1389
|
+
* Получить цвет по индексу элемента
|
|
1390
|
+
* @param index - индекс элемента, которому требуется цвет
|
|
1391
|
+
*/
|
|
1392
|
+
var getColorByIndex = function (index) {
|
|
1393
|
+
var colorsLength = colors.length;
|
|
1394
|
+
var countTurns = Math.trunc(index / colorsLength);
|
|
1395
|
+
var color = colors[index - colorsLength * countTurns];
|
|
1396
|
+
if (!color) {
|
|
1397
|
+
throw new Error("Не удалось автоматически определить цвет, возможно палитра цветов пуста.");
|
|
1398
|
+
}
|
|
1399
|
+
return color;
|
|
1400
|
+
};
|
|
1353
1401
|
|
|
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 };
|
|
1402
|
+
export { EActionButtonsTypes, 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, colors, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getColorByIndex, 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
|
@@ -83,6 +83,12 @@ var isExecuteScriptActionValid = function (action, _a) {
|
|
|
83
83
|
return true;
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
+
exports.EActionButtonsTypes = void 0;
|
|
87
|
+
(function (EActionButtonsTypes) {
|
|
88
|
+
EActionButtonsTypes["LINK"] = "link";
|
|
89
|
+
EActionButtonsTypes["BASE"] = "primary";
|
|
90
|
+
EActionButtonsTypes["SECONDARY"] = "primary-outlined";
|
|
91
|
+
})(exports.EActionButtonsTypes || (exports.EActionButtonsTypes = {}));
|
|
86
92
|
|
|
87
93
|
exports.ESimpleDataType = void 0;
|
|
88
94
|
(function (ESimpleDataType) {
|
|
@@ -140,6 +146,18 @@ var __assign = function() {
|
|
|
140
146
|
return __assign.apply(this, arguments);
|
|
141
147
|
};
|
|
142
148
|
|
|
149
|
+
function __rest(s, e) {
|
|
150
|
+
var t = {};
|
|
151
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
152
|
+
t[p] = s[p];
|
|
153
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
154
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
155
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
156
|
+
t[p[i]] = s[p[i]];
|
|
157
|
+
}
|
|
158
|
+
return t;
|
|
159
|
+
}
|
|
160
|
+
|
|
143
161
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
144
162
|
var e = new Error(message);
|
|
145
163
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -1045,13 +1063,15 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
1045
1063
|
return hierarchyDimensions[0];
|
|
1046
1064
|
}
|
|
1047
1065
|
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1066
|
+
var getDefaultSortOrders = function (_a) {
|
|
1067
|
+
var sortOrders = _a.sortOrders, dimensions = _a.dimensions, measures = _a.measures;
|
|
1068
|
+
/** Если есть условие отображения или пользовательские сортировки, то не делаем авто-сортировку */
|
|
1069
|
+
if (sortOrders.length > 0 ||
|
|
1070
|
+
dimensions.some(function (dimension) {
|
|
1071
|
+
return dimension.displayCondition &&
|
|
1072
|
+
dimension.displayCondition.mode !== exports.EDisplayConditionMode.DISABLED;
|
|
1073
|
+
})) {
|
|
1074
|
+
return sortOrders;
|
|
1055
1075
|
}
|
|
1056
1076
|
/** Если есть временной разрез, то авто-сортировка по первому такому разрезу (по возрастанию) */
|
|
1057
1077
|
var timeDimension = dimensions.find(function (dimension) {
|
|
@@ -1088,7 +1108,7 @@ var getDefaultSortOrder = function (dimensions, measures) {
|
|
|
1088
1108
|
};
|
|
1089
1109
|
function mapSortingToInputs(_a) {
|
|
1090
1110
|
var _b;
|
|
1091
|
-
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType
|
|
1111
|
+
var settings = _a.settings, variables = _a.variables, filters = _a.filters, getIndicatorType = _a.getIndicatorType;
|
|
1092
1112
|
var sortOrder = compactMap((_b = settings["sorting"]) !== null && _b !== void 0 ? _b : [], function (_a) {
|
|
1093
1113
|
var _b;
|
|
1094
1114
|
var direction = _a.direction, value = _a.value;
|
|
@@ -1121,29 +1141,12 @@ function mapSortingToInputs(_a) {
|
|
|
1121
1141
|
direction: direction,
|
|
1122
1142
|
};
|
|
1123
1143
|
});
|
|
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);
|
|
1144
|
+
return sortOrder;
|
|
1145
|
+
}
|
|
1146
|
+
function prepareSortOrders(_a) {
|
|
1147
|
+
var dimensions = _a.dimensions, measures = _a.measures, rest = __rest(_a, ["dimensions", "measures"]);
|
|
1148
|
+
var sortOrders = mapSortingToInputs(rest);
|
|
1149
|
+
return getDefaultSortOrders({ sortOrders: sortOrders, dimensions: dimensions, measures: measures });
|
|
1147
1150
|
}
|
|
1148
1151
|
|
|
1149
1152
|
var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
@@ -1351,6 +1354,51 @@ var isValidColor = function (color, globalContext) {
|
|
|
1351
1354
|
}
|
|
1352
1355
|
return true;
|
|
1353
1356
|
};
|
|
1357
|
+
var colors = [
|
|
1358
|
+
"#222F3E",
|
|
1359
|
+
"#00D2D3",
|
|
1360
|
+
"#5F27CD",
|
|
1361
|
+
"#FECA57",
|
|
1362
|
+
"#078936",
|
|
1363
|
+
"#E51320",
|
|
1364
|
+
"#96AABF",
|
|
1365
|
+
"#1C55E7",
|
|
1366
|
+
"#341F97",
|
|
1367
|
+
"#FFDD59",
|
|
1368
|
+
"#D82C46",
|
|
1369
|
+
"#0BE881",
|
|
1370
|
+
"#0ABDE3",
|
|
1371
|
+
"#FF9F43",
|
|
1372
|
+
"#EC41D4",
|
|
1373
|
+
"#117F8E",
|
|
1374
|
+
"#B9B9B9",
|
|
1375
|
+
"#505BF1",
|
|
1376
|
+
"#64FFB6",
|
|
1377
|
+
"#485460",
|
|
1378
|
+
"#FFD32A",
|
|
1379
|
+
"#C74E1A",
|
|
1380
|
+
"#6E70A6",
|
|
1381
|
+
"#3C40C6",
|
|
1382
|
+
"#48DBFB",
|
|
1383
|
+
"#486179",
|
|
1384
|
+
"#FF9FF3",
|
|
1385
|
+
"#1DD1A1",
|
|
1386
|
+
"#BCC8D4",
|
|
1387
|
+
"#BA46AA",
|
|
1388
|
+
];
|
|
1389
|
+
/**
|
|
1390
|
+
* Получить цвет по индексу элемента
|
|
1391
|
+
* @param index - индекс элемента, которому требуется цвет
|
|
1392
|
+
*/
|
|
1393
|
+
var getColorByIndex = function (index) {
|
|
1394
|
+
var colorsLength = colors.length;
|
|
1395
|
+
var countTurns = Math.trunc(index / colorsLength);
|
|
1396
|
+
var color = colors[index - colorsLength * countTurns];
|
|
1397
|
+
if (!color) {
|
|
1398
|
+
throw new Error("Не удалось автоматически определить цвет, возможно палитра цветов пуста.");
|
|
1399
|
+
}
|
|
1400
|
+
return color;
|
|
1401
|
+
};
|
|
1354
1402
|
|
|
1355
1403
|
Object.defineProperty(exports, "ELanguages", {
|
|
1356
1404
|
enumerable: true,
|
|
@@ -1363,6 +1411,7 @@ Object.defineProperty(exports, "EFilteringMethodValues", {
|
|
|
1363
1411
|
exports.bindContentWithIndicator = bindContentWithIndicator;
|
|
1364
1412
|
exports.bindContentsWithIndicators = bindContentsWithIndicators;
|
|
1365
1413
|
exports.checkDisplayCondition = checkDisplayCondition;
|
|
1414
|
+
exports.colors = colors;
|
|
1366
1415
|
exports.dashboardLinkRegExp = dashboardLinkRegExp;
|
|
1367
1416
|
exports.dimensionTemplateFormulas = dimensionTemplateFormulas;
|
|
1368
1417
|
exports.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
@@ -1371,6 +1420,8 @@ exports.fillTemplateString = fillTemplateString;
|
|
|
1371
1420
|
exports.formattingConfig = formattingConfig;
|
|
1372
1421
|
exports.formulaFilterMethods = formulaFilterMethods;
|
|
1373
1422
|
exports.generateColumnFormula = generateColumnFormula;
|
|
1423
|
+
exports.getColorByIndex = getColorByIndex;
|
|
1424
|
+
exports.getDefaultSortOrders = getDefaultSortOrders;
|
|
1374
1425
|
exports.getDimensionFormula = getDimensionFormula;
|
|
1375
1426
|
exports.getDisplayConditionFormula = getDisplayConditionFormula;
|
|
1376
1427
|
exports.getEventMeasureFormula = getEventMeasureFormula;
|
|
@@ -1392,6 +1443,7 @@ exports.mapSortingToInputs = mapSortingToInputs;
|
|
|
1392
1443
|
exports.mapTransitionMeasuresToInputs = mapTransitionMeasuresToInputs;
|
|
1393
1444
|
exports.measureTemplateFormulas = measureTemplateFormulas;
|
|
1394
1445
|
exports.parseIndicatorLink = parseIndicatorLink;
|
|
1446
|
+
exports.prepareSortOrders = prepareSortOrders;
|
|
1395
1447
|
exports.prepareValuesForSql = prepareValuesForSql;
|
|
1396
1448
|
exports.replaceDisplayCondition = replaceDisplayCondition;
|
|
1397
1449
|
exports.replaceFiltersBySelection = replaceFiltersBySelection;
|