文档

集成

定义新字段

测试版功能

插件支持目前处于内部测试阶段。在此加入测试

我们支持以下字段类型:

  • string:文本输入字段。

    // ... other fields ...
    .field(
      "stringField", // The key of the field.
      "string", // Type of the field.
      {
        displayName: "A string field",
        subtitle: "Subtitle", // Optional subtitle for the field. (Show below the field)
        hint: "Hint", // Optional hint for the field. (Show on hover)
        isParagraph: false, // Whether to show a large text input area for this field.
        isProtected: false, // Whether the value should be obscured in the UI (e.g., for passwords).
        placeholder: "Placeholder text", // Optional placeholder text for the field.
      },
      "default value", // Default Value
    )
    // ... other fields ...
    
  • numeric:数字输入字段,带可选的验证和滑块用户界面。

    // ... other fields ...
    .field(
      "numberField", // The key of the field.
      "numeric", // Type of the field.
      {
        displayName: "A number field",
        subtitle: "Subtitle for", // Optional subtitle for the field. (Show below the field)
        hint: "Hint for number field", // Optional hint for the field. (Show on hover)
        int: false, // Whether the field should accept only integer values.
        min: 0, // Minimum value for the field.
        max: 100, // Maximum value for the field.
        slider: {
          // If present, configurations for the slider UI
          min: 0, // Minimum value for the slider.
          max: 100, // Maximum value for the slider.
          step: 1, // Step value for the slider.
        },
      },
      42, // Default Value
    )
    // ... other fields ...
    
  • boolean:复选框或切换输入字段。

    // ... other fields ...
    .field(
      "booleanField", // The key of the field.
      "boolean", // Type of the field.
      {
        displayName: "A boolean field",
        subtitle: "Subtitle", // Optional subtitle for the field. (Show below the field)
        hint: "Hint", // Optional hint for the field. (Show on hover)
      },
      true, // Default Value
    )
    // ... other fields ...
    
  • stringArray:字符串值数组,带可配置的约束。

    // ... other fields ...
    .field(
      "stringArrayField",
      "stringArray",
      {
        displayName: "A string array field",
        subtitle: "Subtitle", // Optional subtitle for the field. (Show below the field)
        hint: "Hint", // Optional hint for the field. (Show on hover)
        allowEmptyStrings: true, // Whether to allow empty strings in the array.
        maxNumItems: 5, // Maximum number of items in the array.
      },
      ["default", "values"], // Default Value
    )
    // ... other fields ...
    
  • select:带预定义选项的下拉选择字段。

    // ... other fields ...
    .field(
      "selectField",
      "select",
      {
        displayName: "A select field",
        options: [
          { value: "option1", displayName: "Option 1" },
          { value: "option2", displayName: "Option 2" },
          { value: "option3", displayName: "Option 3" },
        ],
        subtitle: "Subtitle", // Optional subtitle for the field. (Show below the field)
        hint: "Hint", // Optional hint for the field. (Show on hover)
      },
      "option1", // Default Value
    )
    // ... other fields ...
    

此页面的源代码可在 GitHub 上找到