@dskripchenko/laravel-admin 1.33.0 → 1.34.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.
@@ -1,8 +1,9 @@
1
1
  interface Props {
2
2
  title?: string;
3
- content: string;
3
+ content?: string | null;
4
4
  }
5
5
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
6
6
  title: string;
7
+ content: string | null;
7
8
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
9
  export default _default;
@@ -1,14 +1,4 @@
1
1
  type SemanticTone = 'neutral' | 'positive' | 'negative' | 'warning' | 'info';
2
- /**
3
- * The backend's StatsOverviewWidget::data() returns an array of
4
- * `stats: [{label, value, change: {delta, direction}, color, icon}]`. This
5
- * StatWidget takes the first stat and renders a UidStat; several stats in one
6
- * widget are not supported yet, and a host that needs them declares several
7
- * StatWidgets.
8
- *
9
- * It also works with the older scalar values, where the widget sent `value`
10
- * directly, but stats[0] wins.
11
- */
12
2
  interface StatChange {
13
3
  delta?: number;
14
4
  direction?: 'up' | 'down' | 'flat';
@@ -6,7 +6,7 @@ interface Props {
6
6
  title?: string | null;
7
7
  /** 'left' | 'right' | 'top' | 'bottom'. */
8
8
  position?: string | null;
9
- /** sm | md | lg | xl or a CSS length: a side drawer's width, a bottom one's height. */
9
+ /** sm | md | lg | xl or a CSS length: a left/right drawer's width, a top/bottom one's height. */
10
10
  size?: string | null;
11
11
  dismissable?: boolean;
12
12
  footer?: ScreenActionLike[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { LayoutNode } from '../render/LayoutRenderer.vue';
2
+ interface Props {
3
+ id: string;
4
+ items?: LayoutNode[];
5
+ /** The watched field names. */
6
+ listen?: string[];
7
+ /** The quiet period before a request, in milliseconds. */
8
+ debounce?: number;
9
+ /** Whether the server rendered the children against the form's real state. */
10
+ primed?: boolean;
11
+ }
12
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
+ items: LayoutNode[];
14
+ listen: string[];
15
+ debounce: number;
16
+ primed: boolean;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ export default _default;
@@ -5,8 +5,8 @@
5
5
  * action anywhere on the screen can open the overlay (`Action::opens($id)` on
6
6
  * the backend). Outside a screen the overlay falls back to a local flag.
7
7
  *
8
- * A non-dismissable overlay ignores every close request coming from the UI kit
9
- * (the cross, the overlay click, Escape); only its own footer actions — a
8
+ * A non-dismissable overlay is rendered without the cross and with the kit's
9
+ * overlay click and Escape turned off; only its own footer actions — a
10
10
  * successful method, or an action named `close`/`cancel` — close it.
11
11
  */
12
12
  import { type ComputedRef, type WritableComputedRef } from 'vue';
@@ -12,6 +12,8 @@ export { provideFormState, useFormState, tryUseFormState, } from './formState';
12
12
  export type { FormStateContext } from './formState';
13
13
  export { createScreenContext, provideScreenContext, useScreenContext, } from './screenContext';
14
14
  export type { ScreenContext, ScreenContextOptions, ScreenActionLike } from './screenContext';
15
+ export { provideListenerEndpoint, useListenerEndpoint } from './listenerContext';
16
+ export type { ListenerEndpoint } from './listenerContext';
15
17
  export { default as TextField } from '../fields/TextField.vue';
16
18
  export { default as TextAreaField } from '../fields/TextAreaField.vue';
17
19
  export { default as NumberField } from '../fields/NumberField.vue';
@@ -32,3 +34,4 @@ export { default as ViewLayout } from '../layouts/ViewLayout.vue';
32
34
  export { default as WrapperLayout } from '../layouts/WrapperLayout.vue';
33
35
  export { default as InfolistLayout } from '../layouts/InfolistLayout.vue';
34
36
  export { default as AuditTrailLayout } from '../layouts/AuditTrailLayout.vue';
37
+ export { default as ListenerLayout } from '../layouts/ListenerLayout.vue';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Where a Listener layout sends its requests.
3
+ *
4
+ * The page that owns the form provides it: ScreenPage points at the screen's
5
+ * `listener` action, ResourceFormPage at the resource's, adding the form's
6
+ * context and the record id. Without one — a settings page, a unit test — a
7
+ * listener simply draws its children as the server first sent them.
8
+ */
9
+ import { type InjectionKey } from 'vue';
10
+ export interface ListenerEndpoint {
11
+ /** The action's URL relative to the API root, e.g. `/contact/listener`. */
12
+ url: () => string;
13
+ /** Extra body fields sent along with `{listener, state}`. */
14
+ extra?: () => Record<string, unknown>;
15
+ }
16
+ declare const ListenerEndpointKey: InjectionKey<ListenerEndpoint>;
17
+ export declare function provideListenerEndpoint(endpoint: ListenerEndpoint): void;
18
+ /** The endpoint, or null when no page provides one. */
19
+ export declare function useListenerEndpoint(): ListenerEndpoint | null;
20
+ export { ListenerEndpointKey };
@@ -54,7 +54,7 @@ declare const ScreenContextKey: InjectionKey<ScreenContext>;
54
54
  export interface ScreenContextOptions {
55
55
  running: Readonly<Ref<boolean>>;
56
56
  runMethod: (method: string) => Promise<boolean>;
57
- /** The confirmation prompt; window.confirm by default. */
57
+ /** The confirmation prompt; the panel's confirmation dialog by default. */
58
58
  confirm?: (confirm: {
59
59
  message: string;
60
60
  title?: string;
@@ -13,11 +13,11 @@ interface Props {
13
13
  declare var __VLS_5: {}, __VLS_78: {}, __VLS_147: {
14
14
  filters: Record<string, unknown>;
15
15
  setFilter: (key: string, value: unknown) => Promise<void>;
16
- }, __VLS_213: `cell-${string}`, __VLS_214: {
16
+ }, __VLS_228: `cell-${string}`, __VLS_229: {
17
17
  row: Record<string, unknown> | undefined;
18
18
  };
19
19
  type __VLS_Slots = {} & {
20
- [K in NonNullable<typeof __VLS_213>]?: (props: typeof __VLS_214) => any;
20
+ [K in NonNullable<typeof __VLS_228>]?: (props: typeof __VLS_229) => any;
21
21
  } & {
22
22
  actions?: (props: typeof __VLS_5) => any;
23
23
  } & {
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -19,14 +19,25 @@ export interface AdminAction {
19
19
  /** The nested actions of a dropdown. */
20
20
  items: AdminAction[];
21
21
  }
22
+ /** One run of an action. */
23
+ export interface ActionRunOptions {
24
+ /**
25
+ * The record keys this run applies to — a row's own menu passes its row —
26
+ * instead of the context's `ids()` (the selection).
27
+ */
28
+ ids?: Array<string | number>;
29
+ }
22
30
  /** How a page runs a server-side action in its own context. */
23
31
  export interface ActionExecutor {
24
- /** Runs a button, bulk or modal action; `payload` is the modal form's values. */
25
- execute: (action: AdminAction, payload?: Record<string, unknown>) => Promise<unknown>;
32
+ /**
33
+ * Runs a button, bulk or modal action; `payload` is the modal form's
34
+ * values, `options` what `run()` was given.
35
+ */
36
+ execute: (action: AdminAction, payload?: Record<string, unknown>, options?: ActionRunOptions) => Promise<unknown>;
26
37
  /** The record keys the actions apply to, when the context has any. */
27
38
  ids?: () => Array<string | number>;
28
39
  /** After a successful execute: a toast, a reload. */
29
- onSuccess?: (action: AdminAction, result: unknown) => void | Promise<void>;
40
+ onSuccess?: (action: AdminAction, result: unknown, options?: ActionRunOptions) => void | Promise<void>;
30
41
  /** When execute fails; a toast with the error's message by default. */
31
42
  onError?: (action: AdminAction, err: unknown) => void;
32
43
  /** Reloads the context's data after an async action has finished. */
@@ -42,22 +53,28 @@ export interface DelayedStatus {
42
53
  /** Normalizes one serialized action; null when it has no name or label. */
43
54
  export declare function normalizeAction(raw: unknown): AdminAction | null;
44
55
  export declare function normalizeActions(raw: unknown): AdminAction[];
45
- /** Row and bulk actions apply to the selected records. */
56
+ /**
57
+ * Whether the action applies to records: a BulkAction always does, an action
58
+ * marked `standalone()` never does, any other one does when it is placed in
59
+ * rows or in the bulk bar. The backend's Action::requiresSelection() answers
60
+ * the same way.
61
+ */
46
62
  export declare function needsSelection(action: AdminAction): boolean;
47
63
  /**
48
64
  * Whether a selection of `count` records satisfies the action's
49
65
  * requiresAtLeast / requiresAtMost (BulkAction).
50
66
  */
51
67
  export declare function selectionAllows(action: AdminAction, count: number): boolean;
68
+ export type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
52
69
  /** The UidModal sizes; the backend's modalSize() is a free-form string. */
53
- export declare function modalSizeOf(raw: unknown): 'sm' | 'md' | 'lg' | 'xl';
70
+ export declare function modalSizeOf(raw: unknown): ModalSize;
54
71
  /**
55
72
  * Turns an absolute href into a router path when it points inside the panel;
56
73
  * null when it has to be a full navigation.
57
74
  */
58
75
  export declare function toRouterPath(router: Router | undefined, href: string): string | null;
59
76
  export declare function useActionRunner(executor: ActionExecutor): {
60
- run: (action: AdminAction) => Promise<boolean>;
77
+ run: (action: AdminAction, options?: ActionRunOptions) => Promise<boolean>;
61
78
  running: import("vue").Ref<boolean, boolean>;
62
79
  confirm: (opts: ActionConfirm | string, destructive?: boolean) => Promise<boolean>;
63
80
  confirmState: {
@@ -91,11 +108,14 @@ export declare function useActionRunner(executor: ActionExecutor): {
91
108
  } | null;
92
109
  title: string;
93
110
  submitLabel: string;
94
- size: "sm" | "md" | "lg" | "xl";
111
+ size: ModalSize;
95
112
  fields: Array<Record<string, unknown>>;
96
113
  values: Record<string, unknown>;
97
114
  errors: Record<string, string[]>;
98
115
  submitting: boolean;
116
+ options: {
117
+ ids?: Array<string | number> | undefined;
118
+ } | undefined;
99
119
  };
100
120
  submitModal: () => Promise<void>;
101
121
  closeModal: () => void;
@@ -0,0 +1,31 @@
1
+ export interface ConfirmOptions {
2
+ message: string;
3
+ title?: string;
4
+ confirmLabel?: string;
5
+ cancelLabel?: string;
6
+ /** Paints the confirm button as dangerous. */
7
+ destructive?: boolean;
8
+ }
9
+ export interface ConfirmState {
10
+ open: boolean;
11
+ title: string;
12
+ message: string;
13
+ confirmLabel: string;
14
+ cancelLabel: string;
15
+ destructive: boolean;
16
+ }
17
+ export declare const confirmState: {
18
+ open: boolean;
19
+ title: string;
20
+ message: string;
21
+ confirmLabel: string;
22
+ cancelLabel: string;
23
+ destructive: boolean;
24
+ };
25
+ /** Asks a question; resolves to true when the user agreed. */
26
+ export declare function confirmDialog(opts: ConfirmOptions | string): Promise<boolean>;
27
+ /** Answers the open question (the dialog's buttons, its cross, Escape). */
28
+ export declare function resolveConfirmDialog(ok: boolean): void;
29
+ export declare function useConfirm(): {
30
+ confirm: typeof confirmDialog;
31
+ };
@@ -0,0 +1 @@
1
+ export {};