Skip to content

@idealworld/formula-editor v0.6.2 / iwInterface / EditorProps

Interface: EditorProps

Editor configuration properties

Properties

addDefaultFunLib?

optional addDefaultFunLib: boolean

Whether to add a default function library

Source

processes/interface.ts:123


entrance?

optional entrance: string

Entry variables for material items

Default is $

Source

processes/interface.ts:119


formulaValue?

optional formulaValue: string

Formula value

Example

$.fun.concat($.fun.sum(1,$.field.age),3, true, ['1','2'], 'string')

Source

processes/interface.ts:113


materials

materials: Namespace[]

Material list

Used to specify the variables and functions available in the current editor

Namespace

Example

[
  {
    name: 'field',
    label: '字段',
    isVar: true,
    showLabel: true,
    showField: true,
    color: '#f8e3c5',
    items: [
      {
        name: 'applicant',
        label: '申请人',
        kind: VarKind.STRING,
        note: '表单申请人姓名',
        minLen: 2,
        maxLen: 20,
        cates: ['基础信息']
      },
      {
        name: 'age',
        label: '年龄',
        kind: VarKind.NUMBER,
        note: '年龄',
        minLen: 18,
        maxLen: 60,
        defaultValue:36,
        cates: ['基础信息']
      }
    ]
  },
  {
    name: 'fun',
    label: '函数',
    isVar: false,
    showLabel: false,
    color: '#d9ecff',
    items: [
      {
        name: 'now',
        label: '当前时间',
        note: `返回当前时间戳`,
        input: [],
        isVarLen: false,
        isAsync: false,
        output: {
            kind: VarKind.NUMBER
        },
        body: `return Date.now()`,
        cates: ['常用', '日期处理']
      }
    ]
  }
]

Source

processes/interface.ts:104


targetVar

targetVar: VarInfo

Target variable

Used to specify the target object to which the current formula is applied. The editor will check whether the formula return type matches it.

Example

{
  name: 'formName',
  label: '表单标题',
  kind: VarKind.STRING,
  note: '表单的显示名称',
  minLen: 2,
  maxLen: 20
}

Source

processes/interface.ts:39