nextjs-cms 0.8.9 → 0.9.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.
- package/LICENSE +21 -21
- package/README.md +290 -290
- package/dist/api/index.d.ts +92 -9
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/lib/serverActions.d.ts +64 -9
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +463 -90
- package/dist/api/root.d.ts +184 -18
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/routers/accountSettings.d.ts +2 -2
- package/dist/api/routers/accountSettings.js +10 -10
- package/dist/api/routers/admins.js +11 -11
- package/dist/api/routers/auth.d.ts +1 -1
- package/dist/api/routers/config.d.ts +13 -0
- package/dist/api/routers/config.d.ts.map +1 -1
- package/dist/api/routers/config.js +4 -0
- package/dist/api/routers/cpanel.js +7 -7
- package/dist/api/routers/fields.d.ts +1 -0
- package/dist/api/routers/fields.d.ts.map +1 -1
- package/dist/api/routers/fields.js +39 -6
- package/dist/api/routers/gallery.js +1 -1
- package/dist/api/routers/hasItemsSection.d.ts +41 -2
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/routers/hasItemsSection.js +43 -2
- package/dist/api/routers/logs.js +1 -1
- package/dist/api/routers/navigation.d.ts +3 -3
- package/dist/api/routers/simpleSection.d.ts +31 -1
- package/dist/api/routers/simpleSection.d.ts.map +1 -1
- package/dist/api/routers/simpleSection.js +44 -2
- package/dist/api/trpc.js +2 -2
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/lib/actions.d.ts +3 -3
- package/dist/auth/lib/actions.d.ts.map +1 -1
- package/dist/auth/lib/actions.js +14 -14
- package/dist/auth/react.d.ts +2 -2
- package/dist/auth/react.d.ts.map +1 -1
- package/dist/auth/react.js +7 -7
- package/dist/cli/lib/db-config.js +10 -10
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +145 -9
- package/dist/cli/utils/schema-generator.d.ts +20 -0
- package/dist/cli/utils/schema-generator.d.ts.map +1 -1
- package/dist/cli/utils/schema-generator.js +40 -0
- package/dist/core/config/config-loader.d.ts +49 -5
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +100 -21
- package/dist/core/config/index.d.ts +2 -2
- package/dist/core/config/index.d.ts.map +1 -1
- package/dist/core/config/index.js +1 -1
- package/dist/core/db/table-checker/MysqlTable.js +8 -8
- package/dist/core/factories/FieldFactory.d.ts +5 -3
- package/dist/core/factories/FieldFactory.d.ts.map +1 -1
- package/dist/core/factories/FieldFactory.js +74 -16
- package/dist/core/factories/section-factory-with-esbuild.d.ts.map +1 -1
- package/dist/core/factories/section-factory-with-esbuild.js +15 -9
- package/dist/core/factories/section-factory-with-jiti.d.ts.map +1 -1
- package/dist/core/factories/section-factory-with-jiti.js +15 -9
- package/dist/core/fields/checkbox.d.ts +4 -1
- package/dist/core/fields/checkbox.d.ts.map +1 -1
- package/dist/core/fields/color.d.ts +4 -1
- package/dist/core/fields/color.d.ts.map +1 -1
- package/dist/core/fields/color.js +2 -2
- package/dist/core/fields/date.d.ts +4 -1
- package/dist/core/fields/date.d.ts.map +1 -1
- package/dist/core/fields/date.js +2 -2
- package/dist/core/fields/document.d.ts +4 -1
- package/dist/core/fields/document.d.ts.map +1 -1
- package/dist/core/fields/document.js +27 -18
- package/dist/core/fields/field-group.d.ts +3 -3
- package/dist/core/fields/field-group.d.ts.map +1 -1
- package/dist/core/fields/field.d.ts +11 -8
- package/dist/core/fields/field.d.ts.map +1 -1
- package/dist/core/fields/field.js +15 -11
- package/dist/core/fields/map.d.ts +4 -1
- package/dist/core/fields/map.d.ts.map +1 -1
- package/dist/core/fields/map.js +2 -2
- package/dist/core/fields/number.d.ts +26 -1
- package/dist/core/fields/number.d.ts.map +1 -1
- package/dist/core/fields/number.js +16 -7
- package/dist/core/fields/password.d.ts +4 -1
- package/dist/core/fields/password.d.ts.map +1 -1
- package/dist/core/fields/password.js +3 -3
- package/dist/core/fields/photo.d.ts +4 -1
- package/dist/core/fields/photo.d.ts.map +1 -1
- package/dist/core/fields/photo.js +17 -17
- package/dist/core/fields/richText.d.ts +17 -3
- package/dist/core/fields/richText.d.ts.map +1 -1
- package/dist/core/fields/richText.js +20 -8
- package/dist/core/fields/select.d.ts +10 -3
- package/dist/core/fields/select.d.ts.map +1 -1
- package/dist/core/fields/select.js +27 -34
- package/dist/core/fields/selectMultiple.d.ts +8 -4
- package/dist/core/fields/selectMultiple.d.ts.map +1 -1
- package/dist/core/fields/selectMultiple.js +32 -24
- package/dist/core/fields/slug.d.ts +16 -1
- package/dist/core/fields/slug.d.ts.map +1 -1
- package/dist/core/fields/slug.js +3 -3
- package/dist/core/fields/tags.d.ts +6 -3
- package/dist/core/fields/tags.d.ts.map +1 -1
- package/dist/core/fields/tags.js +26 -19
- package/dist/core/fields/text.d.ts +24 -1
- package/dist/core/fields/text.d.ts.map +1 -1
- package/dist/core/fields/text.js +12 -3
- package/dist/core/fields/textArea.d.ts +24 -1
- package/dist/core/fields/textArea.d.ts.map +1 -1
- package/dist/core/fields/textArea.js +9 -0
- package/dist/core/fields/video.d.ts +4 -1
- package/dist/core/fields/video.d.ts.map +1 -1
- package/dist/core/fields/video.js +14 -12
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/localization/index.d.ts +3 -0
- package/dist/core/localization/index.d.ts.map +1 -0
- package/dist/core/localization/index.js +1 -0
- package/dist/core/localization/resolve-locale.d.ts +29 -0
- package/dist/core/localization/resolve-locale.d.ts.map +1 -0
- package/dist/core/localization/resolve-locale.js +43 -0
- package/dist/core/sections/category.d.ts +56 -44
- package/dist/core/sections/category.d.ts.map +1 -1
- package/dist/core/sections/category.js +3 -3
- package/dist/core/sections/hasItems.d.ts +80 -44
- package/dist/core/sections/hasItems.d.ts.map +1 -1
- package/dist/core/sections/section.d.ts +55 -28
- package/dist/core/sections/section.d.ts.map +1 -1
- package/dist/core/sections/section.js +22 -0
- package/dist/core/sections/simple.d.ts +8 -8
- package/dist/core/sections/simple.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.d.ts +24 -16
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -1
- package/dist/core/submit/ItemEditSubmit.js +62 -38
- package/dist/core/submit/LocaleSubmit.d.ts +97 -0
- package/dist/core/submit/LocaleSubmit.d.ts.map +1 -0
- package/dist/core/submit/LocaleSubmit.js +435 -0
- package/dist/core/submit/NewItemSubmit.d.ts +0 -8
- package/dist/core/submit/NewItemSubmit.d.ts.map +1 -1
- package/dist/core/submit/NewItemSubmit.js +6 -12
- package/dist/core/submit/index.d.ts +1 -0
- package/dist/core/submit/index.d.ts.map +1 -1
- package/dist/core/submit/index.js +1 -0
- package/dist/core/submit/submit.d.ts +35 -12
- package/dist/core/submit/submit.d.ts.map +1 -1
- package/dist/core/submit/submit.js +88 -69
- package/dist/db/schema.d.ts +17 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +1 -0
- package/dist/logging/log.d.ts +1 -1
- package/dist/logging/log.d.ts.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/loader.d.ts +3 -3
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/translations/base/en.d.ts +24 -2
- package/dist/translations/base/en.d.ts.map +1 -1
- package/dist/translations/base/en.js +24 -2
- package/dist/translations/client.d.ts +292 -28
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/client.js +2 -2
- package/dist/translations/dict-store.d.ts +2 -2
- package/dist/translations/dict-store.d.ts.map +1 -1
- package/dist/translations/dict-store.js +9 -9
- package/dist/translations/index.d.ts +5 -5
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/index.js +6 -6
- package/dist/translations/language-cookie.d.ts +24 -0
- package/dist/translations/language-cookie.d.ts.map +1 -0
- package/dist/translations/language-cookie.js +44 -0
- package/dist/translations/language-utils.d.ts +42 -0
- package/dist/translations/language-utils.d.ts.map +1 -0
- package/dist/translations/language-utils.js +52 -0
- package/dist/translations/server.d.ts +293 -29
- package/dist/translations/server.d.ts.map +1 -1
- package/dist/translations/server.js +5 -5
- package/dist/validators/number.d.ts +1 -1
- package/dist/validators/number.d.ts.map +1 -1
- package/dist/validators/number.js +1 -1
- package/dist/validators/select-multiple.d.ts +2 -2
- package/dist/validators/select-multiple.d.ts.map +1 -1
- package/dist/validators/select-multiple.js +1 -1
- package/package.json +7 -3
- package/dist/translations/dictionaries/ar.d.ts +0 -433
- package/dist/translations/dictionaries/ar.d.ts.map +0 -1
- package/dist/translations/dictionaries/ar.js +0 -444
- package/dist/translations/dictionaries/en.d.ts +0 -433
- package/dist/translations/dictionaries/en.d.ts.map +0 -1
- package/dist/translations/dictionaries/en.js +0 -444
|
@@ -52,6 +52,12 @@ const baseRichTextExtraConfigSchema = z
|
|
|
52
52
|
* @default true
|
|
53
53
|
*/
|
|
54
54
|
sanitize: z.boolean().optional().describe('Sanitize the value before saving'),
|
|
55
|
+
/**
|
|
56
|
+
* Explicitly set the text direction for this field.
|
|
57
|
+
* When set, overrides the locale-based RTL setting across all locales.
|
|
58
|
+
* Useful for fields that always have a fixed direction regardless of the content locale.
|
|
59
|
+
*/
|
|
60
|
+
rtl: z.boolean().optional().describe('Override text direction: true for RTL, false for LTR'),
|
|
55
61
|
})
|
|
56
62
|
.superRefine((value, ctx) => {
|
|
57
63
|
if (value.minLength !== undefined && value.maxLength !== undefined && value.minLength > value.maxLength) {
|
|
@@ -81,6 +87,7 @@ export class RichTextField extends Field {
|
|
|
81
87
|
allowMedia;
|
|
82
88
|
allowImageUploads;
|
|
83
89
|
sanitize;
|
|
90
|
+
rtl;
|
|
84
91
|
_inlinePhotos = [];
|
|
85
92
|
constructor(config) {
|
|
86
93
|
super(config, 'rich_text');
|
|
@@ -88,6 +95,7 @@ export class RichTextField extends Field {
|
|
|
88
95
|
this.minLength = config.minLength;
|
|
89
96
|
this.placeholder = config.placeholder;
|
|
90
97
|
this.sanitize = config.sanitize ?? true;
|
|
98
|
+
this.rtl = config.rtl;
|
|
91
99
|
if (config.allowMedia && config.allowImageUploads?.publicURLPrefix) {
|
|
92
100
|
this.allowMedia = true;
|
|
93
101
|
this.allowImageUploads = {
|
|
@@ -119,6 +127,7 @@ export class RichTextField extends Field {
|
|
|
119
127
|
allowMedia: this.allowMedia,
|
|
120
128
|
allowImageUploads: this.allowImageUploads,
|
|
121
129
|
sanitize: this.sanitize,
|
|
130
|
+
rtl: this.rtl,
|
|
122
131
|
};
|
|
123
132
|
}
|
|
124
133
|
/**
|
|
@@ -171,13 +180,14 @@ export class RichTextField extends Field {
|
|
|
171
180
|
this.value = this.value.replace(base64String, `${this.allowImageUploads?.publicURLPrefix}/${name}`);
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
|
-
async writeInlineImages(sectionName, itemId) {
|
|
183
|
+
async writeInlineImages(sectionName, itemId, locale) {
|
|
175
184
|
if (!this.allowImageUploads)
|
|
176
185
|
return;
|
|
177
186
|
/**
|
|
178
187
|
* If .photos, and 'sectionName' folders don't exist, create them
|
|
179
188
|
*/
|
|
180
|
-
const
|
|
189
|
+
const cmsConfig = await getCMSConfig();
|
|
190
|
+
const uploadsFolder = cmsConfig.media.upload.path;
|
|
181
191
|
const photosFolder = path.join(uploadsFolder, '.photos', sectionName);
|
|
182
192
|
if (!fs.existsSync(photosFolder)) {
|
|
183
193
|
fs.mkdirSync(photosFolder, { recursive: true });
|
|
@@ -204,6 +214,7 @@ export class RichTextField extends Field {
|
|
|
204
214
|
itemId: itemId,
|
|
205
215
|
section: sectionName,
|
|
206
216
|
field: this.name,
|
|
217
|
+
locale: locale ?? cmsConfig.localization?.defaultLocale ?? 'en',
|
|
207
218
|
linked: true,
|
|
208
219
|
});
|
|
209
220
|
/**
|
|
@@ -238,7 +249,7 @@ export class RichTextField extends Field {
|
|
|
238
249
|
}
|
|
239
250
|
this.extractInlineImages();
|
|
240
251
|
}
|
|
241
|
-
async postSubmit({ sectionName, itemId }) {
|
|
252
|
+
async postSubmit({ sectionName, itemId, locale, }) {
|
|
242
253
|
if (!this._inlinePhotos)
|
|
243
254
|
return;
|
|
244
255
|
/**
|
|
@@ -246,19 +257,20 @@ export class RichTextField extends Field {
|
|
|
246
257
|
* If there are, check if they are still present in the rich text value
|
|
247
258
|
* If they are not present (admin deleted them), delete them from the database and disk
|
|
248
259
|
*/
|
|
249
|
-
await this.checkPreviousInlineImages(sectionName, itemId);
|
|
250
|
-
await this.writeInlineImages(sectionName, itemId);
|
|
260
|
+
await this.checkPreviousInlineImages(sectionName, itemId, locale);
|
|
261
|
+
await this.writeInlineImages(sectionName, itemId, locale);
|
|
251
262
|
}
|
|
252
|
-
async checkPreviousInlineImages(sectionName, itemId) {
|
|
263
|
+
async checkPreviousInlineImages(sectionName, itemId, locale) {
|
|
253
264
|
if (!this.allowImageUploads)
|
|
254
265
|
return;
|
|
255
266
|
/**
|
|
256
|
-
* Get all the photos saved in the database for this field
|
|
267
|
+
* Get all the photos saved in the database for this field, scoped by locale
|
|
257
268
|
*/
|
|
269
|
+
const cmsConfig = await getCMSConfig();
|
|
258
270
|
const tablePhotos = await db
|
|
259
271
|
.select()
|
|
260
272
|
.from(EditorPhotosTable)
|
|
261
|
-
.where(and(eq(EditorPhotosTable.section, sectionName), eq(EditorPhotosTable.itemId, itemId), eq(EditorPhotosTable.field, this.name)));
|
|
273
|
+
.where(and(eq(EditorPhotosTable.section, sectionName), eq(EditorPhotosTable.itemId, itemId), eq(EditorPhotosTable.field, this.name), eq(EditorPhotosTable.locale, locale ?? cmsConfig.localization?.defaultLocale ?? 'en')));
|
|
262
274
|
if (tablePhotos.length === 0)
|
|
263
275
|
return;
|
|
264
276
|
/**
|
|
@@ -142,14 +142,15 @@ export declare class SelectField extends Field<'select', SelectFieldConfig> {
|
|
|
142
142
|
}[] | undefined;
|
|
143
143
|
type: "select";
|
|
144
144
|
name: string;
|
|
145
|
-
label: import("../../index.js").
|
|
145
|
+
label: import("../../index.js").MultilingualString;
|
|
146
146
|
required: boolean;
|
|
147
|
+
localized: boolean;
|
|
147
148
|
conditionalFields: import("../types/index.js").ConditionalField[];
|
|
148
149
|
readonly: boolean;
|
|
149
150
|
defaultValue: any;
|
|
150
151
|
};
|
|
151
|
-
postSubmit(itemId: string): Promise<void>;
|
|
152
|
-
postSubmitRollback(): Promise<void>;
|
|
152
|
+
postSubmit(itemId: string, locale?: string): Promise<void>;
|
|
153
|
+
postSubmitRollback(locale?: string): Promise<void>;
|
|
153
154
|
/**
|
|
154
155
|
* Check the destination db config is set
|
|
155
156
|
* @private
|
|
@@ -210,6 +211,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
210
211
|
order: z.ZodOptional<z.ZodNumber>;
|
|
211
212
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
212
213
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
214
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
213
215
|
}, z.core.$strict>, z.ZodObject<{
|
|
214
216
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
215
217
|
table: z.ZodString;
|
|
@@ -236,6 +238,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
236
238
|
order: z.ZodOptional<z.ZodNumber>;
|
|
237
239
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
238
240
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
241
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
239
242
|
}, z.core.$strict>, z.ZodObject<{
|
|
240
243
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
241
244
|
table: z.ZodString;
|
|
@@ -262,6 +265,7 @@ export declare const selectFieldOptionsSchema: z.ZodUnion<readonly [z.ZodObject<
|
|
|
262
265
|
order: z.ZodOptional<z.ZodNumber>;
|
|
263
266
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
264
267
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
268
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
265
269
|
}, z.core.$strict>]>;
|
|
266
270
|
declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.ZodObject<{
|
|
267
271
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
@@ -291,6 +295,7 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
291
295
|
order: z.ZodOptional<z.ZodNumber>;
|
|
292
296
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
293
297
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
298
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
294
299
|
}, z.core.$strict>, z.ZodObject<{
|
|
295
300
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
296
301
|
table: z.ZodString;
|
|
@@ -317,6 +322,7 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
317
322
|
order: z.ZodOptional<z.ZodNumber>;
|
|
318
323
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
319
324
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
325
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
320
326
|
}, z.core.$strict>, z.ZodObject<{
|
|
321
327
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
322
328
|
table: z.ZodString;
|
|
@@ -343,6 +349,7 @@ declare const selectFieldConfigSchema: z.ZodIntersection<z.ZodUnion<readonly [z.
|
|
|
343
349
|
order: z.ZodOptional<z.ZodNumber>;
|
|
344
350
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
345
351
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
352
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
346
353
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
347
354
|
type: z.ZodLiteral<"select">;
|
|
348
355
|
optionsType: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/core/fields/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAMhD,OAAO,KAAK,EAAE,eAAe,EAAyB,eAAe,EAAyB,MAAM,aAAa,CAAA;AAEjH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,eAAO,MAAM,kBAAkB;;;kBAG7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CA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AAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBxE;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAYhC;;;OAGG;YACW,iCAAiC;IAiB/C;;OAEG;IACY,KAAK;YAyBN,YAAY;IA4D1B;;;OAGG;YACW,sBAAsB;IASpC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB,aAAa;IAWb;;OAEG;IACG,oBAAoB;CAuC7B;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAehF,eAAO,MAAM,wBAAwB;;;QA9gBjC;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;oBA4gBL,CAAA;AAEF,QAAA,MAAM,uBAAuB;;;QAphBzB;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;QANH;;WAEG;;QAEH;;WAEG;;;;;;;;;;;;;;;;;;;;;;;;;;mBAqhBN,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE3E;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,CAgC5F"}
|
|
@@ -140,6 +140,7 @@ export class SelectField extends Field {
|
|
|
140
140
|
* Split the values by comma and set the value as an array of objects
|
|
141
141
|
*/
|
|
142
142
|
const values = value.toString().split(',');
|
|
143
|
+
this.value = [];
|
|
143
144
|
values.map((value) => {
|
|
144
145
|
if (this.checkValueExists) {
|
|
145
146
|
/**
|
|
@@ -147,16 +148,10 @@ export class SelectField extends Field {
|
|
|
147
148
|
*/
|
|
148
149
|
const option = this.options?.find((option) => option.value.toString() === value.toString());
|
|
149
150
|
if (option) {
|
|
150
|
-
if (!this.value) {
|
|
151
|
-
this.value = [];
|
|
152
|
-
}
|
|
153
151
|
this.value.push(option);
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
else {
|
|
157
|
-
if (!this.value) {
|
|
158
|
-
this.value = [];
|
|
159
|
-
}
|
|
160
155
|
this.value.push({
|
|
161
156
|
value: value,
|
|
162
157
|
label: '', // TODO: Fix this
|
|
@@ -217,19 +212,20 @@ export class SelectField extends Field {
|
|
|
217
212
|
value: this.value?.map((value, index) => ({ ...value, level: index + 1 })),
|
|
218
213
|
};
|
|
219
214
|
}
|
|
220
|
-
async postSubmit(itemId) {
|
|
215
|
+
async postSubmit(itemId, locale) {
|
|
221
216
|
if (!this.destinationDb)
|
|
222
217
|
return;
|
|
223
|
-
/**
|
|
224
|
-
* First, check if the select is selecting from a category section with depth higher than 1
|
|
225
|
-
*/
|
|
226
|
-
// if (!this.hasDepth()) return
|
|
227
218
|
this._itemIdentifier = itemId;
|
|
219
|
+
const useLocale = this.localized && locale !== undefined;
|
|
228
220
|
try {
|
|
229
221
|
/**
|
|
230
|
-
* Delete the existing values
|
|
222
|
+
* Delete the existing values, scoped by locale for localized fields
|
|
231
223
|
*/
|
|
232
|
-
|
|
224
|
+
const deleteQuery = sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`;
|
|
225
|
+
if (useLocale) {
|
|
226
|
+
deleteQuery.append(sql ` AND \`locale\` = ${locale}`);
|
|
227
|
+
}
|
|
228
|
+
await db.execute(deleteQuery);
|
|
233
229
|
/**
|
|
234
230
|
* Check if we actually have values to save
|
|
235
231
|
*/
|
|
@@ -240,28 +236,25 @@ export class SelectField extends Field {
|
|
|
240
236
|
* Prepare the sql statement
|
|
241
237
|
*/
|
|
242
238
|
const sqlChunks = [];
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
239
|
+
if (useLocale) {
|
|
240
|
+
sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`, \`locale\`) VALUES `);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`) VALUES `);
|
|
244
|
+
}
|
|
248
245
|
const count = this.value.length;
|
|
249
246
|
this.value.forEach((value, index) => {
|
|
250
|
-
|
|
247
|
+
if (useLocale) {
|
|
248
|
+
sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier}, ${locale})`);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
|
|
252
|
+
}
|
|
251
253
|
if (index < count - 1) {
|
|
252
|
-
/**
|
|
253
|
-
* Add a comma to separate the values in the sql statement
|
|
254
|
-
*/
|
|
255
254
|
sqlChunks.push(sql `, `);
|
|
256
255
|
}
|
|
257
256
|
});
|
|
258
|
-
/**
|
|
259
|
-
* Join the sql chunks
|
|
260
|
-
*/
|
|
261
257
|
const finalSql = sql.join(sqlChunks);
|
|
262
|
-
/**
|
|
263
|
-
* Execute the sql statement
|
|
264
|
-
*/
|
|
265
258
|
await db.execute(finalSql);
|
|
266
259
|
}
|
|
267
260
|
catch (error) {
|
|
@@ -269,18 +262,18 @@ export class SelectField extends Field {
|
|
|
269
262
|
throw new Error(`${this.label}: Error saving values to the destination table`);
|
|
270
263
|
}
|
|
271
264
|
}
|
|
272
|
-
async postSubmitRollback() {
|
|
265
|
+
async postSubmitRollback(locale) {
|
|
273
266
|
if (!this.destinationDb)
|
|
274
267
|
return;
|
|
275
|
-
/**
|
|
276
|
-
* First, check if the select is selecting from a category section with depth higher than 1
|
|
277
|
-
*/
|
|
278
|
-
// if (!this.hasDepth()) return
|
|
279
268
|
if (!this._itemIdentifier) {
|
|
280
269
|
throw new Error(`${this.label}: Item identifier is not set. Make sure to set the item identifier by calling postSubmit() before calling postSubmitRollback()`);
|
|
281
270
|
}
|
|
282
271
|
try {
|
|
283
|
-
|
|
272
|
+
const query = sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`;
|
|
273
|
+
if (this.localized && locale !== undefined) {
|
|
274
|
+
query.append(sql ` AND \`locale\` = ${locale}`);
|
|
275
|
+
}
|
|
276
|
+
await db.execute(query);
|
|
284
277
|
}
|
|
285
278
|
catch (error) {
|
|
286
279
|
throw new Error(`${this.label}: Error deleting values from the destination table`);
|
|
@@ -94,7 +94,7 @@ export declare class SelectMultipleField extends Field<'select_multiple', Select
|
|
|
94
94
|
* @param value can be a string of comma-separated values coming from the db table,
|
|
95
95
|
* or an array of `SelectOption` objects coming from the client
|
|
96
96
|
*/
|
|
97
|
-
setValue(value: string | SelectOption[]): void;
|
|
97
|
+
setValue(value: string | SelectOption[] | null | undefined): void;
|
|
98
98
|
exportForClient(): {
|
|
99
99
|
options: {
|
|
100
100
|
value: string | number;
|
|
@@ -106,14 +106,15 @@ export declare class SelectMultipleField extends Field<'select_multiple', Select
|
|
|
106
106
|
}[] | undefined;
|
|
107
107
|
type: "select_multiple";
|
|
108
108
|
name: string;
|
|
109
|
-
label: import("../../index.js").
|
|
109
|
+
label: import("../../index.js").MultilingualString;
|
|
110
110
|
required: boolean;
|
|
111
|
+
localized: boolean;
|
|
111
112
|
conditionalFields: import("../types/index.js").ConditionalField[];
|
|
112
113
|
readonly: boolean;
|
|
113
114
|
defaultValue: any;
|
|
114
115
|
};
|
|
115
|
-
postSubmit(itemId: string): Promise<void>;
|
|
116
|
-
postSubmitRollback(): Promise<void>;
|
|
116
|
+
postSubmit(itemId: string, locale?: string): Promise<void>;
|
|
117
|
+
postSubmitRollback(locale?: string): Promise<void>;
|
|
117
118
|
/**
|
|
118
119
|
* Build the field to be rendered in a form
|
|
119
120
|
*/
|
|
@@ -168,6 +169,7 @@ declare const selectMultipleFieldHelperConfigSchema: z.ZodIntersection<z.ZodUnio
|
|
|
168
169
|
order: z.ZodOptional<z.ZodNumber>;
|
|
169
170
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
170
171
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
172
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
171
173
|
}, z.core.$strict>, z.ZodObject<{
|
|
172
174
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
173
175
|
table: z.ZodString;
|
|
@@ -198,6 +200,7 @@ declare const selectMultipleFieldHelperConfigSchema: z.ZodIntersection<z.ZodUnio
|
|
|
198
200
|
order: z.ZodOptional<z.ZodNumber>;
|
|
199
201
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
200
202
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
203
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
201
204
|
}, z.core.$strict>, z.ZodObject<{
|
|
202
205
|
destinationDb: z.ZodOptional<z.ZodObject<{
|
|
203
206
|
table: z.ZodString;
|
|
@@ -218,6 +221,7 @@ declare const selectMultipleFieldHelperConfigSchema: z.ZodIntersection<z.ZodUnio
|
|
|
218
221
|
order: z.ZodOptional<z.ZodNumber>;
|
|
219
222
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
220
223
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
224
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
221
225
|
}, z.core.$strict>]>, z.ZodObject<{
|
|
222
226
|
type: z.ZodLiteral<"select_multiple">;
|
|
223
227
|
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<SelectMultipleField, SelectMultipleField>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectMultiple.d.ts","sourceRoot":"","sources":["../../../src/core/fields/selectMultiple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO/C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE5E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAgDxB,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAdnB,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;cAHpC,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;;;;;;;;;;;;;;oBAepD,CAAA;AAEF,KAAK,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAEhF,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IACxF,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAwB;IACrE,QAAQ,CAAC,gBA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GAAG,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS;IA4CnD,eAAe;;;;;;;;;;;;;;;;;;IAQT,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsD1D,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxE;;OAEG;IACY,KAAK;YAsBN,YAAY;IAuB1B;;;OAGG;YACW,sBAAsB;IASpC;;;OAGG;YACW,iCAAiC;IAiB/C;;;OAGG;IACH,OAAO,CAAC,aAAa;IAUrB;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAYhC,aAAa;IAWb;;OAEG;IACG,oBAAoB;CAkC7B;AAED,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAqBhG,QAAA,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cApbzB,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;cAHpC,WAAW,GAAG,UAAU;cACxB,MAAM;gBACJ,MAAM;iBACL,eAAe,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA0brD,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAA;AAEjG;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,CAAC,yBAAyB,CAAC,GAAG,6BAA6B,CAiBpH"}
|
|
@@ -140,6 +140,10 @@ export class SelectMultipleField extends Field {
|
|
|
140
140
|
* or an array of `SelectOption` objects coming from the client
|
|
141
141
|
*/
|
|
142
142
|
setValue(value) {
|
|
143
|
+
if (value === null || value === undefined) {
|
|
144
|
+
this.value = undefined;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
143
147
|
if (typeof value === 'string') {
|
|
144
148
|
/**
|
|
145
149
|
* Value can be an encoded JSON string sent from the client,
|
|
@@ -158,15 +162,13 @@ export class SelectMultipleField extends Field {
|
|
|
158
162
|
* split the values by comma and set the value as an array of objects
|
|
159
163
|
*/
|
|
160
164
|
const values = value.split(',');
|
|
165
|
+
this.value = [];
|
|
161
166
|
values.map((value) => {
|
|
162
167
|
/**
|
|
163
168
|
* Check if the value exists in the options and return the value and text
|
|
164
169
|
*/
|
|
165
170
|
const option = this.options?.find((option) => option.value.toString() === value.toString());
|
|
166
171
|
if (option) {
|
|
167
|
-
if (!this.value) {
|
|
168
|
-
this.value = [];
|
|
169
|
-
}
|
|
170
172
|
this.value.push(option);
|
|
171
173
|
}
|
|
172
174
|
});
|
|
@@ -189,17 +191,22 @@ export class SelectMultipleField extends Field {
|
|
|
189
191
|
value: this.value,
|
|
190
192
|
};
|
|
191
193
|
}
|
|
192
|
-
async postSubmit(itemId) {
|
|
194
|
+
async postSubmit(itemId, locale) {
|
|
193
195
|
if (!this.destinationDb)
|
|
194
196
|
return;
|
|
195
197
|
this._itemIdentifier = itemId;
|
|
198
|
+
const useLocale = this.localized && locale !== undefined;
|
|
196
199
|
try {
|
|
197
200
|
/**
|
|
198
|
-
* Delete the existing values
|
|
201
|
+
* Delete the existing values, scoped by locale for localized fields
|
|
199
202
|
*/
|
|
200
|
-
|
|
203
|
+
const deleteQuery = sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`;
|
|
204
|
+
if (useLocale) {
|
|
205
|
+
deleteQuery.append(sql ` AND \`locale\` = ${locale}`);
|
|
206
|
+
}
|
|
207
|
+
await db.execute(deleteQuery);
|
|
201
208
|
/**
|
|
202
|
-
* Check if
|
|
209
|
+
* Check if we actually have values to save
|
|
203
210
|
*/
|
|
204
211
|
if (!this.value || this.value.length === 0) {
|
|
205
212
|
return;
|
|
@@ -208,42 +215,43 @@ export class SelectMultipleField extends Field {
|
|
|
208
215
|
* Prepare the sql statement
|
|
209
216
|
*/
|
|
210
217
|
const sqlChunks = [];
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
218
|
+
if (useLocale) {
|
|
219
|
+
sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`, \`locale\`) VALUES `);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
sqlChunks.push(sql `INSERT INTO \`${sql.raw(this.destinationDb.table)}\` (\`${sql.raw(this.destinationDb.selectIdentifier)}\`, \`${sql.raw(this.destinationDb.itemIdentifier)}\`) VALUES `);
|
|
223
|
+
}
|
|
216
224
|
const count = this.value.length;
|
|
217
225
|
this.value.forEach((value, index) => {
|
|
218
|
-
|
|
226
|
+
if (useLocale) {
|
|
227
|
+
sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier}, ${locale})`);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
sqlChunks.push(sql `(${value.value}, ${this._itemIdentifier})`);
|
|
231
|
+
}
|
|
219
232
|
if (index < count - 1) {
|
|
220
|
-
/**
|
|
221
|
-
* Add a comma to separate the values in the sql statement
|
|
222
|
-
*/
|
|
223
233
|
sqlChunks.push(sql `, `);
|
|
224
234
|
}
|
|
225
235
|
});
|
|
226
|
-
/**
|
|
227
|
-
* Join the sql chunks
|
|
228
|
-
*/
|
|
229
236
|
const finalSql = sql.join(sqlChunks);
|
|
230
|
-
/**
|
|
231
|
-
* Execute the sql statement
|
|
232
|
-
*/
|
|
233
237
|
await db.execute(finalSql);
|
|
234
238
|
}
|
|
235
239
|
catch (error) {
|
|
236
240
|
throw new Error(`${this.label}: Error saving values to the destination table`);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
|
-
async postSubmitRollback() {
|
|
243
|
+
async postSubmitRollback(locale) {
|
|
240
244
|
if (!this.destinationDb)
|
|
241
245
|
return;
|
|
242
246
|
if (!this._itemIdentifier) {
|
|
243
247
|
throw new Error(`${this.label}: Item identifier is not set. Make sure to set the item identifier by calling postSubmit() before calling postSubmitRollback()`);
|
|
244
248
|
}
|
|
245
249
|
try {
|
|
246
|
-
|
|
250
|
+
const query = sql `DELETE FROM \`${sql.raw(this.destinationDb.table)}\` WHERE \`${sql.raw(this.destinationDb.itemIdentifier)}\` = ${this._itemIdentifier}`;
|
|
251
|
+
if (this.localized && locale !== undefined) {
|
|
252
|
+
query.append(sql ` AND \`locale\` = ${locale}`);
|
|
253
|
+
}
|
|
254
|
+
await db.execute(query);
|
|
247
255
|
}
|
|
248
256
|
catch (error) {
|
|
249
257
|
throw new Error(`${this.label}: Error deleting values from the destination table`);
|
|
@@ -26,11 +26,13 @@ declare const slugFieldConfigSchema: z.ZodObject<{
|
|
|
26
26
|
maxLength?: number | undefined;
|
|
27
27
|
defaultValue?: string | undefined;
|
|
28
28
|
sanitize?: boolean | undefined;
|
|
29
|
+
rtl?: boolean | undefined;
|
|
29
30
|
label?: string | Record<string, string> | undefined;
|
|
30
31
|
required?: boolean | undefined;
|
|
31
32
|
order?: number | undefined;
|
|
32
33
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
33
34
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
35
|
+
localized?: boolean | undefined;
|
|
34
36
|
}, {
|
|
35
37
|
type: "text";
|
|
36
38
|
build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("./text.js").TextField, import("./text.js").TextField>>;
|
|
@@ -40,11 +42,13 @@ declare const slugFieldConfigSchema: z.ZodObject<{
|
|
|
40
42
|
maxLength?: number | undefined;
|
|
41
43
|
defaultValue?: string | undefined;
|
|
42
44
|
sanitize?: boolean | undefined;
|
|
45
|
+
rtl?: boolean | undefined;
|
|
43
46
|
label?: string | Record<string, string> | undefined;
|
|
44
47
|
required?: boolean | undefined;
|
|
45
48
|
order?: number | undefined;
|
|
46
49
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
47
50
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
51
|
+
localized?: boolean | undefined;
|
|
48
52
|
}>;
|
|
49
53
|
}, z.core.$strict>;
|
|
50
54
|
type Config = z.infer<typeof slugFieldConfigSchema>;
|
|
@@ -74,8 +78,9 @@ export declare class SlugField extends Field<'slug', Config> {
|
|
|
74
78
|
forFieldName: string;
|
|
75
79
|
type: "slug";
|
|
76
80
|
name: string;
|
|
77
|
-
label: import("../../index.js").
|
|
81
|
+
label: import("../../index.js").MultilingualString;
|
|
78
82
|
required: boolean;
|
|
83
|
+
localized: boolean;
|
|
79
84
|
conditionalFields: import("../types/index.js").ConditionalField[];
|
|
80
85
|
readonly: boolean;
|
|
81
86
|
defaultValue: any;
|
|
@@ -118,11 +123,13 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
118
123
|
maxLength?: number | undefined;
|
|
119
124
|
defaultValue?: string | undefined;
|
|
120
125
|
sanitize?: boolean | undefined;
|
|
126
|
+
rtl?: boolean | undefined;
|
|
121
127
|
label?: string | Record<string, string> | undefined;
|
|
122
128
|
required?: boolean | undefined;
|
|
123
129
|
order?: number | undefined;
|
|
124
130
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
125
131
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
132
|
+
localized?: boolean | undefined;
|
|
126
133
|
}, {
|
|
127
134
|
type: "text";
|
|
128
135
|
build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("./text.js").TextField, import("./text.js").TextField>>;
|
|
@@ -132,11 +139,13 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
132
139
|
maxLength?: number | undefined;
|
|
133
140
|
defaultValue?: string | undefined;
|
|
134
141
|
sanitize?: boolean | undefined;
|
|
142
|
+
rtl?: boolean | undefined;
|
|
135
143
|
label?: string | Record<string, string> | undefined;
|
|
136
144
|
required?: boolean | undefined;
|
|
137
145
|
order?: number | undefined;
|
|
138
146
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
139
147
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
148
|
+
localized?: boolean | undefined;
|
|
140
149
|
}>;
|
|
141
150
|
name: z.ZodString;
|
|
142
151
|
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
@@ -144,6 +153,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
144
153
|
order: z.ZodOptional<z.ZodNumber>;
|
|
145
154
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
146
155
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
156
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
147
157
|
}, z.core.$strict>;
|
|
148
158
|
declare const configSchema: z.ZodObject<{
|
|
149
159
|
type: z.ZodLiteral<"slug">;
|
|
@@ -170,11 +180,13 @@ declare const configSchema: z.ZodObject<{
|
|
|
170
180
|
maxLength?: number | undefined;
|
|
171
181
|
defaultValue?: string | undefined;
|
|
172
182
|
sanitize?: boolean | undefined;
|
|
183
|
+
rtl?: boolean | undefined;
|
|
173
184
|
label?: string | Record<string, string> | undefined;
|
|
174
185
|
required?: boolean | undefined;
|
|
175
186
|
order?: number | undefined;
|
|
176
187
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
177
188
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
189
|
+
localized?: boolean | undefined;
|
|
178
190
|
}, {
|
|
179
191
|
type: "text";
|
|
180
192
|
build: z.core.$InferOuterFunctionType<z.core.$ZodFunctionArgs, z.ZodCustom<import("./text.js").TextField, import("./text.js").TextField>>;
|
|
@@ -184,11 +196,13 @@ declare const configSchema: z.ZodObject<{
|
|
|
184
196
|
maxLength?: number | undefined;
|
|
185
197
|
defaultValue?: string | undefined;
|
|
186
198
|
sanitize?: boolean | undefined;
|
|
199
|
+
rtl?: boolean | undefined;
|
|
187
200
|
label?: string | Record<string, string> | undefined;
|
|
188
201
|
required?: boolean | undefined;
|
|
189
202
|
order?: number | undefined;
|
|
190
203
|
conditionalRules?: import("../types/index.js").ConditionalRule[] | undefined;
|
|
191
204
|
adminGenerated?: boolean | "readonly" | undefined;
|
|
205
|
+
localized?: boolean | undefined;
|
|
192
206
|
}>;
|
|
193
207
|
name: z.ZodString;
|
|
194
208
|
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
@@ -196,6 +210,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
196
210
|
order: z.ZodOptional<z.ZodNumber>;
|
|
197
211
|
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types/index.js").ConditionalRule, import("../types/index.js").ConditionalRule>>>;
|
|
198
212
|
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
213
|
+
localized: z.ZodOptional<z.ZodBoolean>;
|
|
199
214
|
}, z.core.$strict>;
|
|
200
215
|
/**
|
|
201
216
|
* Slug field configuration type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../../../src/core/fields/slug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,KAAK,EAAyB,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WA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,IAAI,MAAM,GAAG,SAAS;IAI9B,aAAa;IAQJ,kBAAkB,IAAI,OAAO;IAOtC;;;;OAIG;IACG,oBAAoB;CAwB7B;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAE5E,QAAA,MAAM,aAAa;;;;IAvHf;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiHL,CAAA;AAEF,QAAA,MAAM,YAAY;;;;;;IA5Hd;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAuHL,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,eAAe,CAkB/E"}
|
package/dist/core/fields/slug.js
CHANGED
|
@@ -72,7 +72,7 @@ export class SlugField extends Field {
|
|
|
72
72
|
checkRequired() {
|
|
73
73
|
if (this.required) {
|
|
74
74
|
if (!this.value || this.value.trim().length === 0) {
|
|
75
|
-
throw new Error(getString('fieldIsRequired', this.
|
|
75
|
+
throw new Error(getString('fieldIsRequired', this.language, { field: this.getLocalizedLabel() }));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -96,7 +96,7 @@ export class SlugField extends Field {
|
|
|
96
96
|
*/
|
|
97
97
|
if (this.minLength) {
|
|
98
98
|
if (this.minLength > this.value.length) {
|
|
99
|
-
throw new Error(getString('minLength', this.
|
|
99
|
+
throw new Error(getString('minLength', this.language, { min: this.minLength }));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -104,7 +104,7 @@ export class SlugField extends Field {
|
|
|
104
104
|
*/
|
|
105
105
|
if (this.maxLength) {
|
|
106
106
|
if (this.maxLength < this.value.length) {
|
|
107
|
-
throw new Error(getString('maxLength', this.
|
|
107
|
+
throw new Error(getString('maxLength', this.language, { max: this.maxLength }));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|