@payloadcms/richtext-lexical 3.69.0-internal.2883df2 → 3.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cell/rscEntry.d.ts.map +1 -1
  2. package/dist/cell/rscEntry.js +3 -1
  3. package/dist/cell/rscEntry.js.map +1 -1
  4. package/dist/dependencyChecker.spec.js +1 -0
  5. package/dist/dependencyChecker.spec.js.map +1 -1
  6. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js +2 -0
  7. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js.map +7 -0
  8. package/dist/exports/client/bundled.css +1 -1
  9. package/dist/exports/client/component-YQ22OGQW.js +2 -0
  10. package/dist/exports/client/component-YQ22OGQW.js.map +7 -0
  11. package/dist/exports/client/index.js +7 -7
  12. package/dist/exports/client/index.js.map +3 -3
  13. package/dist/features/blocks/server/index.d.ts.map +1 -1
  14. package/dist/features/blocks/server/index.js +11 -2
  15. package/dist/features/blocks/server/index.js.map +1 -1
  16. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +1 -0
  17. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  18. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  19. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -1
  20. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  21. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  22. package/dist/features/relationship/client/components/RelationshipComponent.js +6 -1
  23. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  24. package/dist/features/upload/client/component/index.js +6 -2
  25. package/dist/features/upload/client/component/index.js.map +1 -1
  26. package/dist/field/bundled.css +1 -1
  27. package/dist/lexical/utils/url.spec.js +1 -0
  28. package/dist/lexical/utils/url.spec.js.map +1 -1
  29. package/dist/utilities/applyBaseFilterToFields.d.ts +10 -0
  30. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -0
  31. package/dist/utilities/applyBaseFilterToFields.js +97 -0
  32. package/dist/utilities/applyBaseFilterToFields.js.map +1 -0
  33. package/dist/utilities/jsx/jsx.spec.js +1 -0
  34. package/dist/utilities/jsx/jsx.spec.js.map +1 -1
  35. package/package.json +6 -6
  36. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +0 -2
  37. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +0 -7
  38. package/dist/exports/client/component-5IW2M4GH.js +0 -2
  39. package/dist/exports/client/component-5IW2M4GH.js.map +0 -7
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js';
2
3
  describe('Lexical URL Regex Matchers', () => {
3
4
  describe('relativeOrAnchorRegExp', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"url.spec.js","names":["absoluteRegExp","relativeOrAnchorRegExp","validateUrl","describe","it","shouldMatch","forEach","testCase","expect","test","toBe","shouldNotMatch","not","validUrls","url","invalidUrls"],"sources":["../../../src/lexical/utils/url.spec.ts"],"sourcesContent":["import { jest } from '@jest/globals'\nimport { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js'\n\ndescribe('Lexical URL Regex Matchers', () => {\n describe('relativeOrAnchorRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '#anchor',\n '#section-title',\n '/path#fragment',\n '/page?id=123',\n '/page?id=123#section',\n '/search?q=test',\n '/?global=true',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n 'match',\n 'http://example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n '#',\n '/#',\n '/path/with spaces',\n '',\n 'ftp://example.com',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('absoluteRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n 'http://example.com',\n 'https://example.com',\n 'ftp://files.example.com',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'mailto:email@example.com',\n 'tel:+1234567890',\n 'http://user:pass@example.com',\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n '/relative/path',\n '#anchor',\n 'example.com',\n '://missing.scheme',\n 'http://',\n 'http:/example.com',\n 'ftp://example .com',\n 'http://example',\n 'not-a-url',\n 'http//example.com',\n 'https://example.com/ spaces',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('validateUrl', () => {\n describe('absolute URLs', () => {\n it('should validate http and https URLs', () => {\n const validUrls = [\n 'http://example.com',\n 'https://example.com',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate other protocol URLs', () => {\n const validUrls = ['ftp://files.example.com', 'mailto:email@example.com', 'tel:+1234567890']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate www URLs without protocol', () => {\n const validUrls = [\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('relative URLs', () => {\n it('should validate relative paths', () => {\n const validUrls = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '/path#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('anchor links', () => {\n it('should validate anchor links', () => {\n const validUrls = ['#anchor', '#section-title']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('with query params', () => {\n it('should validate relative URLs with query parameters', () => {\n const validUrls = [\n '/page?id=123',\n '/search?q=test',\n '/products?category=electronics&sort=price',\n '/path?key=value&another=param',\n '/page?id=123&filter=active',\n '/?global=true',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate absolute URLs with query parameters', () => {\n const validUrls = [\n 'https://example.com?id=123',\n 'http://example.com/page?key=value',\n 'www.example.com?search=query',\n 'https://example.com/path?a=1&b=2&c=3',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate URLs with query parameters and anchors', () => {\n const validUrls = [\n '/page?id=123#section',\n 'https://example.com?key=value#anchor',\n '/search?q=test#results',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('edge cases', () => {\n it('should handle the default https:// case', () => {\n expect(validateUrl('https://')).toBe(true)\n })\n\n it('should return false for empty or invalid URLs', () => {\n const invalidUrls = [\n '',\n 'not-a-url',\n 'example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n 'http://',\n 'http:/example.com',\n 'http//example.com',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for URLs with spaces', () => {\n const invalidUrls = [\n '/path/with spaces',\n 'http://example.com/ spaces',\n 'https://example.com/path with spaces',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for malformed URLs', () => {\n const invalidUrls = ['://missing.scheme', 'ftp://example .com', 'http://example', '#', '/#']\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n })\n })\n})\n"],"mappings":"AACA,SAASA,cAAc,EAAEC,sBAAsB,EAAEC,WAAW,QAAQ;AAEpEC,QAAA,CAAS,8BAA8B;EACrCA,QAAA,CAAS,0BAA0B;IACjCC,EAAA,CAAG,wCAAwC;MACzC,MAAMC,WAAA,GAAc,CAClB,qBACA,mBACA,KACA,SACA,oBACA,WACA,kBACA,kBACA,gBACA,wBACA,kBACA,gBACD;MAEDA,WAAA,CAAYC,OAAO,CAAEC,QAAA;QACnBC,MAAA,CAAOP,sBAAA,CAAuBQ,IAAI,CAACF,QAAA,GAAWG,IAAI,CAAC;MACrD;IACF;IAEAN,EAAA,CAAG,4CAA4C;MAC7C,MAAMO,cAAA,GAAiB,CACrB,SACA,sBACA,iBACA,aACA,iBACA,KACA,MACA,qBACA,IACA,oBACD;MAEDA,cAAA,CAAeL,OAAO,CAAEC,QAAA;QACtBC,MAAA,CAAOP,sBAAA,CAAuBQ,IAAI,CAACF,QAAA,GAAWK,GAAG,CAACF,IAAI,CAAC;MACzD;IACF;EACF;EAEAP,QAAA,CAAS,kBAAkB;IACzBC,EAAA,CAAG,wCAAwC;MACzC,MAAMC,WAAA,GAAc,CAClB,sBACA,uBACA,2BACA,+BACA,0CACA,sCACA,0BACA,qCACA,4BACA,mBACA,gCACA,mBACA,4BACA,oCACA,2BACD;MAEDA,WAAA,CAAYC,OAAO,CAAEC,QAAA;QACnBC,MAAA,CAAOR,cAAA,CAAeS,IAAI,CAACF,QAAA,GAAWG,IAAI,CAAC;MAC7C;IACF;IAEAN,EAAA,CAAG,4CAA4C;MAC7C,MAAMO,cAAA,GAAiB,CACrB,kBACA,WACA,eACA,qBACA,WACA,qBACA,sBACA,kBACA,aACA,qBACA,8BACD;MAE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B,kBAAkB,KAAK,KAAK;QAE5FA,WAAA,CAAYT,OAAO,CAAEQ,GAAA;UACnBN,MAAA,CAAON,WAAA,CAAYY,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"url.spec.js","names":["describe","it","expect","absoluteRegExp","relativeOrAnchorRegExp","validateUrl","shouldMatch","forEach","testCase","test","toBe","shouldNotMatch","not","validUrls","url","invalidUrls"],"sources":["../../../src/lexical/utils/url.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js'\n\ndescribe('Lexical URL Regex Matchers', () => {\n describe('relativeOrAnchorRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '#anchor',\n '#section-title',\n '/path#fragment',\n '/page?id=123',\n '/page?id=123#section',\n '/search?q=test',\n '/?global=true',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n 'match',\n 'http://example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n '#',\n '/#',\n '/path/with spaces',\n '',\n 'ftp://example.com',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('absoluteRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n 'http://example.com',\n 'https://example.com',\n 'ftp://files.example.com',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'mailto:email@example.com',\n 'tel:+1234567890',\n 'http://user:pass@example.com',\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n '/relative/path',\n '#anchor',\n 'example.com',\n '://missing.scheme',\n 'http://',\n 'http:/example.com',\n 'ftp://example .com',\n 'http://example',\n 'not-a-url',\n 'http//example.com',\n 'https://example.com/ spaces',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('validateUrl', () => {\n describe('absolute URLs', () => {\n it('should validate http and https URLs', () => {\n const validUrls = [\n 'http://example.com',\n 'https://example.com',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate other protocol URLs', () => {\n const validUrls = ['ftp://files.example.com', 'mailto:email@example.com', 'tel:+1234567890']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate www URLs without protocol', () => {\n const validUrls = [\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('relative URLs', () => {\n it('should validate relative paths', () => {\n const validUrls = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '/path#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('anchor links', () => {\n it('should validate anchor links', () => {\n const validUrls = ['#anchor', '#section-title']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('with query params', () => {\n it('should validate relative URLs with query parameters', () => {\n const validUrls = [\n '/page?id=123',\n '/search?q=test',\n '/products?category=electronics&sort=price',\n '/path?key=value&another=param',\n '/page?id=123&filter=active',\n '/?global=true',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate absolute URLs with query parameters', () => {\n const validUrls = [\n 'https://example.com?id=123',\n 'http://example.com/page?key=value',\n 'www.example.com?search=query',\n 'https://example.com/path?a=1&b=2&c=3',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate URLs with query parameters and anchors', () => {\n const validUrls = [\n '/page?id=123#section',\n 'https://example.com?key=value#anchor',\n '/search?q=test#results',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('edge cases', () => {\n it('should handle the default https:// case', () => {\n expect(validateUrl('https://')).toBe(true)\n })\n\n it('should return false for empty or invalid URLs', () => {\n const invalidUrls = [\n '',\n 'not-a-url',\n 'example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n 'http://',\n 'http:/example.com',\n 'http//example.com',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for URLs with spaces', () => {\n const invalidUrls = [\n '/path/with spaces',\n 'http://example.com/ spaces',\n 'https://example.com/path with spaces',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for malformed URLs', () => {\n const invalidUrls = ['://missing.scheme', 'ftp://example .com', 'http://example', '#', '/#']\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,cAAc,EAAEC,sBAAsB,EAAEC,WAAW,QAAQ;AAEpEL,QAAA,CAAS,8BAA8B;EACrCA,QAAA,CAAS,0BAA0B;IACjCC,EAAA,CAAG,wCAAwC;MACzC,MAAMK,WAAA,GAAc,CAClB,qBACA,mBACA,KACA,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EO,GAAA;UACjBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;MAEAT,EAAA,CAAG,0DAA0D;QAC3D,MAAMY,SAAA,GAAY,CAChB,wBACA,wCACA,yBACD;QAEDA,SAAA,CAAUN,OAAO,CAAEO,GAAA;UACjBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;IACF;IAEAV,QAAA,CAAS,cAAc;MACrBC,EAAA,CAAG,2CAA2C;QAC5CC,MAAA,CAAOG,WAAA,CAAY,aAAaK,IAAI,CAAC;MACvC;MAEAT,EAAA,CAAG,iDAAiD;QAClD,MAAMc,WAAA,GAAc,CAClB,IACA,aACA,eACA,iBACA,aACA,iBACA,WACA,qBACA,oBACD;QAEDA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;MAEAT,EAAA,CAAG,4CAA4C;QAC7C,MAAMc,WAAA,GAAc,CAClB,qBACA,8BACA,uCACD;QAEDA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;MAEAT,EAAA,CAAG,0CAA0C;QAC3C,MAAMc,WAAA,GAAc,CAAC,qBAAqB,sBAAsB,kBAAkB,KAAK,KAAK;QAE5FA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import type { Field, SanitizedConfig } from 'payload';
2
+ /**
3
+ * Recursively applies baseFilter from collection config to relationship fields
4
+ * within blocks. This ensures that relationship drawers in blocks respect
5
+ * collection-level filters like multi-tenant filtering.
6
+ *
7
+ * Based on the fix from PR #13229 for LinkFeature
8
+ */
9
+ export declare function applyBaseFilterToFields(fields: Field[], config: SanitizedConfig): Field[];
10
+ //# sourceMappingURL=applyBaseFilterToFields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyBaseFilterToFields.d.ts","sourceRoot":"","sources":["../../src/utilities/applyBaseFilterToFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,KAAK,EAAE,eAAe,EAAa,MAAM,SAAS,CAAA;AAIvE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,KAAK,EAAE,CAiGzF"}
@@ -0,0 +1,97 @@
1
+ import { combineWhereConstraints } from 'payload/shared';
2
+ /**
3
+ * Recursively applies baseFilter from collection config to relationship fields
4
+ * within blocks. This ensures that relationship drawers in blocks respect
5
+ * collection-level filters like multi-tenant filtering.
6
+ *
7
+ * Based on the fix from PR #13229 for LinkFeature
8
+ */
9
+ export function applyBaseFilterToFields(fields, config) {
10
+ return fields.map(field => {
11
+ // Handle relationship fields
12
+ if (field.type === 'relationship') {
13
+ const relationshipField = field;
14
+ // Store the original filterOptions
15
+ const originalFilterOptions = relationshipField.filterOptions;
16
+ // Create new filterOptions that includes baseFilter
17
+ relationshipField.filterOptions = async args => {
18
+ const {
19
+ relationTo,
20
+ req,
21
+ user
22
+ } = args;
23
+ // Call original filterOptions if it exists
24
+ const originalResult = typeof originalFilterOptions === 'function' ? await originalFilterOptions(args) : originalFilterOptions ?? true;
25
+ // If original filter returns false, respect that
26
+ if (originalResult === false) {
27
+ return false;
28
+ }
29
+ // Get the collection's admin config
30
+ const admin = config.collections.find(({
31
+ slug
32
+ }) => slug === relationTo)?.admin;
33
+ // Check if collection is hidden
34
+ const hidden = admin?.hidden;
35
+ if (typeof hidden === 'function' && hidden({
36
+ user
37
+ })) {
38
+ return false;
39
+ }
40
+ // Apply baseFilter (with backwards compatibility for baseListFilter)
41
+ const baseFilter = admin?.baseFilter ?? admin?.baseListFilter;
42
+ const baseFilterResult = await baseFilter?.({
43
+ limit: 0,
44
+ page: 1,
45
+ req,
46
+ sort: 'id'
47
+ });
48
+ // If no baseFilter, return original result
49
+ if (!baseFilterResult) {
50
+ return originalResult;
51
+ }
52
+ // If original result is true, just return the baseFilter
53
+ if (originalResult === true) {
54
+ return baseFilterResult;
55
+ }
56
+ // Combine original and baseFilter results
57
+ return combineWhereConstraints([originalResult, baseFilterResult], 'and');
58
+ };
59
+ return relationshipField;
60
+ }
61
+ // Recursively process nested fields
62
+ if ('fields' in field && field.fields) {
63
+ return {
64
+ ...field,
65
+ fields: applyBaseFilterToFields(field.fields, config)
66
+ };
67
+ }
68
+ // Handle tabs
69
+ if (field.type === 'tabs' && 'tabs' in field) {
70
+ return {
71
+ ...field,
72
+ tabs: field.tabs.map(tab => ({
73
+ ...tab,
74
+ fields: applyBaseFilterToFields(tab.fields, config)
75
+ }))
76
+ };
77
+ }
78
+ // Handle blocks
79
+ if (field.type === 'blocks') {
80
+ const blocks = field.blockReferences ?? field.blocks ?? [];
81
+ return {
82
+ ...field,
83
+ blocks: blocks.map(block => {
84
+ if (typeof block === 'string') {
85
+ return block;
86
+ }
87
+ return {
88
+ ...block,
89
+ fields: applyBaseFilterToFields(block.fields, config)
90
+ };
91
+ })
92
+ };
93
+ }
94
+ return field;
95
+ });
96
+ }
97
+ //# sourceMappingURL=applyBaseFilterToFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyBaseFilterToFields.js","names":["combineWhereConstraints","applyBaseFilterToFields","fields","config","map","field","type","relationshipField","originalFilterOptions","filterOptions","args","relationTo","req","user","originalResult","admin","collections","find","slug","hidden","baseFilter","baseListFilter","baseFilterResult","limit","page","sort","tabs","tab","blocks","blockReferences","block"],"sources":["../../src/utilities/applyBaseFilterToFields.ts"],"sourcesContent":["import type { Block, Field, SanitizedConfig, TypedUser } from 'payload'\n\nimport { combineWhereConstraints } from 'payload/shared'\n\n/**\n * Recursively applies baseFilter from collection config to relationship fields\n * within blocks. This ensures that relationship drawers in blocks respect\n * collection-level filters like multi-tenant filtering.\n *\n * Based on the fix from PR #13229 for LinkFeature\n */\nexport function applyBaseFilterToFields(fields: Field[], config: SanitizedConfig): Field[] {\n return fields.map((field) => {\n // Handle relationship fields\n if (field.type === 'relationship') {\n const relationshipField = field\n\n // Store the original filterOptions\n const originalFilterOptions = relationshipField.filterOptions\n\n // Create new filterOptions that includes baseFilter\n relationshipField.filterOptions = async (args) => {\n const { relationTo, req, user } = args\n\n // Call original filterOptions if it exists\n const originalResult =\n typeof originalFilterOptions === 'function'\n ? await originalFilterOptions(args)\n : (originalFilterOptions ?? true)\n\n // If original filter returns false, respect that\n if (originalResult === false) {\n return false\n }\n\n // Get the collection's admin config\n const admin = config.collections.find(({ slug }) => slug === relationTo)?.admin\n\n // Check if collection is hidden\n const hidden = admin?.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: TypedUser })) {\n return false\n }\n\n // Apply baseFilter (with backwards compatibility for baseListFilter)\n const baseFilter = admin?.baseFilter ?? admin?.baseListFilter\n const baseFilterResult = await baseFilter?.({\n limit: 0,\n page: 1,\n req,\n sort: 'id',\n })\n\n // If no baseFilter, return original result\n if (!baseFilterResult) {\n return originalResult\n }\n\n // If original result is true, just return the baseFilter\n if (originalResult === true) {\n return baseFilterResult\n }\n\n // Combine original and baseFilter results\n return combineWhereConstraints([originalResult, baseFilterResult], 'and')\n }\n\n return relationshipField\n }\n\n // Recursively process nested fields\n if ('fields' in field && field.fields) {\n return {\n ...field,\n fields: applyBaseFilterToFields(field.fields, config),\n }\n }\n\n // Handle tabs\n if (field.type === 'tabs' && 'tabs' in field) {\n return {\n ...field,\n tabs: field.tabs.map((tab) => ({\n ...tab,\n fields: applyBaseFilterToFields(tab.fields, config),\n })),\n }\n }\n\n // Handle blocks\n if (field.type === 'blocks') {\n const blocks = (field.blockReferences ?? field.blocks ?? []) as Block[]\n return {\n ...field,\n blocks: blocks.map((block) => {\n if (typeof block === 'string') {\n return block\n }\n return {\n ...block,\n fields: applyBaseFilterToFields(block.fields, config),\n }\n }),\n }\n }\n\n return field\n })\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAExC;;;;;;;AAOA,OAAO,SAASC,wBAAwBC,MAAe,EAAEC,MAAuB;EAC9E,OAAOD,MAAA,CAAOE,GAAG,CAAEC,KAAA;IACjB;IACA,IAAIA,KAAA,CAAMC,IAAI,KAAK,gBAAgB;MACjC,MAAMC,iBAAA,GAAoBF,KAAA;MAE1B;MACA,MAAMG,qBAAA,GAAwBD,iBAAA,CAAkBE,aAAa;MAE7D;MACAF,iBAAA,CAAkBE,aAAa,GAAG,MAAOC,IAAA;QACvC,MAAM;UAAEC,UAAU;UAAEC,GAAG;UAAEC;QAAI,CAAE,GAAGH,IAAA;QAElC;QACA,MAAMI,cAAA,GACJ,OAAON,qBAAA,KAA0B,aAC7B,MAAMA,qBAAA,CAAsBE,IAAA,IAC3BF,qBAAA,IAAyB;QAEhC;QACA,IAAIM,cAAA,KAAmB,OAAO;UAC5B,OAAO;QACT;QAEA;QACA,MAAMC,KAAA,GAAQZ,MAAA,CAAOa,WAAW,CAACC,IAAI,CAAC,CAAC;UAAEC;QAAI,CAAE,KAAKA,IAAA,KAASP,UAAA,GAAaI,KAAA;QAE1E;QACA,MAAMI,MAAA,GAASJ,KAAA,EAAOI,MAAA;QACtB,IAAI,OAAOA,MAAA,KAAW,cAAcA,MAAA,CAAO;UAAEN;QAAK,IAA2B;UAC3E,OAAO;QACT;QAEA;QACA,MAAMO,UAAA,GAAaL,KAAA,EAAOK,UAAA,IAAcL,KAAA,EAAOM,cAAA;QAC/C,MAAMC,gBAAA,GAAmB,MAAMF,UAAA,GAAa;UAC1CG,KAAA,EAAO;UACPC,IAAA,EAAM;UACNZ,GAAA;UACAa,IAAA,EAAM;QACR;QAEA;QACA,IAAI,CAACH,gBAAA,EAAkB;UACrB,OAAOR,cAAA;QACT;QAEA;QACA,IAAIA,cAAA,KAAmB,MAAM;UAC3B,OAAOQ,gBAAA;QACT;QAEA;QACA,OAAOtB,uBAAA,CAAwB,CAACc,cAAA,EAAgBQ,gBAAA,CAAiB,EAAE;MACrE;MAEA,OAAOf,iBAAA;IACT;IAEA;IACA,IAAI,YAAYF,KAAA,IAASA,KAAA,CAAMH,MAAM,EAAE;MACrC,OAAO;QACL,GAAGG,KAAK;QACRH,MAAA,EAAQD,uBAAA,CAAwBI,KAAA,CAAMH,MAAM,EAAEC,MAAA;MAChD;IACF;IAEA;IACA,IAAIE,KAAA,CAAMC,IAAI,KAAK,UAAU,UAAUD,KAAA,EAAO;MAC5C,OAAO;QACL,GAAGA,KAAK;QACRqB,IAAA,EAAMrB,KAAA,CAAMqB,IAAI,CAACtB,GAAG,CAAEuB,GAAA,KAAS;UAC7B,GAAGA,GAAG;UACNzB,MAAA,EAAQD,uBAAA,CAAwB0B,GAAA,CAAIzB,MAAM,EAAEC,MAAA;QAC9C;MACF;IACF;IAEA;IACA,IAAIE,KAAA,CAAMC,IAAI,KAAK,UAAU;MAC3B,MAAMsB,MAAA,GAAUvB,KAAA,CAAMwB,eAAe,IAAIxB,KAAA,CAAMuB,MAAM,IAAI,EAAE;MAC3D,OAAO;QACL,GAAGvB,KAAK;QACRuB,MAAA,EAAQA,MAAA,CAAOxB,GAAG,CAAE0B,KAAA;UAClB,IAAI,OAAOA,KAAA,KAAU,UAAU;YAC7B,OAAOA,KAAA;UACT;UACA,OAAO;YACL,GAAGA,KAAK;YACR5B,MAAA,EAAQD,uBAAA,CAAwB6B,KAAA,CAAM5B,MAAM,EAAEC,MAAA;UAChD;QACF;MACF;IACF;IAEA,OAAOE,KAAA;EACT;AACF","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import { describe, it, expect } from 'vitest';
1
2
  import { extractPropsFromJSXPropsString } from './extractPropsFromJSXPropsString.js';
2
3
  import { propsToJSXString } from './jsx.js';
3
4
  describe('jsx', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"jsx.spec.js","names":["extractPropsFromJSXPropsString","propsToJSXString","describe","INPUT_AND_OUTPUT","input","output","key","inputFromOutput","object","test","global","packageId","uniqueId","update","hello","something","nested","it","replace","propsObject","propsString","console","log","expect","toStrictEqual","originalInput","props","replaceAll","toBe"],"sources":["../../../src/utilities/jsx/jsx.spec.ts"],"sourcesContent":["import { extractPropsFromJSXPropsString } from './extractPropsFromJSXPropsString.js'\nimport { propsToJSXString } from './jsx.js'\n\ndescribe('jsx', () => {\n describe('prop string to object', () => {\n const INPUT_AND_OUTPUT: {\n input: string\n inputFromOutput?: string\n output: Record<string, any>\n }[] = [\n {\n input: 'key=\"value\"',\n output: {\n key: 'value',\n },\n },\n {\n input: \"key='value'\",\n output: {\n key: 'value',\n },\n inputFromOutput: 'key=\"value\"',\n },\n {\n input: 'key={[1, 2, 3]}',\n output: {\n key: [1, 2, 3],\n },\n },\n {\n input: 'key={[1, 2, 3, [1, 2]]}',\n output: {\n key: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={4}',\n output: {\n object: 4,\n },\n },\n {\n input: 'object={{\"test\": 1}}',\n output: {\n object: { test: 1 },\n },\n },\n {\n input: 'object={[1, 2, 3, [1, 2]]}',\n output: {\n object: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={[1, 2]}',\n output: {\n object: [1, 2],\n },\n },\n {\n input: 'key=\"value\" object={{key: \"value\"}}',\n inputFromOutput: 'key=\"value\" object={{\"key\": \"value\"}}',\n output: {\n key: 'value',\n object: { key: 'value' },\n },\n },\n {\n input: 'global packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'global key=\"value\" object={{key: \"value\", something: \"test\", hello: 1}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"something\": \"test\"}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: { hello: 1, key: 'value', something: 'test' },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}}',\n inputFromOutput:\n 'object={{\"hello\": 1, \"key\": \"value\", \"nested\": {\"key\": \"value\"}, \"something\": \"test\", \"test\": [1, 2, 3]}}',\n output: {\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n },\n },\n {\n input:\n 'global key=\"value\" object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"nested\": { \"key\": \"value\" }, \"something\": \"test\", \"test\": [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n // Test if unquoted property keys in objects within arrays are supprted. This is\n // supported through the more lenient JSOX parser, instead of using JSON.parse()\n input: 'key={[1, 2, { hello: \"there\" }]}',\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if ` strings work\n input: `key={[1, 2, { hello: \\`there\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if multiline ` strings work\n input: `key={[1, 2, { hello: \\`Hello\nthere\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"Hello\\\\nthere\" }]}',\n output: {\n key: [1, 2, { hello: 'Hello\\nthere' }],\n },\n },\n ]\n\n for (const { input, output } of INPUT_AND_OUTPUT) {\n it(`can correctly convert to object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsObject = extractPropsFromJSXPropsString({ propsString: input })\n console.log({ output, propsObject })\n\n expect(propsObject).toStrictEqual(output)\n })\n }\n\n for (const { input: originalInput, inputFromOutput, output } of INPUT_AND_OUTPUT) {\n const input = inputFromOutput || originalInput\n it(`can correctly convert from object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsString = propsToJSXString({ props: output })\n console.log({ input, propsString })\n\n expect(propsString.replaceAll(' ', '')).toBe(input.replaceAll(' ', ''))\n })\n }\n })\n})\n"],"mappings":"AAAA,SAASA,8BAA8B,QAAQ;AAC/C,SAASC,gBAAgB,QAAQ;AAEjCC,QAAA,CAAS,OAAO;EACdA,QAAA,CAAS,yBAAyB;IAChC,MAAMC,gBAAA,GAIA,CACJ;MACEC,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;MACAC,eAAA,EAAiB;IACnB,GACA;MACEH,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG;MACd;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MACvB;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;MACV;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;UAAEC,IAAA,EAAM;QAAE;MACpB;IACF,GACA;MACEL,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MAC1B;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,M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/B;IACF,GACA;MACE;MACAV,KAAA,EAAO,oCAAoC;MAC3CG,eAAA,EAAiB;MACjBF,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG;UAAEQ,KAAA,EAAO;QAAQ;MAC/B;IACF,GACA;MACE;MACAV,KAAA,EAAO;YACH;MACJG,eAAA,EAAiB;MACjBF,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG;UAAEQ,KAAA,EAAO;QAAe;MACtC;IACF,EACD;IAED,KAAK,MAAM;MAAEV,KAAK;MAAEC;IAAM,CAAE,IAAIF,gBAAA,EAAkB;MAChDc,EAAA,CAAG,qCAAqCb,KAAA,CAAMc,OAAO,CAAC,OAAO,SAAS,EAAE;QACtE,MAAMC,WAAA,GAAcnB,8BAAA,CAA+B;UAAEoB,WAAA,EAAahB;QAAM;QACxEiB,OAAA,CAAQC,GAAG,CAAC;UAAEjB,MAAA;UAAQc;QAAY;QAElCI,MAAA,CAAOJ,WAAA,EAAaK,aAAa,CAACnB,MAAA;MACpC;IACF;IAEA,KAAK,MAAM;MAAED,KAAA,EAAOqB,aAAa;MAAElB,eAAe;MAAEF;IAAM,CAAE,IAAIF,gBAAA,EAAkB;MAChF,MAAMC,KAAA,GAAQG,eAAA,IAAmBkB,aAAA;MACjCR,EAAA,CAAG,uCAAuCb,KAAA,CAAMc,OAAO,CAAC,OAAO,SAAS,EAAE;QACxE,MAAME,WAAA,GAAcnB,gBAAA,CAAiB;UAAEyB,KAAA,EAAOrB;QAAO;QACrDgB,OAAA,CAAQC,GAAG,CAAC;UAAElB,KAAA;UAAOgB;QAAY;QAEjCG,MAAA,CAAOH,WAAA,CAAYO,UAAU,CAAC,KAAK,KAAKC,IAAI,CAACxB,KAAA,CAAMuB,UAAU,CAAC,KAAK;MACrE;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"jsx.spec.js","names":["describe","it","expect","extractPropsFromJSXPropsString","propsToJSXString","INPUT_AND_OUTPUT","input","output","key","inputFromOutput","object","test","global","packageId","uniqueId","update","hello","something","nested","replace","propsObject","propsString","console","log","toStrictEqual","originalInput","props","replaceAll","toBe"],"sources":["../../../src/utilities/jsx/jsx.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { extractPropsFromJSXPropsString } from './extractPropsFromJSXPropsString.js'\nimport { propsToJSXString } from './jsx.js'\n\ndescribe('jsx', () => {\n describe('prop string to object', () => {\n const INPUT_AND_OUTPUT: {\n input: string\n inputFromOutput?: string\n output: Record<string, any>\n }[] = [\n {\n input: 'key=\"value\"',\n output: {\n key: 'value',\n },\n },\n {\n input: \"key='value'\",\n output: {\n key: 'value',\n },\n inputFromOutput: 'key=\"value\"',\n },\n {\n input: 'key={[1, 2, 3]}',\n output: {\n key: [1, 2, 3],\n },\n },\n {\n input: 'key={[1, 2, 3, [1, 2]]}',\n output: {\n key: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={4}',\n output: {\n object: 4,\n },\n },\n {\n input: 'object={{\"test\": 1}}',\n output: {\n object: { test: 1 },\n },\n },\n {\n input: 'object={[1, 2, 3, [1, 2]]}',\n output: {\n object: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={[1, 2]}',\n output: {\n object: [1, 2],\n },\n },\n {\n input: 'key=\"value\" object={{key: \"value\"}}',\n inputFromOutput: 'key=\"value\" object={{\"key\": \"value\"}}',\n output: {\n key: 'value',\n object: { key: 'value' },\n },\n },\n {\n input: 'global packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'global key=\"value\" object={{key: \"value\", something: \"test\", hello: 1}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"something\": \"test\"}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: { hello: 1, key: 'value', something: 'test' },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}}',\n inputFromOutput:\n 'object={{\"hello\": 1, \"key\": \"value\", \"nested\": {\"key\": \"value\"}, \"something\": \"test\", \"test\": [1, 2, 3]}}',\n output: {\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n },\n },\n {\n input:\n 'global key=\"value\" object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"nested\": { \"key\": \"value\" }, \"something\": \"test\", \"test\": [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n // Test if unquoted property keys in objects within arrays are supprted. This is\n // supported through the more lenient JSOX parser, instead of using JSON.parse()\n input: 'key={[1, 2, { hello: \"there\" }]}',\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if ` strings work\n input: `key={[1, 2, { hello: \\`there\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if multiline ` strings work\n input: `key={[1, 2, { hello: \\`Hello\nthere\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"Hello\\\\nthere\" }]}',\n output: {\n key: [1, 2, { hello: 'Hello\\nthere' }],\n },\n },\n ]\n\n for (const { input, output } of INPUT_AND_OUTPUT) {\n it(`can correctly convert to object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsObject = extractPropsFromJSXPropsString({ propsString: input })\n console.log({ output, propsObject })\n\n expect(propsObject).toStrictEqual(output)\n })\n }\n\n for (const { input: originalInput, inputFromOutput, output } of INPUT_AND_OUTPUT) {\n const input = inputFromOutput || originalInput\n it(`can correctly convert from object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsString = propsToJSXString({ props: output })\n console.log({ input, propsString })\n\n expect(propsString.replaceAll(' ', '')).toBe(input.replaceAll(' ', ''))\n })\n }\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,gBAAgB,QAAQ;AAEjCJ,QAAA,CAAS,OAAO;EACdA,QAAA,CAAS,yBAAyB;IAChC,MAAMK,gBAAA,GAIA,CACJ;MACEC,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;MACAC,eAAA,EAAiB;IACnB,GACA;MACEH,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG;MACd;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MACvB;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;MACV;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;UAAEC,IAAA,EAAM;QAAE;MACpB;IACF,GACA;MACEL,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MAC1B;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,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exical",
3
- "version": "3.69.0-internal.2883df2",
3
+ "version": "3.69.0",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -374,8 +374,8 @@
374
374
  "react-error-boundary": "4.1.2",
375
375
  "ts-essentials": "10.0.3",
376
376
  "uuid": "10.0.0",
377
- "@payloadcms/translations": "3.69.0-internal.2883df2",
378
- "@payloadcms/ui": "3.69.0-internal.2883df2"
377
+ "@payloadcms/translations": "3.69.0",
378
+ "@payloadcms/ui": "3.69.0"
379
379
  },
380
380
  "devDependencies": {
381
381
  "@babel/cli": "7.27.2",
@@ -395,15 +395,15 @@
395
395
  "esbuild-sass-plugin": "3.3.1",
396
396
  "swc-plugin-transform-remove-imports": "8.3.0",
397
397
  "@payloadcms/eslint-config": "3.28.0",
398
- "payload": "3.69.0-internal.2883df2"
398
+ "payload": "3.69.0"
399
399
  },
400
400
  "peerDependencies": {
401
401
  "@faceless-ui/modal": "3.0.0",
402
402
  "@faceless-ui/scroll-info": "2.0.0",
403
403
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
404
404
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
405
- "@payloadcms/next": "3.69.0-internal.2883df2",
406
- "payload": "3.69.0-internal.2883df2"
405
+ "@payloadcms/next": "3.69.0",
406
+ "payload": "3.69.0"
407
407
  },
408
408
  "engines": {
409
409
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- "use client";import{a as h}from"./chunk-DBWINSQN.js";import{a as f}from"./chunk-F26IQ5RE.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useLexicalComposerContext as S}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as j}from"@lexical/react/useLexicalEditable";import{getTranslation as B}from"@payloadcms/translations";import{Button as b,useConfig as L,usePayloadAPI as A,useTranslation as I}from"@payloadcms/ui";import{$getNodeByKey as P}from"lexical";import k,{useCallback as H,useReducer as K,useRef as M,useState as O}from"react";var _={depth:0},X=g=>{let{className:e,data:{relationTo:R,value:s},nodeKey:a}=g;if(typeof s=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let v=M(null),[l]=S(),i=j(),{config:{routes:{api:C},serverURL:N},getEntityConfig:$}=L(),[t]=O(()=>$({collectionSlug:R})),{i18n:w,t:n}=I(),[u,x]=K(r=>r+1,0),[{data:m},{setParams:d}]=A(`${N}${C}/${t.slug}/${s}`,{initialParams:_}),{closeDocumentDrawer:p,DocumentDrawer:D,DocumentDrawerToggler:E}=f({id:s,collectionSlug:t.slug}),T=H(()=>{l.update(()=>{P(a)?.remove()})},[l,a]),y=k.useCallback(()=>{d({..._,cacheBust:u}),p(),x()},[u,d,p]);return c("div",{className:`${e}__contents`,contentEditable:!1,ref:v,children:[c("div",{className:`${e}__wrap`,children:[o("p",{className:`${e}__label`,children:n("fields:labelRelationship",{label:t.labels?.singular?B(t.labels?.singular,w):t.slug})}),o(E,{className:`${e}__doc-drawer-toggler`,children:o("p",{className:`${e}__title`,children:m?m[t?.admin?.useAsTitle||"id"]:s})})]}),i&&c("div",{className:`${e}__actions`,children:[o(b,{buttonStyle:"icon-label",className:`${e}__swapButton`,disabled:!i,el:"button",icon:"swap",onClick:()=>{a&&l.dispatchCommand(h,{replace:{nodeKey:a}})},round:!0,tooltip:n("fields:swapRelationship")}),o(b,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:!i,icon:"x",onClick:r=>{r.preventDefault(),T()},round:!0,tooltip:n("fields:removeRelationship")})]}),!!s&&o(D,{onSave:y})]})};export{X as RelationshipComponent};
2
- //# sourceMappingURL=RelationshipComponent-UCIWIEVD.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/relationship/client/components/RelationshipComponent.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, useConfig, usePayloadAPI, useTranslation } from '@payloadcms/ui'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport './index.scss'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nexport const RelationshipComponent: React.FC<Props> = (props) => {\n const {\n className: baseClass,\n data: { relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.',\n )\n }\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const [relatedCollection] = useState(() => getEntityConfig({ collectionSlug: relationTo }))\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey!)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(() => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDocumentDrawer()\n dispatchCacheBust()\n }, [cacheBust, setParams, closeDocumentDrawer])\n\n return (\n <div className={`${baseClass}__contents`} contentEditable={false} ref={relationshipElemRef}>\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: relatedCollection.labels?.singular\n ? getTranslation(relatedCollection.labels?.singular, i18n)\n : relatedCollection.slug,\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value}\n </p>\n </DocumentDrawerToggler>\n </div>\n {isEditable && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n if (nodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {!!value && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n"],
5
- "mappings": "+IAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,sBAAAA,MAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OAASC,UAAAA,EAAQC,aAAAA,EAAWC,iBAAAA,EAAeC,kBAAAA,MAAsB,iBACjE,OAASC,iBAAAA,MAAqB,UAC9B,OAAOC,GAASC,eAAAA,EAAaC,cAAAA,EAAYC,UAAAA,EAAQC,YAAAA,MAAgB,QAQjE,IAAMC,EAAgB,CACpBC,MAAO,CACT,EASaC,EAA0CC,GAAA,CACrD,GAAM,CACJC,UAAWC,EACXC,KAAM,CAAEC,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AAW,GAAGC,CAAA,mBACjB8C,EAAC,IAAA,CAAE/C,UAAW,GAAGC,CAAA,mBACdsB,EAAE,2BAA4B,CAC7ByB,MAAO7B,EAAkB8B,QAAQC,SAC7BC,EAAehC,EAAkB8B,QAAQC,SAAU5B,CAAA,EACnDH,EAAkBY,IACxB,CAAA,IAEFgB,EAACb,EAAA,CAAsBlC,UAAW,GAAGC,CAAA,gCACnC8C,EAAC,IAAA,CAAE/C,UAAW,GAAGC,CAAA,mBACdC,EAAOA,EAAKiB,GAAmBiC,OAAOC,YAAc,IAAA,EAAQjD,SAIlEO,GACCiC,EAAC,MAAA,CAAI5C,UAAW,GAAGC,CAAA,sBACjB8C,EAACO,EAAA,CACCC,YAAY,aACZvD,UAAW,GAAGC,CAAA,eACduD,SAAU,CAAC7C,EACX8C,GAAG,SACHC,KAAK,OACLC,QAASA,IAAA,CACHtD,GACFI,EAAOmD,gBAAgBC,EAAyC,CAC9DC,QAAS,CAAEzD,QAAAA,CAAQ,CACrB,CAAA,CAEJ,EACA0D,MAAK,GACLC,QAASzC,EAAE,yBAAA,IAEbwB,EAACO,EAAA,CACCC,YAAY,aACZvD,UAAW,GAAGC,CAAA,iBACduD,SAAU,CAAC7C,EACX+C,KAAK,IACLC,QAAUM,GAAA,CACRA,EAAEC,eAAc,EAChB7B,EAAA,CACF,EACA0B,MAAK,GACLC,QAASzC,EAAE,2BAAA,OAKhB,CAAC,CAACnB,GAAS2C,EAACd,EAAA,CAAekC,OAAQzB,MAG1C",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "useConfig", "usePayloadAPI", "useTranslation", "$getNodeByKey", "React", "useCallback", "useReducer", "useRef", "useState", "initialParams", "depth", "RelationshipComponent", "props", "className", "baseClass", "data", "relationTo", "value", "nodeKey", "Error", "relationshipElemRef", "useRef", "editor", "useLexicalComposerContext", "isEditable", "useLexicalEditable", "config", "routes", "api", "serverURL", "getEntityConfig", "useConfig", "relatedCollection", "useState", "collectionSlug", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "setParams", "usePayloadAPI", "slug", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "removeRelationship", "useCallback", "update", "$getNodeByKey", "remove", "updateRelationship", "React", "_jsxs", "contentEditable", "ref", "_jsx", "label", "labels", "singular", "getTranslation", "admin", "useAsTitle", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "dispatchCommand", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "replace", "round", "tooltip", "e", "preventDefault", "onSave"]
7
- }
@@ -1,2 +0,0 @@
1
- "use client";import{a as C,b as S}from"./chunk-O6XRT2H3.js";import{a as x}from"./chunk-INBEEENE.js";import{a as N}from"./chunk-F26IQ5RE.js";import{b as m}from"./chunk-BZZVLW4U.js";import{jsx as a,jsxs as n}from"react/jsx-runtime";import{useLexicalComposerContext as Y}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Z}from"@lexical/react/useLexicalEditable";import{getTranslation as y}from"@payloadcms/translations";import{Button as p,formatDrawerSlug as ee,Thumbnail as te,useConfig as ae,useEditDepth as oe,usePayloadAPI as le,useTranslation as ie}from"@payloadcms/ui";import{$getNodeByKey as R}from"lexical";import{isImage as se}from"payload/shared";import{useCallback as h,useId as re,useReducer as ne,useRef as de,useState as ce}from"react";var E={depth:0},Ne=L=>{let{className:e,data:{fields:P,relationTo:f,value:d},format:T,nodeKey:l}=L;if(typeof d=="object")throw new Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{routes:{api:U},serverURL:F},getEntityConfig:j}=ae(),I=de(null),{uuid:z}=m(),B=oe(),[i]=Y(),{editorConfig:k,fieldProps:{schemaPath:A}}=m(),c=Z(),{i18n:g,t:s}=ie(),[_,K]=ne(r=>r+1,0),[o]=ce(()=>j({collectionSlug:f})),M=re(),b=ee({slug:"lexical-upload-drawer-"+z+M,depth:B}),{toggleDrawer:O}=x(b,!0),{closeDocumentDrawer:w,DocumentDrawer:W,DocumentDrawerToggler:H}=N({id:d,collectionSlug:o.slug}),[{data:t},{setParams:D}]=le(`${F}${U}/${o.slug}/${d}`,{initialParams:E}),v=t?.thumbnailURL||t?.url,q=h(()=>{i.update(()=>{R(l)?.remove()})},[i,l]),G=h(r=>{D({...E,cacheBust:_}),K(),w()},[D,_,w]),$=k?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[o.slug]?.hasExtraFields,J=h((r,V)=>{i.update(()=>{let u=R(l);if(u){let X={...u.getData(),fields:V};u.setData(X)}})},[i,l]),Q=v&&t?.width&&t?.height?t.width>t.height?"landscape":"portrait":"landscape";return n("div",{className:`${e}__contents ${e}__contents--${Q}`,"data-align":T||void 0,"data-filename":t?.filename,ref:I,children:[n("div",{className:`${e}__card`,children:[n("div",{className:`${e}__media`,children:[a(te,{collectionSlug:f,fileSrc:se(t?.mimeType)?v:null,height:t?.height,size:"none",width:t?.width}),c&&a("div",{className:`${e}__overlay ${e}__floater`,children:n("div",{className:`${e}__actions`,role:"toolbar",children:[$?a(p,{buttonStyle:"icon-label",className:`${e}__upload-drawer-toggler`,disabled:!c,el:"button",icon:"edit",onClick:O,round:!0,size:"medium",tooltip:s("fields:editRelationship")}):null,a(p,{buttonStyle:"icon-label",className:`${e}__swap-drawer-toggler`,disabled:!c,el:"button",icon:"swap",onClick:()=>{i.dispatchCommand(S,{replace:{nodeKey:l}})},round:!0,size:"medium",tooltip:s("fields:swapUpload")}),a(p,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:!c,icon:"x",onClick:r=>{r.preventDefault(),q()},round:!0,size:"medium",tooltip:s("fields:removeUpload")})]})})]}),n("div",{className:`${e}__metaOverlay ${e}__floater`,children:[a(H,{className:`${e}__doc-drawer-toggler`,children:a("strong",{className:`${e}__filename`,children:t?.filename||s("general:untitled")})}),a("div",{className:`${e}__collectionLabel`,children:y(o.labels.singular,g)})]})]}),d?a(W,{onSave:G}):null,$?a(C,{data:P,drawerSlug:b,drawerTitle:s("general:editLabel",{label:y(o.labels.singular,g)}),featureKey:"upload",handleDrawerSubmit:J,schemaPath:A,schemaPathSuffix:o.slug}):null]})};export{Ne as UploadComponent};
2
- //# sourceMappingURL=component-5IW2M4GH.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, type ElementFormatType } from 'lexical'\nimport { isImage } from 'payload/shared'\nimport React, { useCallback, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n className: string\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nexport const UploadComponent: React.FC<ElementProps> = (props) => {\n const {\n className: baseClass,\n data: { fields, relationTo, value },\n format,\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (_data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass}__contents ${baseClass}__contents--${aspectRatio}`}\n data-align={format || undefined}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__overlay ${baseClass}__floater`}>\n <div className={`${baseClass}__actions`} role=\"toolbar\">\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n </div>\n )}\n </div>\n\n <div className={`${baseClass}__metaOverlay ${baseClass}__floater`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </strong>\n </DocumentDrawerToggler>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n"],
5
- "mappings": "sOAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,sBAAAA,MAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,oBAAAA,GACAC,aAAAA,GACAC,aAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,iBAAAA,MAA6C,UACtD,OAASC,WAAAA,OAAe,iBACxB,OAAgBC,eAAAA,EAAaC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,OAAgB,QAcxE,IAAMC,EAAgB,CACpBC,MAAO,CACT,EASaC,GAA2CC,GAAA,CACtD,GAAM,CACJC,UAAWC,EACXC,KAAM,CAAEC,OAAAA,EAAQC,WAAAA,EAAYC,MAAAA,CAAK,EACjCC,OAAAA,EACAC,QAAAA,CAAO,EACLR,EAEJ,GAAI,OAAOM,GAAU,SACnB,MAAM,IAAIG,MACR,wHAAA,EAIJ,GAAM,CACJC,OAAQ,CACNC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CAAS,EAEXC,gBAAAA,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UAAW,GAAGC,CAAA,wBACdwF,SAAU,CAAC/D,EACXgE,GAAG,SACHC,KAAK,OACLC,QAASA,IAAA,CACPvE,EAAO0E,gBAAgBC,EAAmC,CACxDC,QAAS,CAAE1F,QAAAA,CAAQ,CACrB,CAAA,CACF,EACAsF,MAAK,GACLR,KAAK,SACLS,QAASjE,EAAE,mBAAA,IAGbmD,EAACO,EAAA,CACCC,YAAY,aACZxF,UAAW,GAAGC,CAAA,iBACdwF,SAAU,CAAC/D,EACXiE,KAAK,IACLC,QAAUM,GAAA,CACRA,EAAEC,eAAc,EAChB5C,EAAA,CACF,EACAsC,MAAK,GACLR,KAAK,SACLS,QAASjE,EAAE,qBAAA,YAOrB+C,EAAC,MAAA,CAAI5E,UAAW,GAAGC,CAAA,iBAA0BA,CAAA,sBAC3C+E,EAACjC,EAAA,CAAsB/C,UAAW,GAAGC,CAAA,gCACnC+E,EAAC,SAAA,CAAOhF,UAAW,GAAGC,CAAA,sBACnBC,GAAM4E,UAAYjD,EAAE,kBAAA,MAGzBmD,EAAC,MAAA,CAAIhF,UAAW,GAAGC,CAAA,6BAChBmG,EAAejE,EAAkBkE,OAAOC,SAAU1E,CAAA,UAKxDvB,EAAQ2E,EAAClC,EAAA,CAAeyD,OAAQ3C,IAAmB,KACnDE,EACCkB,EAACwB,EAAA,CACCtG,KAAMC,EACNsG,WAAYjE,EACZkE,YAAa7E,EAAE,oBAAqB,CAClC8E,MAAOP,EAAejE,EAAkBkE,OAAOC,SAAU1E,CAAA,CAC3D,CAAA,EACAgF,WAAW,SACXC,mBAAoB1C,EACpB1C,WAAYA,EACZqF,iBAAkB3E,EAAkBO,OAEpC,IAAA,GAGV",
6
- "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "formatDrawerSlug", "Thumbnail", "useConfig", "useEditDepth", "usePayloadAPI", "useTranslation", "$getNodeByKey", "isImage", "useCallback", "useId", "useReducer", "useRef", "useState", "initialParams", "depth", "UploadComponent", "props", "className", "baseClass", "data", "fields", "relationTo", "value", "format", "nodeKey", "Error", "config", "routes", "api", "serverURL", "getEntityConfig", "useConfig", "uploadRef", "useRef", "uuid", "useEditorConfigContext", "editDepth", "useEditDepth", "editor", "useLexicalComposerContext", "editorConfig", "fieldProps", "schemaPath", "isEditable", "useLexicalEditable", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "relatedCollection", "useState", "collectionSlug", "componentID", "useId", "extraFieldsDrawerSlug", "formatDrawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "setParams", "usePayloadAPI", "thumbnailSRC", "thumbnailURL", "url", "removeUpload", "useCallback", "update", "$getNodeByKey", "remove", "updateUpload", "_data", "hasExtraFields", "resolvedFeatureMap", "get", "sanitizedClientFeatureProps", "collections", "onExtraFieldsDrawerSubmit", "_", "uploadNode", "newData", "getData", "setData", "aspectRatio", "width", "height", "_jsxs", "undefined", "filename", "ref", "_jsx", "Thumbnail", "fileSrc", "isImage", "mimeType", "size", "role", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "e", "preventDefault", "getTranslation", "labels", "singular", "onSave", "FieldsDrawer", "drawerSlug", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix"]
7
- }