inertia_rails 3.18.0 → 3.19.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/generators/inertia/install/frameworks.yml +4 -1
- data/lib/generators/inertia/install/install_generator.rb +6 -0
- data/lib/generators/inertia/install/templates/react/inertia.jsx +4 -41
- data/lib/generators/inertia/install/templates/react/inertia.tsx +5 -42
- data/lib/generators/inertia/install/templates/react/tsconfig.app.json +2 -3
- data/lib/generators/inertia/install/templates/svelte/inertia.js +4 -39
- data/lib/generators/inertia/install/templates/svelte/inertia.ts +4 -41
- data/lib/generators/inertia/install/templates/svelte/tsconfig.json +2 -3
- data/lib/generators/inertia/install/templates/vue/inertia.js +4 -38
- data/lib/generators/inertia/install/templates/vue/inertia.ts +3 -39
- data/lib/generators/inertia/install/templates/vue/tsconfig.app.json +2 -3
- data/lib/generators/inertia_templates/scaffold/templates/react/form.tsx.tt +4 -4
- data/lib/generators/inertia_templates/scaffold/templates/svelte/form.svelte.tt +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/form.ts.svelte.tt +1 -1
- data/lib/generators/inertia_templates/scaffold/templates/svelte/index.svelte.tt +2 -2
- data/lib/generators/inertia_templates/scaffold/templates/svelte/index.ts.svelte.tt +2 -2
- data/lib/generators/inertia_templates/scaffold/templates/svelte/show.svelte.tt +2 -2
- data/lib/generators/inertia_templates/scaffold/templates/svelte/show.ts.svelte.tt +2 -2
- data/lib/generators/inertia_tw_templates/scaffold/templates/react/form.tsx.tt +4 -4
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/form.ts.svelte.tt +1 -1
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/index.svelte.tt +2 -2
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/index.ts.svelte.tt +2 -2
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/show.svelte.tt +2 -2
- data/lib/generators/inertia_tw_templates/scaffold/templates/svelte/show.ts.svelte.tt +2 -2
- data/lib/inertia_rails/base_prop.rb +1 -1
- data/lib/inertia_rails/configuration.rb +19 -1
- data/lib/inertia_rails/controller.rb +15 -79
- data/lib/inertia_rails/engine.rb +37 -4
- data/lib/inertia_rails/errors.rb +30 -0
- data/lib/{patches → inertia_rails/extensions}/better_errors.rb +0 -2
- data/lib/{patches → inertia_rails/extensions}/debug_exceptions.rb +0 -4
- data/lib/{patches → inertia_rails/extensions}/mapper.rb +0 -2
- data/lib/{patches → inertia_rails/extensions}/request.rb +0 -2
- data/lib/inertia_rails/helper.rb +0 -2
- data/lib/inertia_rails/lazy_prop.rb +1 -1
- data/lib/inertia_rails/middleware.rb +2 -3
- data/lib/inertia_rails/precognition.rb +0 -3
- data/lib/inertia_rails/prop_evaluator.rb +22 -0
- data/lib/inertia_rails/props_resolver.rb +243 -0
- data/lib/inertia_rails/renderer.rb +49 -226
- data/lib/inertia_rails/scroll_prop.rb +3 -5
- data/lib/inertia_rails/ssr_renderer.rb +110 -0
- data/lib/inertia_rails/testing.rb +3 -3
- data/lib/inertia_rails/version.rb +1 -1
- data/lib/inertia_rails.rb +83 -22
- metadata +9 -8
- data/lib/inertia_rails/action_filter.rb +0 -28
- data/lib/inertia_rails/inertia_rails.rb +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91497e407b470afd9fdc6c938bf97fd1f7e74e8b39ab6e76ca8b8c50b2d92f75
|
|
4
|
+
data.tar.gz: d132dd3a36f682357bcbeb63e7d0e825449603b2928d760c5a725e9a35657fc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 385280b11bf6fc2aae7f067bb5c77e1bc641d886aa71aff1e3f25ded9db24256a53b68b0daeb4722fe28bca45f0e7b5daeff308b81d326348f3852b8e54e7f2e
|
|
7
|
+
data.tar.gz: 21548a2a8b4e1bf1ecf307d2298c78e24a7fad344f881197d8f421538ca7769704a2301979f45990c3af46fdf1578b49c53a65cfcd169ba5ac6b63150bccce1e
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [3.19.0] - 2026-03-25
|
|
8
|
+
|
|
9
|
+
* Upgrades to support Inertia.js 3.x! All thanks to @skyrukov!
|
|
10
|
+
* Improvements to renderer code structure
|
|
11
|
+
* Improved `inertia_share` implementation, including an instance method to go alongside the class method
|
|
12
|
+
* Better SSR in development
|
|
13
|
+
* Docs updates
|
|
14
|
+
* Support nested deferred/optional props
|
|
15
|
+
* ...and more!
|
|
16
|
+
|
|
7
17
|
## [3.18.0] - 2026-03-11
|
|
8
18
|
|
|
9
19
|
* New (super awesome) landing page design (seriously, go look at the animated graphic) (@skryukov)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
react:
|
|
2
2
|
inertia_package: "@inertiajs/react"
|
|
3
3
|
packages:
|
|
4
|
+
- "@inertiajs/vite"
|
|
4
5
|
- "@vitejs/plugin-react"
|
|
5
6
|
- "react"
|
|
6
7
|
- "react-dom"
|
|
@@ -25,11 +26,12 @@ react:
|
|
|
25
26
|
vue:
|
|
26
27
|
inertia_package: "@inertiajs/vue3"
|
|
27
28
|
packages:
|
|
29
|
+
- "@inertiajs/vite"
|
|
28
30
|
- "vue"
|
|
29
31
|
- "@vitejs/plugin-vue"
|
|
30
32
|
- "vite@latest"
|
|
31
33
|
packages_ts:
|
|
32
|
-
- "typescript
|
|
34
|
+
- "typescript"
|
|
33
35
|
- "vue-tsc"
|
|
34
36
|
vite_plugin_import: "import vue from '@vitejs/plugin-vue'"
|
|
35
37
|
vite_plugin_call: "vue()"
|
|
@@ -46,6 +48,7 @@ vue:
|
|
|
46
48
|
svelte:
|
|
47
49
|
inertia_package: "@inertiajs/svelte"
|
|
48
50
|
packages:
|
|
51
|
+
- "@inertiajs/vite"
|
|
49
52
|
- "svelte@5"
|
|
50
53
|
- "@sveltejs/vite-plugin-svelte"
|
|
51
54
|
- "vite@latest"
|
|
@@ -93,6 +93,12 @@ module Inertia
|
|
|
93
93
|
prepend_file vite_config_path, "#{FRAMEWORKS[framework]['vite_plugin_import']}\n"
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
unless File.read(vite_config_path).include?('@inertiajs/vite')
|
|
97
|
+
say 'Adding Inertia Vite plugin'
|
|
98
|
+
insert_into_file vite_config_path, "\n inertia(),", after: 'plugins: ['
|
|
99
|
+
prepend_file vite_config_path, "import inertia from '@inertiajs/vite'\n"
|
|
100
|
+
end
|
|
101
|
+
|
|
96
102
|
say "Copying #{inertia_entrypoint} entrypoint"
|
|
97
103
|
copy_file "#{framework}/#{inertia_entrypoint}", js_file_path("entrypoints/#{inertia_entrypoint}")
|
|
98
104
|
|
|
@@ -1,54 +1,17 @@
|
|
|
1
1
|
import { createInertiaApp } from '@inertiajs/react'
|
|
2
|
-
import { StrictMode } from 'react'
|
|
3
|
-
import { createRoot } from 'react-dom/client'
|
|
4
2
|
|
|
5
3
|
createInertiaApp({
|
|
6
|
-
|
|
7
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
|
8
|
-
//
|
|
9
|
-
// title: title => title ? `${title} - App` : 'App',
|
|
4
|
+
pages: "../pages",
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
14
|
-
// progress: false,
|
|
15
|
-
|
|
16
|
-
resolve: (name) => {
|
|
17
|
-
const pages = import.meta.glob('../pages/**/*.jsx', {
|
|
18
|
-
eager: true,
|
|
19
|
-
})
|
|
20
|
-
const page = pages[`../pages/${name}.jsx`]
|
|
21
|
-
if (!page) {
|
|
22
|
-
console.error(`Missing Inertia page component: '${name}.jsx'`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// To use a default layout, import the Layout component
|
|
26
|
-
// and use the following lines.
|
|
27
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
28
|
-
//
|
|
29
|
-
// page.default.layout ||= (page) => (<Layout>{page}</Layout>)
|
|
30
|
-
|
|
31
|
-
return page
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
setup({ el, App, props }) {
|
|
35
|
-
createRoot(el).render(
|
|
36
|
-
<StrictMode>
|
|
37
|
-
<App {...props} />
|
|
38
|
-
</StrictMode>
|
|
39
|
-
)
|
|
40
|
-
},
|
|
6
|
+
strictMode: true,
|
|
41
7
|
|
|
42
8
|
defaults: {
|
|
43
9
|
form: {
|
|
44
10
|
forceIndicesArrayFormatInFormData: false,
|
|
45
11
|
withAllErrors: true,
|
|
46
12
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
useDataInertiaHeadAttribute: true,
|
|
50
|
-
useDialogForErrorModal: true,
|
|
51
|
-
preserveEqualProps: true,
|
|
13
|
+
visitOptions: () => {
|
|
14
|
+
return { queryStringArrayFormat: "brackets" }
|
|
52
15
|
},
|
|
53
16
|
},
|
|
54
17
|
}).catch((error) => {
|
|
@@ -1,54 +1,17 @@
|
|
|
1
|
-
import { createInertiaApp
|
|
2
|
-
import { StrictMode } from 'react'
|
|
3
|
-
import { createRoot } from 'react-dom/client'
|
|
1
|
+
import { createInertiaApp } from '@inertiajs/react'
|
|
4
2
|
|
|
5
3
|
void createInertiaApp({
|
|
6
|
-
|
|
7
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
|
8
|
-
//
|
|
9
|
-
// title: title => title ? `${title} - App` : 'App',
|
|
4
|
+
pages: "../pages",
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
14
|
-
// progress: false,
|
|
15
|
-
|
|
16
|
-
resolve: (name) => {
|
|
17
|
-
const pages = import.meta.glob<{default: ResolvedComponent}>('../pages/**/*.tsx', {
|
|
18
|
-
eager: true,
|
|
19
|
-
})
|
|
20
|
-
const page = pages[`../pages/${name}.tsx`]
|
|
21
|
-
if (!page) {
|
|
22
|
-
console.error(`Missing Inertia page component: '${name}.tsx'`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// To use a default layout, import the Layout component
|
|
26
|
-
// and use the following line.
|
|
27
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
28
|
-
//
|
|
29
|
-
// page.default.layout ||= (page: ReactNode) => (<Layout>{page}</Layout>)
|
|
30
|
-
|
|
31
|
-
return page
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
setup({ el, App, props }) {
|
|
35
|
-
createRoot(el).render(
|
|
36
|
-
<StrictMode>
|
|
37
|
-
<App {...props} />
|
|
38
|
-
</StrictMode>
|
|
39
|
-
)
|
|
40
|
-
},
|
|
6
|
+
strictMode: true,
|
|
41
7
|
|
|
42
8
|
defaults: {
|
|
43
9
|
form: {
|
|
44
10
|
forceIndicesArrayFormatInFormData: false,
|
|
45
11
|
withAllErrors: true,
|
|
46
12
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
useDataInertiaHeadAttribute: true,
|
|
50
|
-
useDialogForErrorModal: true,
|
|
51
|
-
preserveEqualProps: true,
|
|
13
|
+
visitOptions: () => {
|
|
14
|
+
return { queryStringArrayFormat: "brackets" }
|
|
52
15
|
},
|
|
53
16
|
},
|
|
54
17
|
}).catch((error) => {
|
|
@@ -24,10 +24,9 @@
|
|
|
24
24
|
"noFallthroughCasesInSwitch": true,
|
|
25
25
|
|
|
26
26
|
/* Aliases */
|
|
27
|
-
"baseUrl": ".",
|
|
28
27
|
"paths": {
|
|
29
|
-
"@/*": ["
|
|
30
|
-
"~/*": ["
|
|
28
|
+
"@/*": ["./<%= js_destination_path %>/*"],
|
|
29
|
+
"~/*": ["./<%= js_destination_path %>/*"]
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
"include": ["<%= js_destination_path %>"]
|
|
@@ -1,50 +1,15 @@
|
|
|
1
1
|
import { createInertiaApp } from '@inertiajs/svelte'
|
|
2
|
-
import { mount } from 'svelte';
|
|
3
2
|
|
|
4
3
|
createInertiaApp({
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
8
|
-
// progress: false,
|
|
9
|
-
|
|
10
|
-
resolve: (name) => {
|
|
11
|
-
const pages = import.meta.glob('../pages/**/*.svelte', {
|
|
12
|
-
eager: true,
|
|
13
|
-
})
|
|
14
|
-
const page = pages[`../pages/${name}.svelte`]
|
|
15
|
-
if (!page) {
|
|
16
|
-
console.error(`Missing Inertia page component: '${name}.svelte'`)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// To use a default layout, import the Layout component
|
|
20
|
-
// and use the following line.
|
|
21
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
22
|
-
//
|
|
23
|
-
// return { default: page.default, layout: page.layout || Layout }
|
|
24
|
-
|
|
25
|
-
return page
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
setup({ el, App, props }) {
|
|
29
|
-
if (el) {
|
|
30
|
-
mount(App, { target: el, props })
|
|
31
|
-
} else {
|
|
32
|
-
console.error(
|
|
33
|
-
"Missing root element.\n\n" +
|
|
34
|
-
"If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n" +
|
|
35
|
-
'Consider moving <%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
},
|
|
4
|
+
pages: "../pages",
|
|
39
5
|
|
|
40
6
|
defaults: {
|
|
41
7
|
form: {
|
|
42
8
|
forceIndicesArrayFormatInFormData: false,
|
|
9
|
+
withAllErrors: true,
|
|
43
10
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
useDialogForErrorModal: true,
|
|
47
|
-
preserveEqualProps: true,
|
|
11
|
+
visitOptions: () => {
|
|
12
|
+
return { queryStringArrayFormat: "brackets" }
|
|
48
13
|
},
|
|
49
14
|
},
|
|
50
15
|
})
|
|
@@ -1,52 +1,15 @@
|
|
|
1
|
-
import { createInertiaApp
|
|
2
|
-
import { mount } from 'svelte'
|
|
1
|
+
import { createInertiaApp } from '@inertiajs/svelte'
|
|
3
2
|
|
|
4
3
|
createInertiaApp({
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
8
|
-
// progress: false,
|
|
9
|
-
|
|
10
|
-
resolve: (name) => {
|
|
11
|
-
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', {
|
|
12
|
-
eager: true,
|
|
13
|
-
})
|
|
14
|
-
const page = pages[`../pages/${name}.svelte`]
|
|
15
|
-
if (!page) {
|
|
16
|
-
console.error(`Missing Inertia page component: '${name}.svelte'`)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// To use a default layout, import the Layout component
|
|
20
|
-
// and use the following line.
|
|
21
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
22
|
-
//
|
|
23
|
-
// return { default: page.default, layout: page.layout || Layout } as ResolvedComponent
|
|
24
|
-
|
|
25
|
-
return page
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
setup({ el, App, props }) {
|
|
29
|
-
if (el) {
|
|
30
|
-
mount(App, { target: el, props })
|
|
31
|
-
} else {
|
|
32
|
-
console.error(
|
|
33
|
-
'Missing root element.\n\n' +
|
|
34
|
-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
|
|
35
|
-
'Consider moving <%= vite_typescript_tag "inertia" %> to the Inertia-specific layout instead.',
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
},
|
|
4
|
+
pages: "../pages",
|
|
39
5
|
|
|
40
6
|
defaults: {
|
|
41
7
|
form: {
|
|
42
8
|
forceIndicesArrayFormatInFormData: false,
|
|
43
9
|
withAllErrors: true,
|
|
44
10
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
useDataInertiaHeadAttribute: true,
|
|
48
|
-
useDialogForErrorModal: true,
|
|
49
|
-
preserveEqualProps: true,
|
|
11
|
+
visitOptions: () => {
|
|
12
|
+
return { queryStringArrayFormat: "brackets" }
|
|
50
13
|
},
|
|
51
14
|
},
|
|
52
15
|
})
|
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
"moduleDetection": "force",
|
|
18
18
|
|
|
19
19
|
/* Aliases */
|
|
20
|
-
"baseUrl": ".",
|
|
21
20
|
"paths": {
|
|
22
|
-
"@/*": ["
|
|
23
|
-
"~/*": ["
|
|
21
|
+
"@/*": ["./<%= js_destination_path %>/*"],
|
|
22
|
+
"~/*": ["./<%= js_destination_path %>/*"]
|
|
24
23
|
}
|
|
25
24
|
},
|
|
26
25
|
|
|
@@ -1,49 +1,15 @@
|
|
|
1
1
|
import { createInertiaApp } from '@inertiajs/vue3'
|
|
2
|
-
import { createApp, h } from 'vue'
|
|
3
2
|
|
|
4
3
|
createInertiaApp({
|
|
5
|
-
|
|
6
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
|
7
|
-
//
|
|
8
|
-
// title: title => title ? `${title} - App` : 'App',
|
|
9
|
-
|
|
10
|
-
// Disable progress bar
|
|
11
|
-
//
|
|
12
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
13
|
-
// progress: false,
|
|
14
|
-
|
|
15
|
-
resolve: (name) => {
|
|
16
|
-
const pages = import.meta.glob('../pages/**/*.vue', {
|
|
17
|
-
eager: true,
|
|
18
|
-
})
|
|
19
|
-
const page = pages[`../pages/${name}.vue`]
|
|
20
|
-
if (!page) {
|
|
21
|
-
console.error(`Missing Inertia page component: '${name}.vue'`)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// To use a default layout, import the Layout component
|
|
25
|
-
// and use the following lines.
|
|
26
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
27
|
-
//
|
|
28
|
-
// page.default.layout = page.default.layout || Layout
|
|
29
|
-
|
|
30
|
-
return page
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
setup({ el, App, props, plugin }) {
|
|
34
|
-
createApp({ render: () => h(App, props) })
|
|
35
|
-
.use(plugin)
|
|
36
|
-
.mount(el)
|
|
37
|
-
},
|
|
4
|
+
pages: "../pages",
|
|
38
5
|
|
|
39
6
|
defaults: {
|
|
40
7
|
form: {
|
|
41
8
|
forceIndicesArrayFormatInFormData: false,
|
|
9
|
+
withAllErrors: true,
|
|
42
10
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
useDialogForErrorModal: true,
|
|
46
|
-
preserveEqualProps: true,
|
|
11
|
+
visitOptions: () => {
|
|
12
|
+
return { queryStringArrayFormat: "brackets" }
|
|
47
13
|
},
|
|
48
14
|
},
|
|
49
15
|
}).catch((error) => {
|
|
@@ -1,51 +1,15 @@
|
|
|
1
1
|
import { createInertiaApp } from '@inertiajs/vue3'
|
|
2
|
-
import { createApp, DefineComponent, h } from 'vue'
|
|
3
2
|
|
|
4
3
|
createInertiaApp({
|
|
5
|
-
|
|
6
|
-
// see https://inertia-rails.dev/guide/title-and-meta
|
|
7
|
-
//
|
|
8
|
-
// title: title => title ? `${title} - App` : 'App',
|
|
9
|
-
|
|
10
|
-
// Disable progress bar
|
|
11
|
-
//
|
|
12
|
-
// see https://inertia-rails.dev/guide/progress-indicators
|
|
13
|
-
// progress: false,
|
|
14
|
-
|
|
15
|
-
resolve: (name) => {
|
|
16
|
-
const pages = import.meta.glob<DefineComponent>('../pages/**/*.vue', {
|
|
17
|
-
eager: true,
|
|
18
|
-
})
|
|
19
|
-
const page = pages[`../pages/${name}.vue`]
|
|
20
|
-
if (!page) {
|
|
21
|
-
console.error(`Missing Inertia page component: '${name}.vue'`)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// To use a default layout, import the Layout component
|
|
25
|
-
// and use the following lines.
|
|
26
|
-
// see https://inertia-rails.dev/guide/pages#default-layouts
|
|
27
|
-
//
|
|
28
|
-
// page.default.layout = page.default.layout || Layout
|
|
29
|
-
|
|
30
|
-
return page
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
setup({ el, App, props, plugin }) {
|
|
34
|
-
createApp({ render: () => h(App, props) })
|
|
35
|
-
.use(plugin)
|
|
36
|
-
.mount(el)
|
|
37
|
-
},
|
|
4
|
+
pages: "../pages",
|
|
38
5
|
|
|
39
6
|
defaults: {
|
|
40
7
|
form: {
|
|
41
8
|
forceIndicesArrayFormatInFormData: false,
|
|
42
9
|
withAllErrors: true,
|
|
43
10
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
useDataInertiaHeadAttribute: true,
|
|
47
|
-
useDialogForErrorModal: true,
|
|
48
|
-
preserveEqualProps: true,
|
|
11
|
+
visitOptions: () => {
|
|
12
|
+
return { queryStringArrayFormat: "brackets" }
|
|
49
13
|
},
|
|
50
14
|
},
|
|
51
15
|
}).catch((error) => {
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
"noFallthroughCasesInSwitch": true,
|
|
22
22
|
|
|
23
23
|
/* Aliases */
|
|
24
|
-
"baseUrl": ".",
|
|
25
24
|
"paths": {
|
|
26
|
-
"@/*": ["
|
|
27
|
-
"~/*": ["
|
|
25
|
+
"@/*": ["./<%= js_destination_path %>/*"],
|
|
26
|
+
"~/*": ["./<%= js_destination_path %>/*"]
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
29
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { type FormComponentProps } from '@inertiajs/core'
|
|
1
2
|
import { Form as InertiaForm } from '@inertiajs/react'
|
|
2
|
-
import { type ComponentProps } from 'react'
|
|
3
3
|
|
|
4
|
-
import type { <%= inertia_model_type %> } from './types'
|
|
4
|
+
import type { <%= inertia_model_type %>, <%= inertia_model_form_type %> } from './types'
|
|
5
5
|
|
|
6
|
-
type FormProps =
|
|
6
|
+
type FormProps = FormComponentProps<<%= inertia_model_form_type %>> & {
|
|
7
7
|
<%= singular_table_name %>: <%= inertia_model_type %>
|
|
8
8
|
submitText: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export default function Form({ <%= singular_table_name %>, submitText, ...formProps }: FormProps) {
|
|
12
12
|
return (
|
|
13
|
-
<InertiaForm
|
|
13
|
+
<InertiaForm<<%= inertia_model_form_type %>>
|
|
14
14
|
transform={data => ({ <%= singular_table_name %>: data })}
|
|
15
15
|
{...formProps}
|
|
16
16
|
>
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<title><%= human_name.pluralize %></title>
|
|
10
10
|
</svelte:head>
|
|
11
11
|
|
|
12
|
-
{#if
|
|
13
|
-
<p class="notice">{
|
|
12
|
+
{#if page.flash.notice}
|
|
13
|
+
<p class="notice">{page.flash.notice}</p>
|
|
14
14
|
{/if}
|
|
15
15
|
|
|
16
16
|
<h1><%= human_name.pluralize %></h1>
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<title><%= human_name.pluralize %></title>
|
|
13
13
|
</svelte:head>
|
|
14
14
|
|
|
15
|
-
{#if
|
|
16
|
-
<p class="notice">{
|
|
15
|
+
{#if page.flash.notice}
|
|
16
|
+
<p class="notice">{page.flash.notice}</p>
|
|
17
17
|
{/if}
|
|
18
18
|
|
|
19
19
|
<h1><%= human_name.pluralize %></h1>
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
<title><%= human_name %> #{<%= singular_table_name %>.id}</title>
|
|
10
10
|
</svelte:head>
|
|
11
11
|
|
|
12
|
-
{#if
|
|
13
|
-
<p class="notice">{
|
|
12
|
+
{#if page.flash.notice}
|
|
13
|
+
<p class="notice">{page.flash.notice}</p>
|
|
14
14
|
{/if}
|
|
15
15
|
|
|
16
16
|
<h1><%= human_name %> #{<%= singular_table_name %>.id}</h1>
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<title><%= human_name %> #{<%= singular_table_name %>.id}</title>
|
|
13
13
|
</svelte:head>
|
|
14
14
|
|
|
15
|
-
{#if
|
|
16
|
-
<p class="notice">{
|
|
15
|
+
{#if page.flash.notice}
|
|
16
|
+
<p class="notice">{page.flash.notice}</p>
|
|
17
17
|
{/if}
|
|
18
18
|
|
|
19
19
|
<h1><%= human_name %> #{<%= singular_table_name %>.id}</h1>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { type FormComponentProps } from '@inertiajs/core'
|
|
1
2
|
import { Form as InertiaForm } from '@inertiajs/react'
|
|
2
|
-
import { type ComponentProps } from 'react'
|
|
3
3
|
|
|
4
|
-
import { <%= inertia_model_type %> } from './types'
|
|
4
|
+
import type { <%= inertia_model_type %>, <%= inertia_model_form_type %> } from './types'
|
|
5
5
|
|
|
6
|
-
type FormProps =
|
|
6
|
+
type FormProps = FormComponentProps<<%= inertia_model_form_type %>> & {
|
|
7
7
|
<%= singular_table_name %>: <%= inertia_model_type %>
|
|
8
8
|
submitText: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export default function Form({ <%= singular_table_name %>, submitText, ...formProps }: FormProps) {
|
|
12
12
|
return (
|
|
13
|
-
<InertiaForm
|
|
13
|
+
<InertiaForm<<%= inertia_model_form_type %>>
|
|
14
14
|
transform={data => ({ <%= singular_table_name %>: data })}
|
|
15
15
|
className="contents"
|
|
16
16
|
{...formProps}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
</svelte:head>
|
|
11
11
|
|
|
12
12
|
<div class="mx-auto md:w-2/3 w-full px-8 pt-8">
|
|
13
|
-
{#if
|
|
13
|
+
{#if page.flash.notice}
|
|
14
14
|
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block">
|
|
15
|
-
{
|
|
15
|
+
{page.flash.notice}
|
|
16
16
|
</p>
|
|
17
17
|
{/if}
|
|
18
18
|
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
</svelte:head>
|
|
14
14
|
|
|
15
15
|
<div class="mx-auto md:w-2/3 w-full px-8 pt-8">
|
|
16
|
-
{#if
|
|
16
|
+
{#if page.flash.notice}
|
|
17
17
|
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block">
|
|
18
|
-
{
|
|
18
|
+
{page.flash.notice}
|
|
19
19
|
</p>
|
|
20
20
|
{/if}
|
|
21
21
|
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
<div class="mx-auto md:w-2/3 w-full px-8 pt-8">
|
|
13
13
|
<div class="mx-auto">
|
|
14
|
-
{#if
|
|
14
|
+
{#if page.flash.notice}
|
|
15
15
|
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block">
|
|
16
|
-
{
|
|
16
|
+
{page.flash.notice}
|
|
17
17
|
</p>
|
|
18
18
|
{/if}
|
|
19
19
|
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
<div class="mx-auto md:w-2/3 w-full px-8 pt-8">
|
|
16
16
|
<div class="mx-auto">
|
|
17
|
-
{#if
|
|
17
|
+
{#if page.flash.notice}
|
|
18
18
|
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block">
|
|
19
|
-
{
|
|
19
|
+
{page.flash.notice}
|
|
20
20
|
</p>
|
|
21
21
|
{/if}
|
|
22
22
|
|