Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/data-plugins/lib/collections/ext-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export class PluginRender extends Plugin {
label: 'Colormap',
type: 'string',
'ui:widget': 'tagger',
allowOther: {
type: 'string'
},
enum: colorMaps
},
colormap: {
Expand All @@ -89,6 +92,9 @@ export class PluginRender extends Plugin {
label: 'Resampling',
type: 'string',
'ui:widget': 'tagger',
allowOther: {
type: 'string'
},
enum: [
['near', 'Nearest neighbour'],
['bilinear', 'Bilinear'],
Expand Down
8 changes: 4 additions & 4 deletions packages/data-widgets/lib/widgets/tagger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export function WidgetTagger(props: WidgetProps) {

if (field.type === 'string') {
if (!field.enum) {
throw new Error("WidgetTagger: 'enum' is required for string fields");
throw new Error("WidgetTagger: 'enum' is required when type is 'string'");
}

if (field.allowOther?.type !== 'string') {
throw new Error(
"WidgetTagger: 'allowOther.type' is required for the 'tagger' widget. Use the 'select' widget instead."
"WidgetTagger: 'allowOther.type' is required for the 'tagger' widget with 'enum' options. Use the 'select' widget instead."
);
}

Expand All @@ -68,14 +68,14 @@ export function WidgetTagger(props: WidgetProps) {
if (field.type === 'array') {
if (field.items.type !== 'string') {
throw new Error(
"WidgetTagger: 'items.type' must be 'string' for array fields"
"WidgetTagger: 'items.type' must be 'string' when type is 'array'"
);
}

if (field.items.enum) {
if (field.items.allowOther?.type !== 'string') {
throw new Error(
"WidgetTagger: 'items.allowOther.type' is required for the 'tagger' widget with 'enum'. Use the 'select' widget instead."
"WidgetTagger: 'items.allowOther.type' is required for the 'tagger' widget with 'enum' options. Use the 'select' widget instead."
);
}

Expand Down