Skip to content

informat.app Application Information Functions

Overview

Use the informat.app object to perform application-related global operations.

callAutomatic

Call automation

javascript
informat.app.callAutomatic({ automaticId, args });
ParameterTypeDescription
appIdStringID of the application to which the automation belongs. Defaults to current application if not passed
automaticIdStringAutomation identifier
argsArrayParameters passed to the automation
withoutTimeoutLoadingboolWhether to show system execution loading

Return Value Automation call result

javascript
// Call system automation
informat.app
  .callAutomatic({
    // appId: 'msucfeq7305cn',
    automaticId: "a1",
    args: ["123", 1],
  })
  .then((result) => {
    console.log(result);
  });

setAutomaticSetting

Set current application automation configuration

javascript
informat.app.setAutomaticSetting(setting);
ParameterTypeDescription
withoutLoadingbooleanWhether to disable system execution loading
loadingDelayMsnumberSet system execution loading delay (in milliseconds, default 2000)

Return Value Whether the setting was successful

javascript
informat.app.setAutomaticSetting({
  // Whether to disable system execution loading
  withoutLoading: false,
  // Set system execution loading delay
  loadingDelayMs: 1000,
});

getAutomaticSetting

Get current application automation configuration

javascript
informat.app.getAutomaticSetting();

Return Value Type is Promise<Object>

javascript
informat.app.getAutomaticSetting().then((setting) => {
  console.log(setting);
});

resetAutomaticSetting

Reset current application automation configuration to default settings

javascript
informat.app.resetAutomaticSetting();

Return Value Whether the reset was successful

javascript
informat.app.resetAutomaticSetting().then((result) => {
  console.log(result);
});

resetAllAutomaticSetting

Reset all configured application automation configurations to default settings

javascript
informat.app.resetAllAutomaticSetting();

Return Value Whether the reset was successful

javascript
informat.app.resetAllAutomaticSetting().then((result) => {
  console.log(result);
});

setAppData

Set App data on the client side

javascript
informat.app.setAppData(key, value);
ParameterTypeDescription
keyStringData key to set
valueObjectData value to set
javascript
informat.app.setAppData("count", 1000).then((res) => {
  console.log("setAppData success");
});

getAppData

Get App data with specified key on the client side

javascript
informat.app.getAppData(key);
ParameterTypeDescription
keyStringData key to get

Return Value Type is Object

javascript
informat.app.getAppData("count").then((res) => {
  console.log("getAppData success", res); // getAppData success 1000
});

getApp

Get current application information

javascript
informat.app.getApp();

Return Value Type is Promise<Application>

javascript
informat.app.getApp().then((app) => {
  console.log(app);
});

getAppEnv

Get current application environment variable information

javascript
informat.app.getAppEnv();

Return Value Type is Promise<Any>

javascript
informat.app.getAppEnv().then((env) => {
  console.log(env);
});

getAppEnvByKey

Get current application environment variable value by Key

javascript
informat.app.getAppEnvByKey(key);
ParameterTypeDescription
keyStringApplication environment variable key

Return Value Type is Promise<Any>

javascript
informat.app.getAppEnvByKey("baseUrl").then((value) => {
  console.log(value);
});

getUser

Get current application user information

javascript
informat.app.getUser();

Return Value Type is Promise<User>

javascript
informat.app.getUser().then((user) => {
  console.log(user);
});

attachmentUrl

Get data table attachment field file link

javascript
informat.app.attachmentUrl(tableKey, fieldKey, fileId);
ParameterTypeDescription
tableKeyStringModule identifier
fieldKeyStringField identifier
fileIdStringFile ID

Return Value Type is String

javascript
const attachmentUrl = informat.app.attachmentUrl("testTable", "testField", "xxxx.png");
console.log(attachmentUrl); // https://next.informat.cn/web0/file/fieldkey/gx6wpgysmthb1/testTable/testField/xxxx.png?token=xxxxxxx

baseURL

Get website module root node link

javascript
informat.app.baseURL(websiteModuleKey);
ParameterTypeDescription
websiteModuleKeyStringWebsite module identifier

Return Value Type is String

javascript
const websiteBaseUrl = informat.app.baseURL("testWebsiteModule");
console.log(websiteBaseUrl); // https://next.informat.cn/web0/website/gx6wpgysmthb1/testWebsiteModule

getRefKeys

Get list of bound platform component identifiers

javascript
informat.app.getRefKeys();

Return Value Type is Array<String>

getRef

Get components within the platform by refKey

javascript
informat.app.getRef(refKey);
ParameterTypeDescription
refKeyStringComponent ref identifier

Return Value Type is Compoent

javascript
const recordSelectDialog = informat.app.getRef("informatAutomaticRecordSelect");
console.log(recordSelectDialog);
if (recordSelectDialog) {
  recordSelectDialog.reloadData();
}

AutomaticRecordSelectComponent

Open data table record list popup

refKey Calculation Rule

Derived from the Dialog Identifier set in the Open Data Table Record List Popup

typescript
interface AutomaticRecordSelectComponent extends Component {
  /**
   * Reload data
   */
  reloadData(): void;

  /**
   * Close popup
   */
  close(): void;
}

TableViewComponent

Data table view module

refKey Calculation Rule

Derived from the Module Identifier set in module settings

typescript
interface TableViewComponent extends Component {
  /**
   * Load data,
   * @param {Number} [pageIndex] If not passed, defaults to reloading current page data
   */
  _loadData(pageIndex?: number): void;

  /**
   * Set pagination size, this operation only sets the pagination number, does not actively load data. Please call {@link _loadData} to load data
   * @param {Number} pageSize Pagination data size
   */
  _setPageSize(pageSize?: number): void;

  /**
   * Open record detail page
   * @param recordId
   */
  _openRecord(recordId: string): void;

  /**
   * Reset view filter conditions, reset page number to 1, then reload data
   */
  _resetQueryFilterConditions(): void;

  /**
   * Set view filter condition value,
   * @param {string} key  Field identifier
   * @param {any} value   Field value
   */
  _setQueryFilterConditionValue(key: string, value: any): void;

  /**
   * Set view filter condition value calculation function,
   * @param {string} key  Field identifier
   * @param {any} func   Calculation function
   */
  _setQueryFilterConditionFunc(key: string, func: any): void;

  /**
   * Set view filter condition value comparison method
   * @param {string} key  Field identifier
   * @param {any} opt   Comparison method
   */
  _setQueryFilterConditionOpt(key: string, opt: any): void;

  /**
   * Set selected records in view
   * @param {Array<string>} idList Record ID list
   * @param {string} mode          Selection mode, supports replace: reset, add: append, remove: remove, toggle: toggle selection
   */
  _setSelectionIdList(idList: Array<string>, mode: "replace" | "add" | "remove" | "toggle" | string): void;

  /**
   * Get selected record ID list in view
   * @returns Array<string>
   */
  _getSelectionIdList(): Array<string>;

  /**
   * Get data information in view
   * @returns Object
   */
  _getTableData(): {
    /**
     * Data table raw record list
     */
    tableRawRecordList: Array<Record<string, any>>;
    /**
     * Data table identifier field record list
     */
    tableRecordList: Array<Record<string, any>>;
    /**
     * View data total count
     */
    tableRecordPageTotal: number;
    /**
     * View current page number
     */
    tableRecordPageIndex: number;
    /**
     * View current page size
     */
    tableRecordPageSize: number;
  };

  /**
   * Get table view data information
   */
  _getTableGridData(): {
    /**
     * Get activated row data
     */
    activeEditRecord:
      | {
          row: any;
          rowIndex: number;
          column: Record<string, any>;
          columnIndex: number;
        }
      | undefined;
    editableColumnList: {
      edit: boolean;
      icon: string;
      id: string;
      name: string;
      type: string;
      width: string;
    }[];
  };

  /**
   * Activate next editable cell
   * @param cellActiveType Activation method for next cell
   * @param nextActiveCellEditInfoHandler  Custom activated editable cell information. If not passed, system will automatically calculate, defaults to starting from first editable cell of first row
   */
  _activeGridNextCellEdit(
    cellActiveType: "column" | "row",
    nextActiveCellEditInfoHandler?: (data: {
      /**
       * Get activated row data
       */
      activeEditRecord:
        | {
            row: any;
            rowIndex: number;
            column: Record<string, any>;
            columnIndex: number;
          }
        | undefined;
      /**
       * Activation method for next cell
       */
      cellActiveType: string;
      /**
       * Editable column data
       */
      editableColumnList: {
        edit: boolean;
        icon: string;
        id: string;
        name: string;
        type: string;
        width: string;
      }[];
    }) => {
      editRowIndex: number;
      editColumnIndex: number;
    }
  ): Promise<any>;

  /**
   * Activate specified cell
   * @param recordId  Record ID
   * @param columnIndex   Column ID, defaults to 0 if not passed
   */
  _activeGridCellEdit(recordId: string, columnIndex?: number): Promise<any>;
}

DashboardModuleComponent

Dashboard module

refKey Calculation Rule

Derived from the Module Identifier set in module settings

typescript
interface DashboardModuleComponent extends Component {
  /**
   * Reload dashboard data
   */
  _loadData(): void;

  /**
   * Set dashboard filter condition value
   * @param {string} key  Field identifier
   * @param {any} value   Field value
   */
  _setFilterConditionValue(key: string, value: any): void;

  /**
   * Get card list
   */
  _getCardList(): Array<{
    /**
     * Card ID
     */
    id: string;
    /**
     * Card name
     */
    name: string;
    /**
     * Card type
     */
    type: string;
    /**
     * Whether inside card (tab card, card container, collapsible panel)
     */
    isInTab: boolean;
  }>;

  /**
   * Refresh card
   * @param {string} cardId
   */
  _loadCardData(cardId: string): void;

  /**
   * Set dashboard card filter condition value
   * @param {string} cardId
   * @param {string} key
   * @param {string} value
   */
  _setCardFilterConditionValue(cardId: string, key: string, value: any): void;
}

RecordFormComponent

Data form

refKey Calculation Rule

TableForm-{Module Identifier}-{Record ID}

When the record doesn't exist, the Record ID is replaced with an empty string.

For example:

Assuming there's an Employee Table module with identifier staff

Then Record Detail Page (Record ID: zhangsan): TableForm-staff-zhangsan Then Record Create Page: TableForm-staff-

typescript
interface RecordFormComponent extends Component {
  /**
   * Get form data information
   */
  _getFormData(): {
    /**
     * Application information
     */
    app: Record<string, any>;
    /**
     * User information
     */
    user: User;
    /**
     * Form record data
     */
    formRecord: Record<string, any>;
    /**
     * Form module identifier
     */
    formModuleKey: string;
  };

  /**
   * Set field value
   * @param {string} key  Field identifier
   * @param {any} value   Field value
   * @param {string} setType Setting method, only effective for sub-table fields.reset: overwrite, append: append to end, insert: append to start
   * @private
   */
  _setFieldValue(key: string, value: any, setType?: "reset" | "append" | "insert" | string): void;

  /**
   * Close current form
   */
  _close(): void;

  /**
   * Reload form
   * @private
   */
  _reload(): void;

  /**
   * Validate form
   * @param callback Callback function after validation, passing form validation result
   */
  _validate(callback?: (valid: boolean) => {}): void;
}

RecordFormFieldComponent

Data form field

refKey Calculation Rule

TableForm-{Module Identifier}-{Record ID}-Field-{Field Identifier}

When the record doesn't exist, the Record ID is replaced with an empty string.

For example:

Assuming there's an Employee Table module with identifier staff, and a resume lookup field resumeLookup

Then Record Detail Page (Record ID: zhangsan): TableForm-staff-zhangsan-Field-resumeLookup Then Record Create Page: TableForm-staff--Field-resumeLookup

typescript
/**
 * Data table field
 */
interface RecordFormFieldComponent extends Component {
  /**
   * Get form associated list, sub-object, lookup list field data information
   */
  _getTableFormData(): {
    /**
     * Get activated row data
     */
    activeEditRecord:
      | {
          row: any;
          rowIndex: number;
          column: Record<string, any>;
          columnIndex: number;
        }
      | undefined;
    editableColumnList: {
      edit: boolean;
      icon: string;
      id: string;
      name: string;
      type: string;
      width: string;
    }[];
  };

  /**
   * Activate next editable cell in form associated list, sub-object, lookup list
   * @param cellActiveType Activation method for next cell
   * @param nextActiveCellEditInfoHandler  Custom activated editable cell information. If not passed, system will automatically calculate, defaults to starting from first editable cell of first row
   */
  _activeTableNextCellEdit(
    cellActiveType: "column" | "row",
    nextActiveCellEditInfoHandler?: (data: {
      /**
       * Get activated row data
       */
      activeEditRecord:
        | {
            row: any;
            rowIndex: number;
            column: Record<string, any>;
            columnIndex: number;
          }
        | undefined;
      /**
       * Activation method for next cell
       */
      cellActiveType: string;
      /**
       * Editable column data
       */
      editableColumnList: {
        edit: boolean;
        icon: string;
        id: string;
        name: string;
        type: string;
        width: string;
      }[];
    }) => {
      editRowIndex: number;
      editColumnIndex: number;
    }
  ): Promise<any>;

  /**
   * Activate specified cell in form associated list, sub-object, lookup list
   * @param recordId  Record ID
   * @param columnIndex   Column ID, defaults to 0 if not passed
   */
  _activeTableCellEdit(recordId: string, columnIndex?: number): Promise<any>;
}

onAnyRefMounted

Listen for any component instance mounting

typescript
informat.app.onAnyRefMounted(handler);
js
informat.app.onAnyRefMounted((data) => {
  console.log("[" + data.refKey + "] onAnyRefMounted", data.data);
});

onceAnyRefMounted

Listen once for any component instance mounting

typescript
informat.app.onceAnyRefMounted(handler);
js
informat.app.onceAnyRefMounted((data) => {
  console.log("[" + data.refKey + "] onceAnyRefMounted", data.data);
});

offAnyRefMounted

Remove listener for any component instance mounting

typescript
informat.app.offAnyRefMounted(handler);
js
informat.app.onceAnyRefMounted((data) => {
  console.log("[" + data.refKey + "] offAnyRefMounted", data.data);
});

onRefMounted

Listen for component instance mounting

typescript
informat.app.onRefMounted(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onRefMounted("staff", (data) => {
  console.log("[" + data.refKey + "] onRefMounted", data.data);
});

onceRefMounted

Listen once for component instance mounting

typescript
informat.app.onceRefMounted(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onceRefMounted("staff", (data) => {
  console.log("[" + data.refKey + "] onceRefMounted", data.data);
});

offRefMounted

Remove listener for component instance mounting

typescript
informat.app.offRefMounted(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.offRefMounted("staff", (data) => {
  console.log("[" + data.refKey + "] offRefMounted", data.data);
});

onAnyRefDestroy

Listen for any component instance destruction

typescript
informat.app.onAnyRefDestroy(handler);
js
informat.app.onAnyRefDestroy((data) => {
  console.log("[" + data.refKey + "] onAnyRefDestroy", data.data);
});

onceAnyRefDestroy

Listen once for any component instance destruction

typescript
informat.app.onceAnyRefDestroy(handler);
js
informat.app.onceAnyRefDestroy((data) => {
  console.log("[" + data.refKey + "] onceAnyRefDestroy", data.data);
});

offAnyRefDestroy

Remove listener for any component instance destruction

typescript
informat.app.offAnyRefDestroy(handler);
js
informat.app.offAnyRefDestroy((data) => {
  console.log("[" + data.refKey + "] offAnyRefDestroy", data.data);
});

onRefDestroy

Remove listener for any component instance destruction

typescript
informat.app.onRefDestroy(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onRefDestroy("staff", (data) => {
  console.log("[" + data.refKey + "] onRefDestroy", data.data);
});

onceRefDestroy

Listen once for component instance destruction

typescript
informat.app.onceRefDestroy(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onceRefDestroy("staff", (data) => {
  console.log("[" + data.refKey + "] onceRefDestroy", data.data);
});

offRefDestroy

Remove listener for component instance destruction

typescript
informat.app.offRefDestroy(refKey, handler);
js
// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.offRefDestroy("staff", (data) => {
  console.log("[" + data.refKey + "] offRefDestroy", data.data);
});