SheetXL - v1.0.2
    Preparing search index...

    Class PivotFieldsModel

    A pivot table's field list as a user works it, with no UI: what each field is and where it sits, the four areas in order, and one method per gesture (DESIGN-PIVOT-UI ยง3). A view renders getSnapshot and calls the gestures; it hears every change, the table's own and those made by script, undo or another view, through subscribe.

    Reads and writes through the public IPivotTable only, so the same model drives a task pane beside a sheet and a pivot widget with no grid. Each gesture is one step to undo, two calls included, and gestures run one after another in the order they are asked for. A refused gesture rejects with the table's error and changes nothing.

    While anything subscribes, the snapshot is the same object until the table changes, as useSyncExternalStore needs; otherwise each call reads the table afresh.

    Index
    • Changes a value's settings as one step to undo: its function, then how it is shown, then its number format, then its caption. What settings leaves out stays.

      Parameters

      Returns Promise<void>

      The order is the dialog's: a function rewrites the caption and a kind of show-as the format, so a caption or a format asked for with them is the one the value keeps.

    • Stops listening to the table, whoever still subscribes.

      Returns void

    • The table the model works.

      Returns IPivotTable

    • Puts a chip, or a field from the list, in an area at index (counted from 0 among the area's chips, the values' slot among them); absent, after the last.

      Parameters

      Returns Promise<void>

      • A field to the rows, columns or filters moves there; within its own area it changes place.
      • A field to the values is summarized, leaving any axis it was on, as Excel's does.
      • A value to another area: it goes, and its field takes that area.
      • The values' slot moves between the rows and the columns only.
    • Takes a chip off the table: a field off its axis, a value deleted. The values' slot deletes every value, as Excel's does.

      Parameters

      Returns Promise<void>

    • Renames a chip: a field, a value, or the values' slot.

      Parameters

      Returns Promise<void>

    • Changes what a value computes; a caption the table made follows it, as Excel's does.

      Parameters

      • value: string
      • fn: Function

      Returns Promise<void>

    • Calls listener after each change to the table; returns the call that stops it. The model listens to the table's sheet while anything listens to it.

      Parameters

      • listener: () => void

      Returns () => void

    • Ticks a field in the list: a field of numbers goes to the values, as a Sum; any other to the rows, after the last (IPivotTable.IField.getDataType). Nothing for a field already ticked.

      Parameters

      • field: string

      Returns Promise<void>

    • Unticks a field in the list: it comes off its axis and every value summarizing it goes.

      Parameters

      • field: string

      Returns Promise<void>