feat: Improve auto-form layout (#7150)

This commit is contained in:
Michael Genson
2026-02-26 10:50:45 -06:00
committed by GitHub
parent 669df6bbb4
commit 8144799733
16 changed files with 313 additions and 224 deletions

View File

@@ -26,8 +26,10 @@ export function useReadOnlyActions<T extends BoundT>(
api: BaseCRUDAPIReadOnly<T>,
allRef: Ref<T[] | null> | null,
loading: Ref<boolean>,
defaultQueryParams: Record<string, QueryValue> = {},
): ReadOnlyStoreActions<T> {
function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
params = { ...defaultQueryParams, ...params };
params.orderBy ??= "name";
params.orderDirection ??= "asc";
@@ -56,6 +58,7 @@ export function useReadOnlyActions<T extends BoundT>(
}
async function refresh(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
params = { ...defaultQueryParams, ...params };
params.orderBy ??= "name";
params.orderDirection ??= "asc";
@@ -86,8 +89,10 @@ export function useStoreActions<T extends BoundT>(
api: BaseCRUDAPI<unknown, T, unknown>,
allRef: Ref<T[] | null> | null,
loading: Ref<boolean>,
defaultQueryParams: Record<string, QueryValue> = {},
): StoreActions<T> {
function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
params = { ...defaultQueryParams, ...params };
params.orderBy ??= "name";
params.orderDirection ??= "asc";
@@ -116,6 +121,7 @@ export function useStoreActions<T extends BoundT>(
}
async function refresh(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
params = { ...defaultQueryParams, ...params };
params.orderBy ??= "name";
params.orderDirection ??= "asc";