create-nextjs-cms 0.6.5 → 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": {
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
RichTextFieldClientConfig,
|
|
25
25
|
SelectFieldClientConfig,
|
|
26
26
|
SelectMultipleFieldClientConfig,
|
|
27
|
+
SlugFieldClientConfig,
|
|
27
28
|
TextAreaFieldClientConfig,
|
|
28
29
|
TextFieldClientConfig,
|
|
29
30
|
VideoFieldClientConfig,
|
|
@@ -44,11 +45,13 @@ import {
|
|
|
44
45
|
colorFieldSchema,
|
|
45
46
|
mapFieldSchema,
|
|
46
47
|
passwordFieldSchema,
|
|
48
|
+
slugFieldSchema,
|
|
47
49
|
} from 'nextjs-cms/validators'
|
|
48
50
|
|
|
49
51
|
import { ConditionalField, FieldType } from 'nextjs-cms/core/types'
|
|
50
52
|
import { configLastUpdated } from '@/components/form/helpers/util'
|
|
51
53
|
import PhotoGallery from '../PhotoGallery'
|
|
54
|
+
import { useSession } from 'nextjs-cms/auth/react'
|
|
52
55
|
|
|
53
56
|
export default function Form({
|
|
54
57
|
formType,
|
|
@@ -99,6 +102,10 @@ export default function Form({
|
|
|
99
102
|
progressVariant?: 'determinate' | 'query'
|
|
100
103
|
buttonType?: 'big' | 'small'
|
|
101
104
|
}) {
|
|
105
|
+
const t = useI18n()
|
|
106
|
+
const session = useSession()
|
|
107
|
+
const locale = session?.data?.user?.locale
|
|
108
|
+
|
|
102
109
|
let schema = z.object({})
|
|
103
110
|
/**
|
|
104
111
|
* Construct the schema for the form
|
|
@@ -109,86 +116,92 @@ export default function Form({
|
|
|
109
116
|
switch (input.type) {
|
|
110
117
|
case 'select_multiple':
|
|
111
118
|
schema = schema.extend({
|
|
112
|
-
[input.name]: selectMultipleFieldSchema(input as SelectMultipleFieldClientConfig),
|
|
119
|
+
[input.name]: selectMultipleFieldSchema(input as SelectMultipleFieldClientConfig, locale),
|
|
113
120
|
})
|
|
114
121
|
break
|
|
115
122
|
case 'select':
|
|
116
123
|
schema = schema.extend({
|
|
117
|
-
[input.name]: selectFieldSchema(input as SelectFieldClientConfig),
|
|
124
|
+
[input.name]: selectFieldSchema(input as SelectFieldClientConfig, locale),
|
|
118
125
|
})
|
|
119
126
|
break
|
|
120
127
|
|
|
121
128
|
case 'date':
|
|
122
129
|
schema = schema.extend({
|
|
123
|
-
[input.name]: dateFieldSchema(input as DateFieldClientConfig),
|
|
130
|
+
[input.name]: dateFieldSchema(input as DateFieldClientConfig, locale),
|
|
124
131
|
})
|
|
125
132
|
break
|
|
126
133
|
|
|
127
134
|
case 'checkbox':
|
|
128
135
|
schema = schema.extend({
|
|
129
|
-
[input.name]: checkboxFieldSchema(input as CheckboxFieldClientConfig),
|
|
136
|
+
[input.name]: checkboxFieldSchema(input as CheckboxFieldClientConfig, locale),
|
|
130
137
|
})
|
|
131
138
|
break
|
|
132
139
|
|
|
133
140
|
case 'text':
|
|
134
141
|
schema = schema.extend({
|
|
135
|
-
[input.name]: textFieldSchema(input as TextFieldClientConfig),
|
|
142
|
+
[input.name]: textFieldSchema(input as TextFieldClientConfig, locale),
|
|
136
143
|
})
|
|
137
144
|
break
|
|
138
145
|
|
|
139
146
|
case 'textarea':
|
|
140
147
|
schema = schema.extend({
|
|
141
|
-
[input.name]: textareaFieldSchema(input as TextAreaFieldClientConfig),
|
|
148
|
+
[input.name]: textareaFieldSchema(input as TextAreaFieldClientConfig, locale),
|
|
142
149
|
})
|
|
143
150
|
break
|
|
144
151
|
|
|
145
152
|
case 'rich_text':
|
|
146
153
|
schema = schema.extend({
|
|
147
|
-
[input.name]: richTextFieldSchema(input as RichTextFieldClientConfig),
|
|
154
|
+
[input.name]: richTextFieldSchema(input as RichTextFieldClientConfig, locale),
|
|
148
155
|
})
|
|
149
156
|
break
|
|
150
157
|
|
|
151
158
|
case 'photo':
|
|
152
159
|
if (formType === 'edit' && !!input.value) break
|
|
153
160
|
schema = schema.extend({
|
|
154
|
-
[input.name]: photoFieldSchema(input as PhotoFieldClientConfig),
|
|
161
|
+
[input.name]: photoFieldSchema(input as PhotoFieldClientConfig, locale),
|
|
155
162
|
})
|
|
156
163
|
break
|
|
157
164
|
|
|
158
165
|
case 'document':
|
|
159
166
|
if (formType === 'edit' && !!input.value) break
|
|
160
167
|
schema = schema.extend({
|
|
161
|
-
[input.name]: documentFieldSchema(input as DocumentFieldClientConfig),
|
|
168
|
+
[input.name]: documentFieldSchema(input as DocumentFieldClientConfig, locale),
|
|
162
169
|
})
|
|
163
170
|
break
|
|
164
171
|
|
|
165
172
|
case 'video':
|
|
166
173
|
if (formType === 'edit' && !!input.value) break
|
|
167
174
|
schema = schema.extend({
|
|
168
|
-
[input.name]: videoFieldSchema(input as VideoFieldClientConfig),
|
|
175
|
+
[input.name]: videoFieldSchema(input as VideoFieldClientConfig, locale),
|
|
169
176
|
})
|
|
170
177
|
break
|
|
171
178
|
|
|
172
179
|
case 'number':
|
|
173
180
|
schema = schema.extend({
|
|
174
|
-
[input.name]: numberFieldSchema(input as NumberFieldClientConfig),
|
|
181
|
+
[input.name]: numberFieldSchema(input as NumberFieldClientConfig, locale),
|
|
175
182
|
})
|
|
176
183
|
break
|
|
177
184
|
case 'color':
|
|
178
185
|
schema = schema.extend({
|
|
179
|
-
[input.name]: colorFieldSchema(input as ColorFieldClientConfig),
|
|
186
|
+
[input.name]: colorFieldSchema(input as ColorFieldClientConfig, locale),
|
|
180
187
|
})
|
|
181
188
|
break
|
|
182
189
|
|
|
183
190
|
case 'map':
|
|
184
191
|
schema = schema.extend({
|
|
185
|
-
[input.name]: mapFieldSchema(input as MapFieldClientConfig),
|
|
192
|
+
[input.name]: mapFieldSchema(input as MapFieldClientConfig, locale),
|
|
186
193
|
})
|
|
187
194
|
break
|
|
188
195
|
|
|
189
196
|
case 'password':
|
|
190
197
|
schema = schema.extend({
|
|
191
|
-
[input.name]: passwordFieldSchema(input as PasswordFieldClientConfig),
|
|
198
|
+
[input.name]: passwordFieldSchema(input as PasswordFieldClientConfig, locale),
|
|
199
|
+
})
|
|
200
|
+
break
|
|
201
|
+
|
|
202
|
+
case 'slug':
|
|
203
|
+
schema = schema.extend({
|
|
204
|
+
[input.name]: slugFieldSchema(input as SlugFieldClientConfig, locale),
|
|
192
205
|
})
|
|
193
206
|
break
|
|
194
207
|
}
|
|
@@ -198,7 +211,6 @@ export default function Form({
|
|
|
198
211
|
const methods = useForm({
|
|
199
212
|
resolver: zodResolver(schema),
|
|
200
213
|
})
|
|
201
|
-
const t = useI18n()
|
|
202
214
|
|
|
203
215
|
return (
|
|
204
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",
|