@omnitend/dashboard-for-laravel 0.27.0 → 0.29.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/charts.d.ts +19 -0
- package/dist/charts.js +225 -0
- package/dist/charts.js.map +1 -0
- package/dist/charts.umd.cjs +2 -0
- package/dist/charts.umd.cjs.map +1 -0
- package/dist/components/base/DAlert.vue.d.ts +6 -1
- package/dist/components/base/DFormCheckboxGroup.vue.d.ts +12 -0
- package/dist/components/charts/chartTheme.d.ts +1 -0
- package/dist/components/extended/DXDashboardSidebar.vue.d.ts +2 -2
- package/dist/components/extended/DXField.vue.d.ts +4 -4
- package/dist/components/extended/DXForm.vue.d.ts +1 -1
- package/dist/components/extended/DXTable.vue.d.ts +9 -44
- package/dist/components/extended/DXTableEditorModal.vue.d.ts +80 -0
- package/dist/components/extended/DXTablePagination.vue.d.ts +27 -0
- package/dist/composables/useResourceEditor.d.ts +74 -0
- package/dist/dashboard-for-laravel.js +12463 -12819
- package/dist/dashboard-for-laravel.js.map +1 -1
- package/dist/dashboard-for-laravel.umd.cjs +8 -8
- package/dist/dashboard-for-laravel.umd.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/public/api-reference.json +224 -9
- package/docs/public/docs-map.md +2 -2
- package/docs/public/llms.txt +3 -2
- package/package.json +12 -6
- package/resources/css/theme.scss +49 -7
- package/resources/js/charts.ts +19 -0
- package/resources/js/components/base/DAlert.vue +19 -1
- package/resources/js/components/base/DFormCheckboxGroup.vue +22 -0
- package/resources/js/components/charts/DXBarChart.vue +1 -10
- package/resources/js/components/charts/DXDoughnutChart.vue +1 -10
- package/resources/js/components/charts/DXLineChart.vue +1 -10
- package/resources/js/components/charts/chartTheme.ts +19 -16
- package/resources/js/components/extended/DXField.vue +12 -0
- package/resources/js/components/extended/DXTable.vue +161 -1034
- package/resources/js/components/extended/DXTableEditorModal.vue +247 -0
- package/resources/js/components/extended/DXTablePagination.vue +126 -0
- package/resources/js/composables/useForm.ts +10 -1
- package/resources/js/composables/useResourceEditor.ts +542 -0
- package/resources/js/index.ts +4 -3
- package/resources/js/types/index.ts +1 -0
|
@@ -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
|
+
};
|