@infomaximum/widget-sdk 4.0.0-beta11 → 4.0.0-beta12
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 +66 -9
- package/dist/index.esm.js +38 -6
- package/dist/index.js +37 -5
- package/package.json +1 -1
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
|
}
|
|
@@ -418,25 +421,62 @@ type TWidgetFiltering = {
|
|
|
418
421
|
mode: EWidgetFilterMode;
|
|
419
422
|
};
|
|
420
423
|
declare enum EColorMode {
|
|
424
|
+
DISABLED = "DISABLED",
|
|
421
425
|
FORMULA = "FORMULA",
|
|
422
426
|
BASE = "BASE",
|
|
423
427
|
GRADIENT = "GRADIENT",
|
|
424
|
-
AUTO = "AUTO"
|
|
428
|
+
AUTO = "AUTO",
|
|
429
|
+
RULE = "RULE",
|
|
430
|
+
VALUES = "VALUES",
|
|
431
|
+
BY_DIMENSION = "BY_DIMENSION"
|
|
425
432
|
}
|
|
426
|
-
|
|
427
|
-
type TColor = {
|
|
428
|
-
mode: EColorMode.FORMULA;
|
|
429
|
-
formula: string;
|
|
430
|
-
} | {
|
|
433
|
+
type TColorBase = {
|
|
431
434
|
mode: EColorMode.BASE;
|
|
432
435
|
value?: string;
|
|
433
436
|
defaultColor?: string;
|
|
437
|
+
};
|
|
438
|
+
declare enum EColorScope {
|
|
439
|
+
WORKSPACE = "WORKSPACE",
|
|
440
|
+
DASHBOARD = "DASHBOARD"
|
|
441
|
+
}
|
|
442
|
+
type TColorRuleCommon = {
|
|
443
|
+
mode: EColorMode.RULE;
|
|
444
|
+
ruleName: string;
|
|
445
|
+
};
|
|
446
|
+
type TColorRule = ({
|
|
447
|
+
scope: EColorScope.DASHBOARD | null;
|
|
434
448
|
} | {
|
|
449
|
+
scope: EColorScope.WORKSPACE;
|
|
450
|
+
workspaceGroupId: number | null;
|
|
451
|
+
}) & TColorRuleCommon;
|
|
452
|
+
interface IColoredValue {
|
|
453
|
+
value: string;
|
|
454
|
+
color: TColorBase | TColorRule;
|
|
455
|
+
}
|
|
456
|
+
declare enum EMarkdownDisplayMode {
|
|
457
|
+
NONE = "NONE",
|
|
458
|
+
INDICATOR = "INDICATOR"
|
|
459
|
+
}
|
|
460
|
+
/** Настройка цвета */
|
|
461
|
+
type TColor = {
|
|
462
|
+
mode: EColorMode.FORMULA;
|
|
463
|
+
formula: string;
|
|
464
|
+
} | TColorBase | {
|
|
435
465
|
mode: EColorMode.GRADIENT;
|
|
436
466
|
startValue: string;
|
|
437
467
|
endValue: string;
|
|
438
468
|
} | {
|
|
439
469
|
mode: EColorMode.AUTO;
|
|
470
|
+
} | TColorRule | {
|
|
471
|
+
mode: EColorMode.VALUES;
|
|
472
|
+
dimensionFormula: string;
|
|
473
|
+
items: IColoredValue[];
|
|
474
|
+
} | {
|
|
475
|
+
mode: EColorMode.BY_DIMENSION;
|
|
476
|
+
dimensionName: string;
|
|
477
|
+
items: IColoredValue[];
|
|
478
|
+
} | {
|
|
479
|
+
mode: EColorMode.DISABLED;
|
|
440
480
|
};
|
|
441
481
|
declare enum EDisplayConditionMode {
|
|
442
482
|
DISABLED = "DISABLED",
|
|
@@ -470,6 +510,7 @@ type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
|
|
|
470
510
|
interface ISortOrder {
|
|
471
511
|
formula: string;
|
|
472
512
|
direction: TSortDirection;
|
|
513
|
+
displayCondition?: TNullable<string>;
|
|
473
514
|
}
|
|
474
515
|
type TWidgetSortingValueRelatedWidgetMeasure = {
|
|
475
516
|
mode: ESortingValueModes.MEASURE_IN_WIDGET;
|
|
@@ -613,6 +654,10 @@ interface IWidgetDimension extends IWidgetColumnIndicator {
|
|
|
613
654
|
interface IWidgetMeasure extends IWidgetColumnIndicator {
|
|
614
655
|
type: EWidgetIndicatorType.MEASURE;
|
|
615
656
|
}
|
|
657
|
+
interface IMarkdownMeasure extends IWidgetMeasure {
|
|
658
|
+
format: EFormatTypes;
|
|
659
|
+
displayMode: EMarkdownDisplayMode;
|
|
660
|
+
}
|
|
616
661
|
/** Тип показателя */
|
|
617
662
|
declare enum EIndicatorType {
|
|
618
663
|
/** Показатели процесса */
|
|
@@ -700,6 +745,9 @@ interface IWidgetTable {
|
|
|
700
745
|
* full - полный
|
|
701
746
|
*/
|
|
702
747
|
type TDisplayMode = "preview" | "full";
|
|
748
|
+
interface IDisplayRule {
|
|
749
|
+
color: TColor;
|
|
750
|
+
}
|
|
703
751
|
interface IWidgetsContext {
|
|
704
752
|
/** используемый язык в системе */
|
|
705
753
|
language: ELanguages;
|
|
@@ -722,6 +770,8 @@ interface IWidgetsContext {
|
|
|
722
770
|
userLogin: string;
|
|
723
771
|
scripts: Map<string, IActionScript>;
|
|
724
772
|
tables: Set<string>;
|
|
773
|
+
reportDisplayRules: Map<string, IDisplayRule>;
|
|
774
|
+
workspaceDisplayRules: Map<number, Map<string, IDisplayRule>>;
|
|
725
775
|
}
|
|
726
776
|
|
|
727
777
|
declare enum EWidgetActionInputMode {
|
|
@@ -822,6 +872,9 @@ interface IBaseWidgetSettings {
|
|
|
822
872
|
header?: string;
|
|
823
873
|
headerSize?: number;
|
|
824
874
|
stateName?: string | null;
|
|
875
|
+
showMarkdown?: boolean;
|
|
876
|
+
markdownMeasures?: IMarkdownMeasure[];
|
|
877
|
+
markdownText?: string;
|
|
825
878
|
filters?: (IFormulaFilterValue | string)[];
|
|
826
879
|
filterMode?: EWidgetFilterMode;
|
|
827
880
|
ignoreFilters?: boolean;
|
|
@@ -905,6 +958,10 @@ interface IGroupSetDescription<Settings extends object, GroupSettings extends ob
|
|
|
905
958
|
}
|
|
906
959
|
/** Конфигурация левой панели */
|
|
907
960
|
interface IPanelDescription<Settings extends object, GroupSettings extends IGroupSettings = IGroupSettings> {
|
|
961
|
+
/** Добавить заголовок для виджета */
|
|
962
|
+
useHeader?: boolean;
|
|
963
|
+
/** Добавить описание для виджета */
|
|
964
|
+
useMarkdown?: boolean;
|
|
908
965
|
/** Конфигурация настроек данных виджета */
|
|
909
966
|
dataRecords?: TWidgetLevelRecord<Settings>[];
|
|
910
967
|
/** Конфигурация настроек отображения виджета */
|
|
@@ -1156,7 +1213,7 @@ declare const replaceDisplayCondition: <I extends IWidgetColumnIndicator>(dimens
|
|
|
1156
1213
|
declare function mapMeasuresToInputs<T extends IWidgetMeasure>(measures: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (measure: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
1157
1214
|
|
|
1158
1215
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
1159
|
-
declare function mapDimensionsToInputs(dimensions:
|
|
1216
|
+
declare function mapDimensionsToInputs<T extends IWidgetDimension>(dimensions: T[], variables: Map<string, TWidgetVariable>, addFormulas?: (dimension: T) => Map<string, string>): ICalculatorDimensionInput[];
|
|
1160
1217
|
|
|
1161
1218
|
/** Конвертировать процессные показатели виджета во входы для вычислителя */
|
|
1162
1219
|
declare function mapTransitionMeasuresToInputs<T extends IProcessIndicator>(indicators: T[], process: IWidgetProcess, variables: Map<string, TWidgetVariable>, addFormulas?: (indicator: T) => Map<string, string>): ICalculatorMeasureInput[];
|
|
@@ -1171,7 +1228,7 @@ declare function mapEventMeasuresToInputs<T extends IProcessIndicator>(indicator
|
|
|
1171
1228
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
1172
1229
|
* @returns
|
|
1173
1230
|
*/
|
|
1174
|
-
declare function mapSortingToInputs(sortingIndicators
|
|
1231
|
+
declare function mapSortingToInputs(sortingIndicators: IWidgetSortingIndicator[] | undefined, dimensionsInOriginalOrder: IWidgetDimension[] | undefined, measuresInOriginalOrder: IWidgetMeasure[] | undefined, variables: Map<string, TWidgetVariable>): ISortOrder[];
|
|
1175
1232
|
|
|
1176
1233
|
/**
|
|
1177
1234
|
* Выбрать активный разрез иерархии на основе активных фильтров.
|
|
@@ -1424,4 +1481,4 @@ declare global {
|
|
|
1424
1481
|
}
|
|
1425
1482
|
}
|
|
1426
1483
|
|
|
1427
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionCommon, type IActionGoToUrl, type IActionOpenView, type IActionRunScript, type IActionScript, type IActionScriptField, type IActionUpdateVariable, 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 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 TActionsOnClick, 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 TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, isActionValid, isHierarchy, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, mapVariablesToInputs, measureTemplateFormulas, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection };
|
|
1484
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, EWidgetActionInputMode, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionCommon, type IActionGoToUrl, type IActionOpenView, type IActionRunScript, type IActionScript, type IActionScriptField, type IActionUpdateVariable, 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 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 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 TActionsOnClick, 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 TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetSortingValueRelatedWidgetDimension, type TWidgetSortingValueRelatedWidgetIndicator, type TWidgetSortingValueRelatedWidgetMeasure, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getTransitionMeasureFormula, 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
|
@@ -502,11 +502,25 @@ var EWidgetFilterMode;
|
|
|
502
502
|
})(EWidgetFilterMode || (EWidgetFilterMode = {}));
|
|
503
503
|
var EColorMode;
|
|
504
504
|
(function (EColorMode) {
|
|
505
|
+
EColorMode["DISABLED"] = "DISABLED";
|
|
505
506
|
EColorMode["FORMULA"] = "FORMULA";
|
|
506
507
|
EColorMode["BASE"] = "BASE";
|
|
507
508
|
EColorMode["GRADIENT"] = "GRADIENT";
|
|
508
509
|
EColorMode["AUTO"] = "AUTO";
|
|
510
|
+
EColorMode["RULE"] = "RULE";
|
|
511
|
+
EColorMode["VALUES"] = "VALUES";
|
|
512
|
+
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
509
513
|
})(EColorMode || (EColorMode = {}));
|
|
514
|
+
var EColorScope;
|
|
515
|
+
(function (EColorScope) {
|
|
516
|
+
EColorScope["WORKSPACE"] = "WORKSPACE";
|
|
517
|
+
EColorScope["DASHBOARD"] = "DASHBOARD";
|
|
518
|
+
})(EColorScope || (EColorScope = {}));
|
|
519
|
+
var EMarkdownDisplayMode;
|
|
520
|
+
(function (EMarkdownDisplayMode) {
|
|
521
|
+
EMarkdownDisplayMode["NONE"] = "NONE";
|
|
522
|
+
EMarkdownDisplayMode["INDICATOR"] = "INDICATOR";
|
|
523
|
+
})(EMarkdownDisplayMode || (EMarkdownDisplayMode = {}));
|
|
510
524
|
var EDisplayConditionMode;
|
|
511
525
|
(function (EDisplayConditionMode) {
|
|
512
526
|
EDisplayConditionMode["DISABLED"] = "DISABLED";
|
|
@@ -782,7 +796,8 @@ function mapMeasuresToInputs(measures, variables, addFormulas) {
|
|
|
782
796
|
return compactMap(measures, function (measure) { return mapMeasureToInput(measure, variables, addFormulas); });
|
|
783
797
|
}
|
|
784
798
|
|
|
785
|
-
function mapDimensionToInput(dimension, variables) {
|
|
799
|
+
function mapDimensionToInput(dimension, variables, addFormulas) {
|
|
800
|
+
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
786
801
|
var formula = getDimensionFormula(dimension);
|
|
787
802
|
if (!formula) {
|
|
788
803
|
return null;
|
|
@@ -796,11 +811,14 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
796
811
|
dataType: dimension.dataType,
|
|
797
812
|
hideEmpty: dimension.hideEmptyValues,
|
|
798
813
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
814
|
+
additionalFormulas: addFormulas(dimension),
|
|
799
815
|
};
|
|
800
816
|
}
|
|
801
817
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
802
|
-
function mapDimensionsToInputs(dimensions, variables) {
|
|
803
|
-
return compactMap(dimensions, function (dimension) {
|
|
818
|
+
function mapDimensionsToInputs(dimensions, variables, addFormulas) {
|
|
819
|
+
return compactMap(dimensions, function (dimension) {
|
|
820
|
+
return mapDimensionToInput(dimension, variables, addFormulas);
|
|
821
|
+
});
|
|
804
822
|
}
|
|
805
823
|
|
|
806
824
|
function mapTransitionMeasureToInput(indicator, process, variables, addFormulas) {
|
|
@@ -858,11 +876,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
858
876
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
859
877
|
* @returns
|
|
860
878
|
*/
|
|
861
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder) {
|
|
879
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
862
880
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
863
881
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
864
882
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
865
883
|
return compactMap(sortingIndicators, function (_a) {
|
|
884
|
+
var _b;
|
|
866
885
|
var value = _a.value, direction = _a.direction;
|
|
867
886
|
if (value.mode === ESortingValueModes.FORMULA ||
|
|
868
887
|
value.mode === ESortingValueModes.QUANTITY ||
|
|
@@ -873,7 +892,20 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
873
892
|
if (value.mode === ESortingValueModes.DIMENSION_IN_WIDGET ||
|
|
874
893
|
value.mode === ESortingValueModes.HIERARCHY) {
|
|
875
894
|
var dimension = dimensionsInOriginalOrder[value.index];
|
|
876
|
-
|
|
895
|
+
if (!dimension) {
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
var formula = getDimensionFormula(dimension);
|
|
899
|
+
if (!formula || !checkDisplayCondition(dimension.displayCondition, variables)) {
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
return {
|
|
903
|
+
formula: getDimensionFormula(dimension),
|
|
904
|
+
direction: direction,
|
|
905
|
+
displayCondition: ((_b = dimension.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === EDisplayConditionMode.FORMULA
|
|
906
|
+
? dimension.displayCondition.formula
|
|
907
|
+
: undefined,
|
|
908
|
+
};
|
|
877
909
|
}
|
|
878
910
|
if (value.mode === ESortingValueModes.MEASURE_IN_WIDGET) {
|
|
879
911
|
var measure = measuresInOriginalOrder[value.index];
|
|
@@ -1061,4 +1093,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1061
1093
|
return localization.getLocalized(locObj, props);
|
|
1062
1094
|
};
|
|
1063
1095
|
|
|
1064
|
-
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, 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 };
|
|
1096
|
+
export { EActionTypes, ECalculatorFilterMethods, EColorMode, EColorScope, EControlType, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EOpenViewMode, EProcessFilterNames, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EViewType, 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
|
@@ -503,11 +503,25 @@ exports.EWidgetFilterMode = void 0;
|
|
|
503
503
|
})(exports.EWidgetFilterMode || (exports.EWidgetFilterMode = {}));
|
|
504
504
|
exports.EColorMode = void 0;
|
|
505
505
|
(function (EColorMode) {
|
|
506
|
+
EColorMode["DISABLED"] = "DISABLED";
|
|
506
507
|
EColorMode["FORMULA"] = "FORMULA";
|
|
507
508
|
EColorMode["BASE"] = "BASE";
|
|
508
509
|
EColorMode["GRADIENT"] = "GRADIENT";
|
|
509
510
|
EColorMode["AUTO"] = "AUTO";
|
|
511
|
+
EColorMode["RULE"] = "RULE";
|
|
512
|
+
EColorMode["VALUES"] = "VALUES";
|
|
513
|
+
EColorMode["BY_DIMENSION"] = "BY_DIMENSION";
|
|
510
514
|
})(exports.EColorMode || (exports.EColorMode = {}));
|
|
515
|
+
exports.EColorScope = void 0;
|
|
516
|
+
(function (EColorScope) {
|
|
517
|
+
EColorScope["WORKSPACE"] = "WORKSPACE";
|
|
518
|
+
EColorScope["DASHBOARD"] = "DASHBOARD";
|
|
519
|
+
})(exports.EColorScope || (exports.EColorScope = {}));
|
|
520
|
+
exports.EMarkdownDisplayMode = void 0;
|
|
521
|
+
(function (EMarkdownDisplayMode) {
|
|
522
|
+
EMarkdownDisplayMode["NONE"] = "NONE";
|
|
523
|
+
EMarkdownDisplayMode["INDICATOR"] = "INDICATOR";
|
|
524
|
+
})(exports.EMarkdownDisplayMode || (exports.EMarkdownDisplayMode = {}));
|
|
511
525
|
exports.EDisplayConditionMode = void 0;
|
|
512
526
|
(function (EDisplayConditionMode) {
|
|
513
527
|
EDisplayConditionMode["DISABLED"] = "DISABLED";
|
|
@@ -783,7 +797,8 @@ function mapMeasuresToInputs(measures, variables, addFormulas) {
|
|
|
783
797
|
return compactMap(measures, function (measure) { return mapMeasureToInput(measure, variables, addFormulas); });
|
|
784
798
|
}
|
|
785
799
|
|
|
786
|
-
function mapDimensionToInput(dimension, variables) {
|
|
800
|
+
function mapDimensionToInput(dimension, variables, addFormulas) {
|
|
801
|
+
if (addFormulas === void 0) { addFormulas = function () { return new Map(); }; }
|
|
787
802
|
var formula = getDimensionFormula(dimension);
|
|
788
803
|
if (!formula) {
|
|
789
804
|
return null;
|
|
@@ -797,11 +812,14 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
797
812
|
dataType: dimension.dataType,
|
|
798
813
|
hideEmpty: dimension.hideEmptyValues,
|
|
799
814
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
815
|
+
additionalFormulas: addFormulas(dimension),
|
|
800
816
|
};
|
|
801
817
|
}
|
|
802
818
|
/** Конвертировать разрезы виджета во входы для вычислителя */
|
|
803
|
-
function mapDimensionsToInputs(dimensions, variables) {
|
|
804
|
-
return compactMap(dimensions, function (dimension) {
|
|
819
|
+
function mapDimensionsToInputs(dimensions, variables, addFormulas) {
|
|
820
|
+
return compactMap(dimensions, function (dimension) {
|
|
821
|
+
return mapDimensionToInput(dimension, variables, addFormulas);
|
|
822
|
+
});
|
|
805
823
|
}
|
|
806
824
|
|
|
807
825
|
function mapTransitionMeasureToInput(indicator, process, variables, addFormulas) {
|
|
@@ -859,11 +877,12 @@ function mapEventMeasuresToInputs(indicators, process, variables, addFormulas) {
|
|
|
859
877
|
* @param measuresInOriginalOrder меры виджета (конкретная мера будет браться по индексу)
|
|
860
878
|
* @returns
|
|
861
879
|
*/
|
|
862
|
-
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder) {
|
|
880
|
+
function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measuresInOriginalOrder, variables) {
|
|
863
881
|
if (sortingIndicators === void 0) { sortingIndicators = []; }
|
|
864
882
|
if (dimensionsInOriginalOrder === void 0) { dimensionsInOriginalOrder = []; }
|
|
865
883
|
if (measuresInOriginalOrder === void 0) { measuresInOriginalOrder = []; }
|
|
866
884
|
return compactMap(sortingIndicators, function (_a) {
|
|
885
|
+
var _b;
|
|
867
886
|
var value = _a.value, direction = _a.direction;
|
|
868
887
|
if (value.mode === exports.ESortingValueModes.FORMULA ||
|
|
869
888
|
value.mode === exports.ESortingValueModes.QUANTITY ||
|
|
@@ -874,7 +893,20 @@ function mapSortingToInputs(sortingIndicators, dimensionsInOriginalOrder, measur
|
|
|
874
893
|
if (value.mode === exports.ESortingValueModes.DIMENSION_IN_WIDGET ||
|
|
875
894
|
value.mode === exports.ESortingValueModes.HIERARCHY) {
|
|
876
895
|
var dimension = dimensionsInOriginalOrder[value.index];
|
|
877
|
-
|
|
896
|
+
if (!dimension) {
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
var formula = getDimensionFormula(dimension);
|
|
900
|
+
if (!formula || !checkDisplayCondition(dimension.displayCondition, variables)) {
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
return {
|
|
904
|
+
formula: getDimensionFormula(dimension),
|
|
905
|
+
direction: direction,
|
|
906
|
+
displayCondition: ((_b = dimension.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
907
|
+
? dimension.displayCondition.formula
|
|
908
|
+
: undefined,
|
|
909
|
+
};
|
|
878
910
|
}
|
|
879
911
|
if (value.mode === exports.ESortingValueModes.MEASURE_IN_WIDGET) {
|
|
880
912
|
var measure = measuresInOriginalOrder[value.index];
|