nextjs-cms 0.0.1 → 0.5.2
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 -0
- package/README.md +289 -0
- package/dist/api/axios/axiosInstance.d.ts +2 -0
- package/dist/api/axios/axiosInstance.d.ts.map +1 -0
- package/dist/api/axios/axiosInstance.js +8 -0
- package/dist/api/index.d.ts +856 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +12 -0
- package/dist/api/lib/serverActions.d.ts +240 -0
- package/dist/api/lib/serverActions.d.ts.map +1 -0
- package/dist/api/lib/serverActions.js +834 -0
- package/dist/api/root.d.ts +829 -0
- package/dist/api/root.d.ts.map +1 -0
- package/dist/api/root.js +30 -0
- package/dist/api/routers/accountSettings.d.ts +61 -0
- package/dist/api/routers/accountSettings.d.ts.map +1 -0
- package/dist/api/routers/accountSettings.js +108 -0
- package/dist/api/routers/admins.d.ts +106 -0
- package/dist/api/routers/admins.d.ts.map +1 -0
- package/dist/api/routers/admins.js +219 -0
- package/dist/api/routers/auth.d.ts +48 -0
- package/dist/api/routers/auth.d.ts.map +1 -0
- package/dist/api/routers/auth.js +25 -0
- package/dist/api/routers/categorySection.d.ts +104 -0
- package/dist/api/routers/categorySection.d.ts.map +1 -0
- package/dist/api/routers/categorySection.js +38 -0
- package/dist/api/routers/cmsSettings.d.ts +49 -0
- package/dist/api/routers/cmsSettings.d.ts.map +1 -0
- package/dist/api/routers/cmsSettings.js +51 -0
- package/dist/api/routers/cpanel.d.ts +84 -0
- package/dist/api/routers/cpanel.d.ts.map +1 -0
- package/dist/api/routers/cpanel.js +216 -0
- package/dist/api/routers/files.d.ts +48 -0
- package/dist/api/routers/files.d.ts.map +1 -0
- package/dist/api/routers/files.js +23 -0
- package/dist/api/routers/gallery.d.ts +36 -0
- package/dist/api/routers/gallery.d.ts.map +1 -0
- package/dist/api/routers/gallery.js +62 -0
- package/dist/api/routers/googleAnalytics.d.ts +31 -0
- package/dist/api/routers/googleAnalytics.d.ts.map +1 -0
- package/dist/api/routers/googleAnalytics.js +7 -0
- package/dist/api/routers/hasItemsSection.d.ts +140 -0
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -0
- package/dist/api/routers/hasItemsSection.js +34 -0
- package/dist/api/routers/navigation.d.ts +52 -0
- package/dist/api/routers/navigation.d.ts.map +1 -0
- package/dist/api/routers/navigation.js +11 -0
- package/dist/api/routers/simpleSection.d.ts +58 -0
- package/dist/api/routers/simpleSection.d.ts.map +1 -0
- package/dist/api/routers/simpleSection.js +12 -0
- package/dist/api/trpc.d.ts +107 -0
- package/dist/api/trpc.d.ts.map +1 -0
- package/dist/api/trpc.js +72 -0
- package/dist/auth/axios/axiosInstance.d.ts +2 -0
- package/dist/auth/axios/axiosInstance.d.ts.map +1 -0
- package/dist/auth/axios/axiosInstance.js +8 -0
- package/dist/auth/csrf.d.ts +30 -0
- package/dist/auth/csrf.d.ts.map +1 -0
- package/dist/auth/csrf.js +76 -0
- package/dist/auth/hooks/index.d.ts +4 -0
- package/dist/auth/hooks/index.d.ts.map +1 -0
- package/dist/auth/hooks/index.js +3 -0
- package/dist/auth/hooks/useAxiosPrivate.d.ts +5 -0
- package/dist/auth/hooks/useAxiosPrivate.d.ts.map +1 -0
- package/dist/auth/hooks/useAxiosPrivate.js +74 -0
- package/dist/auth/hooks/useRefreshToken.d.ts +7 -0
- package/dist/auth/hooks/useRefreshToken.d.ts.map +1 -0
- package/dist/auth/hooks/useRefreshToken.js +79 -0
- package/dist/auth/index.d.ts +23 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +44 -0
- package/dist/auth/jwt.d.ts +6 -0
- package/dist/auth/jwt.d.ts.map +1 -0
- package/dist/auth/jwt.js +25 -0
- package/dist/auth/lib/actions.d.ts +33 -0
- package/dist/auth/lib/actions.d.ts.map +1 -0
- package/dist/auth/lib/actions.js +209 -0
- package/dist/auth/lib/client.d.ts +4 -0
- package/dist/auth/lib/client.d.ts.map +1 -0
- package/dist/auth/lib/client.js +46 -0
- package/dist/auth/lib/index.d.ts +3 -0
- package/dist/auth/lib/index.d.ts.map +1 -0
- package/dist/auth/lib/index.js +2 -0
- package/dist/auth/react.d.ts +106 -0
- package/dist/auth/react.d.ts.map +1 -0
- package/dist/auth/react.js +347 -0
- package/dist/auth/trpc.d.ts +6 -0
- package/dist/auth/trpc.d.ts.map +1 -0
- package/dist/auth/trpc.js +81 -0
- package/dist/core/config/config-loader.d.ts +92 -0
- package/dist/core/config/config-loader.d.ts.map +1 -0
- package/dist/core/config/config-loader.js +230 -0
- package/dist/core/config/index.d.ts +3 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +1 -0
- package/dist/core/config/loader.d.ts +2 -0
- package/dist/core/config/loader.d.ts.map +1 -0
- package/dist/core/config/loader.js +42 -0
- package/dist/core/db/index.d.ts +2 -0
- package/dist/core/db/index.d.ts.map +1 -0
- package/dist/core/db/index.js +1 -0
- package/dist/core/db/table-checker/DbTable.d.ts +6 -0
- package/dist/core/db/table-checker/DbTable.d.ts.map +1 -0
- package/dist/core/db/table-checker/DbTable.js +5 -0
- package/dist/core/db/table-checker/MysqlTable.d.ts +34 -0
- package/dist/core/db/table-checker/MysqlTable.d.ts.map +1 -0
- package/dist/core/db/table-checker/MysqlTable.js +102 -0
- package/dist/core/db/table-checker/index.d.ts +2 -0
- package/dist/core/db/table-checker/index.d.ts.map +1 -0
- package/dist/core/db/table-checker/index.js +1 -0
- package/dist/core/factories/FieldFactory.d.ts +124 -0
- package/dist/core/factories/FieldFactory.d.ts.map +1 -0
- package/dist/core/factories/FieldFactory.js +411 -0
- package/dist/core/factories/SectionFactory.d.ts +110 -0
- package/dist/core/factories/SectionFactory.d.ts.map +1 -0
- package/dist/core/factories/SectionFactory.js +415 -0
- package/dist/core/factories/index.d.ts +3 -0
- package/dist/core/factories/index.d.ts.map +1 -0
- package/dist/core/factories/index.js +2 -0
- package/dist/core/fields/checkbox.d.ts +63 -0
- package/dist/core/fields/checkbox.d.ts.map +1 -0
- package/dist/core/fields/checkbox.js +62 -0
- package/dist/core/fields/color.d.ts +84 -0
- package/dist/core/fields/color.d.ts.map +1 -0
- package/dist/core/fields/color.js +91 -0
- package/dist/core/fields/date.d.ts +100 -0
- package/dist/core/fields/date.d.ts.map +1 -0
- package/dist/core/fields/date.js +108 -0
- package/dist/core/fields/document.d.ts +180 -0
- package/dist/core/fields/document.d.ts.map +1 -0
- package/dist/core/fields/document.js +277 -0
- package/dist/core/fields/field-group.d.ts +18 -0
- package/dist/core/fields/field-group.d.ts.map +1 -0
- package/dist/core/fields/field-group.js +6 -0
- package/dist/core/fields/field.d.ts +126 -0
- package/dist/core/fields/field.d.ts.map +1 -0
- package/dist/core/fields/field.js +148 -0
- package/dist/core/fields/fileField.d.ts +15 -0
- package/dist/core/fields/fileField.d.ts.map +1 -0
- package/dist/core/fields/fileField.js +5 -0
- package/dist/core/fields/index.d.ts +65 -0
- package/dist/core/fields/index.d.ts.map +1 -0
- package/dist/core/fields/index.js +18 -0
- package/dist/core/fields/map.d.ts +167 -0
- package/dist/core/fields/map.d.ts.map +1 -0
- package/dist/core/fields/map.js +152 -0
- package/dist/core/fields/number.d.ts +186 -0
- package/dist/core/fields/number.d.ts.map +1 -0
- package/dist/core/fields/number.js +241 -0
- package/dist/core/fields/password.d.ts +109 -0
- package/dist/core/fields/password.d.ts.map +1 -0
- package/dist/core/fields/password.js +133 -0
- package/dist/core/fields/photo.d.ts +289 -0
- package/dist/core/fields/photo.d.ts.map +1 -0
- package/dist/core/fields/photo.js +410 -0
- package/dist/core/fields/richText.d.ts +295 -0
- package/dist/core/fields/richText.d.ts.map +1 -0
- package/dist/core/fields/richText.js +338 -0
- package/dist/core/fields/select.d.ts +366 -0
- package/dist/core/fields/select.d.ts.map +1 -0
- package/dist/core/fields/select.js +499 -0
- package/dist/core/fields/selectMultiple.d.ts +236 -0
- package/dist/core/fields/selectMultiple.d.ts.map +1 -0
- package/dist/core/fields/selectMultiple.js +417 -0
- package/dist/core/fields/tags.d.ts +131 -0
- package/dist/core/fields/tags.d.ts.map +1 -0
- package/dist/core/fields/tags.js +105 -0
- package/dist/core/fields/text.d.ts +136 -0
- package/dist/core/fields/text.d.ts.map +1 -0
- package/dist/core/fields/text.js +157 -0
- package/dist/core/fields/textArea.d.ts +107 -0
- package/dist/core/fields/textArea.d.ts.map +1 -0
- package/dist/core/fields/textArea.js +126 -0
- package/dist/core/fields/video.d.ts +148 -0
- package/dist/core/fields/video.d.ts.map +1 -0
- package/dist/core/fields/video.js +248 -0
- package/dist/core/helpers/entity.d.ts +8 -0
- package/dist/core/helpers/entity.d.ts.map +1 -0
- package/dist/core/helpers/entity.js +27 -0
- package/dist/core/helpers/index.d.ts +5 -0
- package/dist/core/helpers/index.d.ts.map +1 -0
- package/dist/core/helpers/index.js +3 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/sections/category.d.ts +283 -0
- package/dist/core/sections/category.d.ts.map +1 -0
- package/dist/core/sections/category.js +147 -0
- package/dist/core/sections/hasItems.d.ts +632 -0
- package/dist/core/sections/hasItems.d.ts.map +1 -0
- package/dist/core/sections/hasItems.js +144 -0
- package/dist/core/sections/index.d.ts +5 -0
- package/dist/core/sections/index.d.ts.map +1 -0
- package/dist/core/sections/index.js +4 -0
- package/dist/core/sections/section.d.ts +226 -0
- package/dist/core/sections/section.d.ts.map +1 -0
- package/dist/core/sections/section.js +341 -0
- package/dist/core/sections/simple.d.ts +99 -0
- package/dist/core/sections/simple.d.ts.map +1 -0
- package/dist/core/sections/simple.js +95 -0
- package/dist/core/security/dom.d.ts +11 -0
- package/dist/core/security/dom.d.ts.map +1 -0
- package/dist/core/security/dom.js +92 -0
- package/dist/core/submit/ItemEditSubmit.d.ts +76 -0
- package/dist/core/submit/ItemEditSubmit.d.ts.map +1 -0
- package/dist/core/submit/ItemEditSubmit.js +186 -0
- package/dist/core/submit/NewItemSubmit.d.ts +14 -0
- package/dist/core/submit/NewItemSubmit.d.ts.map +1 -0
- package/dist/core/submit/NewItemSubmit.js +93 -0
- package/dist/core/submit/SimpleSectionSubmit.d.ts +13 -0
- package/dist/core/submit/SimpleSectionSubmit.d.ts.map +1 -0
- package/dist/core/submit/SimpleSectionSubmit.js +93 -0
- package/dist/core/submit/index.d.ts +5 -0
- package/dist/core/submit/index.d.ts.map +1 -0
- package/dist/core/submit/index.js +4 -0
- package/dist/core/submit/submit.d.ts +116 -0
- package/dist/core/submit/submit.d.ts.map +1 -0
- package/dist/core/submit/submit.js +479 -0
- package/dist/core/types/index.d.ts +280 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +1 -0
- package/dist/db/client.d.ts +9 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +19 -0
- package/dist/db/config.d.ts +6 -0
- package/dist/db/config.d.ts.map +1 -0
- package/dist/db/config.js +22 -0
- package/dist/db/drizzle.config.d.ts +6 -0
- package/dist/db/drizzle.config.d.ts.map +1 -0
- package/dist/db/drizzle.config.js +18 -0
- package/dist/db/index.d.ts +3 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +3 -0
- package/dist/db/schema.d.ts +639 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +73 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/translations/dictionaries/ar.json +279 -0
- package/dist/translations/dictionaries/en.json +279 -0
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +15 -0
- package/dist/utils/CpanelApi.d.ts +25 -0
- package/dist/utils/CpanelApi.d.ts.map +1 -0
- package/dist/utils/CpanelApi.js +64 -0
- package/dist/utils/constants.d.ts +14 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +61 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/utils.d.ts +60 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +132 -0
- package/dist/validators/checkbox.d.ts +4 -0
- package/dist/validators/checkbox.d.ts.map +1 -0
- package/dist/validators/checkbox.js +12 -0
- package/dist/validators/color.d.ts +4 -0
- package/dist/validators/color.d.ts.map +1 -0
- package/dist/validators/color.js +7 -0
- package/dist/validators/date.d.ts +4 -0
- package/dist/validators/date.d.ts.map +1 -0
- package/dist/validators/date.js +5 -0
- package/dist/validators/document.d.ts +4 -0
- package/dist/validators/document.d.ts.map +1 -0
- package/dist/validators/document.js +57 -0
- package/dist/validators/index.d.ts +15 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +14 -0
- package/dist/validators/map.d.ts +4 -0
- package/dist/validators/map.d.ts.map +1 -0
- package/dist/validators/map.js +5 -0
- package/dist/validators/number.d.ts +4 -0
- package/dist/validators/number.d.ts.map +1 -0
- package/dist/validators/number.js +20 -0
- package/dist/validators/password.d.ts +4 -0
- package/dist/validators/password.d.ts.map +1 -0
- package/dist/validators/password.js +11 -0
- package/dist/validators/photo.d.ts +4 -0
- package/dist/validators/photo.d.ts.map +1 -0
- package/dist/validators/photo.js +100 -0
- package/dist/validators/richText.d.ts +4 -0
- package/dist/validators/richText.d.ts.map +1 -0
- package/dist/validators/richText.js +8 -0
- package/dist/validators/select-multiple.d.ts +10 -0
- package/dist/validators/select-multiple.d.ts.map +1 -0
- package/dist/validators/select-multiple.js +20 -0
- package/dist/validators/select.d.ts +4 -0
- package/dist/validators/select.d.ts.map +1 -0
- package/dist/validators/select.js +5 -0
- package/dist/validators/text.d.ts +4 -0
- package/dist/validators/text.d.ts.map +1 -0
- package/dist/validators/text.js +7 -0
- package/dist/validators/textarea.d.ts +4 -0
- package/dist/validators/textarea.d.ts.map +1 -0
- package/dist/validators/textarea.js +7 -0
- package/dist/validators/video.d.ts +4 -0
- package/dist/validators/video.d.ts.map +1 -0
- package/dist/validators/video.js +57 -0
- package/package.json +150 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/fields/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { TextField, textField } from './text';
|
|
2
|
+
export { PasswordField, passwordField } from './password';
|
|
3
|
+
export { TextAreaField, textAreaField } from './textArea';
|
|
4
|
+
export { NumberField, numberField } from './number';
|
|
5
|
+
export { TagsField, tagsField } from './tags';
|
|
6
|
+
export { PhotoField, photoField } from './photo';
|
|
7
|
+
export { VideoField, videoField } from './video';
|
|
8
|
+
export { CheckboxField, checkboxField } from './checkbox';
|
|
9
|
+
export { SelectField, selectField } from './select';
|
|
10
|
+
export { SelectMultipleField, selectMultipleField } from './selectMultiple';
|
|
11
|
+
export { DocumentField, documentField } from './document';
|
|
12
|
+
export { MapField, mapField } from './map';
|
|
13
|
+
export { RichTextField, richTextField } from './richText';
|
|
14
|
+
export { DateField, dateField } from './date';
|
|
15
|
+
export { ColorField, colorField } from './color';
|
|
16
|
+
export { Field } from './field';
|
|
17
|
+
export { FileField } from './fileField';
|
|
18
|
+
export { fieldGroup } from './field-group';
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { BaseFieldConfig } from './field';
|
|
2
|
+
import { Field } from './field';
|
|
3
|
+
import { entityKind } from '../helpers';
|
|
4
|
+
import * as z from 'zod';
|
|
5
|
+
declare const configSchema: z.ZodObject<{
|
|
6
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
lat: z.ZodNumber;
|
|
8
|
+
lng: z.ZodNumber;
|
|
9
|
+
}, z.core.$strict>>;
|
|
10
|
+
/**
|
|
11
|
+
* The default value of the field.
|
|
12
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
13
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
14
|
+
*/
|
|
15
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
lat: z.ZodNumber;
|
|
17
|
+
lng: z.ZodNumber;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
minZoom: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
latLngBounds: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
north: z.ZodNumber;
|
|
23
|
+
south: z.ZodNumber;
|
|
24
|
+
west: z.ZodNumber;
|
|
25
|
+
east: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
type Config = z.infer<typeof configSchema>;
|
|
29
|
+
export declare class MapField extends Field<'map', Config> {
|
|
30
|
+
static readonly [entityKind]: string;
|
|
31
|
+
/**
|
|
32
|
+
* The value of the map field is an object with `lat` and `lng` properties
|
|
33
|
+
*/
|
|
34
|
+
value: {
|
|
35
|
+
lat: number;
|
|
36
|
+
lng: number;
|
|
37
|
+
} | undefined;
|
|
38
|
+
private readonly _defaultValue;
|
|
39
|
+
zoom: number;
|
|
40
|
+
minZoom: number;
|
|
41
|
+
latLngBounds: {
|
|
42
|
+
north: number;
|
|
43
|
+
south: number;
|
|
44
|
+
west: number;
|
|
45
|
+
east: number;
|
|
46
|
+
};
|
|
47
|
+
center: {
|
|
48
|
+
lat: number;
|
|
49
|
+
lng: number;
|
|
50
|
+
};
|
|
51
|
+
constructor(config: BaseFieldConfig<Config>);
|
|
52
|
+
/**
|
|
53
|
+
* Get the value of the field as a string
|
|
54
|
+
*/
|
|
55
|
+
getValue(): string;
|
|
56
|
+
exportForClient(): {
|
|
57
|
+
zoom: number;
|
|
58
|
+
minZoom: number;
|
|
59
|
+
center: {
|
|
60
|
+
lat: number;
|
|
61
|
+
lng: number;
|
|
62
|
+
};
|
|
63
|
+
latLngBounds: {
|
|
64
|
+
north: number;
|
|
65
|
+
south: number;
|
|
66
|
+
west: number;
|
|
67
|
+
east: number;
|
|
68
|
+
};
|
|
69
|
+
value: {
|
|
70
|
+
lat: number;
|
|
71
|
+
lng: number;
|
|
72
|
+
} | undefined;
|
|
73
|
+
type: "map";
|
|
74
|
+
name: string;
|
|
75
|
+
label: string;
|
|
76
|
+
required: boolean;
|
|
77
|
+
conditionalFields: import("../types").ConditionalField[];
|
|
78
|
+
readonly: boolean;
|
|
79
|
+
defaultValue: any;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Set the value of the field from a string
|
|
83
|
+
* @param value
|
|
84
|
+
*/
|
|
85
|
+
setValue(value: string): void;
|
|
86
|
+
checkRequired(): void;
|
|
87
|
+
hasSqlNameAndValue(): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Prepare the field for submission
|
|
90
|
+
*/
|
|
91
|
+
prepareForSubmission(): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
export type MapFieldClientConfig = ReturnType<MapField['exportForClient']>;
|
|
94
|
+
declare const optionsSchema: z.ZodObject<{
|
|
95
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
lat: z.ZodNumber;
|
|
97
|
+
lng: z.ZodNumber;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
/**
|
|
100
|
+
* The default value of the field.
|
|
101
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
102
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
103
|
+
*/
|
|
104
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
lat: z.ZodNumber;
|
|
106
|
+
lng: z.ZodNumber;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
minZoom: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
latLngBounds: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
north: z.ZodNumber;
|
|
112
|
+
south: z.ZodNumber;
|
|
113
|
+
west: z.ZodNumber;
|
|
114
|
+
east: z.ZodNumber;
|
|
115
|
+
}, z.core.$strict>>;
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
label: z.ZodOptional<z.ZodString>;
|
|
118
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
121
|
+
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
declare const mapFieldConfigSchema: z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"map">;
|
|
125
|
+
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<MapField, MapField>>;
|
|
126
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
lat: z.ZodNumber;
|
|
128
|
+
lng: z.ZodNumber;
|
|
129
|
+
}, z.core.$strict>>;
|
|
130
|
+
/**
|
|
131
|
+
* The default value of the field.
|
|
132
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
133
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
134
|
+
*/
|
|
135
|
+
defaultValue: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
lat: z.ZodNumber;
|
|
137
|
+
lng: z.ZodNumber;
|
|
138
|
+
}, z.core.$strict>>;
|
|
139
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
minZoom: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
latLngBounds: z.ZodOptional<z.ZodObject<{
|
|
142
|
+
north: z.ZodNumber;
|
|
143
|
+
south: z.ZodNumber;
|
|
144
|
+
west: z.ZodNumber;
|
|
145
|
+
east: z.ZodNumber;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
label: z.ZodOptional<z.ZodString>;
|
|
149
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
152
|
+
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
/**
|
|
155
|
+
* Map field configuration type
|
|
156
|
+
* This is a plain object that can be serialized and used anywhere
|
|
157
|
+
* The build() method allows creating a MapField instance when needed
|
|
158
|
+
*/
|
|
159
|
+
export type MapFieldConfig = z.infer<typeof mapFieldConfigSchema>;
|
|
160
|
+
/**
|
|
161
|
+
* Helper function to create a map field configuration
|
|
162
|
+
* Returns a config object with a build() method that can be serialized and used anywhere
|
|
163
|
+
* @param field
|
|
164
|
+
*/
|
|
165
|
+
export declare function mapField(field: z.infer<typeof optionsSchema>): MapFieldConfig;
|
|
166
|
+
export {};
|
|
167
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/core/fields/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAyB,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB,QAAA,MAAM,YAAY;;;;;IAQd;;;;OAIG;;;;;;;;;;;;;kBAmBL,CAAA;AAEF,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,qBAAa,QAAS,SAAQ,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;IAC9C,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAa;IAC1D;;OAEG;IACM,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1E,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;gBACxB,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAoB3C;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIF,eAAe;;;;iBA5BhB,MAAM;iBAAO,MAAM;;;mBADX,MAAM;mBAAS,MAAM;kBAAQ,MAAM;kBAAQ,MAAM;;;iBAJjD,MAAM;iBAAO,MAAM;;;;;;;;;;IA4C1C;;;OAGG;IACM,QAAQ,CAAC,KAAK,EAAE,MAAM;IAS/B,aAAa;IAWJ,kBAAkB,IAAI,OAAO;IAOtC;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ9C;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAE1E,QAAA,MAAM,aAAa;;;;;IA1Hf;;;;OAIG;;;;;;;;;;;;;;;;;;;kBAyHL,CAAA;AAEF,QAAA,MAAM,oBAAoB;;;;;;;IA/HtB;;;;OAIG;;;;;;;;;;;;;;;;;;;kBA+HL,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,cAAc,CAmB7E"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Field, baseFieldConfigSchema } from './field';
|
|
2
|
+
import { entityKind } from '../helpers';
|
|
3
|
+
import * as z from 'zod';
|
|
4
|
+
const configSchema = z.strictObject({
|
|
5
|
+
center: z
|
|
6
|
+
.strictObject({
|
|
7
|
+
lat: z.number().describe('The latitude'),
|
|
8
|
+
lng: z.number().describe('The longitude'),
|
|
9
|
+
})
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('The center coordinates of the map'),
|
|
12
|
+
/**
|
|
13
|
+
* The default value of the field.
|
|
14
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
15
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
16
|
+
*/
|
|
17
|
+
defaultValue: z
|
|
18
|
+
.strictObject({
|
|
19
|
+
lat: z.number().describe('The default latitude'),
|
|
20
|
+
lng: z.number().describe('The default longitude'),
|
|
21
|
+
})
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('The default value of the field'),
|
|
24
|
+
zoom: z.number().optional().describe('The zoom level of the map'),
|
|
25
|
+
minZoom: z.number().optional().describe('The minimum zoom level of the map'),
|
|
26
|
+
latLngBounds: z
|
|
27
|
+
.strictObject({
|
|
28
|
+
north: z.number().describe('The northern boundary'),
|
|
29
|
+
south: z.number().describe('The southern boundary'),
|
|
30
|
+
west: z.number().describe('The western boundary'),
|
|
31
|
+
east: z.number().describe('The eastern boundary'),
|
|
32
|
+
})
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('The latitude/longitude bounds of the map'),
|
|
35
|
+
});
|
|
36
|
+
export class MapField extends Field {
|
|
37
|
+
static [entityKind] = 'MapField';
|
|
38
|
+
/**
|
|
39
|
+
* The value of the map field is an object with `lat` and `lng` properties
|
|
40
|
+
*/
|
|
41
|
+
value;
|
|
42
|
+
_defaultValue;
|
|
43
|
+
zoom;
|
|
44
|
+
minZoom;
|
|
45
|
+
latLngBounds;
|
|
46
|
+
center;
|
|
47
|
+
constructor(config) {
|
|
48
|
+
super(config, 'map');
|
|
49
|
+
this.zoom = config.zoom || 3;
|
|
50
|
+
this.minZoom = config.minZoom || 1;
|
|
51
|
+
this.center = config.center || {
|
|
52
|
+
// Defaults to center of the world
|
|
53
|
+
lat: 39.8283,
|
|
54
|
+
lng: 34.2716,
|
|
55
|
+
};
|
|
56
|
+
this.latLngBounds = config.latLngBounds || {
|
|
57
|
+
// Defaults to the whole world bounds
|
|
58
|
+
north: 85,
|
|
59
|
+
south: -85,
|
|
60
|
+
west: -180,
|
|
61
|
+
east: 180,
|
|
62
|
+
};
|
|
63
|
+
this.value = config.defaultValue;
|
|
64
|
+
this._defaultValue = config.defaultValue;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the value of the field as a string
|
|
68
|
+
*/
|
|
69
|
+
getValue() {
|
|
70
|
+
return `${this.value?.lat},${this.value?.lng}`;
|
|
71
|
+
}
|
|
72
|
+
exportForClient() {
|
|
73
|
+
return {
|
|
74
|
+
...super.exportForClient(),
|
|
75
|
+
zoom: this.zoom,
|
|
76
|
+
minZoom: this.minZoom,
|
|
77
|
+
center: this.center,
|
|
78
|
+
latLngBounds: this.latLngBounds,
|
|
79
|
+
value: this.value,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Set the value of the field from a string
|
|
84
|
+
* @param value
|
|
85
|
+
*/
|
|
86
|
+
setValue(value) {
|
|
87
|
+
if (value) {
|
|
88
|
+
value = value.replace(/\s+/g, '');
|
|
89
|
+
const [lat, lng] = value.split(',').map(Number);
|
|
90
|
+
this.value = lat && lng ? { lat, lng } : undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
checkRequired() {
|
|
94
|
+
/**
|
|
95
|
+
* Check if the field is required
|
|
96
|
+
*/
|
|
97
|
+
if (this.required) {
|
|
98
|
+
if (!this.value) {
|
|
99
|
+
throw new Error(`${this.label}: field is required`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
hasSqlNameAndValue() {
|
|
104
|
+
/**
|
|
105
|
+
* Include the field in the SQL if it is admin-generated, or not admin-generated but has a default value
|
|
106
|
+
*/
|
|
107
|
+
return this.adminGenerated === true || this._defaultValue !== undefined;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Prepare the field for submission
|
|
111
|
+
*/
|
|
112
|
+
async prepareForSubmission() {
|
|
113
|
+
/**
|
|
114
|
+
* Check if the value if well formatted as `lat,lng` string
|
|
115
|
+
*/
|
|
116
|
+
if (!/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(`${this.value?.lat},${this.value?.lng}`)) {
|
|
117
|
+
throw new Error(`${this.label}: value is not well formatted, it should be of format: "number,number"`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const optionsSchema = z.strictObject({
|
|
122
|
+
...baseFieldConfigSchema.shape,
|
|
123
|
+
...configSchema.shape,
|
|
124
|
+
});
|
|
125
|
+
const mapFieldConfigSchema = z.strictObject({
|
|
126
|
+
...optionsSchema.shape,
|
|
127
|
+
type: z.literal('map').describe('The type of the field'),
|
|
128
|
+
build: z.function().output(z.instanceof(MapField)).describe('Build a MapField instance from this config'),
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Helper function to create a map field configuration
|
|
132
|
+
* Returns a config object with a build() method that can be serialized and used anywhere
|
|
133
|
+
* @param field
|
|
134
|
+
*/
|
|
135
|
+
export function mapField(field) {
|
|
136
|
+
/**
|
|
137
|
+
* Validate the field config
|
|
138
|
+
*/
|
|
139
|
+
const result = optionsSchema.safeParse(field);
|
|
140
|
+
if (!result.success) {
|
|
141
|
+
throw new Error(`[Field: ${field.name}]: ${z.prettifyError(result.error)}`);
|
|
142
|
+
}
|
|
143
|
+
const config = {
|
|
144
|
+
...field,
|
|
145
|
+
type: 'map',
|
|
146
|
+
build() {
|
|
147
|
+
// Use the original field config directly (it doesn't have build() method)
|
|
148
|
+
return new MapField(field);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
return config;
|
|
152
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { BaseFieldConfig } from './field';
|
|
2
|
+
import { Field } from './field';
|
|
3
|
+
import { entityKind } from '../helpers';
|
|
4
|
+
import * as z from 'zod';
|
|
5
|
+
declare const configSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
hasAutoIncrement: z.ZodLiteral<true>;
|
|
7
|
+
/** Auto-increment is always integer. Allowing override to 'int' only (optional). */
|
|
8
|
+
format: z.ZodOptional<z.ZodLiteral<"int">>;
|
|
9
|
+
adminGenerated: z.ZodOptional<z.ZodNever>;
|
|
10
|
+
placeholder: z.ZodOptional<z.ZodNever>;
|
|
11
|
+
minValue: z.ZodOptional<z.ZodNever>;
|
|
12
|
+
maxValue: z.ZodOptional<z.ZodNever>;
|
|
13
|
+
minLength: z.ZodOptional<z.ZodNever>;
|
|
14
|
+
maxLength: z.ZodOptional<z.ZodNever>;
|
|
15
|
+
defaultValue: z.ZodOptional<z.ZodNever>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
hasAutoIncrement: z.ZodOptional<z.ZodLiteral<false>>;
|
|
18
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
int: "int";
|
|
20
|
+
float: "float";
|
|
21
|
+
double: "double";
|
|
22
|
+
}>>;
|
|
23
|
+
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
24
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
25
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
/**
|
|
30
|
+
* The default value of the field.
|
|
31
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
32
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
33
|
+
*/
|
|
34
|
+
defaultValue: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strict>], "hasAutoIncrement">;
|
|
36
|
+
type Config = z.infer<typeof configSchema>;
|
|
37
|
+
export declare class NumberField extends Field<'number', Config> {
|
|
38
|
+
static readonly [entityKind]: string;
|
|
39
|
+
readonly format: 'int' | 'float' | 'double';
|
|
40
|
+
readonly minValue: number | undefined;
|
|
41
|
+
readonly maxValue: number | undefined;
|
|
42
|
+
readonly placeholder: string | undefined;
|
|
43
|
+
readonly hasAutoIncrement: boolean | undefined;
|
|
44
|
+
readonly minLength: number | undefined;
|
|
45
|
+
readonly maxLength: number | undefined;
|
|
46
|
+
private readonly _defaultValue;
|
|
47
|
+
value: number | undefined;
|
|
48
|
+
constructor(config: BaseFieldConfig<Config>);
|
|
49
|
+
/**
|
|
50
|
+
* Coerce the value to a number
|
|
51
|
+
*/
|
|
52
|
+
private coerceValue;
|
|
53
|
+
exportForClient(): {
|
|
54
|
+
format: "int" | "float" | "double";
|
|
55
|
+
placeholder: string | undefined;
|
|
56
|
+
minValue: number | undefined;
|
|
57
|
+
maxValue: number | undefined;
|
|
58
|
+
minLength: number | undefined;
|
|
59
|
+
maxLength: number | undefined;
|
|
60
|
+
type: "number";
|
|
61
|
+
name: string;
|
|
62
|
+
label: string;
|
|
63
|
+
required: boolean;
|
|
64
|
+
conditionalFields: import("../types").ConditionalField[];
|
|
65
|
+
readonly: boolean;
|
|
66
|
+
defaultValue: any;
|
|
67
|
+
value: any;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Get the value of the field
|
|
71
|
+
*/
|
|
72
|
+
getValue(): number | undefined;
|
|
73
|
+
hasSqlNameAndValue(): boolean;
|
|
74
|
+
checkRequired(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Prepare the field for submission
|
|
77
|
+
*/
|
|
78
|
+
prepareForSubmission(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export type NumberFieldClientConfig = ReturnType<NumberField['exportForClient']>;
|
|
81
|
+
declare const optionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
82
|
+
hasAutoIncrement: z.ZodLiteral<true>;
|
|
83
|
+
/** Auto-increment is always integer. Allowing override to 'int' only (optional). */
|
|
84
|
+
format: z.ZodOptional<z.ZodLiteral<"int">>;
|
|
85
|
+
adminGenerated: z.ZodOptional<z.ZodNever>;
|
|
86
|
+
placeholder: z.ZodOptional<z.ZodNever>;
|
|
87
|
+
minValue: z.ZodOptional<z.ZodNever>;
|
|
88
|
+
maxValue: z.ZodOptional<z.ZodNever>;
|
|
89
|
+
minLength: z.ZodOptional<z.ZodNever>;
|
|
90
|
+
maxLength: z.ZodOptional<z.ZodNever>;
|
|
91
|
+
defaultValue: z.ZodOptional<z.ZodNever>;
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
label: z.ZodOptional<z.ZodString>;
|
|
94
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
+
hasAutoIncrement: z.ZodOptional<z.ZodLiteral<false>>;
|
|
99
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
int: "int";
|
|
101
|
+
float: "float";
|
|
102
|
+
double: "double";
|
|
103
|
+
}>>;
|
|
104
|
+
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
105
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
106
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
/**
|
|
111
|
+
* The default value of the field.
|
|
112
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
113
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
114
|
+
*/
|
|
115
|
+
defaultValue: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
label: z.ZodOptional<z.ZodString>;
|
|
118
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
121
|
+
}, z.core.$strict>], "hasAutoIncrement">;
|
|
122
|
+
declare const numberFieldConfigSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
123
|
+
hasAutoIncrement: z.ZodLiteral<true>;
|
|
124
|
+
/** Auto-increment is always integer. Allowing override to 'int' only (optional). */
|
|
125
|
+
format: z.ZodOptional<z.ZodLiteral<"int">>;
|
|
126
|
+
adminGenerated: z.ZodOptional<z.ZodNever>;
|
|
127
|
+
placeholder: z.ZodOptional<z.ZodNever>;
|
|
128
|
+
minValue: z.ZodOptional<z.ZodNever>;
|
|
129
|
+
maxValue: z.ZodOptional<z.ZodNever>;
|
|
130
|
+
minLength: z.ZodOptional<z.ZodNever>;
|
|
131
|
+
maxLength: z.ZodOptional<z.ZodNever>;
|
|
132
|
+
defaultValue: z.ZodOptional<z.ZodNever>;
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
label: z.ZodOptional<z.ZodString>;
|
|
135
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
+
hasAutoIncrement: z.ZodOptional<z.ZodLiteral<false>>;
|
|
140
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
int: "int";
|
|
142
|
+
float: "float";
|
|
143
|
+
double: "double";
|
|
144
|
+
}>>;
|
|
145
|
+
adminGenerated: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodLiteral<false>, z.ZodLiteral<"readonly">]>>;
|
|
146
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
147
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
/**
|
|
152
|
+
* The default value of the field.
|
|
153
|
+
* If set, the field will be pre-populated with this value when the form is loaded.
|
|
154
|
+
* If `adminGenerated` is not true, the field will be included when submitting the form with this value.
|
|
155
|
+
*/
|
|
156
|
+
defaultValue: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
label: z.ZodOptional<z.ZodString>;
|
|
159
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
conditionalRules: z.ZodOptional<z.ZodArray<z.ZodCustom<import("../types").ConditionalRule, import("../types").ConditionalRule>>>;
|
|
162
|
+
}, z.core.$strict>], "hasAutoIncrement">, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"number">;
|
|
164
|
+
build: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodCustom<NumberField, NumberField>>;
|
|
165
|
+
}, z.core.$strict>>;
|
|
166
|
+
/**
|
|
167
|
+
* Number field configuration type
|
|
168
|
+
* This is a plain object that can be serialized and used anywhere
|
|
169
|
+
* The build() method allows creating a NumberField instance when needed
|
|
170
|
+
*/
|
|
171
|
+
export type NumberFieldConfig = z.infer<typeof numberFieldConfigSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* Helper function to create a number field configuration
|
|
174
|
+
* Returns a config object with a build() method that can be serialized and used anywhere
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const fieldConfig = numberField({ name: 'age', label: 'Age', required: true, order: 1 })
|
|
179
|
+
* const fieldInstance = fieldConfig.build()
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @param field
|
|
183
|
+
*/
|
|
184
|
+
export declare function numberField(field: z.infer<typeof optionsSchema>): NumberFieldConfig;
|
|
185
|
+
export {};
|
|
186
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/core/fields/number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAyB,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAgCxB,QAAA,MAAM,YAAY;;IA5Bd,oFAAoF;;;;;;;;;;;;;;;;;;;;;;IAoBpF;;;;OAIG;;wCAOL,CAAA;AAEF,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,qBAAa,WAAY,SAAQ,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;IACpD,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAgB;IAE7D,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IACzC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEtB,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAkD3C;;OAEG;IACH,OAAO,CAAC,WAAW;IAYH,eAAe;;;;;;;;;;;;;;;;IAY/B;;OAEG;IACH,QAAQ,IAAI,MAAM,GAAG,SAAS;IAIrB,kBAAkB,IAAI,OAAO;IActC,aAAa;IAkBb;;OAEG;IACG,oBAAoB;CA+C7B;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAYhF,QAAA,MAAM,aAAa;;IApOf,oFAAoF;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoBpF;;;;OAIG;;;;;;;wCA+ML,CAAA;AAEF,QAAA,MAAM,uBAAuB;;IAzOzB,oFAAoF;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoBpF;;;;OAIG;;;;;;;;;;mBAuNN,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,iBAAiB,CAmBnF"}
|