All files / platform/core/src/services/ToolBarService types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                                                                                       
import type { RunCommand } from '../../types/Command';
import React from 'react';
 
/**
 * Type definitions for toolbar sections
 */
export type ToolbarSections = {
  primary: string;
  secondary: string;
  viewportActionMenu: {
    topLeft: string;
    topRight: string;
    bottomLeft: string;
    bottomRight: string;
  };
};
 
export type EvaluatePublic =
  | string
  | EvaluateFunction
  | EvaluateObject
  | (string | EvaluateFunction | EvaluateObject)[];
 
export type EvaluateFunction = (props: Record<string, unknown>) => {
  disabled: boolean;
  className: string;
};
 
export type EvaluateObject = {
  name: string;
  // Allow any additional properties
  [key: string]: unknown;
};
 
export type ButtonOptions = {
  id: string;
  type: 'range' | 'radio' | 'double-range' | 'custom' | 'checkbox' | 'select' | 'button';
  name?: string;
  tooltip?: string;
  min?: number;
  max?: number;
  step?: number;
  value?: number | number[] | string;
  values: Array<{ value: string; label: string }>;
  commands?: RunCommand;
  condition?: (props: Record<string, unknown>) => boolean;
  children?: React.ReactNode | (() => React.ReactNode);
  options?: Array<{ value: string; label: string }>;
  explicitRunOnly?: boolean;
};
 
export type ButtonProps = {
  id: string;
  icon: string;
  isActive?: boolean;
  label: string;
  tooltip?: string;
  commands?: RunCommand;
  disabled?: boolean;
  className?: string;
  evaluate?: EvaluatePublic;
  listeners?: Record<string, RunCommand>;
  options?: ButtonOptions[];
  buttonSection?: string | boolean;
  isActive?: boolean;
};
 
export type Button = {
  id: string;
  props: ButtonProps;
  // button ui type (e.g. 'ohif.splitButton', 'ohif.radioGroup')
  // extensions can provide custom components for these types
  uiType: string;
  component?: React.ComponentType<any>;
};