@infomaximum/widget-sdk 4.0.0-beta1 → 4.0.0-beta10
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 +79 -44
- package/dist/index.esm.js +28 -11
- package/dist/index.js +28 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,9 @@ declare enum EControlType {
|
|
|
33
33
|
displayCondition = "displayCondition",
|
|
34
34
|
eventsColor = "eventsColor",
|
|
35
35
|
inputMarkdown = "inputMarkdown",
|
|
36
|
-
filter = "filter"
|
|
36
|
+
filter = "filter",
|
|
37
|
+
actionOnClick = "actionOnClick",
|
|
38
|
+
eventsPicker = "eventsPicker"
|
|
37
39
|
}
|
|
38
40
|
/** Конфигурация элемента управления настройкой */
|
|
39
41
|
interface IControlRecord<Settings extends object, Value, ControlType = EControlType> {
|
|
@@ -63,6 +65,12 @@ interface ICalculator<Input, Output> {
|
|
|
63
65
|
}
|
|
64
66
|
interface ICalculatorIndicatorInput {
|
|
65
67
|
alias: string;
|
|
68
|
+
/**
|
|
69
|
+
* Информация о типе данных:
|
|
70
|
+
* - Если тип не передан, не производится дополнительной обработки формулы.
|
|
71
|
+
* - Если передан тип "OTHER", формула дополнительно будет обернута в toString().
|
|
72
|
+
*/
|
|
73
|
+
dataType?: ESimpleDataType;
|
|
66
74
|
displayConditionFormula?: TNullable<string>;
|
|
67
75
|
}
|
|
68
76
|
interface ICalculatorIndicatorOutput {
|
|
@@ -253,6 +261,7 @@ declare enum EDurationUnit {
|
|
|
253
261
|
declare const mapFormulaFilterToCalculatorInput: (filterValue: IFormulaFilterValue | string) => TNullable<ICalculatorFilter>;
|
|
254
262
|
declare const mapFormulaFiltersToInputs: (filters: (string | IFormulaFilterValue)[]) => ICalculatorFilter[];
|
|
255
263
|
|
|
264
|
+
type TSelectivePartial<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
|
|
256
265
|
declare const formulaFilterMethods: {
|
|
257
266
|
readonly LAST_TIME: "LAST_TIME";
|
|
258
267
|
readonly EQUAL_TO: ECalculatorFilterMethods.EQUAL_TO;
|
|
@@ -282,6 +291,7 @@ declare enum EProcessFilterNames {
|
|
|
282
291
|
/** Длительность перехода */
|
|
283
292
|
durationOfTransition = "durationOfTransition"
|
|
284
293
|
}
|
|
294
|
+
/** @deprecated необходимо использовать @see {@link IFormulaFilterValue} */
|
|
285
295
|
interface IWidgetFormulaFilterValue extends ICalculatorFilter {
|
|
286
296
|
/**
|
|
287
297
|
* Название фильтра
|
|
@@ -298,16 +308,16 @@ interface IProcessFilterValue {
|
|
|
298
308
|
* События, доступные при выборе процесса.
|
|
299
309
|
* Если параметр не передан, используются все события процесса на основе запроса к вычислителю.
|
|
300
310
|
*/
|
|
301
|
-
|
|
311
|
+
eventsNamesByProcessNameMap?: Map<string, (string | null)[]>;
|
|
302
312
|
}
|
|
303
313
|
interface IProcessEventFilterValue extends IProcessFilterValue {
|
|
304
|
-
|
|
314
|
+
processName: string;
|
|
305
315
|
eventName: string;
|
|
306
316
|
}
|
|
307
317
|
interface IProcessTransitionFilterValue extends IProcessFilterValue {
|
|
308
|
-
|
|
318
|
+
startEventProcessName: string;
|
|
309
319
|
startEventName: string;
|
|
310
|
-
|
|
320
|
+
endEventProcessName: string;
|
|
311
321
|
endEventName: string;
|
|
312
322
|
}
|
|
313
323
|
interface IAddPresenceOfEventFilter {
|
|
@@ -322,15 +332,6 @@ interface IAddPresenceOfTransitionFilter {
|
|
|
322
332
|
interface IAddDurationOfTransitionFilter {
|
|
323
333
|
(name: EProcessFilterNames.durationOfTransition, value: IProcessTransitionFilterValue): void;
|
|
324
334
|
}
|
|
325
|
-
interface IWidgetFiltration {
|
|
326
|
-
/** Значения фильтров, подготовленные для передачи в вычислитель */
|
|
327
|
-
preparedFilterValues: ICalculatorFilter[];
|
|
328
|
-
/** Добавить фильтр по формуле */
|
|
329
|
-
addFormulaFilter(value: IWidgetFormulaFilterValue): void;
|
|
330
|
-
/** Удалить фильтр по формуле */
|
|
331
|
-
removeFormulaFilter(formula: string): void;
|
|
332
|
-
addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
|
|
333
|
-
}
|
|
334
335
|
declare enum EFormulaFilterFieldKeys {
|
|
335
336
|
date = "date",
|
|
336
337
|
dateRange = "dateRange",
|
|
@@ -354,7 +355,7 @@ interface IFormulaFilterValue {
|
|
|
354
355
|
/** Метод фильтрации */
|
|
355
356
|
filteringMethod: valueof<typeof formulaFilterMethods>;
|
|
356
357
|
/** Выбранные в списке значения в виде моделей */
|
|
357
|
-
checkedValues: string[];
|
|
358
|
+
checkedValues: (string | null)[];
|
|
358
359
|
/** Значения полей формы редактора */
|
|
359
360
|
formValues: Partial<{
|
|
360
361
|
[EFormulaFilterFieldKeys.date]: string | null;
|
|
@@ -368,14 +369,41 @@ interface IFormulaFilterValue {
|
|
|
368
369
|
[EFormulaFilterFieldKeys.durationUnit]: EDurationUnit;
|
|
369
370
|
}>;
|
|
370
371
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
interface IStagesFilterItem {
|
|
373
|
+
/** Название этапа */
|
|
374
|
+
name: string;
|
|
375
|
+
/** Формула фильтра этапа */
|
|
376
|
+
formula: string;
|
|
377
|
+
isSelected: boolean;
|
|
378
|
+
}
|
|
379
|
+
interface IStagesFilterValue {
|
|
380
|
+
/** Ключ виджета */
|
|
381
|
+
widgetKey: string;
|
|
382
|
+
/** Заголовок фильтра */
|
|
383
|
+
name: TNullable<string>;
|
|
384
|
+
/** Этапы */
|
|
385
|
+
stages: IStagesFilterItem[];
|
|
386
|
+
}
|
|
387
|
+
type TWidgetFilterValue = IFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
|
|
388
|
+
interface IWidgetFilter {
|
|
389
|
+
filterValue: TWidgetFilterValue;
|
|
390
|
+
preparedFilterValue: ICalculatorFilter;
|
|
391
|
+
}
|
|
392
|
+
interface IWidgetFiltration {
|
|
393
|
+
/** Значения фильтров, подготовленные для передачи в вычислитель */
|
|
394
|
+
preparedFilterValues: ICalculatorFilter[];
|
|
395
|
+
filters: IWidgetFilter[];
|
|
396
|
+
/** Добавить фильтр по формуле */
|
|
397
|
+
addFormulaFilter(value: IWidgetFormulaFilterValue | TSelectivePartial<IFormulaFilterValue, "format" | "formValues">): void;
|
|
398
|
+
/** Удалить фильтр по формуле */
|
|
399
|
+
removeFormulaFilter(formula: string): void;
|
|
400
|
+
addProcessFilter(...args: Parameters<IAddPresenceOfEventFilter> | Parameters<IAddRepetitionOfEventFilter> | Parameters<IAddPresenceOfTransitionFilter> | Parameters<IAddDurationOfTransitionFilter>): void;
|
|
401
|
+
/** Добавить фильтр по этапам */
|
|
402
|
+
addStagesFilter(value: Omit<IStagesFilterValue, "widgetKey">): void;
|
|
403
|
+
/** Удалить фильтр по этапам */
|
|
404
|
+
removeStagesFilter(widgetKey: string): void;
|
|
378
405
|
}
|
|
406
|
+
|
|
379
407
|
declare enum EWidgetFilterMode {
|
|
380
408
|
DEFAULT = "DEFAULT",
|
|
381
409
|
SINGLE = "SINGLE",
|
|
@@ -423,7 +451,7 @@ type TDisplayCondition = {
|
|
|
423
451
|
formula: TNullable<string>;
|
|
424
452
|
} | {
|
|
425
453
|
mode: EDisplayConditionMode.VARIABLE;
|
|
426
|
-
|
|
454
|
+
variableName: TNullable<string>;
|
|
427
455
|
variableValue: TNullable<string>;
|
|
428
456
|
};
|
|
429
457
|
interface IRange {
|
|
@@ -457,7 +485,7 @@ type TWidgetSortingValue = {
|
|
|
457
485
|
formula: string;
|
|
458
486
|
} | TWidgetSortingValueRelatedWidgetIndicator | {
|
|
459
487
|
mode: ESortingValueModes.IN_DASHBOARD | ESortingValueModes.IN_WORKSPACE;
|
|
460
|
-
|
|
488
|
+
name: string;
|
|
461
489
|
formula: string;
|
|
462
490
|
};
|
|
463
491
|
|
|
@@ -540,7 +568,6 @@ declare enum ESortingValueModes {
|
|
|
540
568
|
IN_WORKSPACE = "IN_WORKSPACE"
|
|
541
569
|
}
|
|
542
570
|
interface ICommonColumnIndicator {
|
|
543
|
-
guid: string;
|
|
544
571
|
name: string;
|
|
545
572
|
formula: string;
|
|
546
573
|
}
|
|
@@ -658,8 +685,8 @@ interface IWidgetTableColumn {
|
|
|
658
685
|
dataType: ESimpleDataType;
|
|
659
686
|
}
|
|
660
687
|
interface IActionScript {
|
|
661
|
-
|
|
662
|
-
|
|
688
|
+
name: string | undefined;
|
|
689
|
+
fieldsNames: Set<string>;
|
|
663
690
|
}
|
|
664
691
|
interface IWidgetTable {
|
|
665
692
|
/** Имя таблицы */
|
|
@@ -682,8 +709,8 @@ interface IWidgetsContext {
|
|
|
682
709
|
/** Переменные отчета */
|
|
683
710
|
variables: Map<string, TWidgetVariable>;
|
|
684
711
|
/** Метод установки значения переменной отчета */
|
|
685
|
-
setVariableValue(
|
|
686
|
-
|
|
712
|
+
setVariableValue(name: string, value: TNullable<string> | string[]): void;
|
|
713
|
+
statesNames: Set<string>;
|
|
687
714
|
reportName: string;
|
|
688
715
|
/**
|
|
689
716
|
* режим дашборда
|
|
@@ -711,7 +738,7 @@ type TWidgetActionInputValue = {
|
|
|
711
738
|
columnName: string;
|
|
712
739
|
} | {
|
|
713
740
|
mode: EWidgetActionInputMode.FROM_VARIABLE;
|
|
714
|
-
|
|
741
|
+
name: string;
|
|
715
742
|
} | {
|
|
716
743
|
mode: EWidgetActionInputMode.FORMULA;
|
|
717
744
|
formula: string;
|
|
@@ -728,7 +755,7 @@ type TWidgetActionInputValue = {
|
|
|
728
755
|
defaultValue: string;
|
|
729
756
|
};
|
|
730
757
|
interface IWidgetActionInput {
|
|
731
|
-
|
|
758
|
+
name: string;
|
|
732
759
|
value: TWidgetActionInputValue;
|
|
733
760
|
}
|
|
734
761
|
interface IWidgetAction {
|
|
@@ -736,24 +763,22 @@ interface IWidgetAction {
|
|
|
736
763
|
name: string;
|
|
737
764
|
description: string;
|
|
738
765
|
filters: (IFormulaFilterValue | string)[];
|
|
739
|
-
scriptGuid?: string;
|
|
740
766
|
/** Поле name необходимо, чтобы показать название скрипта, который был удален */
|
|
741
767
|
scriptName?: string;
|
|
742
768
|
inputs: IWidgetActionInput[];
|
|
743
769
|
shouldRefreshWidgetsAfterExecution: boolean;
|
|
744
770
|
}
|
|
745
|
-
declare const isActionValid: (action: IWidgetAction, { scripts, tables }: IWidgetsContext) => boolean;
|
|
771
|
+
declare const isActionValid: (action: IWidgetAction, { scripts, tables, variables }: IWidgetsContext) => boolean;
|
|
746
772
|
|
|
747
773
|
interface IBaseWidgetSettings {
|
|
748
774
|
apiVersion: string;
|
|
749
775
|
type: string;
|
|
750
776
|
header?: string;
|
|
751
777
|
headerSize?: number;
|
|
752
|
-
|
|
778
|
+
stateName?: string | null;
|
|
753
779
|
filters?: (IFormulaFilterValue | string)[];
|
|
754
780
|
filterMode?: EWidgetFilterMode;
|
|
755
781
|
ignoreFilters?: boolean;
|
|
756
|
-
placement: IPlacement;
|
|
757
782
|
sorting?: IWidgetSortingIndicator[];
|
|
758
783
|
actions?: IWidgetAction[];
|
|
759
784
|
displayCondition?: TDisplayCondition;
|
|
@@ -992,7 +1017,7 @@ interface IEdge extends IGraphElement {
|
|
|
992
1017
|
endName: string | null;
|
|
993
1018
|
}
|
|
994
1019
|
interface IProcessGraphCalculatorInput {
|
|
995
|
-
|
|
1020
|
+
processName: string;
|
|
996
1021
|
vertexLimit: number | null;
|
|
997
1022
|
edgeLimit: number;
|
|
998
1023
|
vertexMeasures: ICalculatorMeasureInput[];
|
|
@@ -1124,6 +1149,8 @@ declare function bindContentWithIndicator<Output extends ICalculatorIndicatorOut
|
|
|
1124
1149
|
*/
|
|
1125
1150
|
declare function bindContentsWithIndicators<Output extends ICalculatorIndicatorOutput, Indicator extends IWidgetIndicator>(outputs: Map<string, Output>, indicators: Indicator[]): TBoundedContentWithIndicator<Output, Indicator>[];
|
|
1126
1151
|
|
|
1152
|
+
declare const escapeSpecialCharacters: (formula: string) => string;
|
|
1153
|
+
|
|
1127
1154
|
interface ICalculatorFactory {
|
|
1128
1155
|
general: () => IGeneralCalculator;
|
|
1129
1156
|
pie: () => IPieCalculator;
|
|
@@ -1144,6 +1171,16 @@ interface IDefinition<WidgetSettings extends IBaseWidgetSettings, GroupSettings
|
|
|
1144
1171
|
getMeasures?(settings: WidgetSettings): IWidgetMeasure[];
|
|
1145
1172
|
}
|
|
1146
1173
|
|
|
1174
|
+
type TLaunchActionParams = {
|
|
1175
|
+
action: IWidgetAction;
|
|
1176
|
+
onSuccess: () => void;
|
|
1177
|
+
filters: ICalculatorFilter[];
|
|
1178
|
+
needConfirmation?: boolean;
|
|
1179
|
+
};
|
|
1180
|
+
type TWidgetContainer = {
|
|
1181
|
+
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
|
1182
|
+
isMaxHeightLimited: boolean;
|
|
1183
|
+
};
|
|
1147
1184
|
interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> {
|
|
1148
1185
|
/** guid виджета */
|
|
1149
1186
|
guid: string;
|
|
@@ -1164,14 +1201,12 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
|
|
|
1164
1201
|
rootViewContainer: HTMLDivElement;
|
|
1165
1202
|
/** Объект для управления плейсхолдером */
|
|
1166
1203
|
placeholder: IWidgetPlaceholderController;
|
|
1167
|
-
/** Контекст
|
|
1204
|
+
/** Контекст виджетов */
|
|
1168
1205
|
widgetsContext: IWidgetsContext;
|
|
1169
|
-
/**
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
filters: ICalculatorFilter[];
|
|
1174
|
-
}): void;
|
|
1206
|
+
/** Данные о контейнере виджета */
|
|
1207
|
+
widgetContainer: TWidgetContainer;
|
|
1208
|
+
/** Запуск действия */
|
|
1209
|
+
launchAction(params: TLaunchActionParams): void;
|
|
1175
1210
|
}
|
|
1176
1211
|
interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
|
|
1177
1212
|
/** @deprecated - нужно использовать из widgetsContext */
|
|
@@ -1343,4 +1378,4 @@ declare global {
|
|
|
1343
1378
|
}
|
|
1344
1379
|
}
|
|
1345
1380
|
|
|
1346
|
-
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
|
|
1381
|
+
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 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
|
@@ -73,22 +73,23 @@ 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;
|
|
77
|
-
var currentScript = scripts.get((_b = action.
|
|
76
|
+
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
77
|
+
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
78
78
|
if (!currentScript) {
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
82
|
-
if (actionInputsMap.size < currentScript.
|
|
81
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
82
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
|
-
return __spreadArray([], __read(currentScript.
|
|
86
|
-
var actionInput = actionInputsMap.get(
|
|
85
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
86
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
87
87
|
if (!actionInput) {
|
|
88
88
|
return false;
|
|
89
89
|
}
|
|
90
90
|
var value = actionInput.value;
|
|
91
|
-
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE &&
|
|
91
|
+
if (value.mode === EWidgetActionInputMode.FROM_VARIABLE &&
|
|
92
|
+
!variables.has(value.name)) {
|
|
92
93
|
return false;
|
|
93
94
|
}
|
|
94
95
|
if (value.mode === EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -491,8 +492,8 @@ var EDisplayConditionMode;
|
|
|
491
492
|
function checkDisplayCondition(displayCondition, variables) {
|
|
492
493
|
var _a;
|
|
493
494
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === EDisplayConditionMode.VARIABLE) {
|
|
494
|
-
var
|
|
495
|
-
var currentVariableValue =
|
|
495
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
496
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
496
497
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
497
498
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
498
499
|
: currentVariableValue === variableValue;
|
|
@@ -513,8 +514,18 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
513
514
|
: __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
514
515
|
};
|
|
515
516
|
|
|
517
|
+
var escapeSpecialCharacters = function (formula) {
|
|
518
|
+
return formula
|
|
519
|
+
.replaceAll("\\", "\\\\")
|
|
520
|
+
.replaceAll('"', '\\"')
|
|
521
|
+
.replaceAll("`", "\\`")
|
|
522
|
+
.replaceAll("-", "\\-");
|
|
523
|
+
};
|
|
524
|
+
|
|
516
525
|
function generateColumnFormula(tableName, columnName) {
|
|
517
|
-
|
|
526
|
+
var preparedTableName = escapeSpecialCharacters(tableName);
|
|
527
|
+
var preparedColumnName = escapeSpecialCharacters(columnName);
|
|
528
|
+
return "\"".concat(preparedTableName, "\".\"").concat(preparedColumnName, "\"");
|
|
518
529
|
}
|
|
519
530
|
function fillTemplateString(templateString, params) {
|
|
520
531
|
return templateString.replace(/\{(.*?)\}/g, function (_, key) { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ""; });
|
|
@@ -738,6 +749,7 @@ function mapMeasureToInput(measure, variables, addFormulas) {
|
|
|
738
749
|
return {
|
|
739
750
|
alias: String(measure.id),
|
|
740
751
|
mainFormula: mainFormula,
|
|
752
|
+
dataType: measure.dataType,
|
|
741
753
|
displayConditionFormula: getDisplayConditionFormula(measure.displayCondition),
|
|
742
754
|
additionalFormulas: addFormulas(measure),
|
|
743
755
|
};
|
|
@@ -760,6 +772,7 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
760
772
|
return {
|
|
761
773
|
alias: String(dimension.id),
|
|
762
774
|
formula: formula,
|
|
775
|
+
dataType: dimension.dataType,
|
|
763
776
|
hideEmpty: dimension.hideEmptyValues,
|
|
764
777
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
765
778
|
};
|
|
@@ -783,6 +796,7 @@ function mapTransitionMeasureToInput(indicator, process, variables, addFormulas)
|
|
|
783
796
|
return {
|
|
784
797
|
alias: String(indicator.id),
|
|
785
798
|
mainFormula: mainFormula,
|
|
799
|
+
dataType: indicator.dataType,
|
|
786
800
|
displayConditionFormula: getDisplayConditionFormula(indicator.displayCondition),
|
|
787
801
|
additionalFormulas: addFormulas(indicator),
|
|
788
802
|
};
|
|
@@ -806,6 +820,7 @@ function mapEventMeasureToInput(indicator, process, variables, addFormulas) {
|
|
|
806
820
|
return {
|
|
807
821
|
alias: String(indicator.id),
|
|
808
822
|
mainFormula: mainFormula,
|
|
823
|
+
dataType: indicator.dataType,
|
|
809
824
|
displayConditionFormula: getDisplayConditionFormula(indicator.displayCondition),
|
|
810
825
|
additionalFormulas: addFormulas(indicator),
|
|
811
826
|
};
|
|
@@ -926,6 +941,8 @@ var EControlType;
|
|
|
926
941
|
EControlType["eventsColor"] = "eventsColor";
|
|
927
942
|
EControlType["inputMarkdown"] = "inputMarkdown";
|
|
928
943
|
EControlType["filter"] = "filter";
|
|
944
|
+
EControlType["actionOnClick"] = "actionOnClick";
|
|
945
|
+
EControlType["eventsPicker"] = "eventsPicker";
|
|
929
946
|
})(EControlType || (EControlType = {}));
|
|
930
947
|
|
|
931
948
|
var ESortDirection;
|
|
@@ -1030,4 +1047,4 @@ var getLocalizedText = function (language, locObj, props) {
|
|
|
1030
1047
|
return localization.getLocalized(locObj, props);
|
|
1031
1048
|
};
|
|
1032
1049
|
|
|
1033
|
-
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, 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 };
|
|
1050
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -74,22 +74,23 @@ 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;
|
|
78
|
-
var currentScript = scripts.get((_b = action.
|
|
77
|
+
var scripts = _a.scripts, tables = _a.tables, variables = _a.variables;
|
|
78
|
+
var currentScript = scripts.get((_b = action.scriptName) !== null && _b !== void 0 ? _b : "");
|
|
79
79
|
if (!currentScript) {
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
|
-
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.
|
|
83
|
-
if (actionInputsMap.size < currentScript.
|
|
82
|
+
var actionInputsMap = new Map(action.inputs.map(function (input) { return [input.name, input]; }));
|
|
83
|
+
if (actionInputsMap.size < currentScript.fieldsNames.size) {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
|
-
return __spreadArray([], __read(currentScript.
|
|
87
|
-
var actionInput = actionInputsMap.get(
|
|
86
|
+
return __spreadArray([], __read(currentScript.fieldsNames), false).every(function (name) {
|
|
87
|
+
var actionInput = actionInputsMap.get(name !== null && name !== void 0 ? name : "");
|
|
88
88
|
if (!actionInput) {
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
91
|
var value = actionInput.value;
|
|
92
|
-
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE &&
|
|
92
|
+
if (value.mode === exports.EWidgetActionInputMode.FROM_VARIABLE &&
|
|
93
|
+
!variables.has(value.name)) {
|
|
93
94
|
return false;
|
|
94
95
|
}
|
|
95
96
|
if (value.mode === exports.EWidgetActionInputMode.FORMULA && !value.formula) {
|
|
@@ -492,8 +493,8 @@ exports.EDisplayConditionMode = void 0;
|
|
|
492
493
|
function checkDisplayCondition(displayCondition, variables) {
|
|
493
494
|
var _a;
|
|
494
495
|
if ((displayCondition === null || displayCondition === void 0 ? void 0 : displayCondition.mode) === exports.EDisplayConditionMode.VARIABLE) {
|
|
495
|
-
var
|
|
496
|
-
var currentVariableValue =
|
|
496
|
+
var variableName = displayCondition.variableName, variableValue = displayCondition.variableValue;
|
|
497
|
+
var currentVariableValue = variableName && ((_a = variables.get(variableName)) === null || _a === void 0 ? void 0 : _a.value);
|
|
497
498
|
var isCurrentVariableMatch = Array.isArray(currentVariableValue)
|
|
498
499
|
? !!variableValue && (currentVariableValue === null || currentVariableValue === void 0 ? void 0 : currentVariableValue.includes(variableValue))
|
|
499
500
|
: currentVariableValue === variableValue;
|
|
@@ -514,8 +515,18 @@ var replaceDisplayCondition = function (dimension, displayCondition) {
|
|
|
514
515
|
: __assign(__assign({}, dimension), { displayCondition: displayCondition });
|
|
515
516
|
};
|
|
516
517
|
|
|
518
|
+
var escapeSpecialCharacters = function (formula) {
|
|
519
|
+
return formula
|
|
520
|
+
.replaceAll("\\", "\\\\")
|
|
521
|
+
.replaceAll('"', '\\"')
|
|
522
|
+
.replaceAll("`", "\\`")
|
|
523
|
+
.replaceAll("-", "\\-");
|
|
524
|
+
};
|
|
525
|
+
|
|
517
526
|
function generateColumnFormula(tableName, columnName) {
|
|
518
|
-
|
|
527
|
+
var preparedTableName = escapeSpecialCharacters(tableName);
|
|
528
|
+
var preparedColumnName = escapeSpecialCharacters(columnName);
|
|
529
|
+
return "\"".concat(preparedTableName, "\".\"").concat(preparedColumnName, "\"");
|
|
519
530
|
}
|
|
520
531
|
function fillTemplateString(templateString, params) {
|
|
521
532
|
return templateString.replace(/\{(.*?)\}/g, function (_, key) { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ""; });
|
|
@@ -739,6 +750,7 @@ function mapMeasureToInput(measure, variables, addFormulas) {
|
|
|
739
750
|
return {
|
|
740
751
|
alias: String(measure.id),
|
|
741
752
|
mainFormula: mainFormula,
|
|
753
|
+
dataType: measure.dataType,
|
|
742
754
|
displayConditionFormula: getDisplayConditionFormula(measure.displayCondition),
|
|
743
755
|
additionalFormulas: addFormulas(measure),
|
|
744
756
|
};
|
|
@@ -761,6 +773,7 @@ function mapDimensionToInput(dimension, variables) {
|
|
|
761
773
|
return {
|
|
762
774
|
alias: String(dimension.id),
|
|
763
775
|
formula: formula,
|
|
776
|
+
dataType: dimension.dataType,
|
|
764
777
|
hideEmpty: dimension.hideEmptyValues,
|
|
765
778
|
displayConditionFormula: getDisplayConditionFormula(dimension.displayCondition),
|
|
766
779
|
};
|
|
@@ -784,6 +797,7 @@ function mapTransitionMeasureToInput(indicator, process, variables, addFormulas)
|
|
|
784
797
|
return {
|
|
785
798
|
alias: String(indicator.id),
|
|
786
799
|
mainFormula: mainFormula,
|
|
800
|
+
dataType: indicator.dataType,
|
|
787
801
|
displayConditionFormula: getDisplayConditionFormula(indicator.displayCondition),
|
|
788
802
|
additionalFormulas: addFormulas(indicator),
|
|
789
803
|
};
|
|
@@ -807,6 +821,7 @@ function mapEventMeasureToInput(indicator, process, variables, addFormulas) {
|
|
|
807
821
|
return {
|
|
808
822
|
alias: String(indicator.id),
|
|
809
823
|
mainFormula: mainFormula,
|
|
824
|
+
dataType: indicator.dataType,
|
|
810
825
|
displayConditionFormula: getDisplayConditionFormula(indicator.displayCondition),
|
|
811
826
|
additionalFormulas: addFormulas(indicator),
|
|
812
827
|
};
|
|
@@ -927,6 +942,8 @@ exports.EControlType = void 0;
|
|
|
927
942
|
EControlType["eventsColor"] = "eventsColor";
|
|
928
943
|
EControlType["inputMarkdown"] = "inputMarkdown";
|
|
929
944
|
EControlType["filter"] = "filter";
|
|
945
|
+
EControlType["actionOnClick"] = "actionOnClick";
|
|
946
|
+
EControlType["eventsPicker"] = "eventsPicker";
|
|
930
947
|
})(exports.EControlType || (exports.EControlType = {}));
|
|
931
948
|
|
|
932
949
|
exports.ESortDirection = void 0;
|
|
@@ -1043,6 +1060,7 @@ exports.bindContentWithIndicator = bindContentWithIndicator;
|
|
|
1043
1060
|
exports.bindContentsWithIndicators = bindContentsWithIndicators;
|
|
1044
1061
|
exports.checkDisplayCondition = checkDisplayCondition;
|
|
1045
1062
|
exports.dimensionTemplateFormulas = dimensionTemplateFormulas;
|
|
1063
|
+
exports.escapeSpecialCharacters = escapeSpecialCharacters;
|
|
1046
1064
|
exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
|
|
1047
1065
|
exports.fillTemplateString = fillTemplateString;
|
|
1048
1066
|
exports.formulaFilterMethods = formulaFilterMethods;
|