mirror of
https://github.com/docmost/docmost.git
synced 2026-08-29 10:05:03 +08: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';
|
mode?: 'trgm' | 'fts';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const NO_VALUE_CHOICE_ID = '__no_value';
|
||||||
|
|
||||||
export type ViewConfig = {
|
export type ViewConfig = {
|
||||||
sorts?: ViewSortConfig[];
|
sorts?: ViewSortConfig[];
|
||||||
filter?: FilterGroup;
|
filter?: FilterGroup;
|
||||||
@@ -161,6 +163,10 @@ export type ViewConfig = {
|
|||||||
hiddenPropertyIds?: string[];
|
hiddenPropertyIds?: string[];
|
||||||
propertyWidths?: Record<string, number>;
|
propertyWidths?: Record<string, number>;
|
||||||
propertyOrder?: string[];
|
propertyOrder?: string[];
|
||||||
|
// Kanban
|
||||||
|
groupByPropertyId?: string;
|
||||||
|
hiddenChoiceIds?: string[];
|
||||||
|
choiceOrder?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IBaseView = {
|
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
|
export const viewConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
sorts: z.array(viewSortSchema).optional(),
|
sorts: z.array(viewSortSchema).optional(),
|
||||||
@@ -418,6 +420,12 @@ export const viewConfigSchema = z
|
|||||||
hiddenPropertyIds: z.array(z.uuid()).optional(),
|
hiddenPropertyIds: z.array(z.uuid()).optional(),
|
||||||
propertyWidths: z.record(z.string(), z.number().positive()).optional(),
|
propertyWidths: z.record(z.string(), z.number().positive()).optional(),
|
||||||
propertyOrder: z.array(z.uuid()).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();
|
.passthrough();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user