@infomaximum/widget-sdk 5.0.0-beta2 → 5.0.0-beta4
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 +15 -12
- package/dist/index.esm.js +23 -7
- package/dist/index.js +23 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -383,9 +383,9 @@ interface IFormulaFilterValue {
|
|
|
383
383
|
/** Метод фильтрации */
|
|
384
384
|
filteringMethod: valueof<typeof formulaFilterMethods>;
|
|
385
385
|
/** Выбранные в списке значения в виде моделей */
|
|
386
|
-
checkedValues
|
|
386
|
+
checkedValues?: (string | null)[];
|
|
387
387
|
/** Значения полей формы редактора */
|
|
388
|
-
formValues
|
|
388
|
+
formValues?: Partial<{
|
|
389
389
|
[EFormulaFilterFieldKeys.date]: string | null;
|
|
390
390
|
[EFormulaFilterFieldKeys.dateRange]: [string, string];
|
|
391
391
|
[EFormulaFilterFieldKeys.duration]: string;
|
|
@@ -416,7 +416,7 @@ interface IStagesFilterValue {
|
|
|
416
416
|
/** Этапы */
|
|
417
417
|
stages: IStagesFilterItem[];
|
|
418
418
|
}
|
|
419
|
-
type TWidgetFilterValue =
|
|
419
|
+
type TWidgetFilterValue = TExtendedFormulaFilterValue | IStagesFilterValue | IProcessEventFilterValue | IProcessTransitionFilterValue;
|
|
420
420
|
interface IWidgetFilter {
|
|
421
421
|
/** Значение фильтра */
|
|
422
422
|
filterValue: TWidgetFilterValue;
|
|
@@ -801,7 +801,6 @@ type TActionOpenView = IActionCommon & {
|
|
|
801
801
|
}>));
|
|
802
802
|
type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
|
|
803
803
|
interface IWidgetAction extends IActionCommon {
|
|
804
|
-
filters: TExtendedFormulaFilterValue[];
|
|
805
804
|
parameters: TWidgetActionParameter[];
|
|
806
805
|
type: EActionTypes.EXECUTE_SCRIPT;
|
|
807
806
|
scriptKey: string;
|
|
@@ -831,13 +830,19 @@ declare enum ESortDirection {
|
|
|
831
830
|
}
|
|
832
831
|
type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
|
|
833
832
|
interface ISortOrder {
|
|
833
|
+
/** Формула сортировки */
|
|
834
834
|
formula: string;
|
|
835
|
+
/** Тип данных формулы */
|
|
836
|
+
dbDataType: TNullable<string>;
|
|
837
|
+
/** Направление сортировки */
|
|
835
838
|
direction: TSortDirection;
|
|
839
|
+
/** Условие применения сортировки */
|
|
836
840
|
displayCondition?: TNullable<string>;
|
|
837
841
|
}
|
|
838
842
|
type TWidgetSortingValue = {
|
|
839
843
|
mode: ESortingValueModes.FORMULA;
|
|
840
844
|
formula: string;
|
|
845
|
+
dbDataType: string;
|
|
841
846
|
} | {
|
|
842
847
|
mode: ESortingValueModes.IN_WIDGET;
|
|
843
848
|
group: string;
|
|
@@ -910,15 +915,15 @@ interface ICommonDimensions {
|
|
|
910
915
|
}
|
|
911
916
|
type TColumnIndicatorValue = {
|
|
912
917
|
mode: EWidgetIndicatorValueModes.FORMULA;
|
|
913
|
-
formula
|
|
918
|
+
formula?: string;
|
|
914
919
|
} | {
|
|
915
920
|
mode: EWidgetIndicatorValueModes.TEMPLATE;
|
|
916
921
|
/** Имя шаблонной формулы, использующей колонку таблицы */
|
|
917
|
-
templateName
|
|
922
|
+
templateName?: string;
|
|
918
923
|
/** Имя таблицы */
|
|
919
|
-
tableName
|
|
924
|
+
tableName?: string;
|
|
920
925
|
/** Имя колонки */
|
|
921
|
-
columnName
|
|
926
|
+
columnName?: string;
|
|
922
927
|
};
|
|
923
928
|
/** Общий интерфейс разреза и меры */
|
|
924
929
|
interface IWidgetColumnIndicator extends IWidgetIndicator {
|
|
@@ -1769,10 +1774,8 @@ type TLaunchActionParams = {
|
|
|
1769
1774
|
filters: ICalculatorFilter[];
|
|
1770
1775
|
/** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
|
|
1771
1776
|
eventNames?: [string] | [string, string];
|
|
1772
|
-
/** Callback
|
|
1773
|
-
|
|
1774
|
-
*/
|
|
1775
|
-
resetAndHandleModalData?: () => void;
|
|
1777
|
+
/** Callback вызывается при успешном открытии модального окна подтверждения или при прерывании открытия */
|
|
1778
|
+
onConfirmationOpenSettled?: () => void;
|
|
1776
1779
|
};
|
|
1777
1780
|
type TWidgetContainer = {
|
|
1778
1781
|
/** Имеет ли контейнер виджета ограниченную максимальную высоту */
|
package/dist/index.esm.js
CHANGED
|
@@ -646,6 +646,9 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
646
646
|
if (checkedValues && checkedValues.length) {
|
|
647
647
|
return checkedValues;
|
|
648
648
|
}
|
|
649
|
+
if (!formValues) {
|
|
650
|
+
return [];
|
|
651
|
+
}
|
|
649
652
|
function stringifyNumbersRange(range) {
|
|
650
653
|
if (range === void 0) { range = [undefined, undefined]; }
|
|
651
654
|
return range.map(function (value, index) {
|
|
@@ -680,7 +683,7 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
680
683
|
}
|
|
681
684
|
return compact([datePickerValue]);
|
|
682
685
|
case EFormatTypes.STRING:
|
|
683
|
-
return compact([(_a = formValues
|
|
686
|
+
return compact([(_a = formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
|
|
684
687
|
case EFormatTypes.NUMBER:
|
|
685
688
|
case EFormatTypes.YEAR:
|
|
686
689
|
case EFormatTypes.DAY_OF_MONTH:
|
|
@@ -877,17 +880,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
|
|
|
877
880
|
_a$3[EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
878
881
|
_a$3);
|
|
879
882
|
function getDimensionFormula(_a) {
|
|
883
|
+
var _b;
|
|
880
884
|
var value = _a.value;
|
|
881
885
|
if (!value) {
|
|
882
886
|
return "";
|
|
883
887
|
}
|
|
884
888
|
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
885
|
-
return value.formula;
|
|
889
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
886
890
|
}
|
|
887
891
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
888
892
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
889
893
|
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
890
|
-
if (!templateFormula) {
|
|
894
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
891
895
|
return "";
|
|
892
896
|
}
|
|
893
897
|
return fillTemplateString(templateFormula, {
|
|
@@ -918,17 +922,18 @@ var measureTemplateFormulas = (_a$2 = {},
|
|
|
918
922
|
_a$2[EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
919
923
|
_a$2);
|
|
920
924
|
function getMeasureFormula(_a) {
|
|
925
|
+
var _b;
|
|
921
926
|
var value = _a.value;
|
|
922
927
|
if (!value) {
|
|
923
928
|
return "";
|
|
924
929
|
}
|
|
925
930
|
if (value.mode === EWidgetIndicatorValueModes.FORMULA) {
|
|
926
|
-
return value.formula;
|
|
931
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
927
932
|
}
|
|
928
933
|
if (value.mode === EWidgetIndicatorValueModes.TEMPLATE) {
|
|
929
934
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
930
935
|
var templateFormula = measureTemplateFormulas[templateName];
|
|
931
|
-
if (!templateFormula) {
|
|
936
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
932
937
|
return "";
|
|
933
938
|
}
|
|
934
939
|
return fillTemplateString(templateFormula, {
|
|
@@ -1179,7 +1184,13 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1179
1184
|
].includes(dimension.format);
|
|
1180
1185
|
});
|
|
1181
1186
|
if (timeDimension) {
|
|
1182
|
-
return [
|
|
1187
|
+
return [
|
|
1188
|
+
{
|
|
1189
|
+
formula: getDimensionFormula(timeDimension),
|
|
1190
|
+
dbDataType: timeDimension.dbDataType,
|
|
1191
|
+
direction: ESortDirection.ascend,
|
|
1192
|
+
},
|
|
1193
|
+
];
|
|
1183
1194
|
}
|
|
1184
1195
|
if (measures.length > 0) {
|
|
1185
1196
|
var firstMeasure = measures[0];
|
|
@@ -1188,6 +1199,7 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1188
1199
|
{
|
|
1189
1200
|
direction: ESortDirection.descend,
|
|
1190
1201
|
formula: getMeasureFormula(firstMeasure),
|
|
1202
|
+
dbDataType: firstMeasure.dbDataType,
|
|
1191
1203
|
},
|
|
1192
1204
|
];
|
|
1193
1205
|
}
|
|
@@ -1201,7 +1213,9 @@ function mapSortingToInputs(_a) {
|
|
|
1201
1213
|
var _b;
|
|
1202
1214
|
var direction = _a.direction, value = _a.value;
|
|
1203
1215
|
if (value.mode === ESortingValueModes.FORMULA) {
|
|
1204
|
-
return value.formula
|
|
1216
|
+
return value.formula
|
|
1217
|
+
? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
|
|
1218
|
+
: undefined;
|
|
1205
1219
|
}
|
|
1206
1220
|
var indicatorsGroup = settings[value.group];
|
|
1207
1221
|
var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
|
|
@@ -1219,6 +1233,7 @@ function mapSortingToInputs(_a) {
|
|
|
1219
1233
|
return {
|
|
1220
1234
|
formula: formula,
|
|
1221
1235
|
direction: direction,
|
|
1236
|
+
dbDataType: activeDimensions.dbDataType,
|
|
1222
1237
|
displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === EDisplayConditionMode.FORMULA
|
|
1223
1238
|
? indicator.displayCondition.formula
|
|
1224
1239
|
: undefined,
|
|
@@ -1227,6 +1242,7 @@ function mapSortingToInputs(_a) {
|
|
|
1227
1242
|
return {
|
|
1228
1243
|
formula: getMeasureFormula(indicator),
|
|
1229
1244
|
direction: direction,
|
|
1245
|
+
dbDataType: indicator.dbDataType,
|
|
1230
1246
|
};
|
|
1231
1247
|
});
|
|
1232
1248
|
return sortOrder;
|
package/dist/index.js
CHANGED
|
@@ -647,6 +647,9 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
647
647
|
if (checkedValues && checkedValues.length) {
|
|
648
648
|
return checkedValues;
|
|
649
649
|
}
|
|
650
|
+
if (!formValues) {
|
|
651
|
+
return [];
|
|
652
|
+
}
|
|
650
653
|
function stringifyNumbersRange(range) {
|
|
651
654
|
if (range === void 0) { range = [undefined, undefined]; }
|
|
652
655
|
return range.map(function (value, index) {
|
|
@@ -681,7 +684,7 @@ var getFormulaFilterValues = function (filterValue) {
|
|
|
681
684
|
}
|
|
682
685
|
return compact([datePickerValue]);
|
|
683
686
|
case exports.EFormatTypes.STRING:
|
|
684
|
-
return compact([(_a = formValues
|
|
687
|
+
return compact([(_a = formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
|
|
685
688
|
case exports.EFormatTypes.NUMBER:
|
|
686
689
|
case exports.EFormatTypes.YEAR:
|
|
687
690
|
case exports.EFormatTypes.DAY_OF_MONTH:
|
|
@@ -878,17 +881,18 @@ var dimensionTemplateFormulas = (_a$3 = {},
|
|
|
878
881
|
_a$3[exports.EDimensionTemplateNames.hour] = "if(defaultValueOfArgumentType({columnFormula}) = {columnFormula}, 0, toHour({columnFormula}))",
|
|
879
882
|
_a$3);
|
|
880
883
|
function getDimensionFormula(_a) {
|
|
884
|
+
var _b;
|
|
881
885
|
var value = _a.value;
|
|
882
886
|
if (!value) {
|
|
883
887
|
return "";
|
|
884
888
|
}
|
|
885
889
|
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
886
|
-
return value.formula;
|
|
890
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
887
891
|
}
|
|
888
892
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
889
893
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
890
894
|
var templateFormula = dimensionTemplateFormulas[templateName];
|
|
891
|
-
if (!templateFormula) {
|
|
895
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
892
896
|
return "";
|
|
893
897
|
}
|
|
894
898
|
return fillTemplateString(templateFormula, {
|
|
@@ -919,17 +923,18 @@ var measureTemplateFormulas = (_a$2 = {},
|
|
|
919
923
|
_a$2[exports.EMeasureTemplateNames.sum] = "sum({columnFormula})",
|
|
920
924
|
_a$2);
|
|
921
925
|
function getMeasureFormula(_a) {
|
|
926
|
+
var _b;
|
|
922
927
|
var value = _a.value;
|
|
923
928
|
if (!value) {
|
|
924
929
|
return "";
|
|
925
930
|
}
|
|
926
931
|
if (value.mode === exports.EWidgetIndicatorValueModes.FORMULA) {
|
|
927
|
-
return value.formula;
|
|
932
|
+
return (_b = value.formula) !== null && _b !== void 0 ? _b : "";
|
|
928
933
|
}
|
|
929
934
|
if (value.mode === exports.EWidgetIndicatorValueModes.TEMPLATE) {
|
|
930
935
|
var templateName = value.templateName, tableName = value.tableName, columnName = value.columnName;
|
|
931
936
|
var templateFormula = measureTemplateFormulas[templateName];
|
|
932
|
-
if (!templateFormula) {
|
|
937
|
+
if (!templateFormula || !tableName || !columnName) {
|
|
933
938
|
return "";
|
|
934
939
|
}
|
|
935
940
|
return fillTemplateString(templateFormula, {
|
|
@@ -1180,7 +1185,13 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1180
1185
|
].includes(dimension.format);
|
|
1181
1186
|
});
|
|
1182
1187
|
if (timeDimension) {
|
|
1183
|
-
return [
|
|
1188
|
+
return [
|
|
1189
|
+
{
|
|
1190
|
+
formula: getDimensionFormula(timeDimension),
|
|
1191
|
+
dbDataType: timeDimension.dbDataType,
|
|
1192
|
+
direction: exports.ESortDirection.ascend,
|
|
1193
|
+
},
|
|
1194
|
+
];
|
|
1184
1195
|
}
|
|
1185
1196
|
if (measures.length > 0) {
|
|
1186
1197
|
var firstMeasure = measures[0];
|
|
@@ -1189,6 +1200,7 @@ var getDefaultSortOrders = function (_a) {
|
|
|
1189
1200
|
{
|
|
1190
1201
|
direction: exports.ESortDirection.descend,
|
|
1191
1202
|
formula: getMeasureFormula(firstMeasure),
|
|
1203
|
+
dbDataType: firstMeasure.dbDataType,
|
|
1192
1204
|
},
|
|
1193
1205
|
];
|
|
1194
1206
|
}
|
|
@@ -1202,7 +1214,9 @@ function mapSortingToInputs(_a) {
|
|
|
1202
1214
|
var _b;
|
|
1203
1215
|
var direction = _a.direction, value = _a.value;
|
|
1204
1216
|
if (value.mode === exports.ESortingValueModes.FORMULA) {
|
|
1205
|
-
return value.formula
|
|
1217
|
+
return value.formula
|
|
1218
|
+
? { formula: value.formula, direction: direction, dbDataType: value.dbDataType }
|
|
1219
|
+
: undefined;
|
|
1206
1220
|
}
|
|
1207
1221
|
var indicatorsGroup = settings[value.group];
|
|
1208
1222
|
var indicator = indicatorsGroup === null || indicatorsGroup === void 0 ? void 0 : indicatorsGroup[value.index];
|
|
@@ -1220,6 +1234,7 @@ function mapSortingToInputs(_a) {
|
|
|
1220
1234
|
return {
|
|
1221
1235
|
formula: formula,
|
|
1222
1236
|
direction: direction,
|
|
1237
|
+
dbDataType: activeDimensions.dbDataType,
|
|
1223
1238
|
displayCondition: ((_b = indicator.displayCondition) === null || _b === void 0 ? void 0 : _b.mode) === exports.EDisplayConditionMode.FORMULA
|
|
1224
1239
|
? indicator.displayCondition.formula
|
|
1225
1240
|
: undefined,
|
|
@@ -1228,6 +1243,7 @@ function mapSortingToInputs(_a) {
|
|
|
1228
1243
|
return {
|
|
1229
1244
|
formula: getMeasureFormula(indicator),
|
|
1230
1245
|
direction: direction,
|
|
1246
|
+
dbDataType: indicator.dbDataType,
|
|
1231
1247
|
};
|
|
1232
1248
|
});
|
|
1233
1249
|
return sortOrder;
|