@payloadcms/plugin-form-builder 3.0.0-canary.92e4997 → 3.0.0-canary.a78fca3
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/dist/collections/FormSubmissions/hooks/createCharge.d.ts +3 -0
- package/dist/collections/FormSubmissions/hooks/createCharge.d.ts.map +1 -0
- package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts +3 -0
- package/dist/collections/FormSubmissions/hooks/sendEmail.d.ts.map +1 -0
- package/dist/collections/FormSubmissions/index.d.ts +4 -0
- package/dist/collections/FormSubmissions/index.d.ts.map +1 -0
- package/dist/collections/FormSubmissions/index.js +62 -60
- package/dist/collections/FormSubmissions/index.js.map +1 -1
- package/dist/collections/Forms/DynamicFieldSelector.d.ts +4 -0
- package/dist/collections/Forms/DynamicFieldSelector.d.ts.map +1 -0
- package/dist/collections/Forms/DynamicFieldSelector.js +2 -1
- package/dist/collections/Forms/DynamicFieldSelector.js.map +1 -1
- package/dist/collections/Forms/DynamicPriceSelector.d.ts +4 -0
- package/dist/collections/Forms/DynamicPriceSelector.d.ts.map +1 -0
- package/dist/collections/Forms/DynamicPriceSelector.js +17 -6
- package/dist/collections/Forms/DynamicPriceSelector.js.map +1 -1
- package/dist/collections/Forms/fields.d.ts +6 -0
- package/dist/collections/Forms/fields.d.ts.map +1 -0
- package/dist/collections/Forms/fields.js.map +1 -1
- package/dist/collections/Forms/index.d.ts +4 -0
- package/dist/collections/Forms/index.d.ts.map +1 -0
- package/dist/collections/Forms/index.js +146 -144
- package/dist/collections/Forms/index.js.map +1 -1
- package/dist/exports/types.d.ts +2 -0
- package/dist/exports/types.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +182 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utilities/getPaymentTotal.d.ts +5 -0
- package/dist/utilities/getPaymentTotal.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/heading.d.ts +3 -0
- package/dist/utilities/lexical/converters/heading.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/linebreak.d.ts +3 -0
- package/dist/utilities/lexical/converters/linebreak.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/link.d.ts +3 -0
- package/dist/utilities/lexical/converters/link.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/list.d.ts +4 -0
- package/dist/utilities/lexical/converters/list.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/paragraph.d.ts +3 -0
- package/dist/utilities/lexical/converters/paragraph.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/quote.d.ts +3 -0
- package/dist/utilities/lexical/converters/quote.d.ts.map +1 -0
- package/dist/utilities/lexical/converters/text.d.ts +3 -0
- package/dist/utilities/lexical/converters/text.d.ts.map +1 -0
- package/dist/utilities/lexical/defaultConverters.d.ts +3 -0
- package/dist/utilities/lexical/defaultConverters.d.ts.map +1 -0
- package/dist/utilities/lexical/nodeFormat.d.ts +39 -0
- package/dist/utilities/lexical/nodeFormat.d.ts.map +1 -0
- package/dist/utilities/lexical/serializeLexical.d.ts +9 -0
- package/dist/utilities/lexical/serializeLexical.d.ts.map +1 -0
- package/dist/utilities/lexical/types.d.ts +14 -0
- package/dist/utilities/lexical/types.d.ts.map +1 -0
- package/dist/utilities/replaceDoubleCurlys.d.ts +8 -0
- package/dist/utilities/replaceDoubleCurlys.d.ts.map +1 -0
- package/dist/utilities/slate/serializeSlate.d.ts +12 -0
- package/dist/utilities/slate/serializeSlate.d.ts.map +1 -0
- package/package.json +15 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCharge.d.ts","sourceRoot":"","sources":["../../../../src/collections/FormSubmissions/hooks/createCharge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAEhE,eAAO,MAAM,YAAY,qBACL,GAAG,cACT,uBAAuB,KAClC,QAAQ,GAAG,CAeb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendEmail.d.ts","sourceRoot":"","sources":["../../../../src/collections/FormSubmissions/hooks/sendEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,uBAAuB,EAAkB,MAAM,mBAAmB,CAAA;AAMvF,eAAO,MAAM,SAAS,qBACF,GAAG,cACT,uBAAuB,KAClC,QAAQ,GAAG,CA6Fb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/FormSubmissions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAM7D,eAAO,MAAM,4BAA4B,eAC3B,uBAAuB,KAClC,gBA6JF,CAAA"}
|
|
@@ -3,6 +3,65 @@ import { sendEmail } from './hooks/sendEmail.js';
|
|
|
3
3
|
// all settings can be overridden by the config
|
|
4
4
|
export const generateSubmissionCollection = (formConfig)=>{
|
|
5
5
|
const formSlug = formConfig?.formOverrides?.slug || 'forms';
|
|
6
|
+
const defaultFields = [
|
|
7
|
+
{
|
|
8
|
+
name: 'form',
|
|
9
|
+
type: 'relationship',
|
|
10
|
+
admin: {
|
|
11
|
+
readOnly: true
|
|
12
|
+
},
|
|
13
|
+
relationTo: formSlug,
|
|
14
|
+
required: true,
|
|
15
|
+
validate: async (value, { req: { payload }, req })=>{
|
|
16
|
+
/* Don't run in the client side */ if (!payload) return true;
|
|
17
|
+
if (payload) {
|
|
18
|
+
let _existingForm;
|
|
19
|
+
try {
|
|
20
|
+
_existingForm = await payload.findByID({
|
|
21
|
+
id: value,
|
|
22
|
+
collection: formSlug,
|
|
23
|
+
req
|
|
24
|
+
});
|
|
25
|
+
return true;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return 'Cannot create this submission because this form does not exist.';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'submissionData',
|
|
34
|
+
type: 'array',
|
|
35
|
+
admin: {
|
|
36
|
+
readOnly: true
|
|
37
|
+
},
|
|
38
|
+
fields: [
|
|
39
|
+
{
|
|
40
|
+
name: 'field',
|
|
41
|
+
type: 'text',
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'value',
|
|
46
|
+
type: 'text',
|
|
47
|
+
required: true,
|
|
48
|
+
validate: (value)=>{
|
|
49
|
+
// TODO:
|
|
50
|
+
// create a validation function that dynamically
|
|
51
|
+
// relies on the field type and its options as configured.
|
|
52
|
+
// How to access sibling data from this field?
|
|
53
|
+
// Need the `name` of the field in order to validate it.
|
|
54
|
+
// Might not be possible to use this validation function.
|
|
55
|
+
// Instead, might need to do all validation in a `beforeValidate` collection hook.
|
|
56
|
+
if (typeof value !== 'undefined') {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return 'This field is required.';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
];
|
|
6
65
|
const newConfig = {
|
|
7
66
|
...formConfig?.formSubmissionOverrides || {},
|
|
8
67
|
slug: formConfig?.formSubmissionOverrides?.slug || 'form-submissions',
|
|
@@ -16,66 +75,9 @@ export const generateSubmissionCollection = (formConfig)=>{
|
|
|
16
75
|
...formConfig?.formSubmissionOverrides?.admin || {},
|
|
17
76
|
enableRichTextRelationship: false
|
|
18
77
|
},
|
|
19
|
-
fields:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: 'relationship',
|
|
23
|
-
admin: {
|
|
24
|
-
readOnly: true
|
|
25
|
-
},
|
|
26
|
-
relationTo: formSlug,
|
|
27
|
-
required: true,
|
|
28
|
-
validate: async (value, { req: { payload }, req })=>{
|
|
29
|
-
/* Don't run in the client side */ if (!payload) return true;
|
|
30
|
-
if (payload) {
|
|
31
|
-
let _existingForm;
|
|
32
|
-
try {
|
|
33
|
-
_existingForm = await payload.findByID({
|
|
34
|
-
id: value,
|
|
35
|
-
collection: formSlug,
|
|
36
|
-
req
|
|
37
|
-
});
|
|
38
|
-
return true;
|
|
39
|
-
} catch (error) {
|
|
40
|
-
return 'Cannot create this submission because this form does not exist.';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'submissionData',
|
|
47
|
-
type: 'array',
|
|
48
|
-
admin: {
|
|
49
|
-
readOnly: true
|
|
50
|
-
},
|
|
51
|
-
fields: [
|
|
52
|
-
{
|
|
53
|
-
name: 'field',
|
|
54
|
-
type: 'text',
|
|
55
|
-
required: true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'value',
|
|
59
|
-
type: 'text',
|
|
60
|
-
required: true,
|
|
61
|
-
validate: (value)=>{
|
|
62
|
-
// TODO:
|
|
63
|
-
// create a validation function that dynamically
|
|
64
|
-
// relies on the field type and its options as configured.
|
|
65
|
-
// How to access sibling data from this field?
|
|
66
|
-
// Need the `name` of the field in order to validate it.
|
|
67
|
-
// Might not be possible to use this validation function.
|
|
68
|
-
// Instead, might need to do all validation in a `beforeValidate` collection hook.
|
|
69
|
-
if (typeof value !== 'undefined') {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
return 'This field is required.';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
...formConfig?.formSubmissionOverrides?.fields || []
|
|
78
|
-
],
|
|
78
|
+
fields: formConfig?.formSubmissionOverrides?.fields && typeof formConfig?.formSubmissionOverrides?.fields === 'function' ? formConfig.formSubmissionOverrides.fields({
|
|
79
|
+
defaultFields
|
|
80
|
+
}) : defaultFields,
|
|
79
81
|
hooks: {
|
|
80
82
|
...formConfig?.formSubmissionOverrides?.hooks || {},
|
|
81
83
|
beforeChange: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/FormSubmissions/index.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/FormSubmissions/index.ts"],"sourcesContent":["import type { CollectionConfig, Field } from 'payload'\n\nimport type { FormBuilderPluginConfig } from '../../types.js'\n\nimport { createCharge } from './hooks/createCharge.js'\nimport { sendEmail } from './hooks/sendEmail.js'\n\n// all settings can be overridden by the config\nexport const generateSubmissionCollection = (\n formConfig: FormBuilderPluginConfig,\n): CollectionConfig => {\n const formSlug = formConfig?.formOverrides?.slug || 'forms'\n\n const defaultFields: Field[] = [\n {\n name: 'form',\n type: 'relationship',\n admin: {\n readOnly: true,\n },\n relationTo: formSlug,\n required: true,\n validate: async (value, { req: { payload }, req }) => {\n /* Don't run in the client side */\n if (!payload) return true\n\n if (payload) {\n let _existingForm\n\n try {\n _existingForm = await payload.findByID({\n id: value,\n collection: formSlug,\n req,\n })\n\n return true\n } catch (error) {\n return 'Cannot create this submission because this form does not exist.'\n }\n }\n },\n },\n {\n name: 'submissionData',\n type: 'array',\n admin: {\n readOnly: true,\n },\n fields: [\n {\n name: 'field',\n type: 'text',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n required: true,\n validate: (value: unknown) => {\n // TODO:\n // create a validation function that dynamically\n // relies on the field type and its options as configured.\n\n // How to access sibling data from this field?\n // Need the `name` of the field in order to validate it.\n\n // Might not be possible to use this validation function.\n // Instead, might need to do all validation in a `beforeValidate` collection hook.\n\n if (typeof value !== 'undefined') {\n return true\n }\n\n return 'This field is required.'\n },\n },\n ],\n },\n ]\n\n const newConfig: CollectionConfig = {\n ...(formConfig?.formSubmissionOverrides || {}),\n slug: formConfig?.formSubmissionOverrides?.slug || 'form-submissions',\n access: {\n create: () => true,\n read: ({ req: { user } }) => !!user, // logged-in users,\n update: () => false,\n ...(formConfig?.formSubmissionOverrides?.access || {}),\n },\n admin: {\n ...(formConfig?.formSubmissionOverrides?.admin || {}),\n enableRichTextRelationship: false,\n },\n fields:\n formConfig?.formSubmissionOverrides?.fields &&\n typeof formConfig?.formSubmissionOverrides?.fields === 'function'\n ? formConfig.formSubmissionOverrides.fields({ defaultFields })\n : defaultFields,\n hooks: {\n ...(formConfig?.formSubmissionOverrides?.hooks || {}),\n beforeChange: [\n (data) => createCharge(data, formConfig),\n (data) => sendEmail(data, formConfig),\n ...(formConfig?.formSubmissionOverrides?.hooks?.beforeChange || []),\n ],\n },\n }\n\n const paymentFieldConfig = formConfig?.fields?.payment\n\n if (paymentFieldConfig) {\n newConfig.fields.push({\n name: 'payment',\n type: 'group',\n admin: {\n readOnly: true,\n },\n fields: [\n {\n name: 'field',\n type: 'text',\n label: 'Field',\n },\n {\n name: 'status',\n type: 'text',\n label: 'Status',\n },\n {\n name: 'amount',\n type: 'number',\n admin: {\n description: 'Amount in cents',\n },\n },\n {\n name: 'paymentProcessor',\n type: 'text',\n },\n {\n name: 'creditCard',\n type: 'group',\n fields: [\n {\n name: 'token',\n type: 'text',\n label: 'token',\n },\n {\n name: 'brand',\n type: 'text',\n label: 'Brand',\n },\n {\n name: 'number',\n type: 'text',\n label: 'Number',\n },\n ],\n label: 'Credit Card',\n },\n ],\n })\n }\n\n return newConfig\n}\n"],"names":["createCharge","sendEmail","generateSubmissionCollection","formConfig","formSlug","formOverrides","slug","defaultFields","name","type","admin","readOnly","relationTo","required","validate","value","req","payload","_existingForm","findByID","id","collection","error","fields","newConfig","formSubmissionOverrides","access","create","read","user","update","enableRichTextRelationship","hooks","beforeChange","data","paymentFieldConfig","payment","push","label","description"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Selector.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/DynamicFieldSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAIhE,OAAO,KAA8B,MAAM,OAAO,CAAA;AAIlD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA8BzD,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { Select } from '@payloadcms/ui/fields/Select';
|
|
3
4
|
import { useForm } from '@payloadcms/ui/forms/Form';
|
|
4
5
|
import React, { useEffect, useState } from 'react';
|
|
@@ -26,7 +27,7 @@ export const DynamicFieldSelector = (props)=>{
|
|
|
26
27
|
]);
|
|
27
28
|
// TODO: label from config is Record<string, string> | false | string
|
|
28
29
|
// but the FormFieldBase type has only label?: string, changing FormFieldBase breaks other ui components
|
|
29
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/ _jsx(Select, {
|
|
30
31
|
...props,
|
|
31
32
|
options: options
|
|
32
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/Forms/DynamicFieldSelector.tsx"],"sourcesContent":["'use client'\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/Forms/DynamicFieldSelector.tsx"],"sourcesContent":["'use client'\n\nimport type { TextFieldProps } from '@payloadcms/ui/fields/Text'\n\nimport { Select } from '@payloadcms/ui/fields/Select'\nimport { useForm } from '@payloadcms/ui/forms/Form'\nimport React, { useEffect, useState } from 'react'\n\nimport type { SelectFieldOption } from '../../types.js'\n\nexport const DynamicFieldSelector: React.FC<TextFieldProps> = (props) => {\n const { fields, getDataByPath } = useForm()\n\n const [options, setOptions] = useState<SelectFieldOption[]>([])\n\n useEffect(() => {\n const fields: any[] = getDataByPath('fields')\n\n if (fields) {\n const allNonPaymentFields = fields\n .map((block): SelectFieldOption | null => {\n const { name, blockType, label } = block\n\n if (blockType !== 'payment') {\n return {\n label,\n value: name,\n }\n }\n\n return null\n })\n .filter(Boolean)\n setOptions(allNonPaymentFields)\n }\n }, [fields, getDataByPath])\n\n // TODO: label from config is Record<string, string> | false | string\n // but the FormFieldBase type has only label?: string, changing FormFieldBase breaks other ui components\n return <Select {...props} options={options} />\n}\n"],"names":["Select","useForm","React","useEffect","useState","DynamicFieldSelector","props","fields","getDataByPath","options","setOptions","allNonPaymentFields","map","block","name","blockType","label","value","filter","Boolean"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,SAASA,MAAM,QAAQ,+BAA8B;AACrD,SAASC,OAAO,QAAQ,4BAA2B;AACnD,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAIlD,OAAO,MAAMC,uBAAiD,CAACC;IAC7D,MAAM,EAAEC,MAAM,EAAEC,aAAa,EAAE,GAAGP;IAElC,MAAM,CAACQ,SAASC,WAAW,GAAGN,SAA8B,EAAE;IAE9DD,UAAU;QACR,MAAMI,SAAgBC,cAAc;QAEpC,IAAID,QAAQ;YACV,MAAMI,sBAAsBJ,OACzBK,GAAG,CAAC,CAACC;gBACJ,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGH;gBAEnC,IAAIE,cAAc,WAAW;oBAC3B,OAAO;wBACLC;wBACAC,OAAOH;oBACT;gBACF;gBAEA,OAAO;YACT,GACCI,MAAM,CAACC;YACVT,WAAWC;QACb;IACF,GAAG;QAACJ;QAAQC;KAAc;IAE1B,qEAAqE;IACrE,yGAAyG;IACzG,qBAAO,KAACR;QAAQ,GAAGM,KAAK;QAAEG,SAASA;;AACrC,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicPriceSelector.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/DynamicPriceSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAMhE,OAAO,KAA8B,MAAM,OAAO,CAAA;AAOlD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA2DzD,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { Text } from '@payloadcms/ui/fields/Text';
|
|
3
4
|
import { useWatchForm } from '@payloadcms/ui/forms/Form';
|
|
4
5
|
import { useLocale } from '@payloadcms/ui/providers/Locale';
|
|
@@ -33,7 +34,9 @@ export const DynamicPriceSelector = (props)=>{
|
|
|
33
34
|
]);
|
|
34
35
|
// TODO: make this a number field, block by Payload
|
|
35
36
|
if (valueType === 'static') {
|
|
36
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
const localeCode = typeof locale === 'object' && 'code' in locale ? locale.code : locale;
|
|
39
42
|
const localLabels = typeof label === 'object' ? label : {
|
|
@@ -41,11 +44,19 @@ export const DynamicPriceSelector = (props)=>{
|
|
|
41
44
|
};
|
|
42
45
|
const labelValue = localLabels[localeCode] || localLabels['en'] || '';
|
|
43
46
|
if (valueType === 'valueOfField' && !isNumberField) {
|
|
44
|
-
return /*#__PURE__*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsx("div", {
|
|
50
|
+
children: String(labelValue)
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ _jsx("div", {
|
|
53
|
+
style: {
|
|
54
|
+
color: '#9A9A9A'
|
|
55
|
+
},
|
|
56
|
+
children: "The selected field must be a number field."
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
49
60
|
}
|
|
50
61
|
return null;
|
|
51
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/Forms/DynamicPriceSelector.tsx"],"sourcesContent":["'use client'\n\nimport type { TextFieldProps } from '@payloadcms/ui/fields/Text'\nimport type { Data } from 'payload
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/Forms/DynamicPriceSelector.tsx"],"sourcesContent":["'use client'\n\nimport type { TextFieldProps } from '@payloadcms/ui/fields/Text'\nimport type { Data } from 'payload'\n\nimport { Text } from '@payloadcms/ui/fields/Text'\nimport { useWatchForm } from '@payloadcms/ui/forms/Form'\nimport { useLocale } from '@payloadcms/ui/providers/Locale'\nimport React, { useEffect, useState } from 'react'\n\ntype FieldWithID = {\n id: string\n name: string\n}\n\nexport const DynamicPriceSelector: React.FC<TextFieldProps> = (props) => {\n const { label, path } = props\n\n const { fields, getData, getDataByPath } = useWatchForm()\n\n const locale = useLocale()\n\n const [isNumberField, setIsNumberField] = useState<boolean>()\n const [valueType, setValueType] = useState<'static' | 'valueOfField'>()\n\n // only number fields can use 'valueOfField`\n useEffect(() => {\n if (path) {\n const parentPath = path.split('.').slice(0, -1).join('.')\n const paymentFieldData: any = getDataByPath(parentPath)\n\n if (paymentFieldData) {\n const { fieldToUse, valueType } = paymentFieldData\n\n setValueType(valueType)\n\n const { fields: allFields }: Data = getData()\n const field = allFields.find((field: FieldWithID) => field.name === fieldToUse)\n\n if (field) {\n const { blockType } = field\n setIsNumberField(blockType === 'number')\n }\n }\n }\n }, [fields, path, getDataByPath, getData])\n\n // TODO: make this a number field, block by Payload\n if (valueType === 'static') {\n return <Text {...props} />\n }\n\n const localeCode = typeof locale === 'object' && 'code' in locale ? locale.code : locale\n\n const localLabels = typeof label === 'object' ? label : { [localeCode]: label }\n\n const labelValue = localLabels[localeCode] || localLabels['en'] || ''\n\n if (valueType === 'valueOfField' && !isNumberField) {\n return (\n <div>\n <div>{String(labelValue)}</div>\n <div\n style={{\n color: '#9A9A9A',\n }}\n >\n The selected field must be a number field.\n </div>\n </div>\n )\n }\n\n return null\n}\n"],"names":["Text","useWatchForm","useLocale","React","useEffect","useState","DynamicPriceSelector","props","label","path","fields","getData","getDataByPath","locale","isNumberField","setIsNumberField","valueType","setValueType","parentPath","split","slice","join","paymentFieldData","fieldToUse","allFields","field","find","name","blockType","localeCode","code","localLabels","labelValue","div","String","style","color"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAKA,SAASA,IAAI,QAAQ,6BAA4B;AACjD,SAASC,YAAY,QAAQ,4BAA2B;AACxD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAOlD,OAAO,MAAMC,uBAAiD,CAACC;IAC7D,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGF;IAExB,MAAM,EAAEG,MAAM,EAAEC,OAAO,EAAEC,aAAa,EAAE,GAAGX;IAE3C,MAAMY,SAASX;IAEf,MAAM,CAACY,eAAeC,iBAAiB,GAAGV;IAC1C,MAAM,CAACW,WAAWC,aAAa,GAAGZ;IAElC,4CAA4C;IAC5CD,UAAU;QACR,IAAIK,MAAM;YACR,MAAMS,aAAaT,KAAKU,KAAK,CAAC,KAAKC,KAAK,CAAC,GAAG,CAAC,GAAGC,IAAI,CAAC;YACrD,MAAMC,mBAAwBV,cAAcM;YAE5C,IAAII,kBAAkB;gBACpB,MAAM,EAAEC,UAAU,EAAEP,SAAS,EAAE,GAAGM;gBAElCL,aAAaD;gBAEb,MAAM,EAAEN,QAAQc,SAAS,EAAE,GAASb;gBACpC,MAAMc,QAAQD,UAAUE,IAAI,CAAC,CAACD,QAAuBA,MAAME,IAAI,KAAKJ;gBAEpE,IAAIE,OAAO;oBACT,MAAM,EAAEG,SAAS,EAAE,GAAGH;oBACtBV,iBAAiBa,cAAc;gBACjC;YACF;QACF;IACF,GAAG;QAAClB;QAAQD;QAAMG;QAAeD;KAAQ;IAEzC,mDAAmD;IACnD,IAAIK,cAAc,UAAU;QAC1B,qBAAO,KAAChB;YAAM,GAAGO,KAAK;;IACxB;IAEA,MAAMsB,aAAa,OAAOhB,WAAW,YAAY,UAAUA,SAASA,OAAOiB,IAAI,GAAGjB;IAElF,MAAMkB,cAAc,OAAOvB,UAAU,WAAWA,QAAQ;QAAE,CAACqB,WAAW,EAAErB;IAAM;IAE9E,MAAMwB,aAAaD,WAAW,CAACF,WAAW,IAAIE,WAAW,CAAC,KAAK,IAAI;IAEnE,IAAIf,cAAc,kBAAkB,CAACF,eAAe;QAClD,qBACE,MAACmB;;8BACC,KAACA;8BAAKC,OAAOF;;8BACb,KAACC;oBACCE,OAAO;wBACLC,OAAO;oBACT;8BACD;;;;IAKP;IAEA,OAAO;AACT,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAS,MAAM,SAAS,CAAA;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,gBAAgB,CAAA;AA6jBrE,eAAO,MAAM,MAAM;2CAYc,WAAW,GAAG,OAAO,KAAK,KAAK;CAC/D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field } from 'payload/types'\n\nimport type { FieldConfig, PaymentFieldConfig } from '../../types.js'\n\nimport { DynamicFieldSelector } from './DynamicFieldSelector.js'\nimport { DynamicPriceSelector } from './DynamicPriceSelector.js'\n\nconst name: Field = {\n name: 'name',\n type: 'text',\n label: 'Name (lowercase, no special characters)',\n required: true,\n}\n\nconst label: Field = {\n name: 'label',\n type: 'text',\n label: 'Label',\n localized: true,\n}\n\nconst required: Field = {\n name: 'required',\n type: 'checkbox',\n label: 'Required',\n}\n\nconst width: Field = {\n name: 'width',\n type: 'number',\n label: 'Field Width (percentage)',\n}\n\nconst Select: Block = {\n slug: 'select',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Label',\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Select Attribute Options',\n labels: {\n plural: 'Options',\n singular: 'Option',\n },\n },\n required,\n ],\n labels: {\n plural: 'Select Fields',\n singular: 'Select',\n },\n}\n\nconst Text: Block = {\n slug: 'text',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Fields',\n singular: 'Text',\n },\n}\n\nconst TextArea: Block = {\n slug: 'textarea',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Area Fields',\n singular: 'Text Area',\n },\n}\n\nconst Number: Block = {\n slug: 'number',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Number Fields',\n singular: 'Number',\n },\n}\n\nconst Email: Block = {\n slug: 'email',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Email Fields',\n singular: 'Email',\n },\n}\n\nconst State: Block = {\n slug: 'state',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'State Fields',\n singular: 'State',\n },\n}\n\nconst Country: Block = {\n slug: 'country',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Country Fields',\n singular: 'Country',\n },\n}\n\nconst Checkbox: Block = {\n slug: 'checkbox',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'checkbox',\n label: 'Default Value',\n },\n ],\n labels: {\n plural: 'Checkbox Fields',\n singular: 'Checkbox',\n },\n}\n\nconst Payment = (fieldConfig: PaymentFieldConfig): Block => {\n let paymentProcessorField = null\n if (fieldConfig?.paymentProcessor) {\n paymentProcessorField = {\n name: 'paymentProcessor',\n type: 'select',\n label: 'Payment Processor',\n options: [],\n ...fieldConfig.paymentProcessor,\n }\n }\n\n const fields = {\n slug: 'payment',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'basePrice',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Base Price',\n },\n ],\n },\n paymentProcessorField,\n {\n name: 'priceConditions',\n type: 'array',\n fields: [\n {\n name: 'fieldToUse',\n type: 'text',\n admin: {\n components: {\n Field: DynamicFieldSelector,\n },\n },\n },\n {\n name: 'condition',\n type: 'select',\n defaultValue: 'hasValue',\n label: 'Condition',\n options: [\n {\n label: 'Has Any Value',\n value: 'hasValue',\n },\n {\n label: 'Equals',\n value: 'equals',\n },\n {\n label: 'Does Not Equal',\n value: 'notEquals',\n },\n ],\n },\n {\n name: 'valueForCondition',\n type: 'text',\n admin: {\n condition: (_: any, { condition }: any) =>\n condition === 'equals' || condition === 'notEquals',\n },\n label: 'Value',\n },\n {\n name: 'operator',\n type: 'select',\n defaultValue: 'add',\n options: [\n {\n label: 'Add',\n value: 'add',\n },\n {\n label: 'Subtract',\n value: 'subtract',\n },\n {\n label: 'Multiply',\n value: 'multiply',\n },\n {\n label: 'Divide',\n value: 'divide',\n },\n ],\n },\n {\n name: 'valueType',\n type: 'radio',\n admin: {\n width: '100%',\n },\n defaultValue: 'static',\n label: 'Value Type',\n options: [\n {\n label: 'Static Value',\n value: 'static',\n },\n {\n label: 'Value Of Field',\n value: 'valueOfField',\n },\n ],\n },\n {\n name: 'valueForOperator',\n type: 'text',\n admin: {\n components: {\n Field: DynamicPriceSelector,\n },\n },\n label: 'Value',\n },\n ],\n label: 'Price Conditions',\n labels: {\n plural: 'Price Conditions',\n singular: 'Price Condition',\n },\n },\n required,\n ].filter(Boolean) as Field[],\n labels: {\n plural: 'Payment Fields',\n singular: 'Payment',\n },\n }\n\n return fields\n}\n\nconst Message: Block = {\n slug: 'message',\n fields: [\n {\n name: 'message',\n type: 'richText',\n localized: true,\n },\n ],\n labels: {\n plural: 'Message Blocks',\n singular: 'Message',\n },\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\nexport const fields = {\n checkbox: Checkbox,\n country: Country,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n} as {\n [key: string]: ((fieldConfig?: FieldConfig | boolean) => Block) | Block\n}\n"],"names":["DynamicFieldSelector","DynamicPriceSelector","name","type","label","required","localized","width","Select","slug","fields","admin","labels","plural","singular","Text","TextArea","Number","Email","State","Country","Checkbox","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","filter","Boolean","Message","checkbox","country","email","message","number","payment","select","state","text","textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF;AAEA,yEAAyE;AACzE,OAAO,MAAMJ,SAAS;IACpB0B,UAAUf;IACVgB,SAASjB;IACTkB,OAAOpB;IACPqB,SAASJ;IACTK,QAAQvB;IACRwB,SAASnB;IACToB,QAAQlC;IACRmC,OAAOxB;IACPyB,MAAM7B;IACN8B,UAAU7B;AACZ,EAEC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/collections/Forms/fields.ts"],"sourcesContent":["import type { Block, Field } from 'payload'\n\nimport type { FieldConfig, PaymentFieldConfig } from '../../types.js'\n\nimport { DynamicFieldSelector } from './DynamicFieldSelector.js'\nimport { DynamicPriceSelector } from './DynamicPriceSelector.js'\n\nconst name: Field = {\n name: 'name',\n type: 'text',\n label: 'Name (lowercase, no special characters)',\n required: true,\n}\n\nconst label: Field = {\n name: 'label',\n type: 'text',\n label: 'Label',\n localized: true,\n}\n\nconst required: Field = {\n name: 'required',\n type: 'checkbox',\n label: 'Required',\n}\n\nconst width: Field = {\n name: 'width',\n type: 'number',\n label: 'Field Width (percentage)',\n}\n\nconst Select: Block = {\n slug: 'select',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n {\n name: 'options',\n type: 'array',\n fields: [\n {\n type: 'row',\n fields: [\n {\n name: 'label',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Label',\n localized: true,\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Value',\n required: true,\n },\n ],\n },\n ],\n label: 'Select Attribute Options',\n labels: {\n plural: 'Options',\n singular: 'Option',\n },\n },\n required,\n ],\n labels: {\n plural: 'Select Fields',\n singular: 'Select',\n },\n}\n\nconst Text: Block = {\n slug: 'text',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Fields',\n singular: 'Text',\n },\n}\n\nconst TextArea: Block = {\n slug: 'textarea',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'text',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n localized: true,\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Text Area Fields',\n singular: 'Text Area',\n },\n}\n\nconst Number: Block = {\n slug: 'number',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'defaultValue',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Default Value',\n },\n ],\n },\n required,\n ],\n labels: {\n plural: 'Number Fields',\n singular: 'Number',\n },\n}\n\nconst Email: Block = {\n slug: 'email',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Email Fields',\n singular: 'Email',\n },\n}\n\nconst State: Block = {\n slug: 'state',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'State Fields',\n singular: 'State',\n },\n}\n\nconst Country: Block = {\n slug: 'country',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n width,\n required,\n ],\n labels: {\n plural: 'Country Fields',\n singular: 'Country',\n },\n}\n\nconst Checkbox: Block = {\n slug: 'checkbox',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n ...required,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n name: 'defaultValue',\n type: 'checkbox',\n label: 'Default Value',\n },\n ],\n labels: {\n plural: 'Checkbox Fields',\n singular: 'Checkbox',\n },\n}\n\nconst Payment = (fieldConfig: PaymentFieldConfig): Block => {\n let paymentProcessorField = null\n if (fieldConfig?.paymentProcessor) {\n paymentProcessorField = {\n name: 'paymentProcessor',\n type: 'select',\n label: 'Payment Processor',\n options: [],\n ...fieldConfig.paymentProcessor,\n }\n }\n\n const fields = {\n slug: 'payment',\n fields: [\n {\n type: 'row',\n fields: [\n {\n ...name,\n admin: {\n width: '50%',\n },\n },\n {\n ...label,\n admin: {\n width: '50%',\n },\n },\n ],\n },\n {\n type: 'row',\n fields: [\n {\n ...width,\n admin: {\n width: '50%',\n },\n },\n {\n name: 'basePrice',\n type: 'number',\n admin: {\n width: '50%',\n },\n label: 'Base Price',\n },\n ],\n },\n paymentProcessorField,\n {\n name: 'priceConditions',\n type: 'array',\n fields: [\n {\n name: 'fieldToUse',\n type: 'text',\n admin: {\n components: {\n Field: DynamicFieldSelector,\n },\n },\n },\n {\n name: 'condition',\n type: 'select',\n defaultValue: 'hasValue',\n label: 'Condition',\n options: [\n {\n label: 'Has Any Value',\n value: 'hasValue',\n },\n {\n label: 'Equals',\n value: 'equals',\n },\n {\n label: 'Does Not Equal',\n value: 'notEquals',\n },\n ],\n },\n {\n name: 'valueForCondition',\n type: 'text',\n admin: {\n condition: (_: any, { condition }: any) =>\n condition === 'equals' || condition === 'notEquals',\n },\n label: 'Value',\n },\n {\n name: 'operator',\n type: 'select',\n defaultValue: 'add',\n options: [\n {\n label: 'Add',\n value: 'add',\n },\n {\n label: 'Subtract',\n value: 'subtract',\n },\n {\n label: 'Multiply',\n value: 'multiply',\n },\n {\n label: 'Divide',\n value: 'divide',\n },\n ],\n },\n {\n name: 'valueType',\n type: 'radio',\n admin: {\n width: '100%',\n },\n defaultValue: 'static',\n label: 'Value Type',\n options: [\n {\n label: 'Static Value',\n value: 'static',\n },\n {\n label: 'Value Of Field',\n value: 'valueOfField',\n },\n ],\n },\n {\n name: 'valueForOperator',\n type: 'text',\n admin: {\n components: {\n Field: DynamicPriceSelector,\n },\n },\n label: 'Value',\n },\n ],\n label: 'Price Conditions',\n labels: {\n plural: 'Price Conditions',\n singular: 'Price Condition',\n },\n },\n required,\n ].filter(Boolean) as Field[],\n labels: {\n plural: 'Payment Fields',\n singular: 'Payment',\n },\n }\n\n return fields\n}\n\nconst Message: Block = {\n slug: 'message',\n fields: [\n {\n name: 'message',\n type: 'richText',\n localized: true,\n },\n ],\n labels: {\n plural: 'Message Blocks',\n singular: 'Message',\n },\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\nexport const fields = {\n checkbox: Checkbox,\n country: Country,\n email: Email,\n message: Message,\n number: Number,\n payment: Payment,\n select: Select,\n state: State,\n text: Text,\n textarea: TextArea,\n} as {\n [key: string]: ((fieldConfig?: FieldConfig | boolean) => Block) | Block\n}\n"],"names":["DynamicFieldSelector","DynamicPriceSelector","name","type","label","required","localized","width","Select","slug","fields","admin","labels","plural","singular","Text","TextArea","Number","Email","State","Country","Checkbox","Payment","fieldConfig","paymentProcessorField","paymentProcessor","options","components","Field","defaultValue","value","condition","_","filter","Boolean","Message","checkbox","country","email","message","number","payment","select","state","text","textarea"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,oBAAoB,QAAQ,4BAA2B;AAEhE,MAAMC,OAAc;IAClBA,MAAM;IACNC,MAAM;IACNC,OAAO;IACPC,UAAU;AACZ;AAEA,MAAMD,QAAe;IACnBF,MAAM;IACNC,MAAM;IACNC,OAAO;IACPE,WAAW;AACb;AAEA,MAAMD,WAAkB;IACtBH,MAAM;IACNC,MAAM;IACNC,OAAO;AACT;AAEA,MAAMG,QAAe;IACnBL,MAAM;IACNC,MAAM;IACNC,OAAO;AACT;AAEA,MAAMI,SAAgB;IACpBC,MAAM;IACNC,QAAQ;QACN;YACEP,MAAM;YACNO,QAAQ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wBACNQ,OAAO;4BACLJ,OAAO;wBACT;wBACAsB,cAAc;wBACdzB,OAAO;wBACPsB,SAAS;4BACP;gCACEtB,OAAO;gCACP0B,OAAO;4BACT;4BACA;gCACE1B,OAAO;gCACP0B,OAAO;4BACT;yBACD;oBACH;oBACA;wBACE5B,MAAM;wBACNC,MAAM;wBACNQ,OAAO;4BACLgB,YAAY;gCACVC,OAAO3B;4BACT;wBACF;wBACAG,OAAO;oBACT;iBACD;gBACDA,OAAO;gBACPQ,QAAQ;oBACNC,QAAQ;oBACRC,UAAU;gBACZ;YACF;YACAT;SACD,CAAC4B,MAAM,CAACC;QACTtB,QAAQ;YACNC,QAAQ;YACRC,UAAU;QACZ;IACF;IAEA,OAAOJ;AACT;AAEA,MAAMyB,UAAiB;IACrB1B,MAAM;IACNC,QAAQ;QACN;YACER,MAAM;YACNC,MAAM;YACNG,WAAW;QACb;KACD;IACDM,QAAQ;QACNC,QAAQ;QACRC,UAAU;IACZ;AACF;AAEA,yEAAyE;AACzE,OAAO,MAAMJ,SAAS;IACpB0B,UAAUf;IACVgB,SAASjB;IACTkB,OAAOpB;IACPqB,SAASJ;IACTK,QAAQvB;IACRwB,SAASnB;IACToB,QAAQlC;IACRmC,OAAOxB;IACPyB,MAAM7B;IACN8B,UAAU7B;AACZ,EAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Forms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAI7D,OAAO,KAAK,EAAe,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAK1E,eAAO,MAAM,sBAAsB,eAAgB,uBAAuB,KAAG,gBAqO5E,CAAA"}
|