add select spec to union list items

This commit is contained in:
Matt Hill
2023-03-27 22:42:38 -06:00
parent 5caa9db886
commit 53ef640ed7
4 changed files with 27 additions and 8 deletions

View File

@@ -5,9 +5,8 @@ import {
InputSpec,
UniqueBy,
ValueSpecList,
ValueSpecListOf,
} from "../config-types";
import { guardAll, typeFromProps } from "../../util";
import { guardAll } from "../../util";
/**
* Used as a subtype of Value.list
@@ -116,6 +115,11 @@ export class List<A extends ValueSpecList> extends IBuilder<A> {
default: Record<string, unknown>[];
range: string;
spec: {
select: {
name: string;
description: string | null;
warning: string | null;
}
variants: Variants<{
[key: string]: { name: string; spec: InputSpec };
}>;

View File

@@ -159,17 +159,22 @@ export interface ListValueSpecObject {
export type UniqueBy =
| null
| undefined
| string
| { any: readonly UniqueBy[] | UniqueBy[] }
| { all: readonly UniqueBy[] | UniqueBy[] };
export interface ListValueSpecUnion {
select: {
name: string
description: null | string
warning: null | string
}
variants: { [key: string]: { name: string; spec: InputSpec } };
/** this may be a handlebars template which can conditionally (on tag.id) make use of each union's entries, or if left blank will display as tag.id*/
/** a handlebars template for labeling each union list item */
displayAs: null | string;
/** indicates whether duplicates can be permitted in the list */
uniqueBy: UniqueBy;
/** this should be the variantName which one prefers a user to start with by default when creating a new union instance in a list*/
/** the default variant when creating a new union instance in the list*/
default: null | string;
}