Skip to content

Commit c0b0deb

Browse files
authored
Merge pull request #60 from connorabbas/develop
README improvements, updates
2 parents 3e0ff98 + 76197c0 commit c0b0deb

File tree

3 files changed

+66
-43
lines changed

3 files changed

+66
-43
lines changed

README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1-
# Laravel Inertia & PrimeVue Starter Kit
2-
A basic starter kit using [Laravel](https://laravel.com/docs/master), [Intertia.js](https://inertiajs.com/), and [PrimeVue](https://primevue.org/). An equivalent to using [Laravel Breeze](https://laravel.com/docs/master/starter-kits#laravel-breeze), but with the added benefit of all the PrimeVue components at your disposal.
1+
# Laravel, Inertia, & PrimeVue Starter Kit
2+
## About
3+
A basic authentication starter kit using [Laravel](https://laravel.com/docs/master), [Intertia.js](https://inertiajs.com/), and [PrimeVue](https://primevue.org/). An equivalent to using [Laravel Breeze](https://laravel.com/docs/master/starter-kits#laravel-breeze), but with the added benefit of all the PrimeVue components at your disposal.
4+
5+
## Features
6+
- Same auth structure and features as Laravel Breeze with User Profile page
7+
- Need an admin panel? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/admin-panel)
8+
- Need SSR support? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/ssr)
9+
- Pre-configured [Auto Import](https://primevue.org/autoimport/) PrimeVue components
10+
- Wrapper components for PrimeVue's `Menu`, `MenuBar`, & `PanelMenu` utilizing Inertia's `Link` component
11+
- Light/Dark mode toggle with custom component & composable
12+
- `useLazyDataTable()` composable for use with PrimeVue's `DataTable` component for easy filtering/sorting (example usage in `feature/admin-panel` branch)
13+
- Easily customizable theming
314

4-
Need an admin panel? [There's a branch for that.](https://github.com/connorabbas/laravel-inertia-primevue/tree/feature/admin-panel)
15+
## Theme
16+
This starter kit provides a light/dark mode toggle by default, and custom theme functionality provided by the powerful **PrimeVue V4** theming system, using styled mode and custom design token values.
17+
18+
The starting point for customizing your theme will be the `resources/js/theme-preset.js` module file. To quickly change the look and feel of your site, swap the [primary](https://primevue.org/theming/styled/#primary) values with a different set of [colors](https://primevue.org/theming/styled/#colors), change the [surface](https://primevue.org/theming/styled/#surface) `colorScheme` values (slate, gray, neutral, etc.), or completely change the [preset theme](https://primevue.org/theming/styled/#presets) (Aura used by default).
19+
20+
Please reference the [PrimeVue Styled Mode Docs](https://primevue.org/theming/styled/) to fully understand how this system works, and how to further customize your theme to make it your own.
21+
22+
## PrimeVue v4 w/ Tailwind CSS
23+
If you have used a previous version of this project using **PrimeVue V3**, you'll know that PrimeFlex was used instead of Tailwind. With v4 however, the PrimeTek team has officially suggested [Moving from PrimeFlex to Tailwind CSS](https://primevue.org/guides/primeflex/).
24+
25+
For this reason, Tailwind has been added into the project and is utilized with the [tailwindcss-primeui](https://primevue.org/tailwind/#plugin) plugin. CSS layers have also been implemented so the Tailwind utilities can [override](https://primevue.org/tailwind/#override) the PrimeVue component styling when needed.
26+
27+
---
528

629
## Usage with Docker
730
This starter kit is configured to use Docker Compose for local development with a few extra configuration steps. With this setup, you do not need PHP, Composer, MySQL or Node.js installed on your machine to get up and running with this project.
@@ -35,16 +58,4 @@ This starter kit is configured to use Docker Compose for local development with
3558
- Either build manually with docker compose (like above), use [Laravel Sail](https://laravel.com/docs/master/sail), or build as a [VS Code Dev Container](https://code.visualstudio.com/docs/devcontainers/tutorial) using the `Dev Containers: Reopen in Container` command.
3659
3760
### Additional configuration
38-
If you wish to add additional services, or swap out MySQL with an alternative database, you can reference the [Laravel Sail stubs](https://github.com/laravel/sail/tree/1.x/stubs) and update the `docker-compose.local.yml` file as needed.
39-
40-
## Theme
41-
This starter kit provides a light/dark mode and custom theme functionality provided by the powerful PrimeVue theming system, using styled mode and custom design token values.
42-
43-
The starting point for customizing your theme will be the `resources/js/theme-preset.js` module file. To quickly change the look and feel of your theme, swap the [primary](https://primevue.org/theming/styled/#primary) values with a different set of [colors](https://primevue.org/theming/styled/#colors), change the [surface](https://primevue.org/theming/styled/#surface) `colorScheme` values (slate, gray, neutral, etc.), or completely change the [preset theme](https://primevue.org/theming/styled/#presets) (Aura used by default).
44-
45-
Please reference the [PrimeVue Styled Mode Docs](https://primevue.org/theming/styled/) to fully understand how this system works, and how to further customize your theme to make it your own.
46-
47-
## PrimeVue v4 w/ Tailwind CSS
48-
If you have used a previous version of this project using PrimeVue v3, you'll know that Tailwind was removed in favor of PrimeFlex. With v4 however, the PrimeTek team has officially suggested [Moving from PrimeFlex to Tailwind CSS](https://primevue.org/guides/primeflex/).
49-
50-
For this reason, Tailwind has been added back into the project and is utilized with the [tailwindcss-primeui](https://primevue.org/tailwind/#plugin) plugin. CSS layers have also been implemented so the Tailwind utilities can [override](https://primevue.org/tailwind/#override) the PrimeVue component styling when needed.
61+
If you wish to add additional services, or swap out MySQL with an alternative database, you can reference the [Laravel Sail stubs](https://github.com/laravel/sail/tree/1.x/stubs) and update the `docker-compose.local.yml` file as needed.

resources/js/Composables/useLazyDataTable.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ref, computed, onMounted } from 'vue';
22
import { router, usePage } from '@inertiajs/vue3';
33
import debounce from 'lodash/debounce';
4+
import { FilterMatchMode } from '@primevue/core/api';
45

56
export function useLazyDataTable(
67
defaultFilters = {},
@@ -53,6 +54,7 @@ export function useLazyDataTable(
5354
rows: rowsPerPage.value,
5455
},
5556
preserveState: true,
57+
showProgress: true,
5658
onSuccess: (page) => {
5759
resolve(page);
5860
},
@@ -77,6 +79,7 @@ export function useLazyDataTable(
7779
}
7880

7981
function onSort(event) {
82+
currentPage.value = 1;
8083
sortField.value = event.sortField;
8184
sortOrder.value = event.sortOrder;
8285
fetchData();
@@ -109,18 +112,27 @@ export function useLazyDataTable(
109112
});
110113
}
111114

115+
/**
116+
* WIP, parse url params into useable filters
117+
*/
112118
function parseUrlParams(urlParams) {
113119
filters.value = urlParams?.filters || dataTableDefaults.filters;
114-
// Cast strings to Numbers for v-model
115120
Object.keys(filters.value).forEach((key) => {
116121
const filter = filters.value[key];
117-
if (!filter.value) {
122+
if (!filter?.value || !filter?.matchMode) {
118123
return;
119124
}
120-
if (typeof filter.value === 'string' && !isNaN(filter.value)) {
125+
if (filter.matchMode == FilterMatchMode.DATE_IS) {
126+
filters.value[key].value = new Date(filter.value);
127+
} else if (
128+
typeof filter.value === 'string' &&
129+
!isNaN(filter.value)
130+
) {
121131
filters.value[key].value = Number(filter.value);
122-
}
123-
if (Array.isArray(filter.value)) {
132+
} else if (
133+
Array.isArray(filter.value) ||
134+
filter.matchMode == FilterMatchMode.IN
135+
) {
124136
// TODO: find out why there are duplicate array values in multi-select filters
125137
// "Fixed" with reassigning to unique array
126138
const unique = [...new Set(filter.value)];

resources/js/theme-preset.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@ const customThemePreset = definePreset(Preset, {
1919
colorScheme: {
2020
light: {
2121
surface: {
22-
50: '{gray.50}',
23-
100: '{gray.100}',
24-
200: '{gray.200}',
25-
300: '{gray.300}',
26-
400: '{gray.400}',
27-
500: '{gray.500}',
28-
600: '{gray.600}',
29-
700: '{gray.700}',
30-
800: '{gray.800}',
31-
900: '{gray.900}',
32-
950: '{gray.950}',
22+
50: '{neutral.50}',
23+
100: '{neutral.100}',
24+
200: '{neutral.200}',
25+
300: '{neutral.300}',
26+
400: '{neutral.400}',
27+
500: '{neutral.500}',
28+
600: '{neutral.600}',
29+
700: '{neutral.700}',
30+
800: '{neutral.800}',
31+
900: '{neutral.900}',
32+
950: '{neutral.950}',
3333
},
3434
},
3535
dark: {
3636
surface: {
37-
50: '{gray.50}',
38-
100: '{gray.100}',
39-
200: '{gray.200}',
40-
300: '{gray.300}',
41-
400: '{gray.400}',
42-
500: '{gray.500}',
43-
600: '{gray.600}',
44-
700: '{gray.700}',
45-
800: '{gray.800}',
46-
900: '{gray.900}',
47-
950: '{gray.950}',
37+
50: '{neutral.50}',
38+
100: '{neutral.100}',
39+
200: '{neutral.200}',
40+
300: '{neutral.300}',
41+
400: '{neutral.400}',
42+
500: '{neutral.500}',
43+
600: '{neutral.600}',
44+
700: '{neutral.700}',
45+
800: '{neutral.800}',
46+
900: '{neutral.900}',
47+
950: '{neutral.950}',
4848
},
4949
},
5050
},

0 commit comments

Comments
 (0)