@omnitend/dashboard-for-laravel 0.4.7
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/LICENSE +21 -0
- package/README.md +397 -0
- package/dist/components/base/DAccordion.vue.d.ts +12 -0
- package/dist/components/base/DAccordionItem.vue.d.ts +12 -0
- package/dist/components/base/DAlert.vue.d.ts +12 -0
- package/dist/components/base/DAvatar.vue.d.ts +12 -0
- package/dist/components/base/DBadge.vue.d.ts +12 -0
- package/dist/components/base/DBreadcrumb.vue.d.ts +12 -0
- package/dist/components/base/DButton.vue.d.ts +29 -0
- package/dist/components/base/DButtonGroup.vue.d.ts +12 -0
- package/dist/components/base/DButtonToolbar.vue.d.ts +12 -0
- package/dist/components/base/DCard.vue.d.ts +12 -0
- package/dist/components/base/DCarousel.vue.d.ts +12 -0
- package/dist/components/base/DCarouselSlide.vue.d.ts +12 -0
- package/dist/components/base/DCol.vue.d.ts +12 -0
- package/dist/components/base/DCollapse.vue.d.ts +12 -0
- package/dist/components/base/DContainer.vue.d.ts +12 -0
- package/dist/components/base/DDropdown.vue.d.ts +12 -0
- package/dist/components/base/DDropdownDivider.vue.d.ts +2 -0
- package/dist/components/base/DDropdownItem.vue.d.ts +12 -0
- package/dist/components/base/DForm.vue.d.ts +12 -0
- package/dist/components/base/DFormCheckbox.vue.d.ts +12 -0
- package/dist/components/base/DFormGroup.vue.d.ts +12 -0
- package/dist/components/base/DFormInput.vue.d.ts +2 -0
- package/dist/components/base/DFormInvalidFeedback.vue.d.ts +12 -0
- package/dist/components/base/DFormRadio.vue.d.ts +12 -0
- package/dist/components/base/DFormSelect.vue.d.ts +12 -0
- package/dist/components/base/DFormSpinbutton.vue.d.ts +12 -0
- package/dist/components/base/DFormTags.vue.d.ts +12 -0
- package/dist/components/base/DFormText.vue.d.ts +12 -0
- package/dist/components/base/DFormTextarea.vue.d.ts +2 -0
- package/dist/components/base/DImage.vue.d.ts +12 -0
- package/dist/components/base/DInputGroup.vue.d.ts +12 -0
- package/dist/components/base/DLink.vue.d.ts +12 -0
- package/dist/components/base/DListGroup.vue.d.ts +12 -0
- package/dist/components/base/DListGroupItem.vue.d.ts +12 -0
- package/dist/components/base/DModal.vue.d.ts +12 -0
- package/dist/components/base/DNav.vue.d.ts +12 -0
- package/dist/components/base/DNavItem.vue.d.ts +12 -0
- package/dist/components/base/DNavbar.vue.d.ts +12 -0
- package/dist/components/base/DNavbarBrand.vue.d.ts +12 -0
- package/dist/components/base/DNavbarNav.vue.d.ts +12 -0
- package/dist/components/base/DNavbarToggle.vue.d.ts +12 -0
- package/dist/components/base/DOffcanvas.vue.d.ts +12 -0
- package/dist/components/base/DOverlay.vue.d.ts +12 -0
- package/dist/components/base/DPagination.vue.d.ts +2 -0
- package/dist/components/base/DPlaceholder.vue.d.ts +12 -0
- package/dist/components/base/DPopover.vue.d.ts +12 -0
- package/dist/components/base/DProgress.vue.d.ts +12 -0
- package/dist/components/base/DRow.vue.d.ts +12 -0
- package/dist/components/base/DSpinner.vue.d.ts +2 -0
- package/dist/components/base/DTab.vue.d.ts +12 -0
- package/dist/components/base/DTable.vue.d.ts +26 -0
- package/dist/components/base/DTabs.vue.d.ts +12 -0
- package/dist/components/base/DToast.vue.d.ts +12 -0
- package/dist/components/base/DToaster.vue.d.ts +12 -0
- package/dist/components/base/DTooltip.vue.d.ts +12 -0
- package/dist/components/extended/DXBasicForm.vue.d.ts +39 -0
- package/dist/components/extended/DXDashboard.vue.d.ts +52 -0
- package/dist/components/extended/DXDashboardNavbar.vue.d.ts +53 -0
- package/dist/components/extended/DXDashboardSidebar.vue.d.ts +37 -0
- package/dist/components/extended/DXForm.vue.d.ts +31 -0
- package/dist/components/extended/DXTable.vue.d.ts +190 -0
- package/dist/composables/defineForm.d.ts +35 -0
- package/dist/composables/useForm.d.ts +46 -0
- package/dist/composables/useToast.d.ts +1 -0
- package/dist/dashboard-for-laravel.js +17748 -0
- package/dist/dashboard-for-laravel.js.map +1 -0
- package/dist/dashboard-for-laravel.umd.cjs +11 -0
- package/dist/dashboard-for-laravel.umd.cjs.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/style.css +5 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/navigation.d.ts +17 -0
- package/dist/utils/api.d.ts +30 -0
- package/docs/public/api-reference.json +1932 -0
- package/docs/public/docs-map.md +85 -0
- package/docs/public/llms.txt +110 -0
- package/package.json +116 -0
- package/resources/css/theme.scss +219 -0
- package/resources/js/components/base/DAccordion.vue +21 -0
- package/resources/js/components/base/DAccordionItem.vue +14 -0
- package/resources/js/components/base/DAlert.vue +14 -0
- package/resources/js/components/base/DAvatar.vue +21 -0
- package/resources/js/components/base/DBadge.vue +14 -0
- package/resources/js/components/base/DBreadcrumb.vue +21 -0
- package/resources/js/components/base/DButton.vue +58 -0
- package/resources/js/components/base/DButtonGroup.vue +21 -0
- package/resources/js/components/base/DButtonToolbar.vue +21 -0
- package/resources/js/components/base/DCard.vue +35 -0
- package/resources/js/components/base/DCarousel.vue +21 -0
- package/resources/js/components/base/DCarouselSlide.vue +14 -0
- package/resources/js/components/base/DCol.vue +14 -0
- package/resources/js/components/base/DCollapse.vue +34 -0
- package/resources/js/components/base/DContainer.vue +14 -0
- package/resources/js/components/base/DDropdown.vue +16 -0
- package/resources/js/components/base/DDropdownDivider.vue +7 -0
- package/resources/js/components/base/DDropdownItem.vue +14 -0
- package/resources/js/components/base/DForm.vue +21 -0
- package/resources/js/components/base/DFormCheckbox.vue +14 -0
- package/resources/js/components/base/DFormGroup.vue +11 -0
- package/resources/js/components/base/DFormInput.vue +7 -0
- package/resources/js/components/base/DFormInvalidFeedback.vue +16 -0
- package/resources/js/components/base/DFormRadio.vue +21 -0
- package/resources/js/components/base/DFormSelect.vue +14 -0
- package/resources/js/components/base/DFormSpinbutton.vue +21 -0
- package/resources/js/components/base/DFormTags.vue +21 -0
- package/resources/js/components/base/DFormText.vue +16 -0
- package/resources/js/components/base/DFormTextarea.vue +7 -0
- package/resources/js/components/base/DImage.vue +21 -0
- package/resources/js/components/base/DInputGroup.vue +21 -0
- package/resources/js/components/base/DLink.vue +21 -0
- package/resources/js/components/base/DListGroup.vue +21 -0
- package/resources/js/components/base/DListGroupItem.vue +14 -0
- package/resources/js/components/base/DModal.vue +11 -0
- package/resources/js/components/base/DNav.vue +14 -0
- package/resources/js/components/base/DNavItem.vue +14 -0
- package/resources/js/components/base/DNavbar.vue +21 -0
- package/resources/js/components/base/DNavbarBrand.vue +14 -0
- package/resources/js/components/base/DNavbarNav.vue +14 -0
- package/resources/js/components/base/DNavbarToggle.vue +14 -0
- package/resources/js/components/base/DOffcanvas.vue +11 -0
- package/resources/js/components/base/DOverlay.vue +21 -0
- package/resources/js/components/base/DPagination.vue +7 -0
- package/resources/js/components/base/DPlaceholder.vue +21 -0
- package/resources/js/components/base/DPopover.vue +21 -0
- package/resources/js/components/base/DProgress.vue +21 -0
- package/resources/js/components/base/DRow.vue +14 -0
- package/resources/js/components/base/DSpinner.vue +7 -0
- package/resources/js/components/base/DTab.vue +14 -0
- package/resources/js/components/base/DTable.vue +62 -0
- package/resources/js/components/base/DTabs.vue +21 -0
- package/resources/js/components/base/DToast.vue +16 -0
- package/resources/js/components/base/DToaster.vue +16 -0
- package/resources/js/components/base/DTooltip.vue +21 -0
- package/resources/js/components/extended/DXBasicForm.vue +177 -0
- package/resources/js/components/extended/DXDashboard.vue +208 -0
- package/resources/js/components/extended/DXDashboardNavbar.vue +112 -0
- package/resources/js/components/extended/DXDashboardSidebar.vue +233 -0
- package/resources/js/components/extended/DXForm.vue +44 -0
- package/resources/js/components/extended/DXTable.vue +1345 -0
- package/resources/js/composables/defineForm.ts +78 -0
- package/resources/js/composables/useForm.ts +272 -0
- package/resources/js/composables/useToast.ts +1 -0
- package/resources/js/index.ts +118 -0
- package/resources/js/types/index.ts +61 -0
- package/resources/js/types/navigation.ts +19 -0
- package/resources/js/utils/api.ts +182 -0
- package/scripts/mcp-server.mjs +359 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BNavbarNav } from "bootstrap-vue-next";
|
|
3
|
+
import { useSlots } from "vue";
|
|
4
|
+
|
|
5
|
+
const slots = useSlots();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<BNavbarNav v-bind="$attrs">
|
|
10
|
+
<template v-for="(_, name) in slots" :key="name" #[name]="slotProps">
|
|
11
|
+
<slot :name="name" v-bind="slotProps" />
|
|
12
|
+
</template>
|
|
13
|
+
</BNavbarNav>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BNavbarToggle } from "bootstrap-vue-next";
|
|
3
|
+
import { useSlots } from "vue";
|
|
4
|
+
|
|
5
|
+
const slots = useSlots();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<BNavbarToggle v-bind="$attrs">
|
|
10
|
+
<template v-for="(_, name) in slots" :key="name" #[name]="slotProps">
|
|
11
|
+
<slot :name="name" v-bind="slotProps" />
|
|
12
|
+
</template>
|
|
13
|
+
</BNavbarToggle>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BOffcanvas v-bind="$attrs">
|
|
3
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
4
|
+
<slot :name="name" v-bind="slotProps" />
|
|
5
|
+
</template>
|
|
6
|
+
</BOffcanvas>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { BOffcanvas } from "bootstrap-vue-next";
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BOverlay component.
|
|
4
|
+
* Overlay component for indicating loading states or blocking content.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BOverlay } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BOverlay v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BOverlay>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BPlaceholder component.
|
|
4
|
+
* Loading placeholder component to indicate content is still loading.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BPlaceholder } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BPlaceholder v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BPlaceholder>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BPopover component.
|
|
4
|
+
* Overlay component for displaying rich content in a popup.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BPopover } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BPopover v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BPopover>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BProgress component.
|
|
4
|
+
* Progress bar for displaying simple or complex progress indicators.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BProgress } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BProgress v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BProgress>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BRow } from "bootstrap-vue-next";
|
|
3
|
+
import { useSlots } from "vue";
|
|
4
|
+
|
|
5
|
+
const slots = useSlots();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<BRow v-bind="$attrs">
|
|
10
|
+
<template v-for="(_, name) in slots" :key="name" #[name]>
|
|
11
|
+
<slot :name="name" />
|
|
12
|
+
</template>
|
|
13
|
+
</BRow>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BTab } from "bootstrap-vue-next";
|
|
3
|
+
import { useSlots } from "vue";
|
|
4
|
+
|
|
5
|
+
const slots = useSlots();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<BTab v-bind="$attrs">
|
|
10
|
+
<template v-for="(_, name) in slots" :key="name" #[name]="slotProps">
|
|
11
|
+
<slot :name="name" v-bind="slotProps" />
|
|
12
|
+
</template>
|
|
13
|
+
</BTab>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BTable
|
|
3
|
+
ref="bTableRef"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
@update:sort-by="handleSortByUpdate"
|
|
6
|
+
@update:current-page="handleCurrentPageUpdate"
|
|
7
|
+
@update:busy="handleBusyUpdate"
|
|
8
|
+
@sorted="handleSorted"
|
|
9
|
+
@row-clicked="handleRowClicked"
|
|
10
|
+
>
|
|
11
|
+
<template v-for="(_, name) in $slots" #[name]="slotProps">
|
|
12
|
+
<slot :name="name" v-bind="slotProps" />
|
|
13
|
+
</template>
|
|
14
|
+
</BTable>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { ref } from 'vue';
|
|
19
|
+
import { BTable } from "bootstrap-vue-next";
|
|
20
|
+
|
|
21
|
+
defineOptions({
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Define emits to forward BTable events
|
|
26
|
+
const emit = defineEmits(['update:sortBy', 'update:currentPage', 'update:busy', 'sorted', 'rowClicked']);
|
|
27
|
+
|
|
28
|
+
// Reference to BTable for exposing methods
|
|
29
|
+
const bTableRef = ref<any>(null);
|
|
30
|
+
|
|
31
|
+
// Event handlers to forward BTable events
|
|
32
|
+
const handleSortByUpdate = (val: any) => {
|
|
33
|
+
emit('update:sortBy', val);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleCurrentPageUpdate = (val: any) => {
|
|
37
|
+
emit('update:currentPage', val);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleBusyUpdate = (val: any) => {
|
|
41
|
+
emit('update:busy', val);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleSorted = (val: any) => {
|
|
45
|
+
emit('sorted', val);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const handleRowClicked = (item: any, index: number, event: MouseEvent) => {
|
|
49
|
+
emit('rowClicked', item, index, event);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Expose refresh method from BTable
|
|
53
|
+
const refresh = () => {
|
|
54
|
+
if (bTableRef.value && typeof bTableRef.value.refresh === 'function') {
|
|
55
|
+
bTableRef.value.refresh();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
defineExpose({
|
|
60
|
+
refresh,
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BTabs component.
|
|
4
|
+
* Create tabbed panes of local content with customisable navigation.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BTabs } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BTabs v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BTabs>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BToast } from "bootstrap-vue-next";
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<BToast v-bind="$attrs">
|
|
11
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
12
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
13
|
+
<slot :name="name" v-bind="slotProps" />
|
|
14
|
+
</template>
|
|
15
|
+
</BToast>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BToastOrchestrator } from "bootstrap-vue-next";
|
|
3
|
+
|
|
4
|
+
defineOptions({
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<BToastOrchestrator v-bind="$attrs">
|
|
11
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
12
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
13
|
+
<slot :name="name" v-bind="slotProps" />
|
|
14
|
+
</template>
|
|
15
|
+
</BToastOrchestrator>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component
|
|
3
|
+
* Type-safe wrapper around Bootstrap Vue Next BTooltip component.
|
|
4
|
+
* Display helpful tooltips when hovering over elements.
|
|
5
|
+
*/
|
|
6
|
+
<script setup lang="ts">
|
|
7
|
+
import { BTooltip } from "bootstrap-vue-next";
|
|
8
|
+
|
|
9
|
+
defineOptions({
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<BTooltip v-bind="$attrs">
|
|
16
|
+
<!-- Dynamically pass through all named slots with their props -->
|
|
17
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
|
|
18
|
+
<slot :name="name" v-bind="slotProps" />
|
|
19
|
+
</template>
|
|
20
|
+
</BTooltip>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BForm @submit.prevent="handleSubmit">
|
|
3
|
+
<!-- Form-level error message -->
|
|
4
|
+
<DAlert
|
|
5
|
+
v-if="form.shouldShowMessage"
|
|
6
|
+
:model-value="form.shouldShowMessage"
|
|
7
|
+
variant="danger"
|
|
8
|
+
class="mb-3"
|
|
9
|
+
>
|
|
10
|
+
{{ form.message }}
|
|
11
|
+
</DAlert>
|
|
12
|
+
|
|
13
|
+
<!-- Render each field -->
|
|
14
|
+
<template v-for="field in fields" :key="field.key">
|
|
15
|
+
<!-- Custom slot for this field -->
|
|
16
|
+
<slot :name="`field-${field.key}`" :field="field" :form="form">
|
|
17
|
+
<!-- Default field rendering -->
|
|
18
|
+
<DFormGroup
|
|
19
|
+
:label="field.label"
|
|
20
|
+
:label-for="field.key"
|
|
21
|
+
:class="field.class || 'mb-3'"
|
|
22
|
+
>
|
|
23
|
+
<!-- Text-based inputs -->
|
|
24
|
+
<DFormInput
|
|
25
|
+
v-if="isTextInput(field.type)"
|
|
26
|
+
:id="field.key"
|
|
27
|
+
v-model="form.data[field.key]"
|
|
28
|
+
:type="field.type"
|
|
29
|
+
:required="field.required"
|
|
30
|
+
:placeholder="field.placeholder"
|
|
31
|
+
:state="form.getState(field.key)"
|
|
32
|
+
v-bind="field.inputProps"
|
|
33
|
+
@input="form.clearError(field.key)"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<!-- Textarea -->
|
|
37
|
+
<DFormTextarea
|
|
38
|
+
v-else-if="field.type === 'textarea'"
|
|
39
|
+
:id="field.key"
|
|
40
|
+
v-model="form.data[field.key]"
|
|
41
|
+
:required="field.required"
|
|
42
|
+
:placeholder="field.placeholder"
|
|
43
|
+
:rows="field.rows || 3"
|
|
44
|
+
:state="form.getState(field.key)"
|
|
45
|
+
v-bind="field.inputProps"
|
|
46
|
+
@input="form.clearError(field.key)"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<!-- Select -->
|
|
50
|
+
<DFormSelect
|
|
51
|
+
v-else-if="field.type === 'select'"
|
|
52
|
+
:id="field.key"
|
|
53
|
+
v-model="form.data[field.key]"
|
|
54
|
+
:required="field.required"
|
|
55
|
+
:options="field.options"
|
|
56
|
+
:state="form.getState(field.key)"
|
|
57
|
+
v-bind="field.inputProps"
|
|
58
|
+
@change="form.clearError(field.key)"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<!-- Checkbox -->
|
|
62
|
+
<DFormCheckbox
|
|
63
|
+
v-else-if="field.type === 'checkbox'"
|
|
64
|
+
:id="field.key"
|
|
65
|
+
v-model="form.data[field.key]"
|
|
66
|
+
v-bind="field.inputProps"
|
|
67
|
+
>
|
|
68
|
+
{{ field.label }}
|
|
69
|
+
</DFormCheckbox>
|
|
70
|
+
|
|
71
|
+
<!-- Radio group -->
|
|
72
|
+
<BFormRadioGroup
|
|
73
|
+
v-else-if="field.type === 'radio'"
|
|
74
|
+
:id="field.key"
|
|
75
|
+
v-model="form.data[field.key]"
|
|
76
|
+
:options="field.options"
|
|
77
|
+
:required="field.required"
|
|
78
|
+
:state="form.getState(field.key)"
|
|
79
|
+
v-bind="field.inputProps"
|
|
80
|
+
@change="form.clearError(field.key)"
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<!-- Validation error -->
|
|
84
|
+
<DFormInvalidFeedback v-if="form.hasError(field.key)">
|
|
85
|
+
{{ form.getError(field.key) }}
|
|
86
|
+
</DFormInvalidFeedback>
|
|
87
|
+
|
|
88
|
+
<!-- Help text -->
|
|
89
|
+
<DFormText v-if="field.help">
|
|
90
|
+
{{ field.help }}
|
|
91
|
+
</DFormText>
|
|
92
|
+
</DFormGroup>
|
|
93
|
+
</slot>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<!-- Submit button -->
|
|
97
|
+
<DButton
|
|
98
|
+
v-if="showSubmit"
|
|
99
|
+
type="submit"
|
|
100
|
+
variant="primary"
|
|
101
|
+
:disabled="form.processing"
|
|
102
|
+
class="w-100"
|
|
103
|
+
>
|
|
104
|
+
<span v-if="form.processing">{{ submitLoadingText }}</span>
|
|
105
|
+
<span v-else>{{ submitText }}</span>
|
|
106
|
+
</DButton>
|
|
107
|
+
|
|
108
|
+
<!-- Footer slot -->
|
|
109
|
+
<slot name="footer"></slot>
|
|
110
|
+
</BForm>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { BForm, BFormRadioGroup } from "bootstrap-vue-next";
|
|
115
|
+
import DAlert from "../base/DAlert.vue";
|
|
116
|
+
import DFormGroup from "../base/DFormGroup.vue";
|
|
117
|
+
import DFormInput from "../base/DFormInput.vue";
|
|
118
|
+
import DFormTextarea from "../base/DFormTextarea.vue";
|
|
119
|
+
import DFormSelect from "../base/DFormSelect.vue";
|
|
120
|
+
import DFormCheckbox from "../base/DFormCheckbox.vue";
|
|
121
|
+
import DFormInvalidFeedback from "../base/DFormInvalidFeedback.vue";
|
|
122
|
+
import DFormText from "../base/DFormText.vue";
|
|
123
|
+
import DButton from "../base/DButton.vue";
|
|
124
|
+
import type { UseFormReturn } from "../../composables/useForm";
|
|
125
|
+
import type { FieldDefinition, FieldType } from "../../types";
|
|
126
|
+
|
|
127
|
+
interface Props {
|
|
128
|
+
/** Form instance from useForm composable */
|
|
129
|
+
form: UseFormReturn<any>;
|
|
130
|
+
|
|
131
|
+
/** Field definitions */
|
|
132
|
+
fields: FieldDefinition[];
|
|
133
|
+
|
|
134
|
+
/** Submit button text */
|
|
135
|
+
submitText?: string;
|
|
136
|
+
|
|
137
|
+
/** Submit button loading text */
|
|
138
|
+
submitLoadingText?: string;
|
|
139
|
+
|
|
140
|
+
/** Show submit button */
|
|
141
|
+
showSubmit?: boolean;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
withDefaults(defineProps<Props>(), {
|
|
145
|
+
submitText: "Submit",
|
|
146
|
+
submitLoadingText: "Submitting...",
|
|
147
|
+
showSubmit: true,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const emit = defineEmits<{
|
|
151
|
+
submit: [];
|
|
152
|
+
}>();
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Check if field type is a text-based input
|
|
156
|
+
*/
|
|
157
|
+
const isTextInput = (type: FieldType): boolean => {
|
|
158
|
+
return [
|
|
159
|
+
"text",
|
|
160
|
+
"email",
|
|
161
|
+
"password",
|
|
162
|
+
"number",
|
|
163
|
+
"url",
|
|
164
|
+
"tel",
|
|
165
|
+
"date",
|
|
166
|
+
"datetime-local",
|
|
167
|
+
"time",
|
|
168
|
+
].includes(type);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Handle form submission
|
|
173
|
+
*/
|
|
174
|
+
const handleSubmit = () => {
|
|
175
|
+
emit("submit");
|
|
176
|
+
};
|
|
177
|
+
</script>
|