@infomaximum/widget-sdk 3.26.0-beta → 3.27.0-BI-11861-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 +77 -18
- package/dist/index.esm.js +48 -28
- package/dist/index.js +49 -29
- package/package.json +9 -7
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ interface ICalculatorIndicatorOutput {
|
|
|
79
79
|
interface ICalculatorDimensionInput extends ICalculatorIndicatorInput {
|
|
80
80
|
formula: string;
|
|
81
81
|
hideEmpty?: boolean;
|
|
82
|
+
/** Временно поддерживается обратная совместимость с форматом { alias: string; formula: string }[] */
|
|
83
|
+
/** Появилась необходимость в ленточном графике, т.к. разрез длительность используется, как мера */
|
|
84
|
+
additionalFormulas?: Map<string, string>;
|
|
82
85
|
}
|
|
83
86
|
interface ICalculatorDimensionOutput extends ICalculatorIndicatorOutput {
|
|
84
87
|
}
|
|
@@ -404,6 +407,13 @@ interface IWidgetFiltration {
|
|
|
404
407
|
removeStagesFilter(widgetKey: string): void;
|
|
405
408
|
}
|
|
406
409
|
|
|
410
|
+
interface IPlacement {
|
|
411
|
+
left: number;
|
|
412
|
+
top: number;
|
|
413
|
+
width: number;
|
|
414
|
+
height: number;
|
|
415
|
+
zIndex: number;
|
|
416
|
+
}
|
|
407
417
|
declare enum EWidgetFilterMode {
|
|
408
418
|
DEFAULT = "DEFAULT",
|
|
409
419
|
SINGLE = "SINGLE",
|
|
@@ -418,25 +428,62 @@ type TWidgetFiltering = {
|
|
|
418
428
|
mode: EWidgetFilterMode;
|
|
419
429
|
};
|
|
420
430
|
declare enum EColorMode {
|
|
431
|
+
DISABLED = "DISABLED",
|
|
421
432
|
FORMULA = "FORMULA",
|
|
422
433
|
BASE = "BASE",
|
|
423
434
|
GRADIENT = "GRADIENT",
|
|
424
|
-
AUTO = "AUTO"
|
|
435
|
+
AUTO = "AUTO",
|
|
436
|
+
RULE = "RULE",
|
|
437
|
+
VALUES = "VALUES",
|
|
438
|
+
BY_DIMENSION = "BY_DIMENSION"
|
|
425
439
|
}
|
|
426
|
-
|
|
427
|
-
type TColor = {
|
|
428
|
-
mode: EColorMode.FORMULA;
|
|
429
|
-
formula: string;
|
|
430
|
-
} | {
|
|
440
|
+
type TColorBase = {
|
|
431
441
|
mode: EColorMode.BASE;
|
|
432
442
|
value?: string;
|
|
433
443
|
defaultColor?: string;
|
|
444
|
+
};
|
|
445
|
+
declare enum EColorScope {
|
|
446
|
+
WORKSPACE = "WORKSPACE",
|
|
447
|
+
DASHBOARD = "DASHBOARD"
|
|
448
|
+
}
|
|
449
|
+
type TColorRuleCommon = {
|
|
450
|
+
mode: EColorMode.RULE;
|
|
451
|
+
ruleName: string;
|
|
452
|
+
};
|
|
453
|
+
type TColorRule = ({
|
|
454
|
+
scope: EColorScope.DASHBOARD | null;
|
|
434
455
|
} | {
|
|
456
|
+
scope: EColorScope.WORKSPACE;
|
|
457
|
+
workspaceGroupId: number | null;
|
|
458
|
+
}) & TColorRuleCommon;
|
|
459
|
+
interface IColoredValue {
|
|
460
|
+
value: string;
|
|
461
|
+
color: TColorBase | TColorRule;
|
|
462
|
+
}
|
|
463
|
+
declare enum EMarkdownDisplayMode {
|
|
464
|
+
NONE = "NONE",
|
|
465
|
+
INDICATOR = "INDICATOR"
|
|
466
|
+
}
|
|
467
|
+
/** Настройка цвета */
|
|
468
|
+
type TColor = {
|
|
469
|
+
mode: EColorMode.FORMULA;
|
|
470
|
+
formula: string;
|
|
471
|
+
} | TColorBase | {
|
|
435
472
|
mode: EColorMode.GRADIENT;
|
|
436
473
|
startValue: string;
|
|
437
474
|
endValue: string;
|
|
438
475
|
} | {
|
|
439
476
|
mode: EColorMode.AUTO;
|
|
477
|
+
} | TColorRule | {
|
|
478
|
+
mode: EColorMode.VALUES;
|
|
479
|
+
dimensionFormula: string;
|
|
480
|
+
items: IColoredValue[];
|
|
481
|
+
} | {
|
|
482
|
+
mode: EColorMode.BY_DIMENSION;
|
|
483
|
+
dimensionName: string;
|
|
484
|
+
items: IColoredValue[];
|
|
485
|
+
} | {
|
|
486
|
+
mode: EColorMode.DISABLED;
|
|
440
487
|
};
|
|
441
488
|
declare enum EDisplayConditionMode {
|
|
442
489
|
DISABLED = "DISABLED",
|
|
@@ -470,6 +517,7 @@ type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
|
|
|
470
517
|
interface ISortOrder {
|
|
471
518
|
formula: string;
|
|
472
519
|
direction: TSortDirection;
|
|
520
|
+
displayCondition?: TNullable<string>;
|
|
473
521
|
}
|
|
474
522
|
type TWidgetSortingValueRelatedWidgetMeasure = {
|
|
475
523
|
mode: ESortingValueModes.MEASURE_IN_WIDGET;
|
|
@@ -614,6 +662,10 @@ interface IWidgetDimension extends IWidgetColumnIndicator {
|
|
|
614
662
|
interface IWidgetMeasure extends IWidgetColumnIndicator {
|
|
615
663
|
type: EWidgetIndicatorType.MEASURE;
|
|
616
664
|
}
|
|
665
|
+
interface IMarkdownMeasure extends IWidgetMeasure {
|
|
666
|
+
format: EFormatTypes;
|
|
667
|
+
displayMode: EMarkdownDisplayMode;
|
|
668
|
+
}
|
|
617
669
|
/** Тип показателя */
|
|
618
670
|
declare enum EIndicatorType {
|
|
619
671
|
/** Показатели процесса */
|
|
@@ -701,6 +753,9 @@ interface IWidgetTable {
|
|
|
701
753
|
* full - полный
|
|
702
754
|
*/
|
|
703
755
|
type TDisplayMode = "preview" | "full";
|
|
756
|
+
interface IDisplayRule {
|
|
757
|
+
color: TColor;
|
|
758
|
+
}
|
|
704
759
|
interface IWidgetsContext {
|
|
705
760
|
/** используемый язык в системе */
|
|
706
761
|
language: ELanguages;
|
|
@@ -723,6 +778,8 @@ interface IWidgetsContext {
|
|
|
723
778
|
userLogin: string;
|
|
724
779
|
scripts: Map<string, IActionScript>;
|
|
725
780
|
tables: Set<string>;
|
|
781
|
+
reportDisplayRules: Map<string, IDisplayRule>;
|
|
782
|
+
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
726
783
|
}
|
|
727
784
|
|
|
728
785
|
declare enum EWidgetActionInputMode {
|
|
@@ -770,17 +827,21 @@ interface IWidgetAction {
|
|
|
770
827
|
inputs: IWidgetActionInput[];
|
|
771
828
|
shouldRefreshWidgetsAfterExecution: boolean;
|
|
772
829
|
}
|
|
773
|
-
declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
|
|
830
|
+
declare const isActionValid: (action: IWidgetAction, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
774
831
|
|
|
775
832
|
interface IBaseWidgetSettings {
|
|
776
833
|
apiVersion: string;
|
|
777
834
|
type: string;
|
|
778
835
|
header?: string;
|
|
779
836
|
headerSize?: number;
|
|
837
|
+
showMarkdown?: boolean;
|
|
838
|
+
markdownMeasures?: IMarkdownMeasure[];
|
|
839
|
+
markdownText?: string;
|
|
780
840
|
stateGuid?: string | null;
|
|
781
841
|
filters?: (IFormulaFilterValue | string)[];
|
|
782
842
|
filterMode?: EWidgetFilterMode;
|
|
783
843
|
ignoreFilters?: boolean;
|
|
844
|
+
placement: IPlacement;
|
|
784
845
|
sorting?: IWidgetSortingIndicator[];
|
|
785
846
|
actions?: IWidgetAction[];
|
|
786
847
|
displayCondition?: TDisplayCondition;
|
|
@@ -861,6 +922,10 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
861
922
|
}
|
|
862
923
|
/** Конфигурация левой панели */
|
|
863
924
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
925
|
+
/** Добавить заголовок для виджета */
|
|
926
|
+
useHeader?: boolean;
|
|
927
|
+
/** Добавить описание для виджета */
|
|
928
|
+
useMarkdown?: boolean;
|
|
864
929
|
/** Конфигурация настроек данных виджета */
|
|
865
930
|
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
866
931
|
/** Конфигурация настроек отображения виджета */
|
|
@@ -1112,7 +1177,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
|
|
|
1112
1177
|
declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1113
1178
|
|
|
1114
1179
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
1115
|
-
declare function mapDimensionsToInputs(dimensions:
|
|
1180
|
+
declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (dimension: T) => Map<string, string>): ICalculatorDimensionInput[];
|
|
1116
1181
|
|
|
1117
1182
|
/** Конвертировать процессные показатели виджета во входы для вычислителя */
|
|
1118
1183
|
declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
@@ -1127,7 +1192,7 @@ declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicator
|
|
|
1127
1192
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
1128
1193
|
* @returns
|
|
1129
1194
|
*/
|
|
1130
|
-
declare function mapSortingToInputs(sortingIndicators
|
|
1195
|
+
declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable>): ISortOrder[];
|
|
1131
1196
|
|
|
1132
1197
|
/**
|
|
1133
1198
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1179,10 +1244,6 @@ type TLaunchActionParams = {
|
|
|
1179
1244
|
filters: ICalculatorFilter[];
|
|
1180
1245
|
needConfirmation?: boolean;
|
|
1181
1246
|
};
|
|
1182
|
-
type TWidgetContainer = {
|
|
1183
|
-
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
1184
|
-
isMaxHeightLimited: boolean;
|
|
1185
|
-
};
|
|
1186
1247
|
interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
|
|
1187
1248
|
/** guid виджета */
|
|
1188
1249
|
guid: string;
|
|
@@ -1203,10 +1264,8 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1203
1264
|
rootViewContainer: HTMLDivElement;
|
|
1204
1265
|
/** Объект для управления плейсхолдером */
|
|
1205
1266
|
placeholder: IWidgetPlaceholderController;
|
|
1206
|
-
/** Контекст
|
|
1267
|
+
/** Контекст виджета */
|
|
1207
1268
|
widgetsContext: IWidgetsContext;
|
|
1208
|
-
/** Данные о контейнере виджета */
|
|
1209
|
-
widgetContainer: TWidgetContainer;
|
|
1210
1269
|
/** Запуск действия */
|
|
1211
1270
|
launchAction(params: TLaunchActionParams): void;
|
|
1212
1271
|
}
|
|
@@ -1364,7 +1423,7 @@ declare const replaceFiltersBySelection: (filters: ICalculatorFilter[], selectio
|
|
|
1364
1423
|
* @param {P} [props] - Дополнительные параметры локализации.
|
|
1365
1424
|
* @returns {string} - Локализованный текст для указанного языка.
|
|
1366
1425
|
*/
|
|
1367
|
-
declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P
|
|
1426
|
+
declare const getLocalizedText: <L extends TLocalizationDescription, P extends ILocalizationProps = TExtractLocalizationParams<L>>(language: ELanguages, locObj: L, props?: P) => string;
|
|
1368
1427
|
|
|
1369
1428
|
type TDefineWidgetOptions = {
|
|
1370
1429
|
manifest?: Record<string, unknown>;
|
|
@@ -1380,4 +1439,4 @@ declare global {
|
|
|
1380
1439
|
}
|
|
1381
1440
|
}
|
|
1382
1441
|
|
|
1383
|
-
export { ECalculatorFilterMethods, EColorMode, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionScript, 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 ICommonColumnIndicator, type IControlRecord, type ICustomAddButtonProps, type ICustomWidgetProps, type IDefinition, type IDimensionSelection, type IDimensionSelectionByFormula, type IDisplayPredicate, 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 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 ISelectOption, type ISortOrder, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetAction, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetMeasure, type IWidgetPlaceholderController, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TBoundedContentWithIndicator, type TColor, type TColumnIndicatorValue, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TGroupLevelRecord, type TLaunchActionParams, type TProcessIndicatorValue, type TRecordAccessor, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionInputValue, type
|
|
1442
|
+
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionScript, 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 ICommonColumnIndicator, 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 IPanelDescription, type IPanelDescriptionCreator, type IPieCalculator, type IPieCalculatorInput, type IPieCalculatorOutput, type IPlacement, type IProcessEventFilterValue, type IProcessEventIndicator, type IProcessGraphCalculator, type IProcessGraphCalculatorInput, type IProcessGraphCalculatorOutput, type IProcessIndicator, type IProcessTransitionFilterValue, type IProcessTransitionIndicator, type IRange, type ISelectOption, type ISortOrder, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type IVertex, type IWidget, type IWidgetAction, type IWidgetActionInput, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetFormulaFilterValue, type IWidgetIndicator, type IWidgetMeasure, type IWidgetPlaceholderController, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type IWidgetsContext, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TGroupLevelRecord, type TLaunchActionParams, type TProcessIndicatorValue, type TRecordAccessor, type TSelectivePartial, type TSortDirection, type TUpdateSelection, type TValuePath, type TWidgetActionInputValue, 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, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.esm.js
CHANGED
|
@@ -73,7 +73,7 @@ var EWidgetActionInputMode;
|
|
|
73
73
|
})(EWidgetActionInputMode || (EWidgetActionInputMode = {}));
|
|
74
74
|
var isActionValid = function (action, _a) {
|
|
75
75
|
var _b;
|
|
76
|
-
var scripts = _a.scripts, tables = _a.tables;
|
|
76
|
+
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
77
77
|
var currentScript = scripts.get((_b = action.scriptGuid) !== null && _b !== void 0 ? _b : "");
|
|
78
78
|
if (!currentScript) {
|
|
79
79
|
return false;
|
|
@@ -88,7 +88,7 @@ var isActionValid = function (action, _a) {
|
|
|
88
88
|
return false;
|
|
89
89
|
}
|
|
90
90
|
var value = actionInput.value;
|
|
91
|
-
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !value.guid) {
|
|
91
|
+
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.guid)) {
|
|
92
92
|
return false;
|
|
93
93
|
}
|
|
94
94
|
if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -97,8 +97,7 @@ var isActionValid = function (action, _a) {
|
|
|
97
97
|
if (value.mode === EWidgetActionInputMode.DYNAMIC_LIST && !value.formula) {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
|
-
if (value.mode === EWidgetActionInputMode.FROM_COLUMN &&
|
|
101
|
-
!tables.has(value.tableName)) {
|
|
100
|
+
if (value.mode === EWidgetActionInputMode.FROM_COLUMN && !tables.has(value.tableName)) {
|
|
102
101
|
return false;
|
|
103
102
|
}
|
|
104
103
|
return true;
|
|
@@ -123,9 +122,7 @@ var prepareValuesForSql = function (dataType, values) {
|
|
|
123
122
|
dataType === ESimpleDataType.BOOLEAN
|
|
124
123
|
? values
|
|
125
124
|
: values.map(function (value) {
|
|
126
|
-
return value === null
|
|
127
|
-
? null
|
|
128
|
-
: "'".concat(escapeSingularQuotes(escapeReverseSlash(value)), "'");
|
|
125
|
+
return value === null ? null : "'".concat(escapeSingularQuotes(escapeReverseSlash(value)), "'");
|
|
129
126
|
});
|
|
130
127
|
};
|
|
131
128
|
var escapeReverseSlash = function (formula) {
|
|
@@ -136,7 +133,9 @@ var escapeSingularQuotes = function (formula) {
|
|
|
136
133
|
};
|
|
137
134
|
|
|
138
135
|
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
139
|
-
var compactMap = function (items, f) {
|
|
136
|
+
var compactMap = function (items, f) {
|
|
137
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
138
|
+
};
|
|
140
139
|
var isNil = function (value) {
|
|
141
140
|
return value === null || value === undefined;
|
|
142
141
|
};
|
|
@@ -476,11 +475,25 @@ var EWidgetFilterMode;
|
|
|
476
475
|
})(EWidgetFilterMode || (EWidgetFilterMode = {}));
|
|
477
476
|
var EColorMode;
|
|
478
477
|
(function (EColorMode) {
|
|
478
|
+
EColorMode["DISABLED"] = "DISABLED";
|
|
479
479
|
EColorMode["FORMULA"] = "FORMULA";
|
|
480
480
|
EColorMode["BASE"] = "BASE";
|
|
481
481
|
EColorMode["GRADIENT"] = "GRADIENT";
|
|
482
482
|
EColorMode["AUTO"] = "AUTO";
|
|
483
|
+
EColorMode["RULE"] = "RULE";
|
|
484
|
+
EColorMode["VALUES"] = "VALUES";
|
|
485
|
+
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
483
486
|
})(EColorMode || (EColorMode = {}));
|
|
487
|
+
var EColorScope;
|
|
488
|
+
(function (EColorScope) {
|
|
489
|
+
EColorScope["WORKSPACE"] = "WORKSPACE";
|
|
490
|
+
EColorScope["DASHBOARD"] = "DASHBOARD";
|
|
491
|
+
})(EColorScope || (EColorScope = {}));
|
|
492
|
+
var EMarkdownDisplayMode;
|
|
493
|
+
(function (EMarkdownDisplayMode) {
|
|
494
|
+
EMarkdownDisplayMode["NONE"] = "NONE";
|
|
495
|
+
EMarkdownDisplayMode["INDICATOR"] = "INDICATOR";
|
|
496
|
+
})(EMarkdownDisplayMode || (EMarkdownDisplayMode = {}));
|
|
484
497
|
var EDisplayConditionMode;
|
|
485
498
|
(function (EDisplayConditionMode) {
|
|
486
499
|
EDisplayConditionMode["DISABLED"] = "DISABLED";
|
|
@@ -508,9 +521,7 @@ function getDisplayConditionFormula(displayCondition) {
|
|
|
508
521
|
}
|
|
509
522
|
}
|
|
510
523
|
var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
511
|
-
return isNil(displayCondition)
|
|
512
|
-
? dimension
|
|
513
|
-
: __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
524
|
+
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
514
525
|
};
|
|
515
526
|
|
|
516
527
|
var escapeSpecialCharacters = function (formula) {
|
|
@@ -755,12 +766,11 @@ function mapMeasureToInput(measure, variables, addFormulas) {
|
|
|
755
766
|
}
|
|
756
767
|
/** Конвертировать меры виджета во входы для вычислителя */
|
|
757
768
|
function mapMeasuresToInputs(measures, variables, addFormulas) {
|
|
758
|
-
return compactMap(measures, function (measure) {
|
|
759
|
-
return mapMeasureToInput(measure, variables, addFormulas);
|
|
760
|
-
});
|
|
769
|
+
return compactMap(measures, function (measure) { return mapMeasureToInput(measure, variables, addFormulas); });
|
|
761
770
|
}
|
|
762
771
|
|
|
763
|
-
function mapDimensionToInput(dimension, variables) {
|
|
772
|
+
function mapDimensionToInput(dimension, variables, addFormulas) {
|
|
773
|
+
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
764
774
|
var formula = getDimensionFormula(dimension);
|
|
765
775
|
if (!formula) {
|
|
766
776
|
return null;
|
|
@@ -774,12 +784,13 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
774
784
|
dataType: dimension.dataType,
|
|
775
785
|
hideEmpty: dimension.hideEmptyValues,
|
|
776
786
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
787
|
+
additionalFormulas: addFormulas(dimension),
|
|
777
788
|
};
|
|
778
789
|
}
|
|
779
790
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
780
|
-
function mapDimensionsToInputs(dimensions, variables) {
|
|
791
|
+
function mapDimensionsToInputs(dimensions, variables, addFormulas) {
|
|
781
792
|
return compactMap(dimensions, function (dimension) {
|
|
782
|
-
return mapDimensionToInput(dimension, variables);
|
|
793
|
+
return mapDimensionToInput(dimension, variables, addFormulas);
|
|
783
794
|
});
|
|
784
795
|
}
|
|
785
796
|
|
|
@@ -838,11 +849,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
838
849
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
839
850
|
* @returns
|
|
840
851
|
*/
|
|
841
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder) {
|
|
852
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
842
853
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
843
854
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
844
855
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
845
856
|
return compactMap(sortingIndicators, function (_a) {
|
|
857
|
+
var _b;
|
|
846
858
|
var value = _a.value, direction = _a.direction;
|
|
847
859
|
if (value.mode === ESortingValueModes.FORMULA ||
|
|
848
860
|
value.mode === ESortingValueModes.QUANTITY ||
|
|
@@ -853,7 +865,20 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
853
865
|
if (value.mode === ESortingValueModes.DIMENSION_IN_WIDGET ||
|
|
854
866
|
value.mode === ESortingValueModes.HIERARCHY) {
|
|
855
867
|
var dimension = dimensionsInOriginalOrder[value.index];
|
|
856
|
-
|
|
868
|
+
if (!dimension) {
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
var formula = getDimensionFormula(dimension);
|
|
872
|
+
if (!formula || !checkDisplayCondition(dimension.displayCondition, variables)) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
return {
|
|
876
|
+
formula: getDimensionFormula(dimension),
|
|
877
|
+
direction: direction,
|
|
878
|
+
displayCondition: ((_b = dimension.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === EDisplayConditionMode.FORMULA
|
|
879
|
+
? dimension.displayCondition.formula
|
|
880
|
+
: undefined,
|
|
881
|
+
};
|
|
857
882
|
}
|
|
858
883
|
if (value.mode === ESortingValueModes.MEASURE_IN_WIDGET) {
|
|
859
884
|
var measure = measuresInOriginalOrder[value.index];
|
|
@@ -881,9 +906,7 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
881
906
|
if (!matchedFilter) {
|
|
882
907
|
return "continue";
|
|
883
908
|
}
|
|
884
|
-
var selectionIndex = matchedFilter.values.length > 1
|
|
885
|
-
? i
|
|
886
|
-
: Math.min(i + 1, dimensions.length - 1);
|
|
909
|
+
var selectionIndex = matchedFilter.values.length > 1 ? i : Math.min(i + 1, dimensions.length - 1);
|
|
887
910
|
return { value: dimensions[selectionIndex] };
|
|
888
911
|
};
|
|
889
912
|
for (var i = dimensions.length - 1; i >= 0; i--) {
|
|
@@ -898,8 +921,7 @@ var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
|
898
921
|
return compactMap(dimensions, function (indicator) {
|
|
899
922
|
if (isHierarchy(indicator)) {
|
|
900
923
|
var selectedDimension = selectDimensionFromHierarchy(indicator, filters);
|
|
901
|
-
return (selectedDimension &&
|
|
902
|
-
replaceDisplayCondition(selectedDimension, indicator.displayCondition));
|
|
924
|
+
return (selectedDimension && replaceDisplayCondition(selectedDimension, indicator.displayCondition));
|
|
903
925
|
}
|
|
904
926
|
return indicator;
|
|
905
927
|
});
|
|
@@ -916,9 +938,7 @@ function bindContentWithIndicator(outputs, indicator) {
|
|
|
916
938
|
* Массив объектов, каждый из которых содержит показатель и его контент
|
|
917
939
|
*/
|
|
918
940
|
function bindContentsWithIndicators(outputs, indicators) {
|
|
919
|
-
return compactMap(indicators, function (indicator) {
|
|
920
|
-
return bindContentWithIndicator(outputs, indicator);
|
|
921
|
-
});
|
|
941
|
+
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
922
942
|
}
|
|
923
943
|
|
|
924
944
|
var EControlType;
|
|
@@ -1046,4 +1066,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1046
1066
|
return localization.getLocalized(locObj, props);
|
|
1047
1067
|
};
|
|
1048
1068
|
|
|
1049
|
-
export { ECalculatorFilterMethods, EColorMode, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
|
1069
|
+
export { ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ exports.EWidgetActionInputMode = void 0;
|
|
|
74
74
|
})(exports.EWidgetActionInputMode || (exports.EWidgetActionInputMode = {}));
|
|
75
75
|
var isActionValid = function (action, _a) {
|
|
76
76
|
var _b;
|
|
77
|
-
var scripts = _a.scripts, tables = _a.tables;
|
|
77
|
+
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
78
78
|
var currentScript = scripts.get((_b = action.scriptGuid) !== null && _b !== void 0 ? _b : "");
|
|
79
79
|
if (!currentScript) {
|
|
80
80
|
return false;
|
|
@@ -89,7 +89,7 @@ var isActionValid = function (action, _a) {
|
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
91
|
var value = actionInput.value;
|
|
92
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !value.guid) {
|
|
92
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE && !variables.has(value.guid)) {
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
95
95
|
if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -98,8 +98,7 @@ var isActionValid = function (action, _a) {
|
|
|
98
98
|
if (value.mode === exports.EWidgetActionInputMode.DYNAMIC_LIST && !value.formula) {
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_COLUMN &&
|
|
102
|
-
!tables.has(value.tableName)) {
|
|
101
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_COLUMN && !tables.has(value.tableName)) {
|
|
103
102
|
return false;
|
|
104
103
|
}
|
|
105
104
|
return true;
|
|
@@ -124,9 +123,7 @@ var prepareValuesForSql = function (dataType, values) {
|
|
|
124
123
|
dataType === exports.ESimpleDataType.BOOLEAN
|
|
125
124
|
? values
|
|
126
125
|
: values.map(function (value) {
|
|
127
|
-
return value === null
|
|
128
|
-
? null
|
|
129
|
-
: "'".concat(escapeSingularQuotes(escapeReverseSlash(value)), "'");
|
|
126
|
+
return value === null ? null : "'".concat(escapeSingularQuotes(escapeReverseSlash(value)), "'");
|
|
130
127
|
});
|
|
131
128
|
};
|
|
132
129
|
var escapeReverseSlash = function (formula) {
|
|
@@ -137,7 +134,9 @@ var escapeSingularQuotes = function (formula) {
|
|
|
137
134
|
};
|
|
138
135
|
|
|
139
136
|
var compact = function (items) { return ((items === null || items === void 0 ? void 0 : items.filter(Boolean)) || []); };
|
|
140
|
-
var compactMap = function (items, f) {
|
|
137
|
+
var compactMap = function (items, f) {
|
|
138
|
+
return compact(items === null || items === void 0 ? void 0 : items.map(f));
|
|
139
|
+
};
|
|
141
140
|
var isNil = function (value) {
|
|
142
141
|
return value === null || value === undefined;
|
|
143
142
|
};
|
|
@@ -477,11 +476,25 @@ exports.EWidgetFilterMode = void 0;
|
|
|
477
476
|
})(exports.EWidgetFilterMode || (exports.EWidgetFilterMode = {}));
|
|
478
477
|
exports.EColorMode = void 0;
|
|
479
478
|
(function (EColorMode) {
|
|
479
|
+
EColorMode["DISABLED"] = "DISABLED";
|
|
480
480
|
EColorMode["FORMULA"] = "FORMULA";
|
|
481
481
|
EColorMode["BASE"] = "BASE";
|
|
482
482
|
EColorMode["GRADIENT"] = "GRADIENT";
|
|
483
483
|
EColorMode["AUTO"] = "AUTO";
|
|
484
|
+
EColorMode["RULE"] = "RULE";
|
|
485
|
+
EColorMode["VALUES"] = "VALUES";
|
|
486
|
+
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
484
487
|
})(exports.EColorMode || (exports.EColorMode = {}));
|
|
488
|
+
exports.EColorScope = void 0;
|
|
489
|
+
(function (EColorScope) {
|
|
490
|
+
EColorScope["WORKSPACE"] = "WORKSPACE";
|
|
491
|
+
EColorScope["DASHBOARD"] = "DASHBOARD";
|
|
492
|
+
})(exports.EColorScope || (exports.EColorScope = {}));
|
|
493
|
+
exports.EMarkdownDisplayMode = void 0;
|
|
494
|
+
(function (EMarkdownDisplayMode) {
|
|
495
|
+
EMarkdownDisplayMode["NONE"] = "NONE";
|
|
496
|
+
EMarkdownDisplayMode["INDICATOR"] = "INDICATOR";
|
|
497
|
+
})(exports.EMarkdownDisplayMode || (exports.EMarkdownDisplayMode = {}));
|
|
485
498
|
exports.EDisplayConditionMode = void 0;
|
|
486
499
|
(function (EDisplayConditionMode) {
|
|
487
500
|
EDisplayConditionMode["DISABLED"] = "DISABLED";
|
|
@@ -509,9 +522,7 @@ function getDisplayConditionFormula(displayCondition) {
|
|
|
509
522
|
}
|
|
510
523
|
}
|
|
511
524
|
var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
512
|
-
return isNil(displayCondition)
|
|
513
|
-
? dimension
|
|
514
|
-
: __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
525
|
+
return isNil(displayCondition) ? dimension : __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
515
526
|
};
|
|
516
527
|
|
|
517
528
|
var escapeSpecialCharacters = function (formula) {
|
|
@@ -756,12 +767,11 @@ function mapMeasureToInput(measure, variables, addFormulas) {
|
|
|
756
767
|
}
|
|
757
768
|
/** Конвертировать меры виджета во входы для вычислителя */
|
|
758
769
|
function mapMeasuresToInputs(measures, variables, addFormulas) {
|
|
759
|
-
return compactMap(measures, function (measure) {
|
|
760
|
-
return mapMeasureToInput(measure, variables, addFormulas);
|
|
761
|
-
});
|
|
770
|
+
return compactMap(measures, function (measure) { return mapMeasureToInput(measure, variables, addFormulas); });
|
|
762
771
|
}
|
|
763
772
|
|
|
764
|
-
function mapDimensionToInput(dimension, variables) {
|
|
773
|
+
function mapDimensionToInput(dimension, variables, addFormulas) {
|
|
774
|
+
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
765
775
|
var formula = getDimensionFormula(dimension);
|
|
766
776
|
if (!formula) {
|
|
767
777
|
return null;
|
|
@@ -775,12 +785,13 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
775
785
|
dataType: dimension.dataType,
|
|
776
786
|
hideEmpty: dimension.hideEmptyValues,
|
|
777
787
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
788
|
+
additionalFormulas: addFormulas(dimension),
|
|
778
789
|
};
|
|
779
790
|
}
|
|
780
791
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
781
|
-
function mapDimensionsToInputs(dimensions, variables) {
|
|
792
|
+
function mapDimensionsToInputs(dimensions, variables, addFormulas) {
|
|
782
793
|
return compactMap(dimensions, function (dimension) {
|
|
783
|
-
return mapDimensionToInput(dimension, variables);
|
|
794
|
+
return mapDimensionToInput(dimension, variables, addFormulas);
|
|
784
795
|
});
|
|
785
796
|
}
|
|
786
797
|
|
|
@@ -839,11 +850,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
839
850
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
840
851
|
* @returns
|
|
841
852
|
*/
|
|
842
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder) {
|
|
853
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
843
854
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
844
855
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
845
856
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
846
857
|
return compactMap(sortingIndicators, function (_a) {
|
|
858
|
+
var _b;
|
|
847
859
|
var value = _a.value, direction = _a.direction;
|
|
848
860
|
if (value.mode === exports.ESortingValueModes.FORMULA ||
|
|
849
861
|
value.mode === exports.ESortingValueModes.QUANTITY ||
|
|
@@ -854,7 +866,20 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
854
866
|
if (value.mode === exports.ESortingValueModes.DIMENSION_IN_WIDGET ||
|
|
855
867
|
value.mode === exports.ESortingValueModes.HIERARCHY) {
|
|
856
868
|
var dimension = dimensionsInOriginalOrder[value.index];
|
|
857
|
-
|
|
869
|
+
if (!dimension) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
var formula = getDimensionFormula(dimension);
|
|
873
|
+
if (!formula || !checkDisplayCondition(dimension.displayCondition, variables)) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
return {
|
|
877
|
+
formula: getDimensionFormula(dimension),
|
|
878
|
+
direction: direction,
|
|
879
|
+
displayCondition: ((_b = dimension.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
880
|
+
? dimension.displayCondition.formula
|
|
881
|
+
: undefined,
|
|
882
|
+
};
|
|
858
883
|
}
|
|
859
884
|
if (value.mode === exports.ESortingValueModes.MEASURE_IN_WIDGET) {
|
|
860
885
|
var measure = measuresInOriginalOrder[value.index];
|
|
@@ -882,9 +907,7 @@ function selectDimensionFromHierarchy(_a, filters) {
|
|
|
882
907
|
if (!matchedFilter) {
|
|
883
908
|
return "continue";
|
|
884
909
|
}
|
|
885
|
-
var selectionIndex = matchedFilter.values.length > 1
|
|
886
|
-
? i
|
|
887
|
-
: Math.min(i + 1, dimensions.length - 1);
|
|
910
|
+
var selectionIndex = matchedFilter.values.length > 1 ? i : Math.min(i + 1, dimensions.length - 1);
|
|
888
911
|
return { value: dimensions[selectionIndex] };
|
|
889
912
|
};
|
|
890
913
|
for (var i = dimensions.length - 1; i >= 0; i--) {
|
|
@@ -899,8 +922,7 @@ var replaceHierarchiesWithDimensions = function (dimensions, filters) {
|
|
|
899
922
|
return compactMap(dimensions, function (indicator) {
|
|
900
923
|
if (isHierarchy(indicator)) {
|
|
901
924
|
var selectedDimension = selectDimensionFromHierarchy(indicator, filters);
|
|
902
|
-
return (selectedDimension &&
|
|
903
|
-
replaceDisplayCondition(selectedDimension, indicator.displayCondition));
|
|
925
|
+
return (selectedDimension && replaceDisplayCondition(selectedDimension, indicator.displayCondition));
|
|
904
926
|
}
|
|
905
927
|
return indicator;
|
|
906
928
|
});
|
|
@@ -917,9 +939,7 @@ function bindContentWithIndicator(outputs, indicator) {
|
|
|
917
939
|
* Массив объектов, каждый из которых содержит показатель и его контент
|
|
918
940
|
*/
|
|
919
941
|
function bindContentsWithIndicators(outputs, indicators) {
|
|
920
|
-
return compactMap(indicators, function (indicator) {
|
|
921
|
-
return bindContentWithIndicator(outputs, indicator);
|
|
922
|
-
});
|
|
942
|
+
return compactMap(indicators, function (indicator) { return bindContentWithIndicator(outputs, indicator); });
|
|
923
943
|
}
|
|
924
944
|
|
|
925
945
|
exports.EControlType = void 0;
|
|
@@ -1047,11 +1067,11 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1047
1067
|
return localization.getLocalized(locObj, props);
|
|
1048
1068
|
};
|
|
1049
1069
|
|
|
1050
|
-
Object.defineProperty(exports,
|
|
1070
|
+
Object.defineProperty(exports, "ELanguages", {
|
|
1051
1071
|
enumerable: true,
|
|
1052
1072
|
get: function () { return localization$1.ELanguages; }
|
|
1053
1073
|
});
|
|
1054
|
-
Object.defineProperty(exports,
|
|
1074
|
+
Object.defineProperty(exports, "EFilteringMethodValues", {
|
|
1055
1075
|
enumerable: true,
|
|
1056
1076
|
get: function () { return baseFilter.EFilteringMethodValues; }
|
|
1057
1077
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infomaximum/widget-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0-BI-11861-1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,24 +12,26 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rollup -c",
|
|
14
14
|
"lint": "tsc --noEmit",
|
|
15
|
-
"release": "tsc --noEmit && standard-version && rollup -c"
|
|
15
|
+
"release": "tsc --noEmit && standard-version && rollup -c",
|
|
16
|
+
"format": "prettier --find-config-path --write 'src/**/*'"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
19
|
+
"@infomaximum/base-filter": "^1.1.0",
|
|
18
20
|
"@infomaximum/global-types": "^1.2.0",
|
|
19
|
-
"@infomaximum/localization": "^1.0.4"
|
|
20
|
-
"@infomaximum/base-filter": "^1.1.0"
|
|
21
|
+
"@infomaximum/localization": "^1.0.4"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
24
|
+
"@infomaximum/config": "^2.6.0",
|
|
23
25
|
"@rollup/plugin-commonjs": "25.0.7",
|
|
24
26
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
25
27
|
"@rollup/plugin-typescript": "11.1.5",
|
|
26
|
-
"prettier": "3.
|
|
27
|
-
"rollup": "4.
|
|
28
|
+
"prettier": "3.2.5",
|
|
29
|
+
"rollup": "4.14.3",
|
|
28
30
|
"rollup-plugin-delete": "2.0.0",
|
|
29
31
|
"rollup-plugin-dts": "6.1.0",
|
|
30
32
|
"standard-version": "9.5.0",
|
|
31
33
|
"tslib": "^2.4.1",
|
|
32
|
-
"typescript": "5.
|
|
34
|
+
"typescript": "5.4.5"
|
|
33
35
|
},
|
|
34
36
|
"repository": {
|
|
35
37
|
"type": "git",
|