@infomaximum/widget-sdk 5.0.0-beta1 → 5.0.0-beta3

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/README.md CHANGED
@@ -11,6 +11,6 @@
11
11
  | Версия `widget-sdk` | Версия системы |
12
12
  | ------------------- | -------------- |
13
13
  | 3.x.x | 2401 - 2407 |
14
- | 4.x.x | 2408 - latest |
15
-
14
+ | 4.x.x | 2408 - 2410 |
15
+ | 5.x.x | 2411 - latest |
16
16
  ---
package/dist/index.d.ts CHANGED
@@ -383,9 +383,9 @@ interface IFormulaFilterValue {
383
383
  /** Метод фильтрации */
384
384
  filteringMethod: valueof<typeof formulaFilterMethods>;
385
385
  /** Выбранные в списке значения в виде моделей */
386
- checkedValues: (string | null)[];
386
+ checkedValues?: (string | null)[];
387
387
  /** Значения полей формы редактора */
388
- formValues: Partial<{
388
+ formValues?: Partial<{
389
389
  [EFormulaFilterFieldKeys.date]: string | null;
390
390
  [EFormulaFilterFieldKeys.dateRange]: [string, string];
391
391
  [EFormulaFilterFieldKeys.duration]: string;
@@ -727,16 +727,18 @@ interface IParameterFromEndEvent {
727
727
  interface IParameterFromManualInput {
728
728
  inputMethod: EWidgetActionInputMethod.MANUALLY;
729
729
  description: string;
730
+ defaultValue?: string;
730
731
  }
731
732
  interface IParameterFromStaticList {
732
733
  inputMethod: EWidgetActionInputMethod.STATIC_LIST;
733
- options: string[];
734
- defaultOptionIndex: number;
734
+ options: string;
735
+ defaultOptionIndexes: number[];
735
736
  }
736
737
  interface IParameterFromDynamicList {
737
738
  inputMethod: EWidgetActionInputMethod.DYNAMIC_LIST;
738
- formula: string;
739
+ options: string;
739
740
  defaultValue: string;
741
+ displayOptions: string;
740
742
  filters: TExtendedFormulaFilterValue[];
741
743
  }
742
744
  interface IWidgetActionParameterCommon {
@@ -799,7 +801,6 @@ type TActionOpenView = IActionCommon & {
799
801
  }>));
800
802
  type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
801
803
  interface IWidgetAction extends IActionCommon {
802
- filters: TExtendedFormulaFilterValue[];
803
804
  parameters: TWidgetActionParameter[];
804
805
  type: EActionTypes.EXECUTE_SCRIPT;
805
806
  scriptKey: string;
@@ -829,13 +830,19 @@ declare enum ESortDirection {
829
830
  }
830
831
  type TSortDirection = ESortDirection.ascend | ESortDirection.descend;
831
832
  interface ISortOrder {
833
+ /** Формула сортировки */
832
834
  formula: string;
835
+ /** Тип данных формулы */
836
+ dbDataType: TNullable<string>;
837
+ /** Направление сортировки */
833
838
  direction: TSortDirection;
839
+ /** Условие применения сортировки */
834
840
  displayCondition?: TNullable<string>;
835
841
  }
836
842
  type TWidgetSortingValue = {
837
843
  mode: ESortingValueModes.FORMULA;
838
844
  formula: string;
845
+ dbDataType: string;
839
846
  } | {
840
847
  mode: ESortingValueModes.IN_WIDGET;
841
848
  group: string;
@@ -908,15 +915,15 @@ interface ICommonDimensions {
908
915
  }
909
916
  type TColumnIndicatorValue = {
910
917
  mode: EWidgetIndicatorValueModes.FORMULA;
911
- formula: string;
918
+ formula?: string;
912
919
  } | {
913
920
  mode: EWidgetIndicatorValueModes.TEMPLATE;
914
921
  /** Имя шаблонной формулы, использующей колонку таблицы */
915
- templateName: string;
922
+ templateName?: string;
916
923
  /** Имя таблицы */
917
- tableName: string;
924
+ tableName?: string;
918
925
  /** Имя колонки */
919
- columnName: string;
926
+ columnName?: string;
920
927
  };
921
928
  /** Общий интерфейс разреза и меры */
922
929
  interface IWidgetColumnIndicator extends IWidgetIndicator {
@@ -1767,6 +1774,8 @@ type TLaunchActionParams = {
1767
1774
  filters: ICalculatorFilter[];
1768
1775
  /** Выбранные имена событий для способа ввода EVENT, START_EVENT и FINISH_EVENT */
1769
1776
  eventNames?: [string] | [string, string];
1777
+ /** Callback вызывается при успешном открытии модального окна подтверждения или при прерывании открытия */
1778
+ onConfirmationOpenSettled?: () => void;
1770
1779
  };
1771
1780
  type TWidgetContainer = {
1772
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 === null || formValues === void 0 ? void 0 : formValues[EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
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 [{ formula: getDimensionFormula(timeDimension), direction: ESortDirection.ascend }];
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 ? { formula: value.formula, direction: direction } : undefined;
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 === null || formValues === void 0 ? void 0 : formValues[exports.EFormulaFilterFieldKeys.string]) !== null && _a !== void 0 ? _a : null]);
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 [{ formula: getDimensionFormula(timeDimension), direction: exports.ESortDirection.ascend }];
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 ? { formula: value.formula, direction: direction } : undefined;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "5.0.0-beta1",
3
+ "version": "5.0.0-beta3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",