xladmin 0.3.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -32,6 +32,8 @@ export type AdminClient = {
32
32
  processed: number;
33
33
  } & Record<string, unknown>>;
34
34
  runObjectAction: (slug: string, id: string | number, actionSlug: string, payload?: Record<string, unknown>) => Promise<AdminObjectActionResponse>;
35
+ getBulkActionChoices: (slug: string, actionSlug: string, fieldName: string, q?: string, ids?: Array<string | number>, options?: AdminRequestOptions) => Promise<AdminChoicesResponse>;
36
+ getObjectActionChoices: (slug: string, id: string | number, actionSlug: string, fieldName: string, q?: string, ids?: Array<string | number>, options?: AdminRequestOptions) => Promise<AdminChoicesResponse>;
35
37
  getChoices: (slug: string, fieldName: string, q?: string, ids?: Array<string | number>, options?: AdminRequestOptions) => Promise<AdminChoicesResponse>;
36
38
  getFilterChoices: (slug: string, filterSlug: string, q?: string, ids?: Array<string | number>, options?: AdminRequestOptions) => Promise<AdminChoicesResponse>;
37
39
  };
@@ -0,0 +1,25 @@
1
+ import type { AdminClient } from '../client';
2
+ import type { AdminFormFieldMeta, AdminLocale } from '../types';
3
+ type ActionFormDialogProps = {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ onSuccess: () => void;
7
+ title: string;
8
+ submitLabel?: string;
9
+ slug: string;
10
+ locale: AdminLocale;
11
+ fields: AdminFormFieldMeta[];
12
+ client: AdminClient;
13
+ choiceScope: ({
14
+ kind: 'bulk-action';
15
+ actionSlug: string;
16
+ } | {
17
+ kind: 'object-action';
18
+ actionSlug: string;
19
+ itemId: string | number;
20
+ });
21
+ initialValues?: Record<string, unknown>;
22
+ onSubmit: (payload: Record<string, unknown>) => Promise<void>;
23
+ };
24
+ export declare function ActionFormDialog({ open, onClose, onSuccess, title, submitLabel, slug, locale, fields, client, choiceScope, initialValues, onSubmit, }: ActionFormDialogProps): import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -1,12 +1,26 @@
1
1
  import type { AdminClient } from '@xladmin-core/client';
2
- import type { AdminFieldMeta } from '@xladmin-core/types';
2
+ import type { AdminEditableFieldMeta } from '@xladmin-core/types';
3
3
  type AdminFieldEditorProps = {
4
- field: AdminFieldMeta;
4
+ field: AdminEditableFieldMeta;
5
5
  value: unknown;
6
6
  onChange: (value: unknown) => void;
7
7
  slug: string;
8
8
  client: AdminClient;
9
+ choiceScope?: ({
10
+ kind: 'model';
11
+ } | {
12
+ kind: 'bulk-action';
13
+ actionSlug: string;
14
+ } | {
15
+ kind: 'object-action';
16
+ actionSlug: string;
17
+ itemId: string | number;
18
+ });
9
19
  readOnly?: boolean;
20
+ isPickerOpen?: boolean;
21
+ hasAnotherPickerOpen?: boolean;
22
+ onRequestPickerOpen?: () => void;
23
+ onRequestPickerClose?: () => void;
10
24
  };
11
25
  export type FieldEditorProps = AdminFieldEditorProps;
12
26
  export declare const FieldEditor: import("react").NamedExoticComponent<AdminFieldEditorProps>;
@@ -16,6 +16,7 @@ export declare function useModelPageController({ client, slug, pathname, locatio
16
16
  appliedQuery: string;
17
17
  bulkActionMenuAnchor: HTMLElement | null;
18
18
  bulkActions: import("@xladmin-core/types").AdminBulkActionMeta[];
19
+ activeBulkAction: import("@xladmin-core/types").AdminBulkActionMeta | null;
19
20
  clearBulkDeleteState: () => void;
20
21
  createOpen: boolean;
21
22
  currentPage: number;
@@ -28,6 +29,7 @@ export declare function useModelPageController({ client, slug, pathname, locatio
28
29
  filtersOpen: boolean;
29
30
  handleClearDeletePreview: () => void;
30
31
  handleCloseBulkActionMenu: () => void;
32
+ handleCloseBulkActionForm: () => void;
31
33
  handleCloseRowMenu: () => void;
32
34
  handleConfirmDelete: () => Promise<void>;
33
35
  handleFilterChange: (filterSlug: string, value: string) => void;
@@ -39,6 +41,7 @@ export declare function useModelPageController({ client, slug, pathname, locatio
39
41
  handleResetFilters: () => void;
40
42
  handleRowDelete: (rowId: string | number) => Promise<void>;
41
43
  handleRunNamedBulkAction: (actionSlug: string) => Promise<void>;
44
+ handleSubmitBulkActionForm: (payload: Record<string, unknown>) => Promise<void>;
42
45
  handleSearchCommit: (nextQuery: string) => void;
43
46
  handleSelectAllMatching: () => void;
44
47
  handleToggleAllVisible: (checked: boolean) => void;
@@ -13,6 +13,7 @@ type UseObjectPageControllerOptions = {
13
13
  export declare function useObjectPageController({ client, slug, id, listPath, router, t, }: UseObjectPageControllerOptions): {
14
14
  actionsAnchorEl: HTMLElement | null;
15
15
  activeActionSlug: string | null;
16
+ activeObjectAction: import("@xladmin-core/types").AdminObjectActionMeta | null;
16
17
  data: AdminDetailResponse | null;
17
18
  deleteConfirmOpen: boolean;
18
19
  deletePreview: AdminDeletePreviewResponse | null;
@@ -27,6 +28,8 @@ export declare function useObjectPageController({ client, slug, id, listPath, ro
27
28
  handleOpenDeletePreview: () => Promise<void>;
28
29
  handleRunObjectAction: (actionSlug: string) => Promise<void>;
29
30
  handleSave: () => Promise<void>;
31
+ handleCloseObjectActionForm: () => void;
32
+ handleSubmitObjectActionForm: (payload: Record<string, unknown>) => Promise<void>;
30
33
  initialValues: Record<string, unknown>;
31
34
  isActionsMenuOpen: boolean;
32
35
  isDeletePreviewLoading: boolean;