@omnitend/dashboard-for-laravel 0.26.0 → 0.28.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.
@@ -7,6 +7,7 @@ export declare function mergeOptions(base: Record<string, any>, override: Record
7
7
  * available — chart.js is an external peer dep, so this adds no bundle weight.
8
8
  */
9
9
  export declare function registerCharts(): void;
10
+ export declare const PALETTE_VARS: Array<[string, string]>;
10
11
  /** Resolve the themed categorical palette from the document root. */
11
12
  export declare function getPalette(): string[];
12
13
  /** Add an alpha channel to a hex or rgb() colour (best-effort). */
@@ -220,6 +220,12 @@ export interface Props<TItem = any> {
220
220
  }
221
221
  declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
222
222
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
223
+ readonly onRowCreated?: ((item: any, response: any) => any) | undefined;
224
+ readonly onCreateError?: ((error: any) => any) | undefined;
225
+ readonly onRowUpdated?: ((item: T, response: any) => any) | undefined;
226
+ readonly onEditError?: ((item: T, error: any) => any) | undefined;
227
+ readonly onRowDeleted?: ((item: T, response: any) => any) | undefined;
228
+ readonly onDeleteError?: ((item: T, error: any) => any) | undefined;
223
229
  readonly "onUpdate:sortBy"?: ((sortBy: BTableSortBy[]) => any) | undefined;
224
230
  readonly "onUpdate:busy"?: ((busy: boolean) => any) | undefined;
225
231
  readonly onRowClicked?: ((item: T, index: number, event: MouseEvent) => any) | undefined;
@@ -231,15 +237,9 @@ declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_
231
237
  }) => any) | undefined;
232
238
  readonly onFilterChange?: ((filters: Record<string, string>) => any) | undefined;
233
239
  readonly onPerPageChange?: ((perPage: number) => any) | undefined;
234
- readonly onRowCreated?: ((item: any, response: any) => any) | undefined;
235
- readonly onCreateError?: ((error: any) => any) | undefined;
236
- readonly onRowUpdated?: ((item: T, response: any) => any) | undefined;
237
- readonly onEditError?: ((item: T, error: any) => any) | undefined;
238
- readonly onRowDeleted?: ((item: T, response: any) => any) | undefined;
239
- readonly onDeleteError?: ((item: T, error: any) => any) | undefined;
240
240
  readonly "onUpdate:filters"?: ((filters: Record<string, string>) => any) | undefined;
241
241
  readonly "onUpdate:perPage"?: ((perPage: number) => any) | undefined;
242
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:sortBy" | "onUpdate:busy" | "onRowClicked" | "onUpdate:expandedItems" | "onPageChange" | "onSortChange" | "onFilterChange" | "onPerPageChange" | "onRowCreated" | "onCreateError" | "onRowUpdated" | "onEditError" | "onRowDeleted" | "onDeleteError" | "onUpdate:filters" | "onUpdate:perPage"> & Props<T> & Partial<{}>> & import("vue").PublicProps;
242
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:sortBy" | "onUpdate:busy" | "onRowClicked" | "onUpdate:expandedItems" | "onRowCreated" | "onCreateError" | "onRowUpdated" | "onEditError" | "onRowDeleted" | "onDeleteError" | "onPageChange" | "onSortChange" | "onFilterChange" | "onPerPageChange" | "onUpdate:filters" | "onUpdate:perPage"> & Props<T> & Partial<{}>> & import("vue").PublicProps;
243
243
  expose(exposed: import("vue").ShallowUnwrapRef<{
244
244
  refresh: () => void;
245
245
  /**
@@ -254,50 +254,15 @@ declare const _default: <T = any>(__VLS_props: NonNullable<Awaited<typeof __VLS_
254
254
  [x: string]: ((props: any) => any) | undefined;
255
255
  } & {
256
256
  [x: string]: ((props: any) => any) | undefined;
257
- } & {
258
- [x: string]: ((props: any) => any) | undefined;
259
- } & {
260
- [x: `edit-value(${string})`]: ((props: {
261
- item: import("@vue/reactivity").DistributeRef<[T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>>;
262
- value: any;
263
- update: any;
264
- field: any;
265
- }) => any) | undefined;
266
- } & {
267
- [x: `edit-span(${string})`]: ((props: {
268
- item: import("@vue/reactivity").DistributeRef<[T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>>;
269
- value: any;
270
- update: any;
271
- close: () => void;
272
- }) => any) | undefined;
273
- } & {
274
- [x: `tab-content(${string})`]: ((props: {
275
- item: import("@vue/reactivity").DistributeRef<[T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>>;
276
- tab: any;
277
- }) => any) | undefined;
278
- } & {
279
- [x: `tab-before(${string})`]: ((props: {
280
- item: import("@vue/reactivity").DistributeRef<[T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>>;
281
- tab: any;
282
- }) => any) | undefined;
283
- } & {
284
- [x: `tab-after(${string})`]: ((props: {
285
- item: import("@vue/reactivity").DistributeRef<[T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>>;
286
- tab: any;
287
- }) => any) | undefined;
288
257
  } & {
289
258
  header?: (props: {}) => any;
290
259
  } & {
291
260
  'thead-top'?: (props: any) => any;
292
- } & {
293
- 'thead-top'?: (props: any) => any;
294
- } & {
295
- 'thead-top'?: (props: any) => any;
296
261
  };
297
- emit: ((evt: "update:sortBy", sortBy: BTableSortBy[]) => void) & ((evt: "update:busy", busy: boolean) => void) & ((evt: "rowClicked", item: T, index: number, event: MouseEvent) => void) & ((evt: "update:expandedItems", items: T[]) => void) & ((evt: "pageChange", page: number) => void) & ((evt: "sortChange", sort: {
262
+ emit: ((evt: "rowCreated", item: any, response: any) => void) & ((evt: "createError", error: any) => void) & ((evt: "rowUpdated", item: T, response: any) => void) & ((evt: "editError", item: T, error: any) => void) & ((evt: "rowDeleted", item: T, response: any) => void) & ((evt: "deleteError", item: T, error: any) => void) & ((evt: "update:sortBy", sortBy: BTableSortBy[]) => void) & ((evt: "update:busy", busy: boolean) => void) & ((evt: "rowClicked", item: T, index: number, event: MouseEvent) => void) & ((evt: "update:expandedItems", items: T[]) => void) & ((evt: "pageChange", page: number) => void) & ((evt: "sortChange", sort: {
298
263
  key: string;
299
264
  order: "asc" | "desc";
300
- }) => void) & ((evt: "filterChange", filters: Record<string, string>) => void) & ((evt: "perPageChange", perPage: number) => void) & ((evt: "rowCreated", item: any, response: any) => void) & ((evt: "createError", error: any) => void) & ((evt: "rowUpdated", item: T, response: any) => void) & ((evt: "editError", item: T, error: any) => void) & ((evt: "rowDeleted", item: T, response: any) => void) & ((evt: "deleteError", item: T, error: any) => void) & ((evt: "update:filters", filters: Record<string, string>) => void) & ((evt: "update:perPage", perPage: number) => void);
265
+ }) => void) & ((evt: "filterChange", filters: Record<string, string>) => void) & ((evt: "perPageChange", perPage: number) => void) & ((evt: "update:filters", filters: Record<string, string>) => void) & ((evt: "update:perPage", perPage: number) => void);
301
266
  }>) => import("vue").VNode & {
302
267
  __ctx?: Awaited<typeof __VLS_setup>;
303
268
  };
@@ -0,0 +1,80 @@
1
+ import type { EditTab } from "./DXTable.vue";
2
+ interface Props {
3
+ /** Whether the modal is open (v-model:show). */
4
+ show: boolean;
5
+ /** Modal title. */
6
+ title: string;
7
+ /** Modal size. */
8
+ size?: 'sm' | 'md' | 'lg' | 'xl';
9
+ /** True while the full record is loading via showUrl. */
10
+ loading: boolean;
11
+ /** The edit/create form (a useForm instance), or null before first open. */
12
+ form: any;
13
+ /** Bumped per modal open to remount the DXForm subtree (fresh DXField state). */
14
+ formInstanceKey: number;
15
+ /** Active tab index (v-model:active-tab). */
16
+ activeTab: number;
17
+ /** Field definitions passed to DXForm. */
18
+ fields: any[];
19
+ /** Tab definitions passed to DXForm. */
20
+ tabs?: EditTab[];
21
+ /** The row being edited (null in create mode) — the slot/context row. */
22
+ item: any;
23
+ /** Whether the modal is in create mode (vs edit). */
24
+ isCreateMode: boolean;
25
+ /** Which action is in flight, so Save/Delete show their own loading label. */
26
+ pendingAction: 'save' | 'delete' | null;
27
+ /** Delete endpoint — gates the Delete button. */
28
+ deleteUrl?: string;
29
+ }
30
+ declare var __VLS_21: `edit-value(${string})`, __VLS_22: {
31
+ item: any;
32
+ value: any;
33
+ update: any;
34
+ field: any;
35
+ }, __VLS_25: `edit-span(${string})`, __VLS_26: {
36
+ item: any;
37
+ value: any;
38
+ update: any;
39
+ close: () => void;
40
+ }, __VLS_29: `tab-content(${string})`, __VLS_30: {
41
+ item: any;
42
+ tab: any;
43
+ }, __VLS_33: `tab-before(${string})`, __VLS_34: {
44
+ item: any;
45
+ tab: any;
46
+ }, __VLS_37: `tab-after(${string})`, __VLS_38: {
47
+ item: any;
48
+ tab: any;
49
+ };
50
+ type __VLS_Slots = {} & {
51
+ [K in NonNullable<typeof __VLS_21>]?: (props: typeof __VLS_22) => any;
52
+ } & {
53
+ [K in NonNullable<typeof __VLS_25>]?: (props: typeof __VLS_26) => any;
54
+ } & {
55
+ [K in NonNullable<typeof __VLS_29>]?: (props: typeof __VLS_30) => any;
56
+ } & {
57
+ [K in NonNullable<typeof __VLS_33>]?: (props: typeof __VLS_34) => any;
58
+ } & {
59
+ [K in NonNullable<typeof __VLS_37>]?: (props: typeof __VLS_38) => any;
60
+ };
61
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
62
+ delete: () => any;
63
+ "update:activeTab": (value: number) => any;
64
+ save: () => any;
65
+ cancel: () => any;
66
+ "update:show": (value: boolean) => any;
67
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
68
+ onDelete?: (() => any) | undefined;
69
+ "onUpdate:activeTab"?: ((value: number) => any) | undefined;
70
+ onSave?: (() => any) | undefined;
71
+ onCancel?: (() => any) | undefined;
72
+ "onUpdate:show"?: ((value: boolean) => any) | undefined;
73
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
74
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
75
+ export default _default;
76
+ type __VLS_WithSlots<T, S> = T & {
77
+ new (): {
78
+ $slots: S;
79
+ };
80
+ };
@@ -0,0 +1,27 @@
1
+ import type { PaginationData } from "./DXTable.vue";
2
+ interface Props {
3
+ /** The active pagination metadata (client-side / inertia / provider). */
4
+ pagination: PaginationData;
5
+ /** The effective page size, shown in the selector. */
6
+ perPage: number;
7
+ /** Page sizes offered by the selector. */
8
+ perPageOptions: number[];
9
+ /** Whether to render the pager (still hidden when there is only one page). */
10
+ showPagination: boolean;
11
+ /** Whether to render the per-page selector. */
12
+ showPerPageSelector: boolean;
13
+ /** Singular item noun for the info line (e.g. "product"). */
14
+ singularItemName: string;
15
+ /** Plural item noun for the info line (e.g. "products"). */
16
+ pluralItemName: string;
17
+ /** Whether a column filter is active — gates the "Filtered from N" note. */
18
+ hasActiveFilters: boolean;
19
+ }
20
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "page-change": (page: number) => any;
22
+ "per-page-change": (value: string | number | (string | number)[] | null) => any;
23
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
24
+ "onPage-change"?: ((page: number) => any) | undefined;
25
+ "onPer-page-change"?: ((value: string | number | (string | number)[] | null) => any) | undefined;
26
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
+ export default _default;
@@ -0,0 +1,74 @@
1
+ import { type Ref } from "vue";
2
+ /**
3
+ * The subset of `DXTable`'s props the resource editor reads. Declared
4
+ * structurally (not imported from DXTable.vue) so the composable stays a
5
+ * lower-level dependency — DXTable imports the composable, not the reverse.
6
+ * DXTable's full `Props` is structurally assignable to this.
7
+ */
8
+ export interface ResourceEditorProps<T = any> {
9
+ /** Field definitions for the edit/create modal (enables edit-on-row-click). */
10
+ editFields?: any[];
11
+ /** Tab definitions — only their `key` is read here (DXForm consumes the rest). */
12
+ editTabs?: Array<{
13
+ key: string;
14
+ }>;
15
+ /** Modal title, or a function of the edited row. */
16
+ editModalTitle?: string | ((item: any) => string);
17
+ /** `PUT` endpoint pattern for updates, e.g. `/api/products/:id`. */
18
+ editUrl?: string;
19
+ /** `GET` endpoint pattern to fetch the full record on open, e.g. `/api/products/:id`. */
20
+ showUrl?: string;
21
+ /** `DELETE` endpoint pattern, e.g. `/api/products/:id`. */
22
+ deleteUrl?: string;
23
+ /** `POST` endpoint for creating new items, e.g. `/api/products`. */
24
+ createUrl?: string;
25
+ /** Guard run before delete — a message short-circuits with a toast. */
26
+ deleteGuard?: (item: T) => string | null | undefined;
27
+ }
28
+ /**
29
+ * The events the editor emits back through DXTable's `emit`. Declared as the
30
+ * exact call signatures it uses (a subset of DXTable's emits) so DXTable's typed
31
+ * `emit` is structurally assignable here.
32
+ */
33
+ export interface ResourceEditorEmit<T = any> {
34
+ (event: 'rowCreated', item: any, response: any): void;
35
+ (event: 'createError', error: any): void;
36
+ (event: 'rowUpdated', item: T, response: any): void;
37
+ (event: 'editError', item: T, error: any): void;
38
+ (event: 'rowDeleted', item: T, response: any): void;
39
+ (event: 'deleteError', item: T, error: any): void;
40
+ }
41
+ export interface UseResourceEditorOptions {
42
+ /** Invalidate whichever data source is active, after a successful CRUD op. */
43
+ refresh: () => void;
44
+ /** Singular item noun (e.g. "product") — for toasts and the modal title. */
45
+ singularItemName: Ref<string>;
46
+ }
47
+ /**
48
+ * The resource editor for `DXTable` — the create/edit/delete concern lifted out
49
+ * of the god-component (#129). Owns the edit-modal state, form seeding and
50
+ * visibility rules, the `showUrl` full-record fetch, submission (create `POST` /
51
+ * edit `PUT` / delete), the success/error toasts, and the edit-modal slot-key
52
+ * computeds. It never touches the table's data source, sort, filter, per-page
53
+ * or pagination state — the only coupling back to the table is the `refresh`
54
+ * callback it calls after a successful op.
55
+ *
56
+ * DXTable keeps `handleRowClick` (which emits `rowClicked` regardless) and calls
57
+ * `openEdit` from it; `openEdit` is a no-op unless `editFields` are set.
58
+ */
59
+ export declare function useResourceEditor<T = any>(props: ResourceEditorProps<T>, emit: ResourceEditorEmit<T>, options: UseResourceEditorOptions): {
60
+ showEditModal: Ref<boolean, boolean>;
61
+ editForm: Ref<any, any>;
62
+ editFormInstanceKey: Ref<number, number>;
63
+ activeTabIndex: Ref<number, number>;
64
+ selectedItem: [T | null] extends [Ref<any, any>] ? import("@vue/shared").IfAny<Ref<any, any> & T, Ref<Ref<any, any> & T, Ref<any, any> & T>, Ref<any, any> & T> : Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>;
65
+ isCreateMode: Ref<boolean, boolean>;
66
+ pendingAction: Ref<"delete" | "save" | null, "delete" | "save" | null>;
67
+ editLoading: Ref<boolean, boolean>;
68
+ computedModalTitle: import("vue").ComputedRef<string>;
69
+ openEdit: (item: T) => void;
70
+ openCreate: () => void;
71
+ save: () => Promise<void>;
72
+ cancel: () => void;
73
+ remove: () => Promise<void>;
74
+ };