@infomaximum/widget-sdk 4.0.0 → 4.2.0

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 CHANGED
@@ -39,7 +39,8 @@ declare enum EControlType {
39
39
  filter = "filter",
40
40
  actionOnClick = "actionOnClick",
41
41
  eventsPicker = "eventsPicker",
42
- size = "size"
42
+ size = "size",
43
+ formatting = "formatting"
43
44
  }
44
45
  /** Конфигурация элемента управления настройкой */
45
46
  interface IControlRecord<Settings extends object, Value, ControlType = EControlType> {
@@ -250,6 +251,35 @@ declare enum EFormattingPresets {
250
251
  interface IWidgetFormatting {
251
252
  getFormattedValue: (value: string, formatType: EFormatTypes, formatting: EFormattingPresets, formatTemplate: TNullable<string>) => string;
252
253
  }
254
+ declare const formattingConfig: {
255
+ readonly availableFormatsByDataType: {
256
+ OTHER: EFormatTypes[];
257
+ STRING: EFormatTypes[];
258
+ FLOAT: EFormatTypes[];
259
+ INTEGER: EFormatTypes[];
260
+ DATE: EFormatTypes[];
261
+ DATETIME: EFormatTypes[];
262
+ DATETIME64: EFormatTypes[];
263
+ BOOLEAN: EFormatTypes[];
264
+ };
265
+ readonly availableFormattingByFormat: {
266
+ DATE: EFormattingPresets[];
267
+ DATETIME: EFormattingPresets[];
268
+ DAY_OF_WEEK: EFormattingPresets[];
269
+ MONTH: EFormattingPresets[];
270
+ NUMBER: EFormattingPresets[];
271
+ DURATION: EFormattingPresets[];
272
+ HOUR: EFormattingPresets[];
273
+ MONTH_YEAR: EFormattingPresets[];
274
+ QUARTER: EFormattingPresets[];
275
+ QUARTER_YEAR: EFormattingPresets[];
276
+ STRING: never[];
277
+ DAY_OF_MONTH: never[];
278
+ WEEK: never[];
279
+ YEAR: never[];
280
+ BOOLEAN: never[];
281
+ };
282
+ };
253
283
 
254
284
  declare enum ELastTimeUnit {
255
285
  DAYS = "DAYS",
@@ -709,16 +739,6 @@ interface IActionUpdateVariable extends IActionCommon {
709
739
  type: EActionTypes.UPDATE_VARIABLE;
710
740
  variables: TActionOnClickParameter[];
711
741
  }
712
- type TActionOpenViewMode = {
713
- mode: EViewMode.GENERATED_BY_SCRIPT;
714
- scriptKey: string;
715
- parameters: TActionOnClickParameter[];
716
- displayName: string;
717
- } | {
718
- mode: EViewMode.EXISTED_VIEW;
719
- viewKey: string;
720
- parameters: TActionOnClickParameter[];
721
- };
722
742
  type TActionOpenIn = {
723
743
  openIn: EViewOpenIn.DRAWER_WINDOW;
724
744
  alignment: EDrawerPlacement;
@@ -732,9 +752,23 @@ type TActionOpenIn = {
732
752
  } | {
733
753
  openIn: EViewOpenIn.CURRENT_WINDOW;
734
754
  };
735
- type TActionOpenView = {
755
+ type TActionOpenView = IActionCommon & {
736
756
  type: EActionTypes.OPEN_VIEW;
737
- } & TActionOpenViewMode & TActionOpenIn & IActionCommon;
757
+ } & (({
758
+ mode: EViewMode.GENERATED_BY_SCRIPT;
759
+ scriptKey: string;
760
+ parameters: TActionOnClickParameter[];
761
+ displayName: string;
762
+ } & TActionOpenIn) | ({
763
+ mode: EViewMode.EXISTED_VIEW;
764
+ viewKey: string;
765
+ parameters: TActionOnClickParameter[];
766
+ } & TActionOpenIn) | ({
767
+ mode: EViewMode.EMPTY;
768
+ placeholderName: string;
769
+ } & Extract<TActionOpenIn, {
770
+ openIn: EViewOpenIn.PLACEHOLDER;
771
+ }>));
738
772
  type TActionsOnClick = IActionGoToUrl | IActionRunScript | IActionUpdateVariable | TActionOpenView;
739
773
  interface IWidgetAction extends IActionCommon {
740
774
  filters: TExtendedFormulaFilterValue[];
@@ -745,6 +779,11 @@ interface IWidgetAction extends IActionCommon {
745
779
  description: string;
746
780
  }
747
781
  type TAction = TActionsOnClick | IWidgetAction;
782
+ type TActionValidator = (action: TAction) => boolean;
783
+ /**
784
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
785
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
786
+ */
748
787
  declare const isExecuteScriptActionValid: (action: Extract<TAction, {
749
788
  type: EActionTypes.EXECUTE_SCRIPT;
750
789
  }>, { scripts, tables, variables, systemVariables, }: Pick<IGlobalContext, "scripts" | "tables" | "variables" | "systemVariables">) => boolean;
@@ -1401,6 +1440,9 @@ interface IDivePanelDescription<Settings extends object, GroupSettings extends I
1401
1440
  interface IPanelDescriptionCreator<Settings extends IBaseWidgetSettings, GroupSettings extends IGroupSettings> {
1402
1441
  (context: IGlobalContext, panelSettings: Settings, calculatorFactory: ICalculatorFactory): IPanelDescription<Settings, GroupSettings>;
1403
1442
  }
1443
+ declare enum ESystemRecordKey {
1444
+ formatting = "formatting"
1445
+ }
1404
1446
 
1405
1447
  interface IWidgetPlaceholderController {
1406
1448
  setError(value: Error | null): void;
@@ -1551,6 +1593,8 @@ interface IWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetS
1551
1593
  persistValue: IWidgetPersistValue;
1552
1594
  /** функция для управления контекстными меню */
1553
1595
  setContextMenu: (key: string, value: TContextMenu | null) => void;
1596
+ /** метод валидации действий по клику */
1597
+ actionValidator: TActionValidator;
1554
1598
  }
1555
1599
  interface ICustomWidgetProps<WidgetSettings extends IBaseWidgetSettings = IBaseWidgetSettings> extends IWidgetProps<WidgetSettings> {
1556
1600
  /** манифест виджета */
@@ -1731,4 +1775,4 @@ declare global {
1731
1775
  }
1732
1776
  }
1733
1777
 
1734
- export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAppearanceSettings, type IAutoIdentifiedArrayItem, 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 IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, 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 IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, 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 ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
1778
+ export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, type IActionGoToUrl, type IActionRunScript, type IActionScript, type IActionUpdateVariable, type IAddButtonSelectOption, type IAddDurationOfTransitionFilter, type IAddPresenceOfEventFilter, type IAddPresenceOfTransitionFilter, type IAddRepetitionOfEventFilter, type IAppearanceSettings, type IAutoIdentifiedArrayItem, 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 IColoredValue, type ICommonDimensions, type ICommonMeasures, type ICommonState, 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 IGlobalContext, type IGraphElement, type IGroupSetDescription, type IGroupSetRecord, type IGroupSettings, type IHistogramBin, type IHistogramCalculator, type IHistogramCalculatorInput, type IHistogramCalculatorOutput, type IIndicatorLink, type IInitialSettings, type ILens, type IMarkdownMeasure, type IMeasureAddButtonProps, 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 ISelectBranchOption, type ISelectDividerOption, type ISelectGroupOption, type ISelectLeafOption, type ISelectOption, type ISelectSystemOption, type ISortOrder, type ISortingAddButtonProps, type IStagesFilterValue, type ITwoLimitsCalculator, type ITwoLimitsCalculatorExportInput, type ITwoLimitsCalculatorInput, type ITwoLimitsCalculatorOutput, type ITypeCalculator, type ITypeCalculatorInput, type ITypeCalculatorOutput, type ITypeCalculatorOutputItem, type IVertex, type IViewContext, type IViewInputValue, type IWidget, type IWidgetAction, type IWidgetColumnIndicator, type IWidgetDimension, type IWidgetDimensionHierarchy, type IWidgetEntity, type IWidgetFilter, type IWidgetFiltration, type IWidgetFormatting, type IWidgetIndicator, type IWidgetIndicatorAddButtonProps, type IWidgetMeasure, type IWidgetPersistValue, type IWidgetPlaceholderController, type IWidgetPlaceholderValues, type IWidgetProcess, type IWidgetProps, type IWidgetSortingIndicator, type IWidgetTable, type IWidgetTableColumn, type TAction, type TActionOnClickParameter, type TActionOpenView, type TActionValidator, type TActionsOnClick, type TAddButton, type TBoundedContentWithIndicator, type TColor, type TColorRule, type TColumnIndicatorValue, type TContextMenu, type TContextMenuButton, type TContextMenuButtonActions, type TContextMenuButtonApply, type TContextMenuButtonClose, type TContextMenuButtonCustom, type TContextMenuButtonGroup, type TContextMenuButtonOptions, type TContextMenuList, type TContextMenuPositionUnit, type TContextMenuRow, type TCustomAddButtonSelectOption, type TDefineWidgetOptions, type TDisplayCondition, type TDisplayMode, type TEmptyRecord, type TExtendedFormulaFilterValue, type TFiltrationMode, type TGroupLevelRecord, type TLaunchActionParams, type TMeasureAddButtonSelectOption, type TProcessIndicatorValue, type TRecordAccessor, type TSelectChildOptions, type TSelectFetchOptions, type TSelectivePartial, type TSortDirection, type TSystemVariable, type TUpdateSelection, type TValuePath, type TWidgetActionParameter, type TWidgetContainer, type TWidgetFilterValue, type TWidgetFiltering, type TWidgetLevelRecord, type TWidgetSortingValue, type TWidgetVariable, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.esm.js CHANGED
@@ -40,6 +40,10 @@ var EDrawerPlacement;
40
40
  EDrawerPlacement["LEFT"] = "LEFT";
41
41
  EDrawerPlacement["RIGHT"] = "RIGHT";
42
42
  })(EDrawerPlacement || (EDrawerPlacement = {}));
43
+ /**
44
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
45
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
46
+ */
43
47
  var isExecuteScriptActionValid = function (action, _a) {
44
48
  var _b;
45
49
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables, systemVariables = _a.systemVariables;
@@ -328,6 +332,157 @@ var EFormattingPresets;
328
332
  EFormattingPresets["R[-]YYYY"] = "R[-]YYYY";
329
333
  EFormattingPresets["R[-]YY"] = "R[-]YY";
330
334
  })(EFormattingPresets || (EFormattingPresets = {}));
335
+ var formattingConfig = {
336
+ get availableFormatsByDataType() {
337
+ var _a;
338
+ return _a = {},
339
+ _a[ESimpleDataType.OTHER] = [EFormatTypes.STRING],
340
+ _a[ESimpleDataType.STRING] = [EFormatTypes.STRING],
341
+ _a[ESimpleDataType.FLOAT] = [EFormatTypes.NUMBER, EFormatTypes.DURATION],
342
+ _a[ESimpleDataType.INTEGER] = [
343
+ EFormatTypes.NUMBER,
344
+ EFormatTypes.DURATION,
345
+ EFormatTypes.QUARTER_YEAR,
346
+ EFormatTypes.MONTH_YEAR,
347
+ EFormatTypes.MONTH,
348
+ EFormatTypes.DAY_OF_WEEK,
349
+ ],
350
+ _a[ESimpleDataType.DATE] = [EFormatTypes.DATE],
351
+ _a[ESimpleDataType.DATETIME] = [EFormatTypes.DATETIME],
352
+ _a[ESimpleDataType.DATETIME64] = [EFormatTypes.DATETIME],
353
+ _a[ESimpleDataType.BOOLEAN] = [EFormatTypes.BOOLEAN],
354
+ _a;
355
+ },
356
+ get availableFormattingByFormat() {
357
+ var _a;
358
+ return _a = {},
359
+ _a[EFormatTypes.DATE] = [
360
+ EFormattingPresets.AUTO,
361
+ EFormattingPresets["DD.MM.YY"],
362
+ EFormattingPresets["DD.MM.YYYY"],
363
+ EFormattingPresets["YY-MM-DD"],
364
+ EFormattingPresets["YYYY-MM-DD"],
365
+ EFormattingPresets["MM-DD-YY"],
366
+ EFormattingPresets["MM-DD-YYYY"],
367
+ EFormattingPresets["MM.DD.YY"],
368
+ EFormattingPresets["MM.DD.YYYY"],
369
+ EFormattingPresets["DD MMM YY"],
370
+ EFormattingPresets["DD MMM YYYY"],
371
+ EFormattingPresets["DD MMMM YY"],
372
+ EFormattingPresets["DD MMMM YYYY"],
373
+ EFormattingPresets["DD/MM/YY"],
374
+ EFormattingPresets["DD/MM/YYYY"],
375
+ EFormattingPresets["MM/DD/YY"],
376
+ EFormattingPresets["MM/DD/YYYY"],
377
+ EFormattingPresets["MMMM DD, YY"],
378
+ EFormattingPresets["MMMM DD, YYYY"],
379
+ EFormattingPresets.CUSTOM,
380
+ ],
381
+ _a[EFormatTypes.DATETIME] = [
382
+ EFormattingPresets.AUTO,
383
+ EFormattingPresets["DD.MM.YY"],
384
+ EFormattingPresets["DD.MM.YY, HH:mm"],
385
+ EFormattingPresets["DD.MM.YYYY"],
386
+ EFormattingPresets["DD.MM.YYYY, HH:mm"],
387
+ EFormattingPresets["YY-MM-DD"],
388
+ EFormattingPresets["YYYY-MM-DD, HH:mm"],
389
+ EFormattingPresets["YYYY-MM-DD"],
390
+ EFormattingPresets["YYYY-MM-DD HH:mm"],
391
+ EFormattingPresets["MM-DD-YY"],
392
+ EFormattingPresets["MM-DD-YY, hh:mm a"],
393
+ EFormattingPresets["MM-DD-YYYY"],
394
+ EFormattingPresets["MM-DD-YYYY, hh:mm a"],
395
+ EFormattingPresets["MM.DD.YY"],
396
+ EFormattingPresets["MM.DD.YY, hh:mm a"],
397
+ EFormattingPresets["MM.DD.YYYY"],
398
+ EFormattingPresets["MM.DD.YYYY, hh:mm a"],
399
+ EFormattingPresets["DD MMM YY"],
400
+ EFormattingPresets["DD MMM YY, HH:mm"],
401
+ EFormattingPresets["DD MMM YYYY"],
402
+ EFormattingPresets["DD MMM YYYY, HH:mm"],
403
+ EFormattingPresets["DD MMMM YY"],
404
+ EFormattingPresets["DD MMMM YY, HH:mm"],
405
+ EFormattingPresets["DD MMMM YYYY"],
406
+ EFormattingPresets["DD MMMM YYYY, HH:mm"],
407
+ EFormattingPresets["DD/MM/YY"],
408
+ EFormattingPresets["DD/MM/YY, HH:mm"],
409
+ EFormattingPresets["DD/MM/YYYY"],
410
+ EFormattingPresets["DD/MM/YYYY, HH:mm"],
411
+ EFormattingPresets["MM/DD/YY"],
412
+ EFormattingPresets["MM/DD/YY, hh:mm a"],
413
+ EFormattingPresets["MM/DD/YYYY"],
414
+ EFormattingPresets["MM/DD/YYYY, hh:mm a"],
415
+ EFormattingPresets["MMMM DD, YY"],
416
+ EFormattingPresets["MMMM DD, YY, HH:mm"],
417
+ EFormattingPresets["MMMM DD, YYYY"],
418
+ EFormattingPresets["MMMM DD, YYYY, HH:mm"],
419
+ EFormattingPresets.CUSTOM,
420
+ ],
421
+ _a[EFormatTypes.DAY_OF_WEEK] = [
422
+ EFormattingPresets.AUTO,
423
+ EFormattingPresets.DD,
424
+ EFormattingPresets.D,
425
+ EFormattingPresets.DDDD,
426
+ ],
427
+ _a[EFormatTypes.MONTH] = [
428
+ EFormattingPresets.AUTO,
429
+ EFormattingPresets.MMM,
430
+ EFormattingPresets.MM,
431
+ EFormattingPresets.MMMM,
432
+ ],
433
+ _a[EFormatTypes.NUMBER] = [
434
+ EFormattingPresets.AUTO,
435
+ EFormattingPresets["#,##x"],
436
+ EFormattingPresets["#,##x.x"],
437
+ EFormattingPresets["#,##x.xx"],
438
+ EFormattingPresets["x[%]"],
439
+ EFormattingPresets["x.x[%]"],
440
+ EFormattingPresets["zx.xx[%]"],
441
+ EFormattingPresets["[$]x"],
442
+ EFormattingPresets.CUSTOM,
443
+ ],
444
+ _a[EFormatTypes.DURATION] = [
445
+ EFormattingPresets.AUTO,
446
+ EFormattingPresets.d,
447
+ EFormattingPresets.h,
448
+ EFormattingPresets.CUSTOM,
449
+ ],
450
+ _a[EFormatTypes.HOUR] = [
451
+ EFormattingPresets.AUTO,
452
+ EFormattingPresets.HH,
453
+ EFormattingPresets["hh a"],
454
+ ],
455
+ _a[EFormatTypes.MONTH_YEAR] = [
456
+ EFormattingPresets.AUTO,
457
+ EFormattingPresets["MMM, YYYY"],
458
+ EFormattingPresets["MMM, YY"],
459
+ EFormattingPresets["MM.YYYY"],
460
+ EFormattingPresets["MM.YY"],
461
+ EFormattingPresets["MMMM YYYY"],
462
+ EFormattingPresets["MMMM YY"],
463
+ EFormattingPresets.CUSTOM,
464
+ ],
465
+ _a[EFormatTypes.QUARTER] = [
466
+ EFormattingPresets.AUTO,
467
+ EFormattingPresets["[Q]q"],
468
+ EFormattingPresets.R,
469
+ ],
470
+ _a[EFormatTypes.QUARTER_YEAR] = [
471
+ EFormattingPresets.AUTO,
472
+ EFormattingPresets["[Q]q[-]YYYY"],
473
+ EFormattingPresets["[Q]q[-]YY"],
474
+ EFormattingPresets["R[-]YYYY"],
475
+ EFormattingPresets["R[-]YY"],
476
+ EFormattingPresets.CUSTOM,
477
+ ],
478
+ _a[EFormatTypes.STRING] = [],
479
+ _a[EFormatTypes.DAY_OF_MONTH] = [],
480
+ _a[EFormatTypes.WEEK] = [],
481
+ _a[EFormatTypes.YEAR] = [],
482
+ _a[EFormatTypes.BOOLEAN] = [],
483
+ _a;
484
+ },
485
+ };
331
486
 
332
487
  var ELastTimeUnit;
333
488
  (function (ELastTimeUnit) {
@@ -1039,6 +1194,7 @@ var EControlType;
1039
1194
  EControlType["actionOnClick"] = "actionOnClick";
1040
1195
  EControlType["eventsPicker"] = "eventsPicker";
1041
1196
  EControlType["size"] = "size";
1197
+ EControlType["formatting"] = "formatting";
1042
1198
  })(EControlType || (EControlType = {}));
1043
1199
 
1044
1200
  var ESelectOptionTypes;
@@ -1054,6 +1210,11 @@ var ECustomSelectTemplates;
1054
1210
  ECustomSelectTemplates["FORMULA"] = "FORMULA";
1055
1211
  ECustomSelectTemplates["DIMENSION_GROUPS"] = "DIMENSION_GROUPS";
1056
1212
  })(ECustomSelectTemplates || (ECustomSelectTemplates = {}));
1213
+ //todo: заполнить в рамках BI-13985
1214
+ var ESystemRecordKey;
1215
+ (function (ESystemRecordKey) {
1216
+ ESystemRecordKey["formatting"] = "formatting";
1217
+ })(ESystemRecordKey || (ESystemRecordKey = {}));
1057
1218
 
1058
1219
  var findFilterByFormula = function (filters, formula) {
1059
1220
  var _a;
@@ -1190,4 +1351,4 @@ var isValidColor = function (color, globalContext) {
1190
1351
  return true;
1191
1352
  };
1192
1353
 
1193
- export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
1354
+ export { EActionTypes, ECalculatorFilterMethods, EColorMode, EControlType, ECustomSelectTemplates, EDbType, EDimensionTemplateNames, EDisplayConditionMode, EDrawerPlacement, EDurationUnit, EEventMeasureTemplateNames, EFontWeight, EFormatTypes, EFormattingPresets, EFormulaFilterFieldKeys, EIndicatorType, ELastTimeUnit, EMarkdownDisplayMode, EMeasureTemplateNames, EProcessFilterNames, ESelectOptionTypes, ESimpleDataType, ESortDirection, ESortingValueModes, ESystemRecordKey, ETransitionMeasureTemplateNames, EUnitMode, EViewMode, EViewOpenIn, EWidgetActionInputMethod, EWidgetFilterMode, EWidgetIndicatorType, EWidgetIndicatorValueModes, bindContentWithIndicator, bindContentsWithIndicators, checkDisplayCondition, dashboardLinkRegExp, dimensionTemplateFormulas, escapeSpecialCharacters, eventMeasureTemplateFormulas, fillTemplateString, formattingConfig, formulaFilterMethods, generateColumnFormula, getDimensionFormula, getDisplayConditionFormula, getEventMeasureFormula, getLocalizedText, getMeasureFormula, getRuleColor, getTransitionMeasureFormula, isDimensionsHierarchy, isExecuteScriptActionValid, isFormulaFilterValue, isValidColor, linkNameRegExp, mapDimensionsToInputs, mapEventMeasuresToInputs, mapFormulaFilterToCalculatorInput, mapFormulaFiltersToInputs, mapMeasuresToInputs, mapSortingToInputs, mapTransitionMeasuresToInputs, measureTemplateFormulas, parseIndicatorLink, prepareValuesForSql, replaceDisplayCondition, replaceFiltersBySelection, replaceHierarchiesWithDimensions, selectDimensionFromHierarchy, transitionMeasureTemplateFormulas, unescapeSpecialCharacters, updateDefaultModeSelection, updateMultiModeSelection, updateSingleModeSelection, workspaceLinkRegExp };
package/dist/index.js CHANGED
@@ -41,6 +41,10 @@ exports.EDrawerPlacement = void 0;
41
41
  EDrawerPlacement["LEFT"] = "LEFT";
42
42
  EDrawerPlacement["RIGHT"] = "RIGHT";
43
43
  })(exports.EDrawerPlacement || (exports.EDrawerPlacement = {}));
44
+ /**
45
+ * @deprecated Функция может работать некорректно и будет удалена в будущих версиях.
46
+ * Необходимо использовать {@link IWidgetProps.actionValidator }.
47
+ */
44
48
  var isExecuteScriptActionValid = function (action, _a) {
45
49
  var _b;
46
50
  var scripts = _a.scripts, tables = _a.tables, variables = _a.variables, systemVariables = _a.systemVariables;
@@ -329,6 +333,157 @@ exports.EFormattingPresets = void 0;
329
333
  EFormattingPresets["R[-]YYYY"] = "R[-]YYYY";
330
334
  EFormattingPresets["R[-]YY"] = "R[-]YY";
331
335
  })(exports.EFormattingPresets || (exports.EFormattingPresets = {}));
336
+ var formattingConfig = {
337
+ get availableFormatsByDataType() {
338
+ var _a;
339
+ return _a = {},
340
+ _a[exports.ESimpleDataType.OTHER] = [exports.EFormatTypes.STRING],
341
+ _a[exports.ESimpleDataType.STRING] = [exports.EFormatTypes.STRING],
342
+ _a[exports.ESimpleDataType.FLOAT] = [exports.EFormatTypes.NUMBER, exports.EFormatTypes.DURATION],
343
+ _a[exports.ESimpleDataType.INTEGER] = [
344
+ exports.EFormatTypes.NUMBER,
345
+ exports.EFormatTypes.DURATION,
346
+ exports.EFormatTypes.QUARTER_YEAR,
347
+ exports.EFormatTypes.MONTH_YEAR,
348
+ exports.EFormatTypes.MONTH,
349
+ exports.EFormatTypes.DAY_OF_WEEK,
350
+ ],
351
+ _a[exports.ESimpleDataType.DATE] = [exports.EFormatTypes.DATE],
352
+ _a[exports.ESimpleDataType.DATETIME] = [exports.EFormatTypes.DATETIME],
353
+ _a[exports.ESimpleDataType.DATETIME64] = [exports.EFormatTypes.DATETIME],
354
+ _a[exports.ESimpleDataType.BOOLEAN] = [exports.EFormatTypes.BOOLEAN],
355
+ _a;
356
+ },
357
+ get availableFormattingByFormat() {
358
+ var _a;
359
+ return _a = {},
360
+ _a[exports.EFormatTypes.DATE] = [
361
+ exports.EFormattingPresets.AUTO,
362
+ exports.EFormattingPresets["DD.MM.YY"],
363
+ exports.EFormattingPresets["DD.MM.YYYY"],
364
+ exports.EFormattingPresets["YY-MM-DD"],
365
+ exports.EFormattingPresets["YYYY-MM-DD"],
366
+ exports.EFormattingPresets["MM-DD-YY"],
367
+ exports.EFormattingPresets["MM-DD-YYYY"],
368
+ exports.EFormattingPresets["MM.DD.YY"],
369
+ exports.EFormattingPresets["MM.DD.YYYY"],
370
+ exports.EFormattingPresets["DD MMM YY"],
371
+ exports.EFormattingPresets["DD MMM YYYY"],
372
+ exports.EFormattingPresets["DD MMMM YY"],
373
+ exports.EFormattingPresets["DD MMMM YYYY"],
374
+ exports.EFormattingPresets["DD/MM/YY"],
375
+ exports.EFormattingPresets["DD/MM/YYYY"],
376
+ exports.EFormattingPresets["MM/DD/YY"],
377
+ exports.EFormattingPresets["MM/DD/YYYY"],
378
+ exports.EFormattingPresets["MMMM DD, YY"],
379
+ exports.EFormattingPresets["MMMM DD, YYYY"],
380
+ exports.EFormattingPresets.CUSTOM,
381
+ ],
382
+ _a[exports.EFormatTypes.DATETIME] = [
383
+ exports.EFormattingPresets.AUTO,
384
+ exports.EFormattingPresets["DD.MM.YY"],
385
+ exports.EFormattingPresets["DD.MM.YY, HH:mm"],
386
+ exports.EFormattingPresets["DD.MM.YYYY"],
387
+ exports.EFormattingPresets["DD.MM.YYYY, HH:mm"],
388
+ exports.EFormattingPresets["YY-MM-DD"],
389
+ exports.EFormattingPresets["YYYY-MM-DD, HH:mm"],
390
+ exports.EFormattingPresets["YYYY-MM-DD"],
391
+ exports.EFormattingPresets["YYYY-MM-DD HH:mm"],
392
+ exports.EFormattingPresets["MM-DD-YY"],
393
+ exports.EFormattingPresets["MM-DD-YY, hh:mm a"],
394
+ exports.EFormattingPresets["MM-DD-YYYY"],
395
+ exports.EFormattingPresets["MM-DD-YYYY, hh:mm a"],
396
+ exports.EFormattingPresets["MM.DD.YY"],
397
+ exports.EFormattingPresets["MM.DD.YY, hh:mm a"],
398
+ exports.EFormattingPresets["MM.DD.YYYY"],
399
+ exports.EFormattingPresets["MM.DD.YYYY, hh:mm a"],
400
+ exports.EFormattingPresets["DD MMM YY"],
401
+ exports.EFormattingPresets["DD MMM YY, HH:mm"],
402
+ exports.EFormattingPresets["DD MMM YYYY"],
403
+ exports.EFormattingPresets["DD MMM YYYY, HH:mm"],
404
+ exports.EFormattingPresets["DD MMMM YY"],
405
+ exports.EFormattingPresets["DD MMMM YY, HH:mm"],
406
+ exports.EFormattingPresets["DD MMMM YYYY"],
407
+ exports.EFormattingPresets["DD MMMM YYYY, HH:mm"],
408
+ exports.EFormattingPresets["DD/MM/YY"],
409
+ exports.EFormattingPresets["DD/MM/YY, HH:mm"],
410
+ exports.EFormattingPresets["DD/MM/YYYY"],
411
+ exports.EFormattingPresets["DD/MM/YYYY, HH:mm"],
412
+ exports.EFormattingPresets["MM/DD/YY"],
413
+ exports.EFormattingPresets["MM/DD/YY, hh:mm a"],
414
+ exports.EFormattingPresets["MM/DD/YYYY"],
415
+ exports.EFormattingPresets["MM/DD/YYYY, hh:mm a"],
416
+ exports.EFormattingPresets["MMMM DD, YY"],
417
+ exports.EFormattingPresets["MMMM DD, YY, HH:mm"],
418
+ exports.EFormattingPresets["MMMM DD, YYYY"],
419
+ exports.EFormattingPresets["MMMM DD, YYYY, HH:mm"],
420
+ exports.EFormattingPresets.CUSTOM,
421
+ ],
422
+ _a[exports.EFormatTypes.DAY_OF_WEEK] = [
423
+ exports.EFormattingPresets.AUTO,
424
+ exports.EFormattingPresets.DD,
425
+ exports.EFormattingPresets.D,
426
+ exports.EFormattingPresets.DDDD,
427
+ ],
428
+ _a[exports.EFormatTypes.MONTH] = [
429
+ exports.EFormattingPresets.AUTO,
430
+ exports.EFormattingPresets.MMM,
431
+ exports.EFormattingPresets.MM,
432
+ exports.EFormattingPresets.MMMM,
433
+ ],
434
+ _a[exports.EFormatTypes.NUMBER] = [
435
+ exports.EFormattingPresets.AUTO,
436
+ exports.EFormattingPresets["#,##x"],
437
+ exports.EFormattingPresets["#,##x.x"],
438
+ exports.EFormattingPresets["#,##x.xx"],
439
+ exports.EFormattingPresets["x[%]"],
440
+ exports.EFormattingPresets["x.x[%]"],
441
+ exports.EFormattingPresets["zx.xx[%]"],
442
+ exports.EFormattingPresets["[$]x"],
443
+ exports.EFormattingPresets.CUSTOM,
444
+ ],
445
+ _a[exports.EFormatTypes.DURATION] = [
446
+ exports.EFormattingPresets.AUTO,
447
+ exports.EFormattingPresets.d,
448
+ exports.EFormattingPresets.h,
449
+ exports.EFormattingPresets.CUSTOM,
450
+ ],
451
+ _a[exports.EFormatTypes.HOUR] = [
452
+ exports.EFormattingPresets.AUTO,
453
+ exports.EFormattingPresets.HH,
454
+ exports.EFormattingPresets["hh a"],
455
+ ],
456
+ _a[exports.EFormatTypes.MONTH_YEAR] = [
457
+ exports.EFormattingPresets.AUTO,
458
+ exports.EFormattingPresets["MMM, YYYY"],
459
+ exports.EFormattingPresets["MMM, YY"],
460
+ exports.EFormattingPresets["MM.YYYY"],
461
+ exports.EFormattingPresets["MM.YY"],
462
+ exports.EFormattingPresets["MMMM YYYY"],
463
+ exports.EFormattingPresets["MMMM YY"],
464
+ exports.EFormattingPresets.CUSTOM,
465
+ ],
466
+ _a[exports.EFormatTypes.QUARTER] = [
467
+ exports.EFormattingPresets.AUTO,
468
+ exports.EFormattingPresets["[Q]q"],
469
+ exports.EFormattingPresets.R,
470
+ ],
471
+ _a[exports.EFormatTypes.QUARTER_YEAR] = [
472
+ exports.EFormattingPresets.AUTO,
473
+ exports.EFormattingPresets["[Q]q[-]YYYY"],
474
+ exports.EFormattingPresets["[Q]q[-]YY"],
475
+ exports.EFormattingPresets["R[-]YYYY"],
476
+ exports.EFormattingPresets["R[-]YY"],
477
+ exports.EFormattingPresets.CUSTOM,
478
+ ],
479
+ _a[exports.EFormatTypes.STRING] = [],
480
+ _a[exports.EFormatTypes.DAY_OF_MONTH] = [],
481
+ _a[exports.EFormatTypes.WEEK] = [],
482
+ _a[exports.EFormatTypes.YEAR] = [],
483
+ _a[exports.EFormatTypes.BOOLEAN] = [],
484
+ _a;
485
+ },
486
+ };
332
487
 
333
488
  exports.ELastTimeUnit = void 0;
334
489
  (function (ELastTimeUnit) {
@@ -1040,6 +1195,7 @@ exports.EControlType = void 0;
1040
1195
  EControlType["actionOnClick"] = "actionOnClick";
1041
1196
  EControlType["eventsPicker"] = "eventsPicker";
1042
1197
  EControlType["size"] = "size";
1198
+ EControlType["formatting"] = "formatting";
1043
1199
  })(exports.EControlType || (exports.EControlType = {}));
1044
1200
 
1045
1201
  exports.ESelectOptionTypes = void 0;
@@ -1055,6 +1211,11 @@ exports.ECustomSelectTemplates = void 0;
1055
1211
  ECustomSelectTemplates["FORMULA"] = "FORMULA";
1056
1212
  ECustomSelectTemplates["DIMENSION_GROUPS"] = "DIMENSION_GROUPS";
1057
1213
  })(exports.ECustomSelectTemplates || (exports.ECustomSelectTemplates = {}));
1214
+ //todo: заполнить в рамках BI-13985
1215
+ exports.ESystemRecordKey = void 0;
1216
+ (function (ESystemRecordKey) {
1217
+ ESystemRecordKey["formatting"] = "formatting";
1218
+ })(exports.ESystemRecordKey || (exports.ESystemRecordKey = {}));
1058
1219
 
1059
1220
  var findFilterByFormula = function (filters, formula) {
1060
1221
  var _a;
@@ -1207,6 +1368,7 @@ exports.dimensionTemplateFormulas = dimensionTemplateFormulas;
1207
1368
  exports.escapeSpecialCharacters = escapeSpecialCharacters;
1208
1369
  exports.eventMeasureTemplateFormulas = eventMeasureTemplateFormulas;
1209
1370
  exports.fillTemplateString = fillTemplateString;
1371
+ exports.formattingConfig = formattingConfig;
1210
1372
  exports.formulaFilterMethods = formulaFilterMethods;
1211
1373
  exports.generateColumnFormula = generateColumnFormula;
1212
1374
  exports.getDimensionFormula = getDimensionFormula;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infomaximum/widget-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",