@universal-ember/table
    Preparing search index...

    Class ColumnOrder<DataType>Private

    Used for keeping track of and updating column order

    Type Parameters

    • DataType = unknown
    Index

    Constructors

    • Type Parameters

      • DataType = unknown

      Parameters

      • args: {
            columns: () => Column<DataType>[];
            existingOrder?: Map<string, number>;
            read?: () => Map<string, number> | undefined;
            save?: (order: Map<string, number>) => void;
            visibleColumns?: () => Record<string, boolean>;
        }
        • columns: () => Column<DataType>[]

          All columns to track in the ordering.

          Backwards compatible usage (without ColumnVisibility):

          • Pass only the columns you want to display
          • All columns are treated as visible

          New usage (with ColumnVisibility):

          • Pass ALL columns (including hidden ones)
          • Provide visibleColumns to indicate which are visible
          • Hidden columns maintain their position when toggled
        • OptionalexistingOrder?: Map<string, number>

          Use read instead for reactive preferences support. Optional: Previously saved column order to restore.

        • Optionalread?: () => Map<string, number> | undefined

          Optional: Callback to read the current saved order from preferences. Called reactively - when preferences change, order updates automatically.

        • Optionalsave?: (order: Map<string, number>) => void

          Optional: Callback to persist the column order (e.g., to localStorage).

        • OptionalvisibleColumns?: () => Record<string, boolean>

          Optional: Record of which columns are currently visible. When provided, moveLeft/moveRight will skip over hidden columns. When omitted, all columns from columns are treated as visible (backwards compatible).

          Example when using ColumnVisibility:

          visibleColumns: () => columns.reduce((acc, col) => {
          acc[col.key] = meta(col).ColumnVisibility?.isVisible !== false;
          return acc;
          }, {})

      Returns ColumnOrder<DataType>

    Properties

    args: {
        columns: () => Column<DataType>[];
        existingOrder?: Map<string, number>;
        read?: () => Map<string, number> | undefined;
        save?: (order: Map<string, number>) => void;
        visibleColumns?: () => Record<string, boolean>;
    }

    Type Declaration

    • columns: () => Column<DataType>[]

      All columns to track in the ordering.

      Backwards compatible usage (without ColumnVisibility):

      • Pass only the columns you want to display
      • All columns are treated as visible

      New usage (with ColumnVisibility):

      • Pass ALL columns (including hidden ones)
      • Provide visibleColumns to indicate which are visible
      • Hidden columns maintain their position when toggled
    • OptionalexistingOrder?: Map<string, number>

      Use read instead for reactive preferences support. Optional: Previously saved column order to restore.

    • Optionalread?: () => Map<string, number> | undefined

      Optional: Callback to read the current saved order from preferences. Called reactively - when preferences change, order updates automatically.

    • Optionalsave?: (order: Map<string, number>) => void

      Optional: Callback to persist the column order (e.g., to localStorage).

    • OptionalvisibleColumns?: () => Record<string, boolean>

      Optional: Record of which columns are currently visible. When provided, moveLeft/moveRight will skip over hidden columns. When omitted, all columns from columns are treated as visible (backwards compatible).

      Example when using ColumnVisibility:

      visibleColumns: () => columns.reduce((acc, col) => {
      acc[col.key] = meta(col).ColumnVisibility?.isVisible !== false;
      return acc;
      }, {})
    map: TrackedMap<string, number> = ...

    This map will be empty until we re-order something.

    Accessors

    • get orderedMap(): ReadonlyMap<string, number>

      The same as this.map, but with all the columns' information. Prefers preferences (via read callback) when available for reactivity.

      Returns ReadonlyMap<string, number>

    Methods

    • Private

      Helper to get visible columns, defaulting to all columns if not specified

      Returns Record<string, boolean>

    • To account for columnVisibilty, we need to:

      • get the list of visible columns
      • get the column order (which preserves the order of hidden columns)
      • skip over non-visible columns when determining the previous "index"
      • set the position to whatever that is.

      Parameters

      • key: string

      Returns void

    • To account for columnVisibilty, we need to:

      • get the list of visible columns
      • get the column order (which preserves the order of hidden columns)
      • skip over non-visible columns when determining the next "index"
      • set the position to whatever that is.

      Parameters

      • key: string

      Returns void

    • Performs a swap of the column's position with the column at position

      Parameters

      • key: string
      • position: number

      Returns false | undefined