mirror of
https://github.com/docmost/docmost.git
synced 2026-07-09 14:44:33 +10:00
feat(bases): add kanban view config fields to schema
This commit is contained in:
@@ -154,6 +154,8 @@ export type SearchSpec = {
|
||||
mode?: 'trgm' | 'fts';
|
||||
};
|
||||
|
||||
export const NO_VALUE_CHOICE_ID = '__no_value';
|
||||
|
||||
export type ViewConfig = {
|
||||
sorts?: ViewSortConfig[];
|
||||
filter?: FilterGroup;
|
||||
@@ -161,6 +163,10 @@ export type ViewConfig = {
|
||||
hiddenPropertyIds?: string[];
|
||||
propertyWidths?: Record<string, number>;
|
||||
propertyOrder?: string[];
|
||||
// Kanban
|
||||
groupByPropertyId?: string;
|
||||
hiddenChoiceIds?: string[];
|
||||
choiceOrder?: string[];
|
||||
};
|
||||
|
||||
export type IBaseView = {
|
||||
|
||||
@@ -410,6 +410,8 @@ const viewFilterGroupSchema: z.ZodType<ViewFilterGroup> = z.lazy(() =>
|
||||
}),
|
||||
);
|
||||
|
||||
export const NO_VALUE_CHOICE_ID = '__no_value';
|
||||
|
||||
export const viewConfigSchema = z
|
||||
.object({
|
||||
sorts: z.array(viewSortSchema).optional(),
|
||||
@@ -418,6 +420,12 @@ export const viewConfigSchema = z
|
||||
hiddenPropertyIds: z.array(z.uuid()).optional(),
|
||||
propertyWidths: z.record(z.string(), z.number().positive()).optional(),
|
||||
propertyOrder: z.array(z.uuid()).optional(),
|
||||
// Kanban-only fields. `hiddenChoiceIds` and `choiceOrder` accept
|
||||
// `z.string()` (not `z.uuid()`) because the NO_VALUE_CHOICE_ID
|
||||
// sentinel ('__no_value') lives in the same array as choice uuids.
|
||||
groupByPropertyId: z.uuid().optional(),
|
||||
hiddenChoiceIds: z.array(z.string()).optional(),
|
||||
choiceOrder: z.array(z.string()).optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user