interface ParentPageModelApi {
    attachment: PageAttachmentsApi;
    events: PageEventsApi;
    field: ControlPageFieldApi & {
        isMasked(field: string): boolean;
        mask(field: string): void;
        onAnyMask(callback: ((mask: {
            field: string;
            fieldValue: string;
        }) => void)): (() => void);
        onAnyUnmask(callback: ((unmask: {
            field: string;
            fieldValue?: FieldValue;
        }) => void)): (() => void);
        onFieldChange(callback: ((change: FieldChange<NonNullable<FieldValue>>) => void)): (() => void);
        onMask(field: string, callback: ((mask: {
            fieldValue: string;
        }) => void)): (() => void);
        onReset(field: string, callback: (() => void)): (() => void);
        onUnmask<Type>(field: string, callback: ((unmask: {
            fieldValue?: FieldTypeToValue<Type>;
        }) => void)): (() => void);
        reset(field: string): void;
        unmask<Type>(field: string): Promise<undefined | FieldTypeToValue<Type>>;
    };
    file: ControlFileApiBase & {
        addFiles(files: (Blob | File)[], category: string): FileChange;
        deleteByUuids(fileUuids: string[]): FileChange;
        deleteFiles(indexes: number[], category: string): FileChange;
        getAddingCount(category: string): number;
        getByUuid(fileUuid: string): undefined | SmiPageFile;
        getDeletingCount(category: string): number;
        getFiles(category: string): SmiPageFile[];
        getFilesFetch(): undefined | Promise<{
            [category: string]: SmiPageFile[];
        }>;
        onFileChange(callback: ((change: FileChange) => void)): void;
        onReset(category: string, callback: (() => void)): (() => void);
        onUploadStart(callback: ((change: UploadFileChange) => void)): (() => void);
        reset(category: string): void;
        upload(fileModels: SmiPageFile[]): UploadFileChange;
    };
    isDraft: boolean;
    isExternalObject: boolean;
    masking: MaskingPageApi;
    objectId: string;
    objectLabel?: string;
    objectName: string;
    uuid: string;
    addChild(childName: string): ChildPageModelApi;
    addMenuItem(options: {
        isDisabled?: (() => boolean);
        onClick: (() => void);
        text: string;
    }): (() => void);
    getActions<T>(name: string): undefined | Action<T>[];
    getChildren(childName: string): ChildPageModelApi[];
    getMode(): SmiPageMode;
    getReferenceDataLabel(field: string, code: string): undefined | string;
    getUserGroupName(id: string, type: "user" | "group"): undefined | string;
    onModeChange(callback: ((mode: SmiPageMode) => void)): (() => void);
}

Hierarchy

  • DataPageModelApi
    • ParentPageModelApi

Properties

attachment: PageAttachmentsApi

An API relating to page attachments

field: ControlPageFieldApi & {
    isMasked(field: string): boolean;
    mask(field: string): void;
    onAnyMask(callback: ((mask: {
        field: string;
        fieldValue: string;
    }) => void)): (() => void);
    onAnyUnmask(callback: ((unmask: {
        field: string;
        fieldValue?: FieldValue;
    }) => void)): (() => void);
    onFieldChange(callback: ((change: FieldChange<NonNullable<FieldValue>>) => void)): (() => void);
    onMask(field: string, callback: ((mask: {
        fieldValue: string;
    }) => void)): (() => void);
    onReset(field: string, callback: (() => void)): (() => void);
    onUnmask<Type>(field: string, callback: ((unmask: {
        fieldValue?: FieldTypeToValue<Type>;
    }) => void)): (() => void);
    reset(field: string): void;
    unmask<Type>(field: string): Promise<undefined | FieldTypeToValue<Type>>;
}

Methods that relate to object fields associated with the page.

Type declaration

  • isMasked:function
    • Determines whether a field is masked.

      Parameters

      • field: string

        The field.

      Returns boolean

      A boolean.

      In favour of the methods at this.controlApi.page.masking.

  • mask:function
    • Masks a field.

      Parameters

      • field: string

        The field.

      Returns void

      In favour of the methods at this.controlApi.page.masking.

  • onAnyMask:function
    • Invokes the callback whenever any field value is masked.

      Parameters

      • callback: ((mask: {
            field: string;
            fieldValue: string;
        }) => void)

        The callback function.

          • (mask): void
          • Parameters

            • mask: {
                  field: string;
                  fieldValue: string;
              }
              • field: string
              • fieldValue: string

            Returns void

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

      In favour of the methods at this.controlApi.page.masking

  • onAnyUnmask:function
    • Invokes the callback whenever any field value is unmasked. fieldValue is optional for the case where a mode change results in the masked field not being present in the page response.

      Parameters

      • callback: ((unmask: {
            field: string;
            fieldValue?: FieldValue;
        }) => void)

        The callback function.

          • (unmask): void
          • Parameters

            • unmask: {
                  field: string;
                  fieldValue?: FieldValue;
              }

            Returns void

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

      In favour of the methods at this.controlApi.page.masking.

  • onFieldChange:function
    • The supplied callback function will run whenever there is a field change.

      Parameters

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

  • onMask:function
    • Invokes the callback whenever the specified field's value is masked.

      Parameters

      • field: string

        The field.

      • callback: ((mask: {
            fieldValue: string;
        }) => void)

        The callback function.

          • (mask): void
          • Parameters

            • mask: {
                  fieldValue: string;
              }
              • fieldValue: string

            Returns void

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

      In favour of the methods at this.controlApi.page.masking.

  • onReset:function
    • Add callbacks to know when the field is reset.

      Parameters

      • field: string
      • callback: (() => void)

        Called when the field is reset.

          • (): void
          • Returns void

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

  • onUnmask:function
    • Invokes the callback whenever the specified field's value is unmasked. fieldValue is optional for the case where a mode change results in the masked field not being present in the page response.

      Type Parameters

      • Type extends FieldType

      Parameters

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

      In favour of the methods at this.controlApi.page.masking.

  • reset:function
    • Resets the field's value to what it was before any edits in the current page mode.

      Parameters

      • field: string

        The field to reset.

      Returns void

  • unmask:function
    • Fetches the unmasked field value and returns it. Note that this also mutates the entry in the field values map, such that subsequent get field value calls return the unmasked value. If the field is already unmasked the returned promise immediately resolves to the value without the fetch. If the user is not authorized to reveal the redacted field, the returned promise will reject.

      Type Parameters

      • Type extends FieldType

      Parameters

      • field: string

        The field.

      Returns Promise<undefined | FieldTypeToValue<Type>>

      A promise that resolves to the field value.

      In favour of the methods at this.controlApi.page.masking.

file: ControlFileApiBase & {
    addFiles(files: (Blob | File)[], category: string): FileChange;
    deleteByUuids(fileUuids: string[]): FileChange;
    deleteFiles(indexes: number[], category: string): FileChange;
    getAddingCount(category: string): number;
    getByUuid(fileUuid: string): undefined | SmiPageFile;
    getDeletingCount(category: string): number;
    getFiles(category: string): SmiPageFile[];
    getFilesFetch(): undefined | Promise<{
        [category: string]: SmiPageFile[];
    }>;
    onFileChange(callback: ((change: FileChange) => void)): void;
    onReset(category: string, callback: (() => void)): (() => void);
    onUploadStart(callback: ((change: UploadFileChange) => void)): (() => void);
    reset(category: string): void;
    upload(fileModels: SmiPageFile[]): UploadFileChange;
}

Methods related to files associated with the page.

Type declaration

  • addFiles:function
    • Adds the given files to the supplied category.

      Parameters

      • files: (Blob | File)[]

        The File or Blob object.

      • category: string

        The file category.

      Returns FileChange

  • deleteByUuids:function
    • Deletes files with a matching UUIDs to those in the supplied array of UUID's.

      Parameters

      • fileUuids: string[]

        Array of file UUIDs to be deleted.

      Returns FileChange

  • deleteFiles:function
    • Deletes the files at the given indexes from the supplied category.

      Parameters

      • indexes: number[]

        The indexes.

      • category: string

        The file category.

      Returns FileChange

  • getAddingCount:function
    • Returns the number of pending adds for the supplied category.

      Parameters

      • category: string

        The category to get the number of pending adds for.

      Returns number

  • getByUuid:function
    • Returns the file with the UUID that matches the supplied UUID.

      Parameters

      • fileUuid: string

        The UUID of the file to be retrieved.

      Returns undefined | SmiPageFile

  • getDeletingCount:function
    • Returns the number of pending deletes for the supplied category.

      Parameters

      • category: string

        The category for which to get the number of pending deletes.

      Returns number

  • getFiles:function
    • Returns the files for the supplied category.

      Parameters

      • category: string

        The file category.

      Returns SmiPageFile[]

  • getFilesFetch:function
    • Returns the files fetch promise for the current object. Files are lazily loaded for children.

      Returns undefined | Promise<{
          [category: string]: SmiPageFile[];
      }>

  • onFileChange:function
    • The supplied callback function will run whenever there is a file change.

      Parameters

      • callback: ((change: FileChange) => void)

        The callback that will be invoked when there is a file change.

          • (change): void
          • Parameters

            Returns void

      Returns void

  • onReset:function
    • Add callbacks to know when the category is reset.

      Parameters

      • category: string
      • callback: (() => void)

        Called when the category is reset.

          • (): void
          • Returns void

      Returns (() => void)

      A function that removes the callback.

        • (): void
        • Returns void

  • onUploadStart:function
    • The callback will run whenever there is an upload of a file.

      Parameters

      Returns (() => void)

      A function that stops the callback running.

        • (): void
        • Returns void

  • reset:function
    • Resets the files of the given category to what they were before any edits were made in the current page mode.

      Parameters

      • category: string

        The category to reset.

      Returns void

  • upload:function
isDraft: boolean

Returns whether the page is a draft.

isExternalObject: boolean

Checks if the object is external.

masking: MaskingPageApi
objectId: string

The object ID, if applicable. Otherwise "".

objectLabel?: string
objectName: string

The object name, if applicable. Otherwise "".

uuid: string

Methods

  • Adds and returns a child page model of the parent page model. Returns an error if the parent cannot have a child with the supplied name.

    Parameters

    • childName: string

      The child name.

    Returns ChildPageModelApi

    The child page.

  • Adds a menu item for the page. Note that this applies to object pages that are not part of a wizard, that is, adding a menu item to the parent object header.

    Parameters

    • options: {
          isDisabled?: (() => boolean);
          onClick: (() => void);
          text: string;
      }

      The options for the menu item: the text string, a click listener function, and an optional function to disable the item.

      • OptionalisDisabled?: (() => boolean)
          • (): boolean
          • Returns boolean

      • onClick: (() => void)
          • (): void
          • Returns void

      • text: string

    Returns (() => void)

    A function that removes the menu item.

      • (): void
      • Returns void

  • Returns the actions for the given name.

    Type Parameters

    Parameters

    • name: string

      The action name.

    Returns undefined | Action<T>[]

    An array of all the actions.

  • Returns the child page models for all instances of a given child name. Returns an error if the parent cannot have a child with the supplied name.

    Parameters

    • childName: string

      The child name.

    Returns ChildPageModelApi[]

    The child pages for the given child name.

  • Returns the reference data label for a given reference data field and code. Note that this is relevant only in View mode, when labels for codes in the field values are returned in the data source part of the page response (meaning there is no need to fetch all reference data).

    Parameters

    • field: string

      The reference data field.

    • code: string

      The reference data code.

    Returns undefined | string

  • Returns the user group name for the given ID and type. Note that only names that are given as part of the pages' users or groups can be returned (i.e. existing user group values from field values).

    Parameters

    • id: string

      The ID of the user group.

    • type: "user" | "group"

      The type of the user group.

    Returns undefined | string

  • Invokes the callback whenever a page changes mode.

    Parameters

    • callback: ((mode: SmiPageMode) => void)

      The callback function.

    Returns (() => void)

    A function that removes the callback.

      • (): void
      • Returns void