@payloadcms/ui 3.47.0-canary.0 → 3.47.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/ArrayAction/index.d.ts +2 -0
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +37 -13
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/ClipboardAction/ClipboardActionLabel.d.ts +5 -0
- package/dist/elements/ClipboardAction/ClipboardActionLabel.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/ClipboardActionLabel.js +44 -0
- package/dist/elements/ClipboardAction/ClipboardActionLabel.js.map +1 -0
- package/dist/elements/ClipboardAction/clipboardUtilities.d.ts +10 -0
- package/dist/elements/ClipboardAction/clipboardUtilities.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/clipboardUtilities.js +53 -0
- package/dist/elements/ClipboardAction/clipboardUtilities.js.map +1 -0
- package/dist/elements/ClipboardAction/index.d.ts +20 -0
- package/dist/elements/ClipboardAction/index.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/index.js +188 -0
- package/dist/elements/ClipboardAction/index.js.map +1 -0
- package/dist/elements/ClipboardAction/isClipboardDataValid.d.ts +10 -0
- package/dist/elements/ClipboardAction/isClipboardDataValid.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/isClipboardDataValid.js +86 -0
- package/dist/elements/ClipboardAction/isClipboardDataValid.js.map +1 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts +14 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +100 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -0
- package/dist/elements/ClipboardAction/types.d.ts +45 -0
- package/dist/elements/ClipboardAction/types.d.ts.map +1 -0
- package/dist/elements/ClipboardAction/types.js +2 -0
- package/dist/elements/ClipboardAction/types.js.map +1 -0
- package/dist/elements/DatePicker/index.scss +1 -0
- package/dist/elements/ReactSelect/ClearIndicator/index.scss +1 -0
- package/dist/elements/ReactSelect/DropdownIndicator/index.scss +1 -0
- package/dist/exports/client/index.js +22 -22
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/shared/index.js +2 -2
- package/dist/exports/shared/index.js.map +4 -4
- package/dist/fields/Array/ArrayRow.d.ts +2 -0
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js +49 -43
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +175 -44
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +2 -0
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +41 -35
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts +2 -0
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +32 -26
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +294 -348
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/providers/LivePreview/index.d.ts +1 -1
- package/dist/providers/LivePreview/index.d.ts.map +1 -1
- package/dist/providers/LivePreview/index.js +1 -2
- package/dist/providers/LivePreview/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/formatDocTitle/formatRelationshipTitle.d.ts +2 -0
- package/dist/utilities/formatDocTitle/formatRelationshipTitle.d.ts.map +1 -0
- package/dist/utilities/formatDocTitle/formatRelationshipTitle.js +15 -0
- package/dist/utilities/formatDocTitle/formatRelationshipTitle.js.map +1 -0
- package/dist/utilities/formatDocTitle/index.d.ts.map +1 -1
- package/dist/utilities/formatDocTitle/index.js +6 -0
- package/dist/utilities/formatDocTitle/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatRelationshipTitle.d.ts","sourceRoot":"","sources":["../../../src/utilities/formatDocTitle/formatRelationshipTitle.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,iBAAW,MAkB9C,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const formatRelationshipTitle = data => {
|
|
2
|
+
if (Array.isArray(data)) {
|
|
3
|
+
return data.map(item => {
|
|
4
|
+
if (typeof item === 'object' && item !== null) {
|
|
5
|
+
return item.id;
|
|
6
|
+
}
|
|
7
|
+
return String(item);
|
|
8
|
+
}).filter(Boolean).join(', ');
|
|
9
|
+
}
|
|
10
|
+
if (typeof data === 'object' && data !== null) {
|
|
11
|
+
return data.id || '';
|
|
12
|
+
}
|
|
13
|
+
return String(data);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=formatRelationshipTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatRelationshipTitle.js","names":["formatRelationshipTitle","data","Array","isArray","map","item","id","String","filter","Boolean","join"],"sources":["../../../src/utilities/formatDocTitle/formatRelationshipTitle.ts"],"sourcesContent":["export const formatRelationshipTitle = (data): string => {\n if (Array.isArray(data)) {\n return data\n .map((item) => {\n if (typeof item === 'object' && item !== null) {\n return item.id\n }\n return String(item)\n })\n .filter(Boolean)\n .join(', ')\n }\n\n if (typeof data === 'object' && data !== null) {\n return data.id || ''\n }\n\n return String(data)\n}\n"],"mappings":"AAAA,OAAO,MAAMA,uBAAA,GAA2BC,IAAA;EACtC,IAAIC,KAAA,CAAMC,OAAO,CAACF,IAAA,GAAO;IACvB,OAAOA,IAAA,CACJG,GAAG,CAAEC,IAAA;MACJ,IAAI,OAAOA,IAAA,KAAS,YAAYA,IAAA,KAAS,MAAM;QAC7C,OAAOA,IAAA,CAAKC,EAAE;MAChB;MACA,OAAOC,MAAA,CAAOF,IAAA;IAChB,GACCG,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;EACV;EAEA,IAAI,OAAOT,IAAA,KAAS,YAAYA,IAAA,KAAS,MAAM;IAC7C,OAAOA,IAAA,CAAKK,EAAE,IAAI;EACpB;EAEA,OAAOC,MAAA,CAAON,IAAA;AAChB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/formatDocTitle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/formatDocTitle/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAA;AAQhB,eAAO,MAAM,cAAc,gGAOxB;IACD,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;IACzC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CACrB,KAAG,MAmDH,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getTranslation } from '@payloadcms/translations';
|
|
2
2
|
import { formatDate } from './formatDateTitle.js';
|
|
3
3
|
import { formatLexicalDocTitle, isSerializedLexicalEditor } from './formatLexicalDocTitle.js';
|
|
4
|
+
import { formatRelationshipTitle } from './formatRelationshipTitle.js';
|
|
4
5
|
export const formatDocTitle = ({
|
|
5
6
|
collectionConfig,
|
|
6
7
|
data,
|
|
@@ -17,6 +18,7 @@ export const formatDocTitle = ({
|
|
|
17
18
|
if (title) {
|
|
18
19
|
const fieldConfig = collectionConfig.fields.find(f => 'name' in f && f.name === useAsTitle);
|
|
19
20
|
const isDate = fieldConfig?.type === 'date';
|
|
21
|
+
const isRelationship = fieldConfig?.type === 'relationship';
|
|
20
22
|
if (isDate) {
|
|
21
23
|
const dateFormat = 'date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat || dateFormatFromConfig;
|
|
22
24
|
title = formatDate({
|
|
@@ -25,6 +27,10 @@ export const formatDocTitle = ({
|
|
|
25
27
|
pattern: dateFormat
|
|
26
28
|
}) || title;
|
|
27
29
|
}
|
|
30
|
+
if (isRelationship) {
|
|
31
|
+
const formattedRelationshipTitle = formatRelationshipTitle(data[useAsTitle]);
|
|
32
|
+
title = formattedRelationshipTitle;
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getTranslation","formatDate","formatLexicalDocTitle","isSerializedLexicalEditor","formatDocTitle","collectionConfig","data","dateFormat","dateFormatFromConfig","fallback","globalConfig","i18n","title","useAsTitle","admin","fieldConfig","fields","find","f","name","isDate","type","date","displayFormat","pattern","label","slug","root","children","t"],"sources":["../../../src/utilities/formatDocTitle/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from './formatDateTitle.js'\nimport { formatLexicalDocTitle, isSerializedLexicalEditor } from './formatLexicalDocTitle.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: object | string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] as string\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n // richtext lexical case. We convert the first child of root to plain text\n if (title && isSerializedLexicalEditor(title)) {\n title = formatLexicalDocTitle(title.root.children?.[0]?.children || [], '')\n }\n\n if (!title && isSerializedLexicalEditor(fallback)) {\n title = formatLexicalDocTitle(fallback.root.children?.[0]?.children || [], '')\n }\n\n if (!title) {\n title = typeof fallback === 'string' ? fallback : `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n"],"mappings":"AAQA,SAASA,cAAc,QAAQ;AAE/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,qBAAqB,EAAEC,yBAAyB,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["getTranslation","formatDate","formatLexicalDocTitle","isSerializedLexicalEditor","formatRelationshipTitle","formatDocTitle","collectionConfig","data","dateFormat","dateFormatFromConfig","fallback","globalConfig","i18n","title","useAsTitle","admin","fieldConfig","fields","find","f","name","isDate","type","isRelationship","date","displayFormat","pattern","formattedRelationshipTitle","label","slug","root","children","t"],"sources":["../../../src/utilities/formatDocTitle/index.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n ClientCollectionConfig,\n ClientGlobalConfig,\n SanitizedConfig,\n TypeWithID,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { formatDate } from './formatDateTitle.js'\nimport { formatLexicalDocTitle, isSerializedLexicalEditor } from './formatLexicalDocTitle.js'\nimport { formatRelationshipTitle } from './formatRelationshipTitle.js'\n\nexport const formatDocTitle = ({\n collectionConfig,\n data,\n dateFormat: dateFormatFromConfig,\n fallback,\n globalConfig,\n i18n,\n}: {\n collectionConfig?: ClientCollectionConfig\n data: TypeWithID\n dateFormat: SanitizedConfig['admin']['dateFormat']\n fallback?: object | string\n globalConfig?: ClientGlobalConfig\n i18n: I18n<any, any>\n}): string => {\n let title: string\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle\n\n if (useAsTitle) {\n title = data?.[useAsTitle] as string\n\n if (title) {\n const fieldConfig = collectionConfig.fields.find(\n (f) => 'name' in f && f.name === useAsTitle,\n )\n\n const isDate = fieldConfig?.type === 'date'\n const isRelationship = fieldConfig?.type === 'relationship'\n\n if (isDate) {\n const dateFormat =\n ('date' in fieldConfig.admin && fieldConfig?.admin?.date?.displayFormat) ||\n dateFormatFromConfig\n\n title = formatDate({ date: title, i18n, pattern: dateFormat }) || title\n }\n\n if (isRelationship) {\n const formattedRelationshipTitle = formatRelationshipTitle(data[useAsTitle])\n title = formattedRelationshipTitle\n }\n }\n }\n }\n\n if (globalConfig) {\n title = getTranslation(globalConfig?.label, i18n) || globalConfig?.slug\n }\n\n // richtext lexical case. We convert the first child of root to plain text\n if (title && isSerializedLexicalEditor(title)) {\n title = formatLexicalDocTitle(title.root.children?.[0]?.children || [], '')\n }\n\n if (!title && isSerializedLexicalEditor(fallback)) {\n title = formatLexicalDocTitle(fallback.root.children?.[0]?.children || [], '')\n }\n\n if (!title) {\n title = typeof fallback === 'string' ? fallback : `[${i18n.t('general:untitled')}]`\n }\n\n return title\n}\n"],"mappings":"AAQA,SAASA,cAAc,Q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;EAEA;EACA,IAAIhB,KAAA,IAASV,yBAAA,CAA0BU,KAAA,GAAQ;IAC7CA,KAAA,GAAQX,qBAAA,CAAsBW,KAAA,CAAMiB,IAAI,CAACC,QAAQ,GAAG,EAAE,EAAEA,QAAA,IAAY,EAAE,EAAE;EAC1E;EAEA,IAAI,CAAClB,KAAA,IAASV,yBAAA,CAA0BO,QAAA,GAAW;IACjDG,KAAA,GAAQX,qBAAA,CAAsBQ,QAAA,CAASoB,IAAI,CAACC,QAAQ,GAAG,EAAE,EAAEA,QAAA,IAAY,EAAE,EAAE;EAC7E;EAEA,IAAI,CAAClB,KAAA,EAAO;IACVA,KAAA,GAAQ,OAAOH,QAAA,KAAa,WAAWA,QAAA,GAAW,IAAIE,IAAA,CAAKoB,CAAC,CAAC,sBAAsB;EACrF;EAEA,OAAOnB,KAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.47.0-canary.
|
|
3
|
+
"version": "3.47.0-canary.2",
|
|
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.47.0-canary.
|
|
139
|
+
"@payloadcms/translations": "3.47.0-canary.2"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
142
|
"@babel/cli": "7.27.2",
|
|
@@ -152,13 +152,13 @@
|
|
|
152
152
|
"esbuild": "0.25.5",
|
|
153
153
|
"esbuild-sass-plugin": "3.3.1",
|
|
154
154
|
"@payloadcms/eslint-config": "3.28.0",
|
|
155
|
-
"payload": "3.47.0-canary.
|
|
155
|
+
"payload": "3.47.0-canary.2"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
158
|
"next": "^15.2.3",
|
|
159
159
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
160
160
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
161
|
-
"payload": "3.47.0-canary.
|
|
161
|
+
"payload": "3.47.0-canary.2"
|
|
162
162
|
},
|
|
163
163
|
"engines": {
|
|
164
164
|
"node": "^18.20.2 || >=20.9.0"
|