@grafana/data#FieldConfigEditorRegistry TypeScript Examples

The following examples show how to use @grafana/data#FieldConfigEditorRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: custom.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
tableFieldRegistry: FieldConfigEditorRegistry = new Registry<FieldPropertyEditorItem>(() => {
  const columWidth: FieldPropertyEditorItem<number, NumberFieldConfigSettings> = {
    id: 'width', // Match field properties
    name: 'Column width',
    description: 'column width (for table)',

    editor: NumberValueEditor,
    override: NumberOverrideEditor,
    process: numberOverrideProcessor,

    settings: {
      placeholder: 'auto',
      min: 20,
      max: 300,
    },

    shouldApply: () => true,
  };

  const cellDisplayMode: FieldPropertyEditorItem<string, SelectFieldConfigSettings<string>> = {
    id: 'displayMode', // Match field properties
    name: 'Cell display mode',
    description: 'Color value, background, show as gauge, etc',

    editor: SelectValueEditor,
    override: SelectOverrideEditor,
    process: selectOverrideProcessor,

    settings: {
      options: [
        { value: 'auto', label: 'Auto' },
        { value: 'color-background', label: 'Color background' },
        { value: 'gradient-gauge', label: 'Gradient gauge' },
        { value: 'lcd-gauge', label: 'LCD gauge' },
      ],
    },

    shouldApply: () => true,
  };

  return [columWidth, cellDisplayMode];
})