|
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
|
|
import { PanelOptionsSupplier } from '../panel/PanelPlugin';
|
|
|
|
|
import { isObject } from '../types';
|
|
|
|
|
import { OptionsEditorItem, OptionsUIRegistryBuilder } from '../types/OptionsUIRegistryBuilder';
|
|
|
|
|
import { FieldConfigEditorProps, FieldConfigPropertyItem, FieldConfigEditorConfig } from '../types/fieldOverrides';
|
|
|
|
|
import { FieldConfigPropertyItem, FieldConfigEditorConfig } from '../types/fieldOverrides';
|
|
|
|
|
import { PanelOptionsEditorConfig, PanelOptionsEditorItem } from '../types/panel';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@@ -26,15 +26,15 @@ import { PanelOptionsEditorConfig, PanelOptionsEditorItem } from '../types/panel
|
|
|
|
|
*/
|
|
|
|
|
export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder<
|
|
|
|
|
TOptions,
|
|
|
|
|
FieldConfigEditorProps<any, any>,
|
|
|
|
|
StandardEditorProps<any, any>,
|
|
|
|
|
FieldConfigPropertyItem<TOptions>
|
|
|
|
|
> {
|
|
|
|
|
addNumberInput<TSettings>(config: FieldConfigEditorConfig<TOptions, TSettings & NumberFieldConfigSettings, number>) {
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
override: standardEditorsRegistry.get('number').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('number').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('number').editor,
|
|
|
|
|
editor: standardEditorsRegistry.get('number').editor,
|
|
|
|
|
process: numberOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ?? (() => true),
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -45,8 +45,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
override: standardEditorsRegistry.get('slider').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('slider').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('slider').editor,
|
|
|
|
|
editor: standardEditorsRegistry.get('slider').editor,
|
|
|
|
|
process: numberOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ?? (() => true),
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -57,8 +57,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
override: standardEditorsRegistry.get('text').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('text').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('text').editor,
|
|
|
|
|
editor: standardEditorsRegistry.get('text').editor,
|
|
|
|
|
process: stringOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ?? (() => true),
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -71,8 +71,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
override: standardEditorsRegistry.get('select').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('select').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('select').editor,
|
|
|
|
|
editor: standardEditorsRegistry.get('select').editor,
|
|
|
|
|
process: selectOverrideProcessor,
|
|
|
|
|
// ???
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
@@ -84,8 +84,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
override: standardEditorsRegistry.get('radio').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('radio').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('radio').editor,
|
|
|
|
|
editor: standardEditorsRegistry.get('radio').editor,
|
|
|
|
|
process: selectOverrideProcessor,
|
|
|
|
|
// ???
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
@@ -97,8 +97,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('boolean').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('boolean').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('boolean').editor,
|
|
|
|
|
override: standardEditorsRegistry.get('boolean').editor,
|
|
|
|
|
process: booleanOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -109,8 +109,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('color').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('color').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('color').editor,
|
|
|
|
|
override: standardEditorsRegistry.get('color').editor,
|
|
|
|
|
process: identityOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -123,8 +123,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('unit').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('unit').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('unit').editor,
|
|
|
|
|
override: standardEditorsRegistry.get('unit').editor,
|
|
|
|
|
process: unitOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -137,8 +137,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('field-name').editor as any,
|
|
|
|
|
override: standardEditorsRegistry.get('field-name').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('field-name').editor,
|
|
|
|
|
override: standardEditorsRegistry.get('field-name').editor,
|
|
|
|
|
process: identityOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -152,8 +152,8 @@ export class FieldConfigEditorBuilder<TOptions> extends OptionsUIRegistryBuilder
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: editor as any,
|
|
|
|
|
override: editor as any,
|
|
|
|
|
editor: editor,
|
|
|
|
|
override: editor,
|
|
|
|
|
process: identityOverrideProcessor,
|
|
|
|
|
shouldApply: config.shouldApply ? config.shouldApply : () => true,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
@@ -226,7 +226,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('number').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('number').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -234,7 +234,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('slider').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('slider').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -242,7 +242,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('text').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('text').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -252,7 +252,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('strings').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('strings').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -262,7 +262,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('select').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('select').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -272,7 +272,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('multi-select').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('multi-select').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -282,7 +282,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('radio').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('radio').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -290,7 +290,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('boolean').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('boolean').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -298,7 +298,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('color').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('color').editor,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@@ -307,7 +307,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('timezone').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('timezone').editor,
|
|
|
|
|
settings: config.settings || {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@@ -318,7 +318,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('unit').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('unit').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -328,7 +328,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('field-name').editor as any,
|
|
|
|
|
editor: standardEditorsRegistry.get('field-name').editor,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -338,7 +338,7 @@ export class PanelOptionsEditorBuilder<TOptions> extends OptionsUIRegistryBuilde
|
|
|
|
|
return this.addCustomEditor({
|
|
|
|
|
...config,
|
|
|
|
|
id: config.path,
|
|
|
|
|
editor: standardEditorsRegistry.get('dashboard-uid').editor as any, // added at runtime
|
|
|
|
|
editor: standardEditorsRegistry.get('dashboard-uid').editor, // added at runtime
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|