SAS logoSAS® Mobile Investigator API
    Preparing search index...

    Interface ChildPageModelApi

    interface ChildPageModelApi {
        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 extends FieldType>(
                field: string,
                callback: (unmask: { fieldValue?: FieldTypeToValue<Type> }) => void,
            ): () => void;
            reset(field: string): void;
            unmask<Type extends FieldType>(
                field: string,
            ): Promise<FieldTypeToValue<Type> | undefined>;
        };
        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): SmiPageFile | undefined;
            getDeletingCount(category: string): number;
            getFiles(category: string): SmiPageFile[];
            getFilesFetch(): | Promise<{ [category: string]: SmiPageFile[] }>
            | undefined;
            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;
        addMenuItem(
            options: {
                isDisabled?: () => boolean;
                onClick: () => void;
                text: string;
            },
        ): () => void;
        getActions<T extends ActionAttributes>(
            name: string,
        ): Action<T>[] | undefined;
        getMode(): SmiPageMode;
        getReferenceDataLabel(field: string, code: string): string | undefined;
        getUserGroupName(id: string, type: "user" | "group"): string | undefined;
        onModeChange(callback: (mode: SmiPageMode) => void): () => void;
    }

    Hierarchy

    • DataPageModelApi
      • ChildPageModelApi
    Index

    Properties

    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 extends FieldType>(
            field: string,
            callback: (unmask: { fieldValue?: FieldTypeToValue<Type> }) => void,
        ): () => void;
        reset(field: string): void;
        unmask<Type extends FieldType>(
            field: string,
        ): Promise<FieldTypeToValue<Type> | undefined>;
    }

    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.

        Returns () => void

        A function that removes the callback.

        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.

        Returns () => void

        A function that removes the callback.

        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.

    • 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.

        Returns () => void

        A function that removes the callback.

        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.

        Returns () => void

        A function that removes the callback.

    • 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

        • field: string

          The field.

        • callback: (unmask: { fieldValue?: FieldTypeToValue<Type> }) => void

          The callback function.

        Returns () => void

        A function that removes the callback.

        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<FieldTypeToValue<Type> | undefined>

        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): SmiPageFile | undefined;
        getDeletingCount(category: string): number;
        getFiles(category: string): SmiPageFile[];
        getFilesFetch(): Promise<{ [category: string]: SmiPageFile[] }> | undefined;
        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 SmiPageFile | undefined

    • 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 Promise<{ [category: string]: SmiPageFile[] }> | undefined

    • 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.

        Returns void

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

        Parameters

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

          Called when the category is reset.

        Returns () => void

        A function that removes the callback.

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

        Parameters

        Returns () => void

        A function that stops the callback running.

    • 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 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.

      Returns () => void

      A function that removes the menu item.

    • Returns the actions for the given name.

      Type Parameters

      Parameters

      • name: string

        The action name.

      Returns Action<T>[] | undefined

      An array of all the actions.

    • 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 string | undefined

    • 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 string | undefined

    • Invokes the callback whenever a page changes mode.

      Parameters

      • callback: (mode: SmiPageMode) => void

        The callback function.

      Returns () => void

      A function that removes the callback.