Bullet Data

June 1, 2022 · View on GitHub

English | 中文

Bullet Data is aim to customize visualize configuration data. Support json data visualize.

Currently only the windows platform is supported.

Screenshots

image-20220301155635709 image-20220301152952560 image-20220301154140204

Example data at example_data folder。

Features

  • Visualize configuration data
  • convenient to dynamically modify the structure and format the data according to the configuration information
  • Support custom validation of fields
  • Supports multi-level nesting of fields
  • Supports multilingualization of data

Config Documentation

The configuration items of the fields are configured in fields. The key value in fields is the key value of the field. The configuration items of the sub-items in the field are as follows:

fieldfeaturerequired
typeDefines the type of the field, string, object, number, array, selectyes
configSegment configuration information for the corresponding typeno
nameThe name of the field displayed on the interfaceno

If the field type is object, the configuration item needs to add a new configuration item fields to describe which fields the corresponding object has, for example:

  {
      "type": "object",
      "fields": {
          "id": {
              "type": "string",
              "config": {
                  "colSpan": 3,
                  "type": "singleline"
              }
          },
          "name": {
              "type": "string",
              "config": {
                  "colSpan": 3,
                  "type": "singleline"
              }
          },
          "desc": {
              "type": "string",
              "config": {
                  "colSpan": 6,
                  "type": "multiline"
              }
          }
      }
  }

If the field type is array, a configuration item fieldSchema needs to be added to describe the data structure of the corresponding array sub-item. Example:

  {
      "type": "array",
      "fieldSchema": {
          "type": "string",
          "config": {
              "type": "multiline"
          }
      }
  }

The internationalization configuration needs to add the key of the corresponding language in the topmost i18n array. If the data is empty, the default is no internationalization. Example:

  "i18n": ["zh","en"] // Indicates that the two languages zh and en are required

Data Type Configuration

Common configuration for all types:

fieldfeaturedefault value
colSpanThe proportion of the width of the data in the card (total width 12)Type is object, array is 12, string, number is 3
defaultValueDefault value of fieldDefault value for the field type
enableWhenThe data determines whether it exists according to the conditions, js functionNone, example: "enableWhen": "(obj) => obj.name === 'good'", where obj is the object where the current field is located

object:

fieldfeaturedefault value
summaryThe content of the card title, which supports data formatting, and refers to the property value through {{your_property}}"{{___key}}", ___key is a special mark, indicating the current field name
initialExpandWhether to expand data by defaulttrue

array:

fieldfeaturedefault value
summaryThe title content of the sub-item card, which can support data formatting, and refer to the property value through {{your_property}}"{{___index}}", ___index is a special mark, indicating the serial number of the current child
initialExpandWhether to expand data by defaultfalse

string:

fieldfeaturedefault value
typeText type, "singleline" for single-line editing, "multiline" for multi-line editing, "code" for code editing"singleline"
requiredIs it necessarytrue
customValidateCustom validation function, js functionNone, example: "enableWhen": "(v) => v.includes('test')", where v is the current input value
customValidateErrorTextCustom error text when validation fails""
minLenMinimum length of text that can be entered1
maxLenMaximum length of text that can be enteredunlimited
heightThe line height of the text box, only takes effect when type=multiline or type=code"200px"
needI18nWhether internationalization is required, not work when type=codefalse
codeLangAvaible when type="code" , monca editor code language""

number:

fieldfeaturedefault value
typeNumeric type, "int" is an integer, "float" is a floating point number"float"
requiredIs it necessarytrue
customValidateCustom validation function, js functionNone, example: "enableWhen": "(v) => v > 1000", where v is the current input value
customValidateErrorTextCustom error text when validation fails""
minThe minimum value that can be enteredunlimited
maxThe maximum value that can be enteredunlimited
prefixNumerical prefix, only displayed on the interface, does not affect the actual data output""
suffixNumerical suffix, only displayed on the interface, does not affect the actual data output""

select:

fieldfeaturedefault value
optionsList of options, array format [{ "label": "Test", "value": "test"}][]

How to compile

  npm install
  npm run start