@payloadcms/ui 3.78.0-canary.6 → 3.78.0-internal.5219978
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/utilities/buildClientFieldSchemaMap/index.d.ts +1 -0
- package/dist/utilities/buildClientFieldSchemaMap/index.d.ts.map +1 -1
- package/dist/utilities/buildClientFieldSchemaMap/index.js +19 -1
- package/dist/utilities/buildClientFieldSchemaMap/index.js.map +1 -1
- package/dist/utilities/buildClientFieldSchemaMap/traverseFields.d.ts.map +1 -1
- package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js +39 -14
- package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js.map +1 -1
- package/dist/utilities/buildFieldSchemaMap/index.d.ts +1 -0
- package/dist/utilities/buildFieldSchemaMap/index.d.ts.map +1 -1
- package/dist/utilities/buildFieldSchemaMap/index.js +18 -1
- package/dist/utilities/buildFieldSchemaMap/index.js.map +1 -1
- package/dist/utilities/buildFormState.d.ts.map +1 -1
- package/dist/utilities/buildFormState.js +8 -5
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/getClientSchemaMap.d.ts +1 -0
- package/dist/utilities/getClientSchemaMap.d.ts.map +1 -1
- package/dist/utilities/getClientSchemaMap.js +7 -4
- package/dist/utilities/getClientSchemaMap.js.map +1 -1
- package/dist/utilities/getSchemaMap.d.ts +1 -0
- package/dist/utilities/getSchemaMap.d.ts.map +1 -1
- package/dist/utilities/getSchemaMap.js +7 -4
- package/dist/utilities/getSchemaMap.js.map +1 -1
- package/dist/utilities/handleLivePreview.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,OAAO,EAER,MAAM,SAAS,CAAA;AAiBhB;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,OAAO,EAER,MAAM,SAAS,CAAA;AAiBhB;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KAAG;IAAE,oBAAoB,EAAE,oBAAoB,CAAA;CA8E/C,CAAA"}
|
|
@@ -18,7 +18,8 @@ export const buildClientFieldSchemaMap = args => {
|
|
|
18
18
|
globalSlug,
|
|
19
19
|
i18n,
|
|
20
20
|
payload,
|
|
21
|
-
schemaMap
|
|
21
|
+
schemaMap,
|
|
22
|
+
widgetSlug
|
|
22
23
|
} = args;
|
|
23
24
|
const clientSchemaMap = new Map();
|
|
24
25
|
if (collectionSlug) {
|
|
@@ -63,6 +64,23 @@ export const buildClientFieldSchemaMap = args => {
|
|
|
63
64
|
schemaMap
|
|
64
65
|
});
|
|
65
66
|
}
|
|
67
|
+
} else if (widgetSlug) {
|
|
68
|
+
const matchedWidget = config.admin?.dashboard?.widgets?.find(widget => widget.slug === widgetSlug);
|
|
69
|
+
if (matchedWidget?.fields?.length) {
|
|
70
|
+
clientSchemaMap.set(widgetSlug, {
|
|
71
|
+
fields: matchedWidget.fields
|
|
72
|
+
});
|
|
73
|
+
traverseFields({
|
|
74
|
+
clientSchemaMap,
|
|
75
|
+
config,
|
|
76
|
+
fields: matchedWidget.fields,
|
|
77
|
+
i18n,
|
|
78
|
+
parentIndexPath: '',
|
|
79
|
+
parentSchemaPath: widgetSlug,
|
|
80
|
+
payload,
|
|
81
|
+
schemaMap
|
|
82
|
+
});
|
|
83
|
+
}
|
|
66
84
|
}
|
|
67
85
|
return {
|
|
68
86
|
clientFieldSchemaMap: clientSchemaMap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["traverseFields","baseAuthFields","name","type","required","buildClientFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","clientSchemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","clientFieldSchemaMap"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n FieldSchemaMap,\n Payload,\n TextFieldClient,\n} from 'payload'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: ClientField[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildClientFieldSchemaMap = (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18n\n payload: Payload\n schemaMap: FieldSchemaMap\n}): { clientFieldSchemaMap: ClientFieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap } = args\n\n const clientSchemaMap: ClientFieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextFieldClient).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextFieldClient).label = i18n.t('authentication:confirmPassword')\n // Place these fields _last_ to ensure they do not disrupt field paths in the field schema map\n fieldsToSet = fieldsToSet.concat(baseAuthFields)\n }\n\n clientSchemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n payload,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n clientSchemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n payload,\n schemaMap,\n })\n }\n }\n\n return { clientFieldSchemaMap: clientSchemaMap }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAAgC,CACpC;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,GACA;EACEF,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,IAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["traverseFields","baseAuthFields","name","type","required","buildClientFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","widgetSlug","clientSchemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","matchedWidget","admin","dashboard","widgets","widget","length","clientFieldSchemaMap"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n FieldSchemaMap,\n Payload,\n TextFieldClient,\n} from 'payload'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: ClientField[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildClientFieldSchemaMap = (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18n\n payload: Payload\n schemaMap: FieldSchemaMap\n widgetSlug?: string\n}): { clientFieldSchemaMap: ClientFieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap, widgetSlug } = args\n\n const clientSchemaMap: ClientFieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextFieldClient).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextFieldClient).label = i18n.t('authentication:confirmPassword')\n // Place these fields _last_ to ensure they do not disrupt field paths in the field schema map\n fieldsToSet = fieldsToSet.concat(baseAuthFields)\n }\n\n clientSchemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n payload,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n clientSchemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n payload,\n schemaMap,\n })\n }\n } else if (widgetSlug) {\n const matchedWidget = config.admin?.dashboard?.widgets?.find(\n (widget) => widget.slug === widgetSlug,\n )\n\n if (matchedWidget?.fields?.length) {\n clientSchemaMap.set(widgetSlug, {\n fields: matchedWidget.fields,\n })\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: matchedWidget.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: widgetSlug,\n payload,\n schemaMap,\n })\n }\n }\n\n return { clientFieldSchemaMap: clientSchemaMap }\n}\n"],"mappings":"AAUA,SAASA,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAAgC,CACpC;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,GACA;EACEF,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,IAAA;EASxC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAU,CAAE,GAAGP,IAAA;EAErF,MAAMQ,eAAA,GAAwC,IAAIC,GAAA;EAElD,IAAIR,cAAA,EAAgB;IAClB,MAAMS,iBAAA,GAAoBR,MAAA,CAAOS,WAAW,CAACC,IAAI,CAC9CC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKb,cAAA;IAGtC,IAAIS,iBAAA,EAAmB;MACrB,IAAIK,WAAA,GAAcL,iBAAA,EAAmBM,MAAA,IAAU,EAAE;MAEjD,IAAIN,iBAAA,CAAkBO,IAAI,IAAI,CAACP,iBAAA,CAAkBO,IAAI,CAACC,oBAAoB,EAAE;;QACxEvB,cAAc,CAAC,EAAE,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QACAc,MAAA,EAAQY,aAAA,CAAcZ,MAAM;QAC5BZ,IAAA;QACAmB,eAAA,EAAiB;QACjBC,gBAAA,EAAkBjB,UAAA;QAClBF,OAAA;QACAC;MACF;IACF;EACF;EAEA,OAAO;IAAE4B,oBAAA,EAAsB1B;EAAgB;AACjD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildClientFieldSchemaMap/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAEV,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,OAAO,EACP,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAKhB,KAAK,IAAI,GAAG;IACV,eAAe,EAAE,oBAAoB,CAAA;IACrC,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,EAAE,CAAC,WAAW,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC1C,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,sGASxB,IAAI,SA+LN,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createClientFields } from 'payload';
|
|
1
|
+
import { createClientBlocks, createClientFields } from 'payload';
|
|
2
2
|
import { fieldAffectsData, getFieldPaths, tabHasName } from 'payload/shared';
|
|
3
3
|
export const traverseFields = ({
|
|
4
4
|
clientSchemaMap,
|
|
@@ -111,20 +111,45 @@ export const traverseFields = ({
|
|
|
111
111
|
richTextFieldSchemaMap.set(path, subField);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
// Now loop through them, convert each entry to a client field and add it to the client schema map
|
|
114
|
+
// Now loop through them, convert each entry to a client field and add it to the client schema map.
|
|
115
|
+
// Schema map values are a union: Block | Field | Tab | { fields: Field[] }.
|
|
116
|
+
// Each variant needs different conversion to strip server-only properties.
|
|
115
117
|
for (const [path, subField] of richTextFieldSchemaMap.entries()) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
if ('slug' in subField) {
|
|
119
|
+
const clientBlocks = createClientBlocks({
|
|
120
|
+
blocks: [subField],
|
|
121
|
+
defaultIDType: payload.config.db.defaultIDType,
|
|
122
|
+
i18n,
|
|
123
|
+
importMap: payload.importMap
|
|
124
|
+
});
|
|
125
|
+
clientSchemaMap.set(path, clientBlocks[0]);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if ('type' in subField) {
|
|
129
|
+
const clientFields = createClientFields({
|
|
130
|
+
defaultIDType: payload.config.db.defaultIDType,
|
|
131
|
+
disableAddingID: true,
|
|
132
|
+
fields: [subField],
|
|
133
|
+
i18n,
|
|
134
|
+
importMap: payload.importMap
|
|
135
|
+
});
|
|
136
|
+
clientSchemaMap.set(path, clientFields[0]);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if ('fields' in subField) {
|
|
140
|
+
const clientFields = createClientFields({
|
|
141
|
+
defaultIDType: payload.config.db.defaultIDType,
|
|
142
|
+
disableAddingID: true,
|
|
143
|
+
fields: subField.fields,
|
|
144
|
+
i18n,
|
|
145
|
+
importMap: payload.importMap
|
|
146
|
+
});
|
|
147
|
+
clientSchemaMap.set(path, {
|
|
148
|
+
fields: clientFields
|
|
149
|
+
});
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
subField;
|
|
128
153
|
}
|
|
129
154
|
break;
|
|
130
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverseFields.js","names":["createClientFields","fieldAffectsData","getFieldPaths","tabHasName","traverseFields","clientSchemaMap","config","fields","i18n","parentIndexPath","parentSchemaPath","payload","schemaMap","index","field","entries","indexPath","schemaPath","set","type","blockReferences","blocks","map","_block","block","blocksMap","find","slug","blockSchemaPath","richTextFieldSchemaMap","Map","path","subField","startsWith","isFieldsOnly","Object","keys","length","clientFields","defaultIDType","db","disableAddingID","importMap","isNamedTab","tabs","tab"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/traverseFields.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n Field,\n FieldSchemaMap,\n Payload,\n TabAsFieldClient,\n} from 'payload'\n\nimport { createClientFields } from 'payload'\nimport { fieldAffectsData, getFieldPaths, tabHasName } from 'payload/shared'\n\ntype Args = {\n clientSchemaMap: ClientFieldSchemaMap\n config: ClientConfig\n fields: (ClientField | TabAsFieldClient)[]\n i18n: I18n<any, any>\n parentIndexPath: string\n parentSchemaPath: string\n payload: Payload\n schemaMap: FieldSchemaMap\n}\n\nexport const traverseFields = ({\n clientSchemaMap,\n config,\n fields,\n i18n,\n parentIndexPath,\n parentSchemaPath,\n payload,\n schemaMap,\n}: Args) => {\n for (const [index, field] of fields.entries()) {\n const { indexPath, schemaPath } = getFieldPaths({\n field,\n index,\n parentIndexPath,\n parentSchemaPath,\n })\n\n clientSchemaMap.set(schemaPath, field)\n\n switch (field.type) {\n case 'array': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n\n case 'blocks':\n ;(field.blockReferences ?? field.blocks).map((_block) => {\n const block =\n typeof _block === 'string'\n ? config.blocksMap\n ? config.blocksMap[_block]\n : config.blocks.find((block) => typeof block !== 'string' && block.slug === _block)\n : _block\n\n const blockSchemaPath = `${schemaPath}.${block.slug}`\n\n clientSchemaMap.set(blockSchemaPath, block)\n traverseFields({\n clientSchemaMap,\n config,\n fields: block.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath + '.' + block.slug,\n payload,\n schemaMap,\n })\n })\n\n break\n\n case 'collapsible':\n case 'row': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n break\n }\n\n case 'group': {\n if (fieldAffectsData(field)) {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n } else {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n }\n break\n }\n\n case 'richText': {\n // richText sub-fields are not part of the ClientConfig or the Config.\n // They only exist in the field schema map.\n // Thus, we need to\n // 1. get them from the field schema map\n // 2. convert them to client fields\n // 3. add them to the client schema map\n\n // So these would basically be all fields that are not part of the client config already\n const richTextFieldSchemaMap: FieldSchemaMap = new Map()\n for (const [path, subField] of schemaMap.entries()) {\n if (path.startsWith(`${schemaPath}.`)) {\n richTextFieldSchemaMap.set(path, subField)\n }\n }\n\n // Now loop through them, convert each entry to a client field and add it to the client schema map\n for (const [path, subField] of richTextFieldSchemaMap.entries()) {\n // check if fields is the only key in the subField object\n const isFieldsOnly = Object.keys(subField).length === 1 && 'fields' in subField\n\n const clientFields = createClientFields({\n defaultIDType: payload.config.db.defaultIDType,\n disableAddingID: true,\n fields: isFieldsOnly ? subField.fields : [subField as Field],\n i18n,\n importMap: payload.importMap,\n })\n\n clientSchemaMap.set(\n path,\n isFieldsOnly\n ? {\n fields: clientFields,\n }\n : clientFields[0],\n )\n }\n break\n }\n\n case 'tab': {\n const isNamedTab = tabHasName(field)\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n\n case 'tabs': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n }\n }\n}\n"],"mappings":"AAWA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,gBAAgB,EAAEC,aAAa,EAAEC,UAAU,QAAQ;AAa5D,OAAO,MAAMC,cAAA,GAAiBA,CAAC;EAC7BC,eAAe;EACfC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,eAAe;EACfC,gBAAgB;EAChBC,OAAO;EACPC;AAAS,CACJ;EACL,KAAK,MAAM,CAACC,KAAA,EAAOC,KAAA,CAAM,IAAIP,MAAA,CAAOQ,OAAO,IAAI;IAC7C,MAAM;MAAEC,SAAS;MAAEC;IAAU,CAAE,GAAGf,aAAA,CAAc;MAC9CY,KAAA;MACAD,KAAA;MACAJ,eAAA;MACAC;IACF;IAEAL,eAAA,CAAgBa,GAAG,CAACD,UAAA,EAAYH,KAAA;IAEhC,QAAQA,KAAA,CAAMK,IAAI;MAChB,KAAK;QAAS;UACZf,cAAA,CAAe;YACbC,eAAA;YACAC,MAAA;YACAC,MAAA,EAAQO,KAAA,CAAMP,MAAM;YACpBC,IAAA;YACAC,eAAA,EAAiB;YACjBC,gBAAA,EAAkBO,UAAA;YAClBN,OAAA;YACAC;UACF;UAEA;QACF;MAEA,KAAK;;QACD,CAAAE,KAAA,CAAMM,eAAe,IAAIN,KAAA,C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Q;UACXR,cAAA,CAAe;YACbC,eAAA;YACAC,MAAA;YACAC,MAAA,EAAQO,KAAA,CAAM8B,IAAI,CAACtB,GAAG,CAAEuB,GAAA,KAAS;cAAE,GAAGA,GAAG;cAAE1B,IAAA,EAAM;YAAM;YACvDX,IAAA;YACAC,eAAA,EAAiBO,SAAA;YACjBN,gBAAA,EAAkBO,UAAA;YAClBN,OAAA;YACAC;UACF;UAEA;QACF;IACF;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"traverseFields.js","names":["createClientBlocks","createClientFields","fieldAffectsData","getFieldPaths","tabHasName","traverseFields","clientSchemaMap","config","fields","i18n","parentIndexPath","parentSchemaPath","payload","schemaMap","index","field","entries","indexPath","schemaPath","set","type","blockReferences","blocks","map","_block","block","blocksMap","find","slug","blockSchemaPath","richTextFieldSchemaMap","Map","path","subField","startsWith","clientBlocks","defaultIDType","db","importMap","clientFields","disableAddingID","isNamedTab","tabs","tab"],"sources":["../../../src/utilities/buildClientFieldSchemaMap/traverseFields.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientBlock,\n ClientConfig,\n ClientField,\n ClientFieldSchemaMap,\n FieldSchemaMap,\n Payload,\n TabAsFieldClient,\n} from 'payload'\n\nimport { createClientBlocks, createClientFields } from 'payload'\nimport { fieldAffectsData, getFieldPaths, tabHasName } from 'payload/shared'\n\ntype Args = {\n clientSchemaMap: ClientFieldSchemaMap\n config: ClientConfig\n fields: (ClientField | TabAsFieldClient)[]\n i18n: I18n<any, any>\n parentIndexPath: string\n parentSchemaPath: string\n payload: Payload\n schemaMap: FieldSchemaMap\n}\n\nexport const traverseFields = ({\n clientSchemaMap,\n config,\n fields,\n i18n,\n parentIndexPath,\n parentSchemaPath,\n payload,\n schemaMap,\n}: Args) => {\n for (const [index, field] of fields.entries()) {\n const { indexPath, schemaPath } = getFieldPaths({\n field,\n index,\n parentIndexPath,\n parentSchemaPath,\n })\n\n clientSchemaMap.set(schemaPath, field)\n\n switch (field.type) {\n case 'array': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n\n case 'blocks':\n ;(field.blockReferences ?? field.blocks).map((_block) => {\n const block =\n typeof _block === 'string'\n ? config.blocksMap\n ? config.blocksMap[_block]\n : config.blocks.find((block) => typeof block !== 'string' && block.slug === _block)\n : _block\n\n const blockSchemaPath = `${schemaPath}.${block.slug}`\n\n clientSchemaMap.set(blockSchemaPath, block)\n traverseFields({\n clientSchemaMap,\n config,\n fields: block.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath + '.' + block.slug,\n payload,\n schemaMap,\n })\n })\n\n break\n\n case 'collapsible':\n case 'row': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n break\n }\n\n case 'group': {\n if (fieldAffectsData(field)) {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n } else {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n }\n break\n }\n\n case 'richText': {\n // richText sub-fields are not part of the ClientConfig or the Config.\n // They only exist in the field schema map.\n // Thus, we need to\n // 1. get them from the field schema map\n // 2. convert them to client fields\n // 3. add them to the client schema map\n\n // So these would basically be all fields that are not part of the client config already\n const richTextFieldSchemaMap: FieldSchemaMap = new Map()\n for (const [path, subField] of schemaMap.entries()) {\n if (path.startsWith(`${schemaPath}.`)) {\n richTextFieldSchemaMap.set(path, subField)\n }\n }\n\n // Now loop through them, convert each entry to a client field and add it to the client schema map.\n // Schema map values are a union: Block | Field | Tab | { fields: Field[] }.\n // Each variant needs different conversion to strip server-only properties.\n for (const [path, subField] of richTextFieldSchemaMap.entries()) {\n if ('slug' in subField) {\n const clientBlocks = createClientBlocks({\n blocks: [subField],\n defaultIDType: payload.config.db.defaultIDType,\n i18n,\n importMap: payload.importMap,\n })\n\n clientSchemaMap.set(path, clientBlocks[0] as ClientBlock)\n continue\n }\n\n if ('type' in subField) {\n const clientFields = createClientFields({\n defaultIDType: payload.config.db.defaultIDType,\n disableAddingID: true,\n fields: [subField],\n i18n,\n importMap: payload.importMap,\n })\n\n clientSchemaMap.set(path, clientFields[0])\n continue\n }\n\n if ('fields' in subField) {\n const clientFields = createClientFields({\n defaultIDType: payload.config.db.defaultIDType,\n disableAddingID: true,\n fields: subField.fields,\n i18n,\n importMap: payload.importMap,\n })\n\n clientSchemaMap.set(path, { fields: clientFields })\n continue\n }\n\n subField satisfies never\n }\n break\n }\n\n case 'tab': {\n const isNamedTab = tabHasName(field)\n\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n\n case 'tabs': {\n traverseFields({\n clientSchemaMap,\n config,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n i18n,\n parentIndexPath: indexPath,\n parentSchemaPath: schemaPath,\n payload,\n schemaMap,\n })\n\n break\n }\n }\n }\n}\n"],"mappings":"AAWA,SAASA,kBAAkB,EAAEC,kBAAkB,QAAQ;AACvD,SAASC,gBAAgB,EAAEC,aAAa,EAAEC,UAAU,QAAQ;AAa5D,OAAO,MAAMC,cAAA,GAAiBA,CAAC;EAC7BC,eAAe;EACfC,MAAM;EACNC,MAAM;EACNC,IAAI;EACJC,eAAe;EACfC,gBAAgB;EAChBC,OAAO;EACPC;AAAS,CACJ;EACL,KAAK,MAAM,CAACC,KAAA,EAAOC,KAAA,CAAM,IAAIP,MAAA,CAAOQ,OAAO,IAAI;IAC7C,MAAM;MAAEC,SAAS;MAAEC;IA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;QACF;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAS,cAAc,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAqBhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU;IACxC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAS,cAAc,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAqBhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU;IACxC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAyEnC,CAAA"}
|
|
@@ -19,7 +19,8 @@ export const buildFieldSchemaMap = args => {
|
|
|
19
19
|
collectionSlug,
|
|
20
20
|
config,
|
|
21
21
|
globalSlug,
|
|
22
|
-
i18n
|
|
22
|
+
i18n,
|
|
23
|
+
widgetSlug
|
|
23
24
|
} = args;
|
|
24
25
|
const schemaMap = new Map();
|
|
25
26
|
if (collectionSlug) {
|
|
@@ -60,6 +61,22 @@ export const buildFieldSchemaMap = args => {
|
|
|
60
61
|
schemaMap
|
|
61
62
|
});
|
|
62
63
|
}
|
|
64
|
+
} else if (widgetSlug) {
|
|
65
|
+
const matchedWidget = config.admin?.dashboard?.widgets?.find(widget => widget.slug === widgetSlug);
|
|
66
|
+
const widgetFields = matchedWidget?.fields;
|
|
67
|
+
if (widgetFields?.length) {
|
|
68
|
+
schemaMap.set(widgetSlug, {
|
|
69
|
+
fields: widgetFields
|
|
70
|
+
});
|
|
71
|
+
traverseFields({
|
|
72
|
+
config,
|
|
73
|
+
fields: widgetFields,
|
|
74
|
+
i18n,
|
|
75
|
+
parentIndexPath: '',
|
|
76
|
+
parentSchemaPath: widgetSlug,
|
|
77
|
+
schemaMap
|
|
78
|
+
});
|
|
79
|
+
}
|
|
63
80
|
}
|
|
64
81
|
return {
|
|
65
82
|
fieldSchemaMap: schemaMap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["confirmPassword","password","traverseFields","baseAuthFields","name","type","required","validate","buildFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","schemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","fieldSchemaMap"],"sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Field, FieldSchemaMap, SanitizedConfig, TextField } from 'payload'\n\nimport { confirmPassword, password } from 'payload/shared'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: Field[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n validate: password,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n validate: confirmPassword,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildFieldSchemaMap = (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18n\n}): { fieldSchemaMap: FieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n } = args\n\n const schemaMap: FieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextField).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextField).label = i18n.t('authentication:confirmPassword')\n // Place these fields _last_ to ensure they do not disrupt field paths in the field schema map\n fieldsToSet = fieldsToSet.concat(baseAuthFields)\n }\n\n schemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n schemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n schemaMap,\n })\n }\n }\n\n return { fieldSchemaMap: schemaMap }\n}\n"],"mappings":"AAGA,SAASA,eAAe,EAAEC,QAAQ,QAAQ;AAE1C,SAASC,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAA0B,CAC9B;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUN;AACZ,GACA;EACEG,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUP;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMQ,mBAAA,GAAuBC,IAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["confirmPassword","password","traverseFields","baseAuthFields","name","type","required","validate","buildFieldSchemaMap","args","collectionSlug","config","globalSlug","i18n","widgetSlug","schemaMap","Map","matchedCollection","collections","find","collection","slug","fieldsToSet","fields","auth","disableLocalStrategy","label","t","concat","set","parentIndexPath","parentSchemaPath","matchedGlobal","globals","global","matchedWidget","admin","dashboard","widgets","widget","widgetFields","length","fieldSchemaMap"],"sources":["../../../src/utilities/buildFieldSchemaMap/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { Field, FieldSchemaMap, SanitizedConfig, TextField } from 'payload'\n\nimport { confirmPassword, password } from 'payload/shared'\n\nimport { traverseFields } from './traverseFields.js'\n\nconst baseAuthFields: Field[] = [\n {\n name: 'password',\n type: 'text',\n required: true,\n validate: password,\n },\n {\n name: 'confirm-password',\n type: 'text',\n required: true,\n validate: confirmPassword,\n },\n]\n\n/**\n * Flattens the config fields into a map of field schemas\n */\nexport const buildFieldSchemaMap = (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18n\n widgetSlug?: string\n}): { fieldSchemaMap: FieldSchemaMap } => {\n const { collectionSlug, config, globalSlug, i18n, widgetSlug } = args\n\n const schemaMap: FieldSchemaMap = new Map()\n\n if (collectionSlug) {\n const matchedCollection = config.collections.find(\n (collection) => collection.slug === collectionSlug,\n )\n\n if (matchedCollection) {\n let fieldsToSet = matchedCollection?.fields || []\n\n if (matchedCollection.auth && !matchedCollection.auth.disableLocalStrategy) {\n ;(baseAuthFields[0] as TextField).label = i18n.t('general:password')\n ;(baseAuthFields[1] as TextField).label = i18n.t('authentication:confirmPassword')\n // Place these fields _last_ to ensure they do not disrupt field paths in the field schema map\n fieldsToSet = fieldsToSet.concat(baseAuthFields)\n }\n\n schemaMap.set(collectionSlug, {\n fields: fieldsToSet,\n })\n\n traverseFields({\n config,\n fields: fieldsToSet,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: collectionSlug,\n schemaMap,\n })\n }\n } else if (globalSlug) {\n const matchedGlobal = config.globals.find((global) => global.slug === globalSlug)\n\n if (matchedGlobal) {\n schemaMap.set(globalSlug, {\n fields: matchedGlobal.fields,\n })\n\n traverseFields({\n config,\n fields: matchedGlobal.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: globalSlug,\n schemaMap,\n })\n }\n } else if (widgetSlug) {\n const matchedWidget = config.admin?.dashboard?.widgets?.find(\n (widget) => widget.slug === widgetSlug,\n )\n const widgetFields = matchedWidget?.fields as Field[] | undefined\n\n if (widgetFields?.length) {\n schemaMap.set(widgetSlug, {\n fields: widgetFields,\n })\n\n traverseFields({\n config,\n fields: widgetFields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: widgetSlug,\n schemaMap,\n })\n }\n }\n\n return { fieldSchemaMap: schemaMap }\n}\n"],"mappings":"AAGA,SAASA,eAAe,EAAEC,QAAQ,QAAQ;AAE1C,SAASC,cAAc,QAAQ;AAE/B,MAAMC,cAAA,GAA0B,CAC9B;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUN;AACZ,GACA;EACEG,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,QAAA,EAAUP;AACZ,EACD;AAED;;;AAGA,OAAO,MAAMQ,mBAAA,GAAuBC,IAAA;EAOlC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC;EAAU,CAAE,GAAGL,IAAA;EAEjE,MAAMM,SAAA,GAA4B,IAAIC,GAAA;EAEtC,IAAIN,cAAA,EAAgB;IAClB,MAAMO,iBAAA,GAAoBN,MAAA,CAAOO,WAAW,CAACC,IAAI,CAC9CC,UAAA,IAAeA,UAAA,CAAWC,IAAI,KAAKX,cAAA;IAGtC,IAAIO,iBAAA,EAAmB;MACrB,IAAIK,WAAA,GAAcL,iBAAA,EAAmBM,MAAA,IAAU,EAAE;MAEjD,IAAIN,iBAAA,CAAkBO,IAAI,IAAI,CAACP,iBAAA,CAAkBO,IAAI,CAACC,oBAAoB,EAAE;;QACxEtB,cAAc,CAAC,EAAE,CAAeuB,KAAK,GAAGb,IAAA,CAAKc,CAAC,CAAC;QAC/CxB,cAA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EA,OAAO;IAAE2B,cAAA,EAAgB3B;EAAU;AACrC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAA;AAchB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpC,CAAA;AAED,KAAK,2BAA2B,GAAG;IACjC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,CACA;IACE,OAAO,EAAE,MAAM,CAAA;CAChB,GACD,WAAW,CACd,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,GAAG,2BAA2B,CAAA;AAE1F,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAChD,kBAAkB,EAClB,OAAO,CAAC,oBAAoB,CAAC,CAwB9B,CAAA;AAED,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"buildFormState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildFormState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAA;AAchB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpC,CAAA;AAED,KAAK,2BAA2B,GAAG;IACjC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAA;IACtB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,GAAG,CACA;IACE,OAAO,EAAE,MAAM,CAAA;CAChB,GACD,WAAW,CACd,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,GAAG,2BAA2B,CAAA;AAE1F,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAChD,kBAAkB,EAClB,OAAO,CAAC,oBAAoB,CAAC,CAwB9B,CAAA;AAED,eAAO,MAAM,cAAc,SACnB,kBAAkB,KACvB,OAAO,CAAC,2BAA2B,CAuMrC,CAAA"}
|
|
@@ -61,21 +61,23 @@ export const buildFormState = async args => {
|
|
|
61
61
|
returnLivePreviewURL,
|
|
62
62
|
returnLockStatus,
|
|
63
63
|
returnPreviewURL,
|
|
64
|
-
|
|
64
|
+
widgetSlug,
|
|
65
|
+
schemaPath = collectionSlug || globalSlug || widgetSlug,
|
|
65
66
|
select,
|
|
66
67
|
skipClientConfigAuth,
|
|
67
68
|
skipValidation,
|
|
68
69
|
updateLastEdited
|
|
69
70
|
} = args;
|
|
70
71
|
const selectMode = select ? getSelectMode(select) : undefined;
|
|
71
|
-
if (!collectionSlug && !globalSlug) {
|
|
72
|
-
throw new Error('Either collectionSlug or
|
|
72
|
+
if (!collectionSlug && !globalSlug && !widgetSlug) {
|
|
73
|
+
throw new Error('Either collectionSlug, globalSlug, or widgetSlug must be provided');
|
|
73
74
|
}
|
|
74
75
|
const schemaMap = getSchemaMap({
|
|
75
76
|
collectionSlug,
|
|
76
77
|
config,
|
|
77
78
|
globalSlug,
|
|
78
|
-
i18n
|
|
79
|
+
i18n,
|
|
80
|
+
widgetSlug
|
|
79
81
|
});
|
|
80
82
|
const clientSchemaMap = getClientSchemaMap({
|
|
81
83
|
collectionSlug,
|
|
@@ -88,7 +90,8 @@ export const buildFormState = async args => {
|
|
|
88
90
|
globalSlug,
|
|
89
91
|
i18n,
|
|
90
92
|
payload,
|
|
91
|
-
schemaMap
|
|
93
|
+
schemaMap,
|
|
94
|
+
widgetSlug
|
|
92
95
|
});
|
|
93
96
|
const id = collectionSlug ? idFromArgs : undefined;
|
|
94
97
|
const fieldOrEntityConfig = schemaMap.get(schemaPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user?: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n schemaPath = collectionSlug || globalSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug) {\n throw new Error('Either collectionSlug or globalSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,CAAE,GAAGD,IAAA;EAEhB,IAAI;IACF,MAAMd,cAAA,CAAe;MAAEe;IAAI;IAC3B,MAAMC,GAAA,GAAM,MAAMC,cAAA,CAAeH,IAAA;IAEjC,OAAOE,GAAA;EACT,EAAE,OAAOE,GAAA,EAAK;IACZH,GAAA,CAAII,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAO;QACLA,OAAA,EAASL,GAAA,CAAIK;MACf;IACF;IAEA,IAAIL,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,MAAM,IAAIrB,iBAAA;IACZ;IAEA,OAAOD,YAAA,CAAaiB,GAAA;EACtB;AACF;AAEA,OAAO,MAAMD,cAAA,GAAiB,MAC5BH,IAAA;EAEA,MAAM;IACJU,EAAA,EAAIC,UAAU;IACdC,cAAc;IACdC,IAAA,EAAMC,YAAY;IAClBC,cAAc;IACdC,cAAc;IACdC,iBAAiB;IACjBC,SAAS;IACTC,UAAU;IACVC,gBAAgB;IAChBC,qBAAqB;IACrBC,QAAQ;IACRC,SA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AA,CAAQsD,WAAW,CAAC/C,cAAA,CAAe,EAAEe,MAAA,EAAQiC,MAAA,IAAU1C,SAAA,CAAU2C,IAAI,EAAE;MACzET,eAAA,CAAgBS,IAAI,GAAG3C,SAAA,CAAU2C,IAAI;IACvC;EACF;EAEA,IAAIC,iBAAA;EAEJ,IAAIjC,gBAAA,EAAkB;IACpBiC,iBAAA,GAAoB,MAAMlE,sBAAA,CAAuB;MAC/Cc,EAAA;MACAE,cAAA;MACAO,UAAA;MACAlB,GAAA;MACAkC;IACF;EACF;EAEA,MAAMjC,GAAA,GAAmC;IACvC6D,WAAA,EAAaD,iBAAA;IACbE,KAAA,EAAOZ;EACT;EAEA,IAAIxB,oBAAA,EAAsB;IACxB,MAAM;MAAEqC;IAAc,CAAE,GAAG,MAAMpE,iBAAA,CAAkB;MACjDe,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIgE,cAAA,EAAgB;MAClB/D,GAAA,CAAI+D,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAInC,gBAAA,EAAkB;IACpB,MAAM;MAAEoC;IAAU,CAAE,GAAG,MAAMpE,aAAA,CAAc;MACzCc,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIiE,UAAA,EAAY;MACdhE,GAAA,CAAIgE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOhE,GAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildFormState.js","names":["canAccessAdmin","formatErrors","UnauthorizedError","getSelectMode","reduceFieldsToValues","fieldSchemasToFormState","renderField","getClientConfig","getClientSchemaMap","getSchemaMap","handleFormStateLocking","handleLivePreview","handlePreview","buildFormStateHandler","args","req","res","buildFormState","err","payload","logger","error","msg","message","id","idFromArgs","collectionSlug","data","incomingData","docPermissions","docPreferences","documentFormState","formState","globalSlug","initialBlockData","initialBlockFormState","mockRSCs","operation","readOnly","renderAllFields","i18n","config","returnLivePreviewURL","returnLockStatus","returnPreviewURL","widgetSlug","schemaPath","select","skipClientConfigAuth","skipValidation","updateLastEdited","selectMode","undefined","Error","schemaMap","clientSchemaMap","importMap","user","fieldOrEntityConfig","get","fields","length","type","documentData","blockData","Array","isArray","formStateResult","clientFieldSchemaMap","fieldSchemaMap","permissions","preferences","previousFormState","renderFieldFn","collections","upload","file","lockedStateResult","lockedState","state","livePreviewURL","previewURL"],"sources":["../../src/utilities/buildFormState.ts"],"sourcesContent":["import type {\n BuildFormStateArgs,\n ClientConfig,\n ClientUser,\n ErrorResult,\n FormState,\n ServerFunction,\n} from 'payload'\n\nimport { canAccessAdmin, formatErrors, UnauthorizedError } from 'payload'\nimport { getSelectMode, reduceFieldsToValues } from 'payload/shared'\n\nimport { fieldSchemasToFormState } from '../forms/fieldSchemasToFormState/index.js'\nimport { renderField } from '../forms/fieldSchemasToFormState/renderField.js'\nimport { getClientConfig } from './getClientConfig.js'\nimport { getClientSchemaMap } from './getClientSchemaMap.js'\nimport { getSchemaMap } from './getSchemaMap.js'\nimport { handleFormStateLocking } from './handleFormStateLocking.js'\nimport { handleLivePreview } from './handleLivePreview.js'\nimport { handlePreview } from './handlePreview.js'\n\nexport type LockedState = {\n isLocked: boolean\n lastEditedAt: string\n user?: ClientUser | number | string\n}\n\ntype BuildFormStateSuccessResult = {\n clientConfig?: ClientConfig\n errors?: never\n indexPath?: string\n livePreviewURL?: string\n lockedState?: LockedState\n previewURL?: string\n state: FormState\n}\n\ntype BuildFormStateErrorResult = {\n livePreviewURL?: never\n lockedState?: never\n previewURL?: never\n state?: never\n} & (\n | {\n message: string\n }\n | ErrorResult\n)\n\nexport type BuildFormStateResult = BuildFormStateErrorResult | BuildFormStateSuccessResult\n\nexport const buildFormStateHandler: ServerFunction<\n BuildFormStateArgs,\n Promise<BuildFormStateResult>\n> = async (args) => {\n const { req } = args\n\n try {\n await canAccessAdmin({ req })\n const res = await buildFormState(args)\n\n return res\n } catch (err) {\n req.payload.logger.error({ err, msg: `There was an error building form state` })\n\n if (err.message === 'Could not find field schema for given path') {\n return {\n message: err.message,\n }\n }\n\n if (err.message === 'Unauthorized') {\n throw new UnauthorizedError()\n }\n\n return formatErrors(err)\n }\n}\n\nexport const buildFormState = async (\n args: BuildFormStateArgs,\n): Promise<BuildFormStateSuccessResult> => {\n const {\n id: idFromArgs,\n collectionSlug,\n data: incomingData,\n docPermissions,\n docPreferences,\n documentFormState,\n formState,\n globalSlug,\n initialBlockData,\n initialBlockFormState,\n mockRSCs,\n operation,\n readOnly,\n renderAllFields,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n },\n returnLivePreviewURL,\n returnLockStatus,\n returnPreviewURL,\n widgetSlug,\n schemaPath = collectionSlug || globalSlug || widgetSlug,\n select,\n skipClientConfigAuth,\n skipValidation,\n updateLastEdited,\n } = args\n\n const selectMode = select ? getSelectMode(select) : undefined\n\n if (!collectionSlug && !globalSlug && !widgetSlug) {\n throw new Error('Either collectionSlug, globalSlug, or widgetSlug must be provided')\n }\n\n const schemaMap = getSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n,\n widgetSlug,\n })\n\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug,\n config: getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user: skipClientConfigAuth ? true : req.user,\n }),\n globalSlug,\n i18n,\n payload,\n schemaMap,\n widgetSlug,\n })\n\n const id = collectionSlug ? idFromArgs : undefined\n const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n if (!fieldOrEntityConfig) {\n throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n }\n\n if (\n (!('fields' in fieldOrEntityConfig) ||\n !fieldOrEntityConfig.fields ||\n !fieldOrEntityConfig.fields.length) &&\n 'type' in fieldOrEntityConfig &&\n fieldOrEntityConfig.type !== 'blocks'\n ) {\n throw new Error(\n `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n )\n }\n\n // If there is form state but no data, deduce data from that form state, e.g. on initial load\n // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n const data = incomingData || reduceFieldsToValues(formState, true)\n\n let documentData = undefined\n\n if (documentFormState) {\n documentData = reduceFieldsToValues(documentFormState, true)\n }\n\n let blockData = initialBlockData\n\n if (initialBlockFormState) {\n blockData = reduceFieldsToValues(initialBlockFormState, true)\n }\n\n /**\n * When building state for sub schemas we need to adjust:\n * - `fields`\n * - `parentSchemaPath`\n * - `parentPath`\n *\n * Type assertion is fine because we wrap sub schemas in an array\n * so we can safely map over them within `fieldSchemasToFormState`\n */\n const fields = Array.isArray(fieldOrEntityConfig)\n ? fieldOrEntityConfig\n : 'fields' in fieldOrEntityConfig\n ? fieldOrEntityConfig.fields\n : [fieldOrEntityConfig]\n\n // Ensure data.id is present during form state requests, where the data\n // is passed from the client as an argument, without the ID\n if (!data.id && id) {\n data.id = id\n }\n\n const formStateResult = await fieldSchemasToFormState({\n id,\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug,\n data,\n documentData,\n fields,\n fieldSchemaMap: schemaMap,\n initialBlockData: blockData,\n mockRSCs,\n operation,\n permissions: docPermissions?.fields || {},\n preferences: docPreferences || { fields: {} },\n previousFormState: formState,\n readOnly,\n renderAllFields,\n renderFieldFn: renderField,\n req,\n schemaPath,\n select,\n selectMode,\n skipValidation,\n })\n\n // Maintain form state of auth / upload fields\n if (collectionSlug && formState) {\n if (payload.collections[collectionSlug]?.config?.upload && formState.file) {\n formStateResult.file = formState.file\n }\n }\n\n let lockedStateResult\n\n if (returnLockStatus) {\n lockedStateResult = await handleFormStateLocking({\n id,\n collectionSlug,\n globalSlug,\n req,\n updateLastEdited,\n })\n }\n\n const res: BuildFormStateSuccessResult = {\n lockedState: lockedStateResult,\n state: formStateResult,\n }\n\n if (returnLivePreviewURL) {\n const { livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (livePreviewURL) {\n res.livePreviewURL = livePreviewURL\n }\n }\n\n if (returnPreviewURL) {\n const { previewURL } = await handlePreview({\n collectionSlug,\n config,\n data,\n globalSlug,\n req,\n })\n\n // Important: only set this when not undefined,\n // Otherwise it will travel through the network as `$undefined`\n if (previewURL) {\n res.previewURL = previewURL\n }\n }\n\n return res\n}\n"],"mappings":"AASA,SAASA,cAAc,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ;AAChE,SAASC,aAAa,EAAEC,oBAAoB,QAAQ;AAEpD,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAC5B,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,QAAQ;AAC7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAgC9B,OAAO,MAAMC,qBAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC;EAAG,CAAE,GAAGD,IAAA;EAEhB,IAAI;IACF,MAAMd,cAAA,CAAe;MAAEe;IAAI;IAC3B,MAAMC,GAAA,GAAM,MAAMC,cAAA,CAAeH,IAAA;IAEjC,OAAOE,GAAA;EACT,EAAE,OAAOE,GAAA,EAAK;IACZH,GAAA,CAAII,OAAO,CAACC,MAAM,CAACC,KAAK,CAAC;MAAEH,GAAA;MAAKI,GAAA,EAAK;IAAyC;IAE9E,IAAIJ,GAAA,CAAIK,OAAO,KAAK,8CAA8C;MAChE,OAAO;QACLA,OAAA,EAASL,GAAA,CAAIK;MACf;IACF;IAEA,IAAIL,GAAA,CAAIK,OAAO,KAAK,gBAAgB;MAClC,MAAM,IAAIrB,iBAAA;IACZ;IAEA,OAAOD,YAAA,CAAaiB,GAAA;EACtB;AACF;AAEA,OAAO,MAAMD,cAAA,GAAiB,MAC5BH,IAAA;EAEA,MAAM;IACJU,EAAA,EAAIC,UAAU;IACdC,cAAc;IACdC,IAAA,EAAMC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AAA,EAAmBxC,SAAA;IACnBM,QAAA;IACAC,eAAA;IACAkC,aAAA,EAAenE,WAAA;IACfS,GAAA;IACA+B,UAAA;IACAC,MAAA;IACAI,UAAA;IACAF;EACF;EAEA;EACA,IAAIvB,cAAA,IAAkBM,SAAA,EAAW;IAC/B,IAAIb,OAAA,CAAQuD,WAAW,CAAChD,cAAA,CAAe,EAAEe,MAAA,EAAQkC,MAAA,IAAU3C,SAAA,CAAU4C,IAAI,EAAE;MACzET,eAAA,CAAgBS,IAAI,GAAG5C,SAAA,CAAU4C,IAAI;IACvC;EACF;EAEA,IAAIC,iBAAA;EAEJ,IAAIlC,gBAAA,EAAkB;IACpBkC,iBAAA,GAAoB,MAAMnE,sBAAA,CAAuB;MAC/Cc,EAAA;MACAE,cAAA;MACAO,UAAA;MACAlB,GAAA;MACAmC;IACF;EACF;EAEA,MAAMlC,GAAA,GAAmC;IACvC8D,WAAA,EAAaD,iBAAA;IACbE,KAAA,EAAOZ;EACT;EAEA,IAAIzB,oBAAA,EAAsB;IACxB,MAAM;MAAEsC;IAAc,CAAE,GAAG,MAAMrE,iBAAA,CAAkB;MACjDe,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIiE,cAAA,EAAgB;MAClBhE,GAAA,CAAIgE,cAAc,GAAGA,cAAA;IACvB;EACF;EAEA,IAAIpC,gBAAA,EAAkB;IACpB,MAAM;MAAEqC;IAAU,CAAE,GAAG,MAAMrE,aAAA,CAAc;MACzCc,cAAA;MACAe,MAAA;MACAd,IAAA;MACAM,UAAA;MACAlB;IACF;IAEA;IACA;IACA,IAAIkE,UAAA,EAAY;MACdjE,GAAA,CAAIiE,UAAU,GAAGA,UAAA;IACnB;EACF;EAEA,OAAOjE,GAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/getClientSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAY1F,eAAO,MAAM,kBAAkB,SACtB;IACL,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"getClientSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/getClientSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAY1F,eAAO,MAAM,kBAAkB,SACtB;IACL,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,YAAY,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KAAG,oBAkCL,CAAA"}
|
|
@@ -11,12 +11,14 @@ export const getClientSchemaMap = cache(args => {
|
|
|
11
11
|
globalSlug,
|
|
12
12
|
i18n,
|
|
13
13
|
payload,
|
|
14
|
-
schemaMap
|
|
14
|
+
schemaMap,
|
|
15
|
+
widgetSlug
|
|
15
16
|
} = args;
|
|
16
17
|
if (!cachedClientSchemaMap || global._payload_doNotCacheClientSchemaMap) {
|
|
17
18
|
cachedClientSchemaMap = new Map();
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
const cacheKey = collectionSlug || globalSlug || `widget:${widgetSlug}`;
|
|
21
|
+
let cachedEntityClientFieldMap = cachedClientSchemaMap.get(cacheKey);
|
|
20
22
|
if (cachedEntityClientFieldMap) {
|
|
21
23
|
return cachedEntityClientFieldMap;
|
|
22
24
|
}
|
|
@@ -29,9 +31,10 @@ export const getClientSchemaMap = cache(args => {
|
|
|
29
31
|
globalSlug,
|
|
30
32
|
i18n: i18n,
|
|
31
33
|
payload,
|
|
32
|
-
schemaMap
|
|
34
|
+
schemaMap,
|
|
35
|
+
widgetSlug
|
|
33
36
|
});
|
|
34
|
-
cachedClientSchemaMap.set(
|
|
37
|
+
cachedClientSchemaMap.set(cacheKey, entityClientFieldMap);
|
|
35
38
|
global._payload_clientSchemaMap = cachedClientSchemaMap;
|
|
36
39
|
global._payload_doNotCacheClientSchemaMap = false;
|
|
37
40
|
return entityClientFieldMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientSchemaMap.js","names":["cache","buildClientFieldSchemaMap","cachedClientSchemaMap","global","_payload_clientSchemaMap","getClientSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","_payload_doNotCacheClientSchemaMap","Map","cachedEntityClientFieldMap","get","clientFieldSchemaMap","entityClientFieldMap","set"],"sources":["../../src/utilities/getClientSchemaMap.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { ClientConfig, ClientFieldSchemaMap, FieldSchemaMap, Payload } from 'payload'\n\nimport { cache } from 'react'\n\nimport { buildClientFieldSchemaMap } from './buildClientFieldSchemaMap/index.js'\n\nlet cachedClientSchemaMap = global._payload_clientSchemaMap\n\nif (!cachedClientSchemaMap) {\n cachedClientSchemaMap = global._payload_clientSchemaMap = null\n}\n\nexport const getClientSchemaMap = cache(\n (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18nClient\n payload: Payload\n schemaMap: FieldSchemaMap\n }): ClientFieldSchemaMap => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap } = args\n\n if (!cachedClientSchemaMap || global._payload_doNotCacheClientSchemaMap) {\n cachedClientSchemaMap = new Map()\n }\n\n let cachedEntityClientFieldMap = cachedClientSchemaMap.get(
|
|
1
|
+
{"version":3,"file":"getClientSchemaMap.js","names":["cache","buildClientFieldSchemaMap","cachedClientSchemaMap","global","_payload_clientSchemaMap","getClientSchemaMap","args","collectionSlug","config","globalSlug","i18n","payload","schemaMap","widgetSlug","_payload_doNotCacheClientSchemaMap","Map","cacheKey","cachedEntityClientFieldMap","get","clientFieldSchemaMap","entityClientFieldMap","set"],"sources":["../../src/utilities/getClientSchemaMap.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { ClientConfig, ClientFieldSchemaMap, FieldSchemaMap, Payload } from 'payload'\n\nimport { cache } from 'react'\n\nimport { buildClientFieldSchemaMap } from './buildClientFieldSchemaMap/index.js'\n\nlet cachedClientSchemaMap = global._payload_clientSchemaMap\n\nif (!cachedClientSchemaMap) {\n cachedClientSchemaMap = global._payload_clientSchemaMap = null\n}\n\nexport const getClientSchemaMap = cache(\n (args: {\n collectionSlug?: string\n config: ClientConfig\n globalSlug?: string\n i18n: I18nClient\n payload: Payload\n schemaMap: FieldSchemaMap\n widgetSlug?: string\n }): ClientFieldSchemaMap => {\n const { collectionSlug, config, globalSlug, i18n, payload, schemaMap, widgetSlug } = args\n\n if (!cachedClientSchemaMap || global._payload_doNotCacheClientSchemaMap) {\n cachedClientSchemaMap = new Map()\n }\n\n const cacheKey = collectionSlug || globalSlug || `widget:${widgetSlug}`\n let cachedEntityClientFieldMap = cachedClientSchemaMap.get(cacheKey)\n\n if (cachedEntityClientFieldMap) {\n return cachedEntityClientFieldMap\n }\n\n cachedEntityClientFieldMap = new Map()\n\n const { clientFieldSchemaMap: entityClientFieldMap } = buildClientFieldSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n: i18n as I18n,\n payload,\n schemaMap,\n widgetSlug,\n })\n\n cachedClientSchemaMap.set(cacheKey, entityClientFieldMap)\n\n global._payload_clientSchemaMap = cachedClientSchemaMap\n\n global._payload_doNotCacheClientSchemaMap = false\n\n return entityClientFieldMap\n },\n)\n"],"mappings":"AAGA,SAASA,KAAK,QAAQ;AAEtB,SAASC,yBAAyB,QAAQ;AAE1C,IAAIC,qBAAA,GAAwBC,MAAA,CAAOC,wBAAwB;AAE3D,IAAI,CAACF,qBAAA,EAAuB;EAC1BA,qBAAA,GAAwBC,MAAA,CAAOC,wBAAwB,GAAG;AAC5D;AAEA,OAAO,MAAMC,kBAAA,GAAqBL,KAAA,CAC/BM,IAAA;EASC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAU,CAAE,GAAGP,IAAA;EAErF,IAAI,CAACJ,qBAAA,IAAyBC,MAAA,CAAOW,kCAAkC,EAAE;IACvEZ,qBAAA,GAAwB,IAAIa,GAAA;EAC9B;EAEA,MAAMC,QAAA,GAAWT,cAAA,IAAkBE,UAAA,IAAc,UAAUI,UAAA,EAAY;EACvE,IAAII,0BAAA,GAA6Bf,qBAAA,CAAsBgB,GAAG,CAACF,QAAA;EAE3D,IAAIC,0BAAA,EAA4B;IAC9B,OAAOA,0BAAA;EACT;EAEAA,0BAAA,GAA6B,IAAIF,GAAA;EAEjC,MAAM;IAAEI,oBAAA,EAAsBC;EAAoB,CAAE,GAAGnB,yBAAA,CAA0B;IAC/EM,cAAA;IACAC,MAAA;IACAC,UAAA;IACAC,IAAA,EAAMA,IAAA;IACNC,OAAA;IACAC,SAAA;IACAC;EACF;EAEAX,qBAAA,CAAsBmB,GAAG,CAACL,QAAA,EAAUI,oBAAA;EAEpCjB,MAAA,CAAOC,wBAAwB,GAAGF,qBAAA;EAElCC,MAAA,CAAOW,kCAAkC,GAAG;EAE5C,OAAOM,oBAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/getSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAY9D,eAAO,MAAM,YAAY,SAChB;IACL,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"getSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/getSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAY9D,eAAO,MAAM,YAAY,SAChB;IACL,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,KAAG,cAgCL,CAAA"}
|
|
@@ -9,12 +9,14 @@ export const getSchemaMap = cache(args => {
|
|
|
9
9
|
collectionSlug,
|
|
10
10
|
config,
|
|
11
11
|
globalSlug,
|
|
12
|
-
i18n
|
|
12
|
+
i18n,
|
|
13
|
+
widgetSlug
|
|
13
14
|
} = args;
|
|
14
15
|
if (!cachedSchemaMap || global._payload_doNotCacheSchemaMap) {
|
|
15
16
|
cachedSchemaMap = new Map();
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
const cacheKey = collectionSlug || globalSlug || `widget:${widgetSlug}`;
|
|
19
|
+
let cachedEntityFieldMap = cachedSchemaMap.get(cacheKey);
|
|
18
20
|
if (cachedEntityFieldMap) {
|
|
19
21
|
return cachedEntityFieldMap;
|
|
20
22
|
}
|
|
@@ -25,9 +27,10 @@ export const getSchemaMap = cache(args => {
|
|
|
25
27
|
collectionSlug,
|
|
26
28
|
config,
|
|
27
29
|
globalSlug,
|
|
28
|
-
i18n: i18n
|
|
30
|
+
i18n: i18n,
|
|
31
|
+
widgetSlug
|
|
29
32
|
});
|
|
30
|
-
cachedSchemaMap.set(
|
|
33
|
+
cachedSchemaMap.set(cacheKey, entityFieldMap);
|
|
31
34
|
global._payload_schemaMap = cachedSchemaMap;
|
|
32
35
|
global._payload_doNotCacheSchemaMap = false;
|
|
33
36
|
return entityFieldMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaMap.js","names":["cache","buildFieldSchemaMap","cachedSchemaMap","global","_payload_schemaMap","getSchemaMap","args","collectionSlug","config","globalSlug","i18n","_payload_doNotCacheSchemaMap","Map","cachedEntityFieldMap","get","fieldSchemaMap","entityFieldMap","set"],"sources":["../../src/utilities/getSchemaMap.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { FieldSchemaMap, SanitizedConfig } from 'payload'\n\nimport { cache } from 'react'\n\nimport { buildFieldSchemaMap } from './buildFieldSchemaMap/index.js'\n\nlet cachedSchemaMap = global._payload_schemaMap\n\nif (!cachedSchemaMap) {\n cachedSchemaMap = global._payload_schemaMap = null\n}\n\nexport const getSchemaMap = cache(\n (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18nClient\n }): FieldSchemaMap => {\n const { collectionSlug, config, globalSlug, i18n } = args\n\n if (!cachedSchemaMap || global._payload_doNotCacheSchemaMap) {\n cachedSchemaMap = new Map()\n }\n\n let cachedEntityFieldMap = cachedSchemaMap.get(
|
|
1
|
+
{"version":3,"file":"getSchemaMap.js","names":["cache","buildFieldSchemaMap","cachedSchemaMap","global","_payload_schemaMap","getSchemaMap","args","collectionSlug","config","globalSlug","i18n","widgetSlug","_payload_doNotCacheSchemaMap","Map","cacheKey","cachedEntityFieldMap","get","fieldSchemaMap","entityFieldMap","set"],"sources":["../../src/utilities/getSchemaMap.ts"],"sourcesContent":["import type { I18n, I18nClient } from '@payloadcms/translations'\nimport type { FieldSchemaMap, SanitizedConfig } from 'payload'\n\nimport { cache } from 'react'\n\nimport { buildFieldSchemaMap } from './buildFieldSchemaMap/index.js'\n\nlet cachedSchemaMap = global._payload_schemaMap\n\nif (!cachedSchemaMap) {\n cachedSchemaMap = global._payload_schemaMap = null\n}\n\nexport const getSchemaMap = cache(\n (args: {\n collectionSlug?: string\n config: SanitizedConfig\n globalSlug?: string\n i18n: I18nClient\n widgetSlug?: string\n }): FieldSchemaMap => {\n const { collectionSlug, config, globalSlug, i18n, widgetSlug } = args\n\n if (!cachedSchemaMap || global._payload_doNotCacheSchemaMap) {\n cachedSchemaMap = new Map()\n }\n\n const cacheKey = collectionSlug || globalSlug || `widget:${widgetSlug}`\n let cachedEntityFieldMap = cachedSchemaMap.get(cacheKey)\n\n if (cachedEntityFieldMap) {\n return cachedEntityFieldMap\n }\n\n cachedEntityFieldMap = new Map()\n\n const { fieldSchemaMap: entityFieldMap } = buildFieldSchemaMap({\n collectionSlug,\n config,\n globalSlug,\n i18n: i18n as I18n,\n widgetSlug,\n })\n\n cachedSchemaMap.set(cacheKey, entityFieldMap)\n\n global._payload_schemaMap = cachedSchemaMap\n\n global._payload_doNotCacheSchemaMap = false\n\n return entityFieldMap\n },\n)\n"],"mappings":"AAGA,SAASA,KAAK,QAAQ;AAEtB,SAASC,mBAAmB,QAAQ;AAEpC,IAAIC,eAAA,GAAkBC,MAAA,CAAOC,kBAAkB;AAE/C,IAAI,CAACF,eAAA,EAAiB;EACpBA,eAAA,GAAkBC,MAAA,CAAOC,kBAAkB,GAAG;AAChD;AAEA,OAAO,MAAMC,YAAA,GAAeL,KAAA,CACzBM,IAAA;EAOC,MAAM;IAAEC,cAAc;IAAEC,MAAM;IAAEC,UAAU;IAAEC,IAAI;IAAEC;EAAU,CAAE,GAAGL,IAAA;EAEjE,IAAI,CAACJ,eAAA,IAAmBC,MAAA,CAAOS,4BAA4B,EAAE;IAC3DV,eAAA,GAAkB,IAAIW,GAAA;EACxB;EAEA,MAAMC,QAAA,GAAWP,cAAA,IAAkBE,UAAA,IAAc,UAAUE,UAAA,EAAY;EACvE,IAAII,oBAAA,GAAuBb,eAAA,CAAgBc,GAAG,CAACF,QAAA;EAE/C,IAAIC,oBAAA,EAAsB;IACxB,OAAOA,oBAAA;EACT;EAEAA,oBAAA,GAAuB,IAAIF,GAAA;EAE3B,MAAM;IAAEI,cAAA,EAAgBC;EAAc,CAAE,GAAGjB,mBAAA,CAAoB;IAC7DM,cAAA;IACAC,MAAA;IACAC,UAAA;IACAC,IAAA,EAAMA,IAAA;IACNC;EACF;EAEAT,eAAA,CAAgBiB,GAAG,CAACL,QAAA,EAAUI,cAAA;EAE9Bf,MAAA,CAAOC,kBAAkB,GAAGF,eAAA;EAE5BC,MAAA,CAAOS,4BAA4B,GAAG;EAEtC,OAAOM,cAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleLivePreview.d.ts","sourceRoot":"","sources":["../../src/utilities/handleLivePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,sEAK9B;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,oBAAoB,EAAE,OAAO,CAAA;CAC9B;;;;;;;;
|
|
1
|
+
{"version":3,"file":"handleLivePreview.d.ts","sourceRoot":"","sources":["../../src/utilities/handleLivePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,oBAAoB,sEAK9B;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,oBAAoB,EAAE,OAAO,CAAA;CAC9B;;;;;;;;wBAsH8iE,CAAC;;oBAAoF,CAAC;;;;;;;CAlHnoE,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,gDAI9B;IACD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,KAAG,OAcH,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,kEAO3B;IACD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC;IACV,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,cAAc,CAAC,EAAE,kBAAkB,CAAA;CACpC,CAqDA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.78.0-
|
|
3
|
+
"version": "3.78.0-internal.5219978",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"ts-essentials": "10.0.3",
|
|
137
137
|
"use-context-selector": "2.0.0",
|
|
138
138
|
"uuid": "10.0.0",
|
|
139
|
-
"@payloadcms/translations": "3.78.0-
|
|
139
|
+
"@payloadcms/translations": "3.78.0-internal.5219978"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
142
|
"@babel/cli": "7.27.2",
|
|
@@ -151,14 +151,14 @@
|
|
|
151
151
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
|
152
152
|
"esbuild": "0.27.1",
|
|
153
153
|
"esbuild-sass-plugin": "3.3.1",
|
|
154
|
-
"
|
|
155
|
-
"
|
|
154
|
+
"payload": "3.78.0-internal.5219978",
|
|
155
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
158
|
"next": ">=15.2.9 <15.3.0 || >=15.3.9 <15.4.0 || >=15.4.11 <15.5.0 || >=16.2.0-canary.10 <17.0.0",
|
|
159
159
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
160
160
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
161
|
-
"payload": "3.78.0-
|
|
161
|
+
"payload": "3.78.0-internal.5219978"
|
|
162
162
|
},
|
|
163
163
|
"engines": {
|
|
164
164
|
"node": "^18.20.2 || >=20.9.0"
|