Class DocItem

DocItem is a subclass of Item which provides additional helper functions for managing a Document (Items of Category DOC in a Matrix Instance).

Hierarchy

Constructors

Properties

toBeIntegrated: IItemGet

Methods

  • Add a new downlink to the item. Does nothing if the item is already represented

    Parameters

    • id: string

      the id of the item to add.

    • Optional title: string

      optional. The title is just for convenience. It is neither saved nor representative of the actual title of the item.

    Returns Item

    the Item

    Throws

    Error if the passed id matches the id of the current item.

  • Add a new uplink to the item. Does nothing if the item is already represented

    Parameters

    • id: string

      the id of the item to add.

    • Optional title: string

      optional. The title is just for convenience. It is neither saved nor representative of the actual title of the item.

    Returns Item

    the Item

    Throws

    Error if the passed id matches the id of the current item.

  • Create a Todo attached to this item.

    Parameters

    • users: string[]

      an array of user names

    • type: TodoTypes
    • text: string
    • atDate: Date

    Returns Promise<string>

    A comma-separated list of Todo ids (integers), relative to the Item.

  • Sometimes you've been given an Item with a restrictive ItemFieldMask, however, you'd like to set a value for a field that was not in the mask. With this method, you can expand the field mask to include the field given by the fieldId (easily obtained from the Category object).

    This field will be added to the mask, and the associated Field object will be returned with an empty value, which you could set. The object will be marked as "dirty" at this point, because we don't know if the server has an empty value for this field or not, so we assume the pessimistic case.

    Parameters

    • fieldId: number

      a valid fieldId from the Category of the item.

    Returns Field

    the Field object

    Throws

    if the fieldId is already in the ItemFieldMask, or if the fieldId is not valid for the Category.

  • Parameters

    • type: "html" | "docx" | "pdf"
    • Optional progressReporter: ((jobId, jobDetails) => void)
        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<string>

  • It's helpful to see the names of DHF fields that would show up in the UI for the DOC. Then fields can be retrieved by these names.

    Returns string[]

    A list of DOC UI field names (not "dhf01" but "Signatures", for example).

  • Get the list of DHF fields. This list only includes actual DHF fields, not the "hidden" ones.

    Returns Field[]

    DHF fields sorted by name (dhf00, dhf01, etc).

  • Retrieve an array of DOC DHF fields with the given UI name.

    Parameters

    • name: string

    Returns Field[]

    An array of Field objects from the Item.

  • This method helps you know the most appropriate FieldHandler class to use to manipulate the doc field.

    Parameters

    • handler: IDocFieldHandler

    Returns string

    the name of the handler class.

  • Returns all fields within the mask which match the fieldName.

    Parameters

    • fieldName: string

    Returns Field[]

    an array of Fields. Note that if the mask has limited the set of fields from the Category which are tracked for this particular item, the number of returned Field objects may be less than you expect.

  • Gets the ItemFieldMask which specifies which fields are loaded

    Returns ItemFieldMask

    on ItemFieldMask object

  • Returns all fields within the mask which match the fieldType.

    Parameters

    • fieldType: string

    Returns Field[]

    an array of Fields. Note that if the mask has limited the set of fields from the Category which are tracked for this particular item, the number of returned Field objects may be less than you expect.

  • Get the unique Id of the Item within the Project.

    Returns string

    a string value containing the Item Id.

  • It is often convenient to work with the "inner field" of a dhf field, where the configuration and values lie.

    Returns IDocFieldHandler[]

    An array of IDocFieldHandlers[]. The length is the number of valid fields.

  • Read-only.

    Returns number

    The highest version reached for this item, or undefined if the item hasn't yet been saved on the server.

  • Returns a Field matching the field name. The field should exist and be within the mask.

    Parameters

    • fieldName: string

    Returns Field

    a valid Field.

    Throws

    Error if there is no such field, either because the name is invalid or it is not within the mask for the Item.

  • Return the Todos associated with this item.

    Parameters

    • Optional includeDone: boolean

      if true, includes done todos

    • Optional includeAllUsers: boolean

      if true, includes all todos for all users.

    • Optional includeFuture: boolean

      false by default. If true, includes future todos.

    Returns Promise<GetTodosAck>

    Information on the Todos

  • An Item can be complete or partial, based on the ItemFieldMask passed in at construction.

    Returns boolean

    true if the item has all of its Category fields.

  • Check if there is a downlink to another item

    Parameters

    • id: string

    Returns boolean

    true if this item links to the item given by {id}

  • In case the Item is masked (hasAllFields() returns false), one or more Fields may not be tracked. hasFieldId() allows you to check if the field is present.

    Parameters

    • fieldId: number

      a valid field id within the Category

    Returns boolean

    true if the Item's mask allows for this field.

    Throws

    Error if fieldId is not valid within the Category

  • Check if there is an uplink to another item

    Parameters

    • id: string

    Returns boolean

    true if this item links to the item given by {id}

  • insert a section at a given position

    Parameters

    • number: number

      Position of the section

    • sectionName: string

      Name of the section

    • sectionType: string

      Type of the section

    Returns DHFFieldHandler

    the DHFFieldHandler inserted.

  • isFolder returns true if the Item is of Category FOLDER.

    Returns boolean

    true if a FOLDER, false otherwise

  • needsSave() checks the Fields of the Category to which the Item belongs to see if they've been changed. If so it marks the Item as dirty.

    Returns boolean

    true if the Item has changes that should be propped to the server

  • Remove a section at a given position

    Parameters

    • number: number

      The position of the element to remove.

    Returns void

    Throws

    Error if number is out of range.

  • Adds one label to the item if it isn't already set. Note that if the label is in an XOR group with another set label, that label will be removed.

    Parameters

    • labelToSet: string

    Returns Item

    Item

    Throws

    throws error if the Item category doesn't allow labels

  • Sets the labels for an Item, overwriting any previous labels

    Parameters

    • newLabels: string[]

    Returns Item

    Item

    Throws

    throws error if the Item category doesn't allow labels

  • Generate a docx document

    Parameters

    • Optional progressReporter: ((jobId, jobDetails) => void)
        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<string>

    the URL of the generated document

  • Generate a html document

    Parameters

    • Optional progressReporter: ((jobId, jobDetails) => void)
        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<string>

    the URL of the generated document

  • Generate a pdf document

    Parameters

    • Optional progressReporter: ((jobId, jobDetails) => void)
        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<string>

    the URL of the generated document

Generated using TypeDoc