create-nextjs-cms 0.6.6 → 0.6.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nextjs-cms",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsx": "^4.20.6",
|
|
30
30
|
"typescript": "^5.9.2",
|
|
31
31
|
"@lzcms/eslint-config": "0.3.0",
|
|
32
|
-
"@lzcms/
|
|
33
|
-
"@lzcms/
|
|
32
|
+
"@lzcms/prettier-config": "0.1.0",
|
|
33
|
+
"@lzcms/tsconfig": "0.1.0"
|
|
34
34
|
},
|
|
35
35
|
"prettier": "@lzcms/prettier-config",
|
|
36
36
|
"scripts": {
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
import { ConditionalField, FieldType } from 'nextjs-cms/core/types'
|
|
52
52
|
import { configLastUpdated } from '@/components/form/helpers/util'
|
|
53
53
|
import PhotoGallery from '../PhotoGallery'
|
|
54
|
+
import { useSession } from 'nextjs-cms/auth/react'
|
|
54
55
|
|
|
55
56
|
export default function Form({
|
|
56
57
|
formType,
|
|
@@ -101,6 +102,10 @@ export default function Form({
|
|
|
101
102
|
progressVariant?: 'determinate' | 'query'
|
|
102
103
|
buttonType?: 'big' | 'small'
|
|
103
104
|
}) {
|
|
105
|
+
const t = useI18n()
|
|
106
|
+
const session = useSession()
|
|
107
|
+
const locale = session?.data?.user?.locale
|
|
108
|
+
|
|
104
109
|
let schema = z.object({})
|
|
105
110
|
/**
|
|
106
111
|
* Construct the schema for the form
|
|
@@ -111,92 +116,92 @@ export default function Form({
|
|
|
111
116
|
switch (input.type) {
|
|
112
117
|
case 'select_multiple':
|
|
113
118
|
schema = schema.extend({
|
|
114
|
-
[input.name]: selectMultipleFieldSchema(input as SelectMultipleFieldClientConfig),
|
|
119
|
+
[input.name]: selectMultipleFieldSchema(input as SelectMultipleFieldClientConfig, locale),
|
|
115
120
|
})
|
|
116
121
|
break
|
|
117
122
|
case 'select':
|
|
118
123
|
schema = schema.extend({
|
|
119
|
-
[input.name]: selectFieldSchema(input as SelectFieldClientConfig),
|
|
124
|
+
[input.name]: selectFieldSchema(input as SelectFieldClientConfig, locale),
|
|
120
125
|
})
|
|
121
126
|
break
|
|
122
127
|
|
|
123
128
|
case 'date':
|
|
124
129
|
schema = schema.extend({
|
|
125
|
-
[input.name]: dateFieldSchema(input as DateFieldClientConfig),
|
|
130
|
+
[input.name]: dateFieldSchema(input as DateFieldClientConfig, locale),
|
|
126
131
|
})
|
|
127
132
|
break
|
|
128
133
|
|
|
129
134
|
case 'checkbox':
|
|
130
135
|
schema = schema.extend({
|
|
131
|
-
[input.name]: checkboxFieldSchema(input as CheckboxFieldClientConfig),
|
|
136
|
+
[input.name]: checkboxFieldSchema(input as CheckboxFieldClientConfig, locale),
|
|
132
137
|
})
|
|
133
138
|
break
|
|
134
139
|
|
|
135
140
|
case 'text':
|
|
136
141
|
schema = schema.extend({
|
|
137
|
-
[input.name]: textFieldSchema(input as TextFieldClientConfig),
|
|
142
|
+
[input.name]: textFieldSchema(input as TextFieldClientConfig, locale),
|
|
138
143
|
})
|
|
139
144
|
break
|
|
140
145
|
|
|
141
146
|
case 'textarea':
|
|
142
147
|
schema = schema.extend({
|
|
143
|
-
[input.name]: textareaFieldSchema(input as TextAreaFieldClientConfig),
|
|
148
|
+
[input.name]: textareaFieldSchema(input as TextAreaFieldClientConfig, locale),
|
|
144
149
|
})
|
|
145
150
|
break
|
|
146
151
|
|
|
147
152
|
case 'rich_text':
|
|
148
153
|
schema = schema.extend({
|
|
149
|
-
[input.name]: richTextFieldSchema(input as RichTextFieldClientConfig),
|
|
154
|
+
[input.name]: richTextFieldSchema(input as RichTextFieldClientConfig, locale),
|
|
150
155
|
})
|
|
151
156
|
break
|
|
152
157
|
|
|
153
158
|
case 'photo':
|
|
154
159
|
if (formType === 'edit' && !!input.value) break
|
|
155
160
|
schema = schema.extend({
|
|
156
|
-
[input.name]: photoFieldSchema(input as PhotoFieldClientConfig),
|
|
161
|
+
[input.name]: photoFieldSchema(input as PhotoFieldClientConfig, locale),
|
|
157
162
|
})
|
|
158
163
|
break
|
|
159
164
|
|
|
160
165
|
case 'document':
|
|
161
166
|
if (formType === 'edit' && !!input.value) break
|
|
162
167
|
schema = schema.extend({
|
|
163
|
-
[input.name]: documentFieldSchema(input as DocumentFieldClientConfig),
|
|
168
|
+
[input.name]: documentFieldSchema(input as DocumentFieldClientConfig, locale),
|
|
164
169
|
})
|
|
165
170
|
break
|
|
166
171
|
|
|
167
172
|
case 'video':
|
|
168
173
|
if (formType === 'edit' && !!input.value) break
|
|
169
174
|
schema = schema.extend({
|
|
170
|
-
[input.name]: videoFieldSchema(input as VideoFieldClientConfig),
|
|
175
|
+
[input.name]: videoFieldSchema(input as VideoFieldClientConfig, locale),
|
|
171
176
|
})
|
|
172
177
|
break
|
|
173
178
|
|
|
174
179
|
case 'number':
|
|
175
180
|
schema = schema.extend({
|
|
176
|
-
[input.name]: numberFieldSchema(input as NumberFieldClientConfig),
|
|
181
|
+
[input.name]: numberFieldSchema(input as NumberFieldClientConfig, locale),
|
|
177
182
|
})
|
|
178
183
|
break
|
|
179
184
|
case 'color':
|
|
180
185
|
schema = schema.extend({
|
|
181
|
-
[input.name]: colorFieldSchema(input as ColorFieldClientConfig),
|
|
186
|
+
[input.name]: colorFieldSchema(input as ColorFieldClientConfig, locale),
|
|
182
187
|
})
|
|
183
188
|
break
|
|
184
189
|
|
|
185
190
|
case 'map':
|
|
186
191
|
schema = schema.extend({
|
|
187
|
-
[input.name]: mapFieldSchema(input as MapFieldClientConfig),
|
|
192
|
+
[input.name]: mapFieldSchema(input as MapFieldClientConfig, locale),
|
|
188
193
|
})
|
|
189
194
|
break
|
|
190
195
|
|
|
191
196
|
case 'password':
|
|
192
197
|
schema = schema.extend({
|
|
193
|
-
[input.name]: passwordFieldSchema(input as PasswordFieldClientConfig),
|
|
198
|
+
[input.name]: passwordFieldSchema(input as PasswordFieldClientConfig, locale),
|
|
194
199
|
})
|
|
195
200
|
break
|
|
196
201
|
|
|
197
202
|
case 'slug':
|
|
198
203
|
schema = schema.extend({
|
|
199
|
-
[input.name]: slugFieldSchema(input as SlugFieldClientConfig),
|
|
204
|
+
[input.name]: slugFieldSchema(input as SlugFieldClientConfig, locale),
|
|
200
205
|
})
|
|
201
206
|
break
|
|
202
207
|
}
|
|
@@ -206,7 +211,6 @@ export default function Form({
|
|
|
206
211
|
const methods = useForm({
|
|
207
212
|
resolver: zodResolver(schema),
|
|
208
213
|
})
|
|
209
|
-
const t = useI18n()
|
|
210
214
|
|
|
211
215
|
return (
|
|
212
216
|
<FormProvider {...methods}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="next" />
|
|
2
2
|
/// <reference types="next/image-types/global" />
|
|
3
|
-
import "./.next/
|
|
3
|
+
import "./.next/types/routes.d.ts";
|
|
4
4
|
|
|
5
5
|
// NOTE: This file should not be edited
|
|
6
6
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"nanoid": "^5.1.2",
|
|
66
66
|
"next": "16.1.1",
|
|
67
67
|
"next-themes": "^0.4.6",
|
|
68
|
-
"nextjs-cms": "0.6.
|
|
68
|
+
"nextjs-cms": "0.6.7",
|
|
69
69
|
"plaiceholder": "^3.0.0",
|
|
70
70
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
71
71
|
"qrcode": "^1.5.4",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"eslint-config-prettier": "^10.0.1",
|
|
99
99
|
"eslint-plugin-prettier": "^5.2.3",
|
|
100
100
|
"fs-extra": "^11.3.3",
|
|
101
|
-
"nextjs-cms-kit": "0.6.
|
|
101
|
+
"nextjs-cms-kit": "0.6.7",
|
|
102
102
|
"postcss": "^8.5.1",
|
|
103
103
|
"prettier": "3.5.0",
|
|
104
104
|
"raw-loader": "^4.0.2",
|