Class Ds<T>

A generic dataset manager.

Type Parameters

  • T extends object

    The type of the data structure managed by this instance.

Hierarchy (View Summary)

Constructors

  • Creates an instance of Ds.

    Type Parameters

    • T extends object

    Parameters

    • params: { core: DsCore<T>; useClone?: boolean }

      The initialization parameters.

      • core: DsCore<T>

        The core instance managing data operations.

      • OptionaluseClone?: boolean

        Whether to use structuredClone() when handling data.

    Returns Ds<T>

Accessors

  • get rowCnt(): undefined | number

    Gets the row count of the first table. tables[0], useful for single table case

    Returns undefined | number

    The number of rows in the first table or undefined if no tables exist.

  • get rowSel(): undefined | Loc

    Gets the selected row location if only one row is selected. Row loc of rowsSel[0], useful for single selection case

    Returns undefined | Loc

    The selected row location or undefined if multiple or no rows are selected.

  • get rowSelRef(): undefined | T

    Gets the reference to the selected row if only one row is selected. Row reference of rowsSel[0], useful for single selection case

    Returns undefined | T

    The selected row or undefined if multiple or no rows are selected.

  • get rowsSel(): Loc[]

    Gets the selected row locations.

    Returns Loc[]

    An array of selected row locations.

  • get rowsSelRef(): T[]

    Gets references to the selected rows.

    Returns T[]

    An array of selected row values.

  • get table(): undefined | T[]

    Gets the first table from the core tables. tables[0], useful for single table case

    Returns undefined | T[]

    The first table or undefined if no tables exist.

  • get tables(): T[][]

    Gets all tables in the dataset.

    Returns T[][]

    A two-dimensional array representing the tables.

  • get tablesCnt(): number

    Gets the total number of tables in the dataset.

    Returns number

    The number of tables.

  • get tableSel(): undefined | number

    Gets the selected table index if only one table is selected. table tid of tablesSel[0], useful for single selection case

    Returns undefined | number

    The selected table index or undefined if multiple or no tables are selected.

  • get tableSelRef(): T[]

    Gets the reference to the selected table if only one table is selected. table reference of tablesSel[0], useful for single selection case

    Returns T[]

    The selected table or an empty array if multiple or no tables are selected.

  • get tablesSel(): number[]

    Gets the selected table indices.

    Returns number[]

    An array of selected table indices.

  • get tablesSelRef(): T[][]

    Gets references to the selected tables.

    Returns T[][]

    A two-dimensional array of selected tables.

Methods

  • Handles row selection on mouse click with support for multi-selection modes. Only intended for frontend usage.

    Parameters

    • row: Loc | T

      The row reference or location.

    • e: MouseEvent

      The mouse event triggering the selection.

    • Optionalsort: "reverse" | "forward"

      The sorting direction.

    Returns { success: boolean }

    An object indicating whether the selection was successful.

  • Handles table selection on mouse click with support for multi-selection modes. Only intended for frontend usage.

    Parameters

    • table: number | T[]

      The table reference or index.

    • e: MouseEvent

      The mouse event triggering the selection.

    • Optionalsort: "reverse" | "forward"

      The sorting direction.

    Returns { success: boolean }

    An object indicating whether the selection was successful.

  • Deselects all selected tables and rows.

    Returns void

  • Deselects all selected rows.

    Returns void

  • Deselects all selected tables.

    Returns void

  • Find row if a row exists at the given location(loc).

    Parameters

    • loc: Loc

      The location of the row, containing table and row indices.

    Returns { found: boolean; rowRef: undefined | T }

    An object indicating whether the row exists and its reference if found.

  • Find row if a given row reference exists in any table.

    Parameters

    • rowRef: T

      The reference to the row.

    Returns { found: boolean; loc: Loc; row?: T }

    An object indicating whether the row reference exists, its location if found, and the row itself.

  • Find table if a table exists at the given index(tid).

    Parameters

    • t: number

      The index of the table.

    Returns { found: boolean; tableRef: undefined | T[] }

    An object indicating whether the table exists and its reference if found.

  • Find table if a given table reference exists in the core tables.

    Parameters

    • tableRef: T[]

      The reference to the table.

    Returns { found: boolean; tid: number }

    An object indicating whether the table reference exists and its index if found.

  • Checks if a table or row (by index or location) is selected.

    Parameters

    • index: number | Loc

      The table index or row location.

    Returns boolean

    True if the table or row is selected, otherwise false.

  • Checks if a row at the given location is selected.

    Parameters

    • loc: Loc

      The row location.

    Returns boolean

    True if the row is selected, otherwise false.

  • Checks if a row reference is selected.

    Parameters

    • rowRef: T

      The row reference.

    Returns boolean

    True if the row is selected, otherwise false.

  • Checks if a table with the given index is selected.

    Parameters

    • tid: number

      The table index.

    Returns boolean

    True if the table is selected, otherwise false.

  • Checks if a table reference is selected.

    Parameters

    • tableRef: T[]

      The table reference.

    Returns boolean

    True if the table is selected, otherwise false.

  • Checks if all given row locations are valid.

    Parameters

    • locs: Loc[]

      The array of row locations.

    Returns boolean

    True if all row locations are valid, otherwise false.

  • Checks if all given table IDs are valid.

    Parameters

    • tids: number[]

      The array of table IDs.

    Returns boolean

    True if all table IDs are valid, otherwise false.

  • Manipulates rows based on selection and placement rules.

    Parameters

    • Optionalsource: T[]
    • Optionaltarget: {
          changeSel?: boolean;
          place?: "above" | "replace" | "below";
          select?: number[] | Loc[] | "tables" | "rows";
          useClone?: boolean;
          which?: "top" | "all" | "bottom";
      }

    Returns { success: boolean }

    rows (full documentation in main implementation)

  • Modifies rows or creates new tables based on placement rules.

    Parameters

    • source: T[]
    • Optionaltarget: {
          changeSel?: boolean;
          place?: "newTableAbove" | "newTableBelow";
          select?: number[] | "tables";
          useClone?: boolean;
          which?: "top" | "all" | "bottom";
      }

    Returns { success: boolean }

    rows (full documentation in main implementation)

  • Converts row references to their corresponding locations.

    Parameters

    • rows: T[]

      An array of row references.

    Returns { foundAll: boolean; locs: Loc[] }

    An object indicating whether all rows were found and their corresponding locations.

  • Selects a row by its reference or location.

    Parameters

    • row: Loc | T

      The row reference or location.

    • Optionaloption: { multiMode?: MultiMode; sort?: "reverse" | "forward" }

      Selection options, including multi-selection mode and sorting direction.

    Returns { success: boolean }

    An object indicating whether the selection was successful.

  • Selects a table by its reference or index(tid).

    Parameters

    • table: number | T[]

      The table reference or index.

    • Optionaloption: { multiMode?: MultiMode; sort?: "reverse" | "forward" }

      Selection options, including multi-selection mode and sorting direction.

    Returns { success: boolean }

    An object indicating whether the selection was successful.

  • Sorts the selected rows based on table and row indices in the specified direction.

    Parameters

    • Optionaldirection: "reverse" | "forward"

      The sorting direction, defaults to "forward".

    Returns void

  • Sorts the selected table indices in the specified direction.

    Parameters

    • Optionaldirection: "reverse" | "forward"

      The sorting direction, defaults to "forward".

    Returns void

  • Converts table references to their corresponding table indices.

    Parameters

    • tables: T[][]

      An array of table references.

    Returns { foundAll: boolean; tids: number[] }

    An object indicating whether all tables were found and their corresponding indices.