Perseus
    Preparing search index...

    The Widget type represents the common API that the Renderer uses to interact with all widgets. All widgets must implement the methods in this API, unless they are marked as optional (?: ...).

    These methods are called on the widget ref and allow the renderer to communicate with the individual widgets to coordinate actions such as scoring, state serialization/deserialization, and focus management.

    Hierarchy

    Implements

    Index

    Constructors

    • Parameters

      Returns Table

    • Parameters

      Returns Table

    Properties

    answerRefs: Record<string, any> = {}

    If using the new style context, re-declare this in your class to be the React.ContextType of your static contextType. Should be used with type annotation or static contextType.

    static contextType = MyContext
    // For TS pre-3.7:
    context!: React.ContextType<typeof MyContext>
    // For TS 3.7 and above:
    declare context: React.ContextType<typeof MyContext>
    headerRefs: Record<string, any> = {}
    contextType: Context<I18nContextType> = PerseusI18nContext

    If set, this.context will be set at runtime to the current value of the given Context.

    type MyContext = number
    const Ctx = React.createContext<MyContext>(0)

    class Foo extends React.Component {
    static contextType = Ctx
    context!: React.ContextType<typeof Ctx>
    render () {
    return <>My context's value: {this.context}</>;
    }
    }
    defaultProps: DefaultProps = ...

    Methods

    • Returns {
          alignment: string | null | undefined;
          answers: PerseusTableUserInput;
          apiOptions: APIOptionsWithDefaults;
          columns: number;
          containerSizeClass: SizeClass;
          Editor: any;
          findWidgets: (criterion: FilterCriterion) => readonly Widget[];
          handleUserInput: (
              newUserInput: PerseusTableUserInput,
              cb?: () => void,
              silent?: boolean,
          ) => void;
          headers: string[];
          keypadElement?: any;
          linterContext: LinterContextProps;
          onBlur: (blurPath: FocusPath) => void;
          onChange: (headers: string[]) => void;
          onFocus: (blurPath: FocusPath) => void;
          problemNum: number | null | undefined;
          reviewMode: boolean;
          rows: number;
          showSolutions?: ShowSolutions;
          static: boolean | null | undefined;
          trackInteraction: (extraData?: Empty) => void;
          widgetId: string;
          widgetIndex: number;
      }

      • alignment: string | null | undefined
      • answers: PerseusTableUserInput
      • apiOptions: APIOptionsWithDefaults
      • columns: number

        The number of columns to display

      • containerSizeClass: SizeClass
      • Editor: any
      • findWidgets: (criterion: FilterCriterion) => readonly Widget[]
      • handleUserInput: (newUserInput: PerseusTableUserInput, cb?: () => void, silent?: boolean) => void
      • headers: string[]

        Translatable Text; A list of column headers

      • OptionalkeypadElement?: any
      • linterContext: LinterContextProps
      • onBlur: (blurPath: FocusPath) => void
      • onChange: (headers: string[]) => void
      • onFocus: (blurPath: FocusPath) => void
      • problemNum: number | null | undefined
      • reviewMode: boolean
      • rows: number

        The number of rows to display

      • OptionalshowSolutions?: ShowSolutions
      • static: boolean | null | undefined
      • trackInteraction: (extraData?: Empty) => void
      • widgetId: string
      • widgetIndex: number

      and likely very broken API [LEMS-3185] do not trust serializedState