@payloadcms/ui 3.0.0-beta.30 → 3.0.0-beta.31
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/assets/index.d.ts +3 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +3 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/payload-favicon-dark.png +0 -0
- package/dist/assets/payload-favicon-light.png +0 -0
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +2 -1
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts +0 -1
- package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
- package/dist/elements/DraggableSortable/useDraggableSortable/types.d.ts +0 -1
- package/dist/elements/DraggableSortable/useDraggableSortable/types.d.ts.map +1 -1
- package/dist/elements/Drawer/types.d.ts +0 -1
- package/dist/elements/Drawer/types.d.ts.map +1 -1
- package/dist/elements/ErrorPill/index.d.ts +2 -2
- package/dist/elements/ErrorPill/index.d.ts.map +1 -1
- package/dist/elements/ErrorPill/index.js.map +1 -1
- package/dist/elements/ListDrawer/types.d.ts +0 -1
- package/dist/elements/ListDrawer/types.d.ts.map +1 -1
- package/dist/elements/Nav/index.d.ts +2 -2
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +15 -8
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/Pill/index.d.ts +0 -1
- package/dist/elements/Pill/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/index.js +4 -1
- package/dist/elements/ReactSelect/index.js.map +1 -1
- package/dist/elements/RenderCustomComponent/index.d.ts +5 -0
- package/dist/elements/RenderCustomComponent/index.d.ts.map +1 -1
- package/dist/elements/RenderCustomComponent/index.js +11 -2
- package/dist/elements/RenderCustomComponent/index.js.map +1 -1
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StepNav/index.scss +1 -2
- package/dist/elements/Translation/index.d.ts +2 -2
- package/dist/elements/Translation/index.d.ts.map +1 -1
- package/dist/elements/Translation/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/types.d.ts +3 -3
- package/dist/elements/WhereBuilder/Condition/Relationship/types.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/Relationship/types.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.d.ts +1 -0
- package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.js +2 -1
- package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
- package/dist/fields/RadioGroup/Radio/index.scss +0 -28
- package/dist/fields/RadioGroup/index.d.ts.map +1 -1
- package/dist/fields/RadioGroup/index.js +1 -0
- package/dist/fields/RadioGroup/index.js.map +1 -1
- package/dist/fields/RadioGroup/index.scss +28 -0
- package/dist/fields/Relationship/types.d.ts +3 -3
- package/dist/fields/Relationship/types.d.ts.map +1 -1
- package/dist/fields/Relationship/types.js.map +1 -1
- package/dist/forms/RowLabel/types.d.ts +2 -2
- package/dist/forms/RowLabel/types.d.ts.map +1 -1
- package/dist/forms/RowLabel/types.js.map +1 -1
- package/dist/graphics/Logo/index.d.ts +2 -2
- package/dist/graphics/Logo/index.d.ts.map +1 -1
- package/dist/graphics/Logo/index.js +4 -3
- package/dist/graphics/Logo/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts +2 -2
- package/dist/providers/ComponentMap/buildComponentMap/collections.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/collections.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts +2 -2
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts +11 -9
- package/dist/providers/ComponentMap/buildComponentMap/globals.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.js +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/globals.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/index.d.ts +2 -2
- package/dist/providers/ComponentMap/buildComponentMap/index.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/index.js +8 -6
- package/dist/providers/ComponentMap/buildComponentMap/index.js.map +1 -1
- package/dist/providers/Root/index.d.ts +2 -2
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/Translation/index.d.ts +10 -8
- package/dist/providers/Translation/index.d.ts.map +1 -1
- package/dist/providers/Translation/index.js +2 -1
- package/dist/providers/Translation/index.js.map +1 -1
- package/dist/templates/Default/index.d.ts +2 -2
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +5 -5
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/formatDate.d.ts +2 -2
- package/dist/utilities/formatDate.d.ts.map +1 -1
- package/dist/utilities/formatDate.js.map +1 -1
- package/dist/utilities/formatDocTitle.d.ts +1 -1
- package/dist/utilities/formatDocTitle.d.ts.map +1 -1
- package/dist/utilities/formatDocTitle.js.map +1 -1
- package/dist/utilities/groupNavItems.d.ts +2 -2
- package/dist/utilities/groupNavItems.d.ts.map +1 -1
- package/dist/utilities/groupNavItems.js.map +1 -1
- package/package.json +4 -4
- /package/dist/assets/{favicon.svg → payload-favicon.svg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/elements/Translation/index.tsx"],"sourcesContent":["import type { TFunction } from '@payloadcms/translations'\n\nimport * as React from 'react'\n\nconst RecursiveTranslation: React.FC<{\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n translationString: string\n}> = ({ elements, translationString }) => {\n const regex = /(<[^>]+>.*?<\\/[^>]+>)/g\n const sections = translationString.split(regex)\n\n return (\n <span>\n {sections.map((section, index) => {\n if (elements && section.startsWith('<') && section.endsWith('>')) {\n const elementKey = section[1]\n const Element = elements[elementKey]\n\n if (Element) {\n const regex = new RegExp(`<${elementKey}>(.*?)<\\/${elementKey}>`, 'g')\n const children = section.replace(regex, (_, group) => group)\n\n return (\n <Element key={index}>\n <RecursiveTranslation translationString={children} />\n </Element>\n )\n }\n }\n\n return section\n })}\n </span>\n )\n}\n\nexport type TranslationProps = {\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n i18nKey:
|
|
1
|
+
{"version":3,"sources":["../../../src/elements/Translation/index.tsx"],"sourcesContent":["import type { ClientTranslationKeys, TFunction } from '@payloadcms/translations'\n\nimport * as React from 'react'\n\nconst RecursiveTranslation: React.FC<{\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n translationString: string\n}> = ({ elements, translationString }) => {\n const regex = /(<[^>]+>.*?<\\/[^>]+>)/g\n const sections = translationString.split(regex)\n\n return (\n <span>\n {sections.map((section, index) => {\n if (elements && section.startsWith('<') && section.endsWith('>')) {\n const elementKey = section[1]\n const Element = elements[elementKey]\n\n if (Element) {\n const regex = new RegExp(`<${elementKey}>(.*?)<\\/${elementKey}>`, 'g')\n const children = section.replace(regex, (_, group) => group)\n\n return (\n <Element key={index}>\n <RecursiveTranslation translationString={children} />\n </Element>\n )\n }\n }\n\n return section\n })}\n </span>\n )\n}\n\nexport type TranslationProps = {\n elements?: Record<string, React.FC<{ children: React.ReactNode }>>\n i18nKey: ClientTranslationKeys\n t: TFunction\n variables?: Record<string, unknown>\n}\n\nexport const Translation: React.FC<TranslationProps> = ({ elements, i18nKey, t, variables }) => {\n const stringWithVariables = t(i18nKey, variables || {})\n\n if (!elements) {\n return stringWithVariables\n }\n\n return <RecursiveTranslation elements={elements} translationString={stringWithVariables} />\n}\n"],"names":["React","RecursiveTranslation","elements","translationString","regex","sections","split","span","map","section","index","startsWith","endsWith","elementKey","Element","RegExp","children","replace","_","group","key","Translation","i18nKey","t","variables","stringWithVariables"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,YAAYA,WAAW,QAAO;AAE9B,MAAMC,uBAGD,CAAC,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE;IACnC,MAAMC,QAAQ;IACd,MAAMC,WAAWF,kBAAkBG,KAAK,CAACF;IAEzC,qBACE,oBAACG,cACEF,SAASG,GAAG,CAAC,CAACC,SAASC;QACtB,IAAIR,YAAYO,QAAQE,UAAU,CAAC,QAAQF,QAAQG,QAAQ,CAAC,MAAM;YAChE,MAAMC,aAAaJ,OAAO,CAAC,EAAE;YAC7B,MAAMK,UAAUZ,QAAQ,CAACW,WAAW;YAEpC,IAAIC,SAAS;gBACX,MAAMV,QAAQ,IAAIW,OAAO,CAAC,CAAC,EAAEF,WAAW,SAAS,EAAEA,WAAW,CAAC,CAAC,EAAE;gBAClE,MAAMG,WAAWP,QAAQQ,OAAO,CAACb,OAAO,CAACc,GAAGC,QAAUA;gBAEtD,qBACE,oBAACL;oBAAQM,KAAKV;iCACZ,oBAACT;oBAAqBE,mBAAmBa;;YAG/C;QACF;QAEA,OAAOP;IACT;AAGN;AASA,OAAO,MAAMY,cAA0C,CAAC,EAAEnB,QAAQ,EAAEoB,OAAO,EAAEC,CAAC,EAAEC,SAAS,EAAE;IACzF,MAAMC,sBAAsBF,EAAED,SAASE,aAAa,CAAC;IAErD,IAAI,CAACtB,UAAU;QACb,OAAOuB;IACT;IAEA,qBAAO,oBAACxB;QAAqBC,UAAUA;QAAUC,mBAAmBsB;;AACtE,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { PaginatedDocs } from 'payload/database';
|
|
3
3
|
import type { ClientCollectionConfig, RelationshipField } from 'payload/types';
|
|
4
4
|
export type Props = {
|
|
@@ -13,7 +13,7 @@ export type Option = {
|
|
|
13
13
|
value: string;
|
|
14
14
|
};
|
|
15
15
|
type CLEAR = {
|
|
16
|
-
i18n:
|
|
16
|
+
i18n: I18nClient;
|
|
17
17
|
required: boolean;
|
|
18
18
|
type: 'CLEAR';
|
|
19
19
|
};
|
|
@@ -21,7 +21,7 @@ type ADD = {
|
|
|
21
21
|
collection: ClientCollectionConfig;
|
|
22
22
|
data: PaginatedDocs<any>;
|
|
23
23
|
hasMultipleRelations: boolean;
|
|
24
|
-
i18n:
|
|
24
|
+
i18n: I18nClient;
|
|
25
25
|
relation: string;
|
|
26
26
|
type: 'ADD';
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/WhereBuilder/Condition/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/elements/WhereBuilder/Condition/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAE9E,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,KAAK,EAAE,OAAO,CAAA;CACf,GAAG,iBAAiB,CAAA;AAErB,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,GAAG,GAAG;IACT,UAAU,EAAE,sBAAsB,CAAA;IAClC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;IACxB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,KAAK,CAAA;AAEhC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/elements/WhereBuilder/Condition/Relationship/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/elements/WhereBuilder/Condition/Relationship/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { PaginatedDocs } from 'payload/database'\nimport type { ClientCollectionConfig, RelationshipField } from 'payload/types'\n\nexport type Props = {\n disabled?: boolean\n onChange: (val: unknown) => void\n value: unknown\n} & RelationshipField\n\nexport type Option = {\n label: string\n options?: Option[]\n relationTo?: string\n value: string\n}\n\ntype CLEAR = {\n i18n: I18nClient\n required: boolean\n type: 'CLEAR'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n data: PaginatedDocs<any>\n hasMultipleRelations: boolean\n i18n: I18nClient\n relation: string\n type: 'ADD'\n}\n\nexport type Action = ADD | CLEAR\n\nexport type ValueWithRelation = {\n relationTo: string\n value: string\n}\n\nexport type GetResults = (args: {\n lastFullyLoadedRelation?: number\n lastLoadedPage?: number\n search?: string\n}) => Promise<void>\n"],"names":[],"rangeMappings":"","mappings":"AAuCA,WAImB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/WhereBuilder/Condition/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,MAAM,KAAK,GAAG;IAClB,YAAY,EAAE,CAAC,EACb,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,KAAK,GAAG,IAAI,CAAA;KACvB,KAAK,IAAI,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACvF,eAAe,EAAE,CAAC,EAChB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,KAAK,GACN,EAAE;QACD,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,M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AC,EAAE,CAAC,KAAK,CAgJrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/elements/WhereBuilder/Condition/index.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nimport type { FieldCondition } from '../types.js'\n\nexport type Props = {\n addCondition: ({\n andIndex,\n fieldName,\n orIndex,\n relation,\n }: {\n andIndex: number\n fieldName: string\n orIndex: number\n relation: 'and' | 'or'\n }) => void\n andIndex: number\n fieldName: string\n fields: FieldCondition[]\n initialValue: string\n operator: string\n orIndex: number\n removeCondition: ({ andIndex, orIndex }: { andIndex: number; orIndex: number }) => void\n updateCondition: ({\n andIndex,\n fieldName,\n operator,\n orIndex,\n value,\n }: {\n andIndex: number\n fieldName: string\n operator: string\n orIndex: number\n value: string\n }) => void\n}\n\nimport type { RelationshipFieldProps } from '@payloadcms/ui/fields/Relationship'\n\nimport { RenderCustomComponent } from '../../../elements/RenderCustomComponent/index.js'\nimport { useDebounce } from '../../../hooks/useDebounce.js'\nimport { Button } from '../../Button/index.js'\nimport { ReactSelect } from '../../ReactSelect/index.js'\nimport { DateField } from './Date/index.js'\nimport { NumberField } from './Number/index.js'\nimport { RelationshipField } from './Relationship/index.js'\nimport { Select } from './Select/index.js'\nimport Text from './Text/index.js'\nimport './index.scss'\n\ntype ComponentType = 'Date' | 'Number' | 'Relationship' | 'Select' | 'Text'\nconst valueFields: Record<ComponentType, React.FC> = {\n Date: DateField,\n Number: NumberField,\n Relationship: RelationshipField,\n Select,\n Text,\n}\n\nconst baseClass = 'condition'\n\nexport const Condition: React.FC<Props> = (props) => {\n const {\n addCondition,\n andIndex,\n fieldName,\n fields,\n initialValue,\n operator,\n orIndex,\n removeCondition,\n updateCondition,\n } = props\n const [internalField, setInternalField] = useState<FieldCondition>(() =>\n fields.find((field) => fieldName === field.value),\n )\n const [internalOperatorOption, setInternalOperatorOption] = useState(operator)\n const [internalQueryValue, setInternalQueryValue] = useState<string>(initialValue)\n\n const debouncedValue = useDebounce(internalQueryValue, 300)\n\n useEffect(() => {\n // This is to trigger changes when the debounced value changes\n if (\n internalField.value &&\n internalOperatorOption &&\n ![null, undefined].includes(debouncedValue)\n ) {\n updateCondition({\n andIndex,\n fieldName: internalField.value,\n operator: internalOperatorOption,\n orIndex,\n value: debouncedValue,\n })\n }\n }, [\n debouncedValue,\n andIndex,\n internalField?.value,\n internalOperatorOption,\n orIndex,\n updateCondition,\n operator,\n ])\n\n const booleanSelect =\n ['exists'].includes(internalOperatorOption) || internalField?.props?.type === 'checkbox'\n const ValueComponent = booleanSelect\n ? Select\n : valueFields[internalField?.component] || valueFields.Text\n\n let valueOptions\n if (booleanSelect) {\n valueOptions = ['true', 'false']\n } else if (internalField?.props && 'options' in internalField.props) {\n valueOptions = internalField.props.options\n }\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__inputs`}>\n <div className={`${baseClass}__field`}>\n <ReactSelect\n isClearable={false}\n onChange={(field) => {\n setInternalField(fields.find((f) => f.value === field.value))\n setInternalOperatorOption(undefined)\n setInternalQueryValue(undefined)\n }}\n options={fields}\n value={fields.find((field) => internalField.value === field.value) || fields[0]}\n />\n </div>\n <div className={`${baseClass}__operator`}>\n <ReactSelect\n disabled={!internalField.value}\n isClearable={false}\n onChange={(operator) => {\n setInternalOperatorOption(operator.value)\n }}\n options={internalField?.operators}\n value={\n internalField?.operators.find(\n (operator) => internalOperatorOption === operator.value,\n ) || null\n }\n />\n </div>\n <div className={`${baseClass}__value`}>\n <RenderCustomComponent\n CustomComponent={internalField?.props?.admin?.components?.Filter}\n DefaultComponent={ValueComponent}\n componentProps={{\n ...internalField?.props,\n disabled: !internalOperatorOption,\n onChange: setInternalQueryValue,\n operator: internalOperatorOption,\n options: valueOptions,\n relationTo:\n internalField?.props?.type === 'relationship' &&\n 'cellProps' in internalField.props &&\n typeof internalField.props.cellProps === 'object' &&\n 'relationTo' in internalField.props.cellProps\n ? internalField.props.cellProps?.relationTo\n : undefined,\n value: internalQueryValue ?? '',\n }}\n />\n </div>\n </div>\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__actions-remove`}\n icon=\"x\"\n iconStyle=\"with-border\"\n onClick={() =>\n removeCondition({\n andIndex,\n orIndex,\n })\n }\n round\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__actions-add`}\n icon=\"plus\"\n iconStyle=\"with-border\"\n onClick={() =>\n addCondition({\n andIndex,\n fieldName,\n orIndex,\n relation: 'and',\n })\n }\n round\n />\n </div>\n </div>\n </div>\n )\n}\n"],"names":["React","useEffect","useState","RenderCustomComponent","useDebounce","Button","ReactSelect","DateField","NumberField","RelationshipField","Select","Text","valueFields","Date","Number","Relationship","baseClass","Condition","props","addCondition","andIndex","fieldName","fields","initialValue","operator","orIndex","removeCondition","updateCondition","internalField","setInternalField","find","field","value","internalOperatorOption","setInternalOperatorOption","internalQueryValue","setInternalQueryValue","debouncedValue","undefined","includes","booleanSelect","type","ValueComponent","component","valueOptions","options","div","className","isClearable","onChange","f","disabled","operators","CustomComponent","admin","components","Filter","DefaultComponent","componentProps","relationTo","cellProps","buttonStyle","icon","iconStyle","onClick","round","relation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAwClD,SAASC,qBAAqB,QAAQ,mDAAkD;AACxF,SAASC,WAAW,QAAQ,gCAA+B;AAC3D,SAASC,MAAM,QAAQ,wBAAuB;AAC9C,SAASC,WAAW,QAAQ,6BAA4B;AACxD,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SAASC,WAAW,QAAQ,oBAAmB;AAC/C,SAASC,iBAAiB,QAAQ,0BAAyB;AAC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C/BrB;YACNN,OAAOG,sBAAsB;QAC/B;wBAIN,oBAACW;QAAIC,WAAW,CAAC,EAAE/B,UAAU,SAAS,CAAC;qBACrC,oBAACX;QACCwD,aAAY;QACZd,WAAW,CAAC,EAAE/B,UAAU,gBAAgB,CAAC;QACzC8C,MAAK;QACLC,WAAU;QACVC,SAAS,IACPtC,gBAAgB;gBACdN;gBACAK;YACF;QAEFwC,OAAAA;sBAEF,oBAAC5D;QACCwD,aAAY;QACZd,WAAW,CAAC,EAAE/B,UAAU,aAAa,CAAC;QACtC8C,MAAK;QACLC,WAAU;QACVC,SAAS,IACP7C,aAAa;gBACXC;gBACAC;gBACAI;gBACAyC,UAAU;YACZ;QAEFD,OAAAA;;AAMZ,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/elements/WhereBuilder/Condition/index.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nimport type { FieldCondition } from '../types.js'\n\nexport type Props = {\n addCondition: ({\n andIndex,\n fieldName,\n orIndex,\n relation,\n }: {\n andIndex: number\n fieldName: string\n orIndex: number\n relation: 'and' | 'or'\n }) => void\n andIndex: number\n fieldName: string\n fields: FieldCondition[]\n initialValue: string\n operator: string\n orIndex: number\n removeCondition: ({ andIndex, orIndex }: { andIndex: number; orIndex: number }) => void\n updateCondition: ({\n andIndex,\n fieldName,\n operator,\n orIndex,\n value,\n }: {\n andIndex: number\n fieldName: string\n operator: string\n orIndex: number\n value: string\n }) => void\n}\n\nimport { RenderCustomComponent } from '../../../elements/RenderCustomComponent/index.js'\nimport { useDebounce } from '../../../hooks/useDebounce.js'\nimport { Button } from '../../Button/index.js'\nimport { ReactSelect } from '../../ReactSelect/index.js'\nimport { DateField } from './Date/index.js'\nimport { NumberField } from './Number/index.js'\nimport { RelationshipField } from './Relationship/index.js'\nimport { Select } from './Select/index.js'\nimport Text from './Text/index.js'\nimport './index.scss'\n\ntype ComponentType = 'Date' | 'Number' | 'Relationship' | 'Select' | 'Text'\nconst valueFields: Record<ComponentType, React.FC> = {\n Date: DateField,\n Number: NumberField,\n Relationship: RelationshipField,\n Select,\n Text,\n}\n\nconst baseClass = 'condition'\n\nexport const Condition: React.FC<Props> = (props) => {\n const {\n addCondition,\n andIndex,\n fieldName,\n fields,\n initialValue,\n operator,\n orIndex,\n removeCondition,\n updateCondition,\n } = props\n const [internalField, setInternalField] = useState<FieldCondition>(() =>\n fields.find((field) => fieldName === field.value),\n )\n const [internalOperatorOption, setInternalOperatorOption] = useState(operator)\n const [internalQueryValue, setInternalQueryValue] = useState<string>(initialValue)\n\n const debouncedValue = useDebounce(internalQueryValue, 300)\n\n useEffect(() => {\n // This is to trigger changes when the debounced value changes\n if (\n internalField.value &&\n internalOperatorOption &&\n ![null, undefined].includes(debouncedValue)\n ) {\n updateCondition({\n andIndex,\n fieldName: internalField.value,\n operator: internalOperatorOption,\n orIndex,\n value: debouncedValue,\n })\n }\n }, [\n debouncedValue,\n andIndex,\n internalField?.value,\n internalOperatorOption,\n orIndex,\n updateCondition,\n operator,\n ])\n\n const booleanSelect =\n ['exists'].includes(internalOperatorOption) || internalField?.props?.type === 'checkbox'\n const ValueComponent = booleanSelect\n ? Select\n : valueFields[internalField?.component] || valueFields.Text\n\n let valueOptions\n if (booleanSelect) {\n valueOptions = ['true', 'false']\n } else if (internalField?.props && 'options' in internalField.props) {\n valueOptions = internalField.props.options\n }\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__wrap`}>\n <div className={`${baseClass}__inputs`}>\n <div className={`${baseClass}__field`}>\n <ReactSelect\n isClearable={false}\n onChange={(field) => {\n setInternalField(fields.find((f) => f.value === field.value))\n setInternalOperatorOption(undefined)\n setInternalQueryValue(undefined)\n }}\n options={fields}\n value={fields.find((field) => internalField.value === field.value) || fields[0]}\n />\n </div>\n <div className={`${baseClass}__operator`}>\n <ReactSelect\n disabled={!internalField.value}\n isClearable={false}\n onChange={(operator) => {\n setInternalOperatorOption(operator.value)\n }}\n options={internalField?.operators}\n value={\n internalField?.operators.find(\n (operator) => internalOperatorOption === operator.value,\n ) || null\n }\n />\n </div>\n <div className={`${baseClass}__value`}>\n <RenderCustomComponent\n CustomComponent={internalField?.props?.admin?.components?.Filter}\n DefaultComponent={ValueComponent}\n componentProps={{\n ...internalField?.props,\n disabled: !internalOperatorOption,\n onChange: setInternalQueryValue,\n operator: internalOperatorOption,\n options: valueOptions,\n relationTo:\n internalField?.props?.type === 'relationship' &&\n 'cellProps' in internalField.props &&\n typeof internalField.props.cellProps === 'object' &&\n 'relationTo' in internalField.props.cellProps\n ? internalField.props.cellProps?.relationTo\n : undefined,\n value: internalQueryValue ?? '',\n }}\n />\n </div>\n </div>\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__actions-remove`}\n icon=\"x\"\n iconStyle=\"with-border\"\n onClick={() =>\n removeCondition({\n andIndex,\n orIndex,\n })\n }\n round\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__actions-add`}\n icon=\"plus\"\n iconStyle=\"with-border\"\n onClick={() =>\n addCondition({\n andIndex,\n fieldName,\n orIndex,\n relation: 'and',\n })\n }\n round\n />\n </div>\n </div>\n </div>\n )\n}\n"],"names":["React","useEffect","useState","RenderCustomComponent","useDebounce","Button","ReactSelect","DateField","NumberField","RelationshipField","Select","Text","valueFields","Date","Number","Relationship","baseClass","Condition","props","addCondition","andIndex","fieldName","fields","initialValue","operator","orIndex","removeCondition","updateCondition","internalField","setInternalField","find","field","value","internalOperatorOption","setInternalOperatorOption","internalQueryValue","setInternalQueryValue","debouncedValue","undefined","includes","booleanSelect","type","ValueComponent","component","valueOptions","options","div","className","isClearable","onChange","f","disabled","operators","CustomComponent","admin","components","Filter","DefaultComponent","componentProps","relationTo","cellProps","buttonStyle","icon","iconStyle","onClick","round","relation"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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eAAeV,OAAOoC,OAAOC,YAAYC;QAC1DC,kBAAkBf;QAClBgB,gBAAgB;YACd,GAAG9B,eAAeV,KAAK;YACvBiC,UAAU,CAAClB;YACXgB,UAAUb;YACVZ,UAAUS;YACVY,SAASD;YACTe,YACE/B,eAAeV,OAAOuB,SAAS,kBAC/B,eAAeb,cAAcV,KAAK,IAClC,OAAOU,cAAcV,KAAK,CAAC0C,SAAS,KAAK,YACzC,gBAAgBhC,cAAcV,KAAK,CAAC0C,SAAS,GACzChC,cAAcV,KAAK,CAAC0C,SAAS,EAAED,aAC/BrB;YACNN,OAAOG,sBAAsB;QAC/B;wBAIN,oBAACW;QAAIC,WAAW,CAAC,EAAE/B,UAAU,SAAS,CAAC;qBACrC,oBAACX;QACCwD,aAAY;QACZd,WAAW,CAAC,EAAE/B,UAAU,gBAAgB,CAAC;QACzC8C,MAAK;QACLC,WAAU;QACVC,SAAS,IACPtC,gBAAgB;gBACdN;gBACAK;YACF;QAEFwC,OAAAA;sBAEF,oBAAC5D;QACCwD,aAAY;QACZd,WAAW,CAAC,EAAE/B,UAAU,aAAa,CAAC;QACtC8C,MAAK;QACLC,WAAU;QACVC,SAAS,IACP7C,aAAa;gBACXC;gBACAC;gBACAI;gBACAyC,UAAU;YACZ;QAEFD,OAAAA;;AAMZ,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/Blocks/BlocksDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { I18nClient } from '@payloadcms/translations'\nimport type { Labels } from 'payload/types'\n\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useEffect, useState } from 'react'\n\nimport type { ReducedBlock } from '../../../providers/ComponentMap/buildComponentMap/types.js'\n\nimport { Drawer } from '../../../elements/Drawer/index.js'\nimport { ThumbnailCard } from '../../../elements/ThumbnailCard/index.js'\nimport { DefaultBlockImage } from '../../../graphics/DefaultBlockImage/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { BlockSearch } from './BlockSearch/index.js'\nimport './index.scss'\n\nexport type Props = {\n addRow: (index: number, blockType?: string) => void\n addRowIndex: number\n blocks: ReducedBlock[]\n drawerSlug: string\n labels: Labels\n}\n\nconst baseClass = 'blocks-drawer'\n\nconst getBlockLabel = (block: ReducedBlock, i18n: I18nClient) => {\n if (typeof block.labels.singular === 'string') return block.labels.singular.toLowerCase()\n if (typeof block.labels.singular === 'object') {\n return getTranslation(block.labels.singular, i18n).toLowerCase()\n }\n return ''\n}\n\nexport const BlocksDrawer: React.FC<Props> = (props) => {\n const { addRow, addRowIndex, blocks, drawerSlug, labels } = props\n const { useModal } = facelessUIImport\n\n const [searchTerm, setSearchTerm] = useState('')\n const [filteredBlocks, setFilteredBlocks] = useState(blocks)\n const { closeModal, isModalOpen } = useModal()\n const { i18n, t } = useTranslation()\n\n useEffect(() => {\n if (!isModalOpen) {\n setSearchTerm('')\n }\n }, [isModalOpen])\n\n useEffect(() => {\n const searchTermToUse = searchTerm.toLowerCase()\n\n const matchingBlocks = blocks?.reduce((matchedBlocks, block) => {\n const blockLabel = getBlockLabel(block, i18n)\n if (blockLabel.includes(searchTermToUse)) matchedBlocks.push(block)\n return matchedBlocks\n }, [])\n\n setFilteredBlocks(matchingBlocks)\n }, [searchTerm, blocks, i18n])\n\n return (\n <Drawer\n slug={drawerSlug}\n title={t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n >\n <BlockSearch setSearchTerm={setSearchTerm} />\n <div className={`${baseClass}__blocks-wrapper`}>\n <ul className={`${baseClass}__blocks`}>\n {filteredBlocks?.map((block, index) => {\n const { slug, imageAltText, imageURL, labels: blockLabels } = block\n\n return (\n <li className={`${baseClass}__block`} key={index}>\n <ThumbnailCard\n alignLabel=\"center\"\n label={getTranslation(blockLabels?.singular, i18n)}\n onClick={() => {\n addRow(addRowIndex, slug)\n closeModal(drawerSlug)\n }}\n thumbnail={\n imageURL ? (\n <img alt={imageAltText} src={imageURL} />\n ) : (\n <div className={`${baseClass}__default-image`}>\n <DefaultBlockImage />\n </div>\n )\n }\n />\n </li>\n )\n })}\n </ul>\n </div>\n </Drawer>\n )\n}\n"],"names":["facelessUIImport","getTranslation","React","useEffect","useState","Drawer","ThumbnailCard","DefaultBlockImage","useTranslation","BlockSearch","baseClass","getBlockLabel","block","i18n","labels","singular","toLowerCase","BlocksDrawer","props","addRow","addRowIndex","blocks","drawerSlug","useModal","searchTerm","setSearchTerm","filteredBlocks","setFilteredBlocks","closeModal","isModalOpen","t","searchTermToUse","matchingBlocks","reduce","matchedBlocks","blockLabel","includes","push","slug","title","label","div","className","ul","map","index","imageAltText","imageURL","blockLabels","li","key","alignLabel","onClick","thumbnail","img","alt","src"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,YAAYA,sBAAsB,qBAAoB;AACtD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAIlD,SAASC,MAAM,QAAQ,oCAAmC;AAC1D,SAASC,aAAa,QAAQ,2CAA0C;AACxE,SAASC,iBAAiB,QAAQ,+CAA8C;AAChF,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,WAAW,QAAQ,yBAAwB;AAWpD,MAAMC,YAAY;AAElB,MAAMC,gBAAgB,CAACC,OAAqBC;IAC1C,IAAI,OAAOD,MAAME,MAAM,CAACC,QAAQ,KAAK,UAAU,OAAOH,MAAME,MAAM,CAACC,QAAQ,CAACC,WAAW;IACvF,IAAI,OAAOJ,MAAME,MAAM,CAACC,QAAQ,KAAK,UAAU;QAC7C,OAAOd,eAAeW,MAAME,MAAM,CAACC,QAAQ,EAAEF,MAAMG,WAAW;I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,OAAO,CAAC;YAAEwC,KAAKL;yBACzC,oBAACvC;YACC6C,YAAW;YACXX,OAAOvC,eAAe+C,aAAajC,UAAUF;YAC7CuC,SAAS;gBACPjC,OAAOC,aAAakB;gBACpBV,WAAWN;YACb;YACA+B,WACEN,yBACE,oBAACO;gBAAIC,KAAKT;gBAAcU,KAAKT;+BAE7B,oBAACN;gBAAIC,WAAW,CAAC,EAAEhC,UAAU,eAAe,CAAC;6BAC3C,oBAACH;;IAOf;AAKV,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/RadioGroup/Radio/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAIjD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/RadioGroup/Radio/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAIjD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG3C,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAyBA,CAAA"}
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { useTranslation } from '../../../providers/Translation/index.js';
|
|
6
6
|
const baseClass = 'radio-input';
|
|
7
7
|
export const Radio = (props)=>{
|
|
8
|
-
const { isSelected, onChange, option, path, uuid } = props;
|
|
8
|
+
const { isSelected, onChange, option, path, readOnly, uuid } = props;
|
|
9
9
|
const { i18n } = useTranslation();
|
|
10
10
|
const editDepth = useEditDepth();
|
|
11
11
|
const id = `field-${path}-${option.value}${editDepth > 1 ? `-${editDepth}` : ''}${uuid ? `-${uuid}` : ''}`;
|
|
@@ -18,6 +18,7 @@ export const Radio = (props)=>{
|
|
|
18
18
|
].filter(Boolean).join(' ')
|
|
19
19
|
}, /*#__PURE__*/ React.createElement("input", {
|
|
20
20
|
checked: isSelected,
|
|
21
|
+
disabled: readOnly,
|
|
21
22
|
id: id,
|
|
22
23
|
onChange: ()=>typeof onChange === 'function' ? onChange(option.value) : null,
|
|
23
24
|
type: "radio"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/RadioGroup/Radio/index.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport React from 'react'\n\nimport type { OnChange } from '../index.js'\n\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-input'\n\nexport const Radio: React.FC<{\n id: string\n isSelected: boolean\n onChange: OnChange\n option: OptionObject\n path: string\n uuid?: string\n}> = (props) => {\n const { isSelected, onChange, option, path, uuid } = props\n const { i18n } = useTranslation()\n\n const editDepth = useEditDepth()\n\n const id = `field-${path}-${option.value}${editDepth > 1 ? `-${editDepth}` : ''}${uuid ? `-${uuid}` : ''}`\n\n return (\n <label htmlFor={id}>\n <div\n className={[baseClass, isSelected && `${baseClass}--is-selected`].filter(Boolean).join(' ')}\n >\n <input\n checked={isSelected}\n id={id}\n onChange={() => (typeof onChange === 'function' ? onChange(option.value) : null)}\n type=\"radio\"\n />\n <span className={`${baseClass}__styled-radio`} />\n <span className={`${baseClass}__label`}>{getTranslation(option.label, i18n)}</span>\n </div>\n </label>\n )\n}\n"],"names":["getTranslation","useEditDepth","React","useTranslation","baseClass","Radio","props","isSelected","onChange","option","path","uuid","i18n","editDepth","id","value","label","htmlFor","div","className","filter","Boolean","join","input","checked","type","span"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/RadioGroup/Radio/index.tsx"],"sourcesContent":["'use client'\nimport type { OptionObject } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { useEditDepth } from '@payloadcms/ui/providers/EditDepth'\nimport React from 'react'\n\nimport type { OnChange } from '../index.js'\n\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-input'\n\nexport const Radio: React.FC<{\n id: string\n isSelected: boolean\n onChange: OnChange\n option: OptionObject\n path: string\n readOnly?: boolean\n uuid?: string\n}> = (props) => {\n const { isSelected, onChange, option, path, readOnly, uuid } = props\n const { i18n } = useTranslation()\n\n const editDepth = useEditDepth()\n\n const id = `field-${path}-${option.value}${editDepth > 1 ? `-${editDepth}` : ''}${uuid ? `-${uuid}` : ''}`\n\n return (\n <label htmlFor={id}>\n <div\n className={[baseClass, isSelected && `${baseClass}--is-selected`].filter(Boolean).join(' ')}\n >\n <input\n checked={isSelected}\n disabled={readOnly}\n id={id}\n onChange={() => (typeof onChange === 'function' ? onChange(option.value) : null)}\n type=\"radio\"\n />\n <span className={`${baseClass}__styled-radio`} />\n <span className={`${baseClass}__label`}>{getTranslation(option.label, i18n)}</span>\n </div>\n </label>\n )\n}\n"],"names":["getTranslation","useEditDepth","React","useTranslation","baseClass","Radio","props","isSelected","onChange","option","path","readOnly","uuid","i18n","editDepth","id","value","label","htmlFor","div","className","filter","Boolean","join","input","checked","disabled","type","span"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,YAAY,QAAQ,qCAAoC;AACjE,OAAOC,WAAW,QAAO;AAIzB,SAASC,cAAc,QAAQ,0CAAyC;AAGxE,MAAMC,YAAY;AAElB,OAAO,MAAMC,QAQR,CAACC;IACJ,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGN;IAC/D,MAAM,EAAEO,IAAI,EAAE,GAAGV;IAEjB,MAAMW,YAAYb;IAElB,MAAMc,KAAK,CAAC,MAAM,EAAEL,KAAK,CAAC,EAAED,OAAOO,KAAK,CAAC,EAAEF,YAAY,IAAI,CAAC,CAAC,EAAEA,UAAU,CAAC,GAAG,GAAG,EAAEF,OAAO,CAAC,CAAC,EAAEA,KAAK,CAAC,GAAG,GAAG,CAAC;IAE1G,qBACE,oBAACK;QAAMC,SAASH;qBACd,oBAACI;QACCC,WAAW;YAAChB;YAAWG,cAAc,CAAC,EAAEH,UAAU,aAAa,CAAC;SAAC,CAACiB,MAAM,CAACC,SAASC,IAAI,CAAC;qBAEvF,oBAACC;QACCC,SAASlB;QACTmB,UAAUf;QACVI,IAAIA;QACJP,UAAU,IAAO,OAAOA,aAAa,aAAaA,SAASC,OAAOO,KAAK,IAAI;QAC3EW,MAAK;sBAEP,oBAACC;QAAKR,WAAW,CAAC,EAAEhB,UAAU,cAAc,CAAC;sBAC7C,oBAACwB;QAAKR,WAAW,CAAC,EAAEhB,UAAU,OAAO,CAAC;OAAGJ,eAAeS,OAAOQ,KAAK,EAAEJ;AAI9E,EAAC"}
|
|
@@ -70,31 +70,3 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
.radio-group--read-only {
|
|
75
|
-
.radio-input {
|
|
76
|
-
cursor: default;
|
|
77
|
-
|
|
78
|
-
&__label {
|
|
79
|
-
color: var(--theme-elevation-800);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&--is-selected {
|
|
83
|
-
.radio-input__styled-radio {
|
|
84
|
-
&:before {
|
|
85
|
-
background-color: var(--theme-elevation-800);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&:not(.radio-input--is-selected) {
|
|
91
|
-
&:hover {
|
|
92
|
-
.radio-input__styled-radio {
|
|
93
|
-
&:before {
|
|
94
|
-
opacity: 0;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/RadioGroup/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,OAAO,cAAc,CAAA;AAQrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/RadioGroup/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,KAAsB,MAAM,OAAO,CAAA;AAQ1C,OAAO,cAAc,CAAA;AAQrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;IAC5C,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;AA0HrD,eAAO,MAAM,UAAU,2BAAiC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/RadioGroup/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n/* eslint-disable react-hooks/exhaustive-deps */\n'use client'\nimport type { Option } from 'payload/types'\n\nimport { optionIsObject } from 'payload/types'\nimport React, { useCallback } from 'react'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { Radio } from './Radio/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-group'\n\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RadioFieldProps = FormFieldBase & {\n layout?: 'horizontal' | 'vertical'\n name?: string\n onChange?: OnChange\n options?: Option[]\n path?: string\n value?: string\n width?: string\n}\n\nexport type OnChange<T = string> = (value: T) => void\n\nconst RadioGroupField: React.FC<RadioFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n layout = 'horizontal',\n onChange: onChangeFromProps,\n options = [],\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n value: valueFromProps,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function')\n return validate(value, { ...validationOptions, options, required })\n },\n [validate, options, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const {\n path,\n setValue,\n showError,\n value: valueFromContext,\n } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const value = valueFromContext || valueFromProps\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n `${baseClass}--layout-${layout}`,\n showError && 'error',\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <div className={`${baseClass}__error-wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <ul className={`${baseClass}--group`} id={`field-${path.replace(/\\./g, '__')}`}>\n {options.map((option) => {\n let optionValue = ''\n\n if (optionIsObject(option)) {\n optionValue = option.value\n } else {\n optionValue = option\n }\n\n const isSelected = String(optionValue) === String(value)\n\n const id = `field-${path}-${optionValue}${uuid ? `-${uuid}` : ''}`\n\n return (\n <li key={`${path} - ${optionValue}`}>\n <Radio\n id={id}\n isSelected={isSelected}\n onChange={() => {\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(optionValue)\n }\n\n if (!readOnly) {\n setValue(optionValue)\n }\n }}\n option={optionIsObject(option) ? option : { label: option, value: option }}\n path={path}\n uuid={uuid}\n />\n </li>\n )\n })}\n </ul>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const RadioGroup = withCondition(RadioGroupField)\n"],"names":["optionIsObject","React","useCallback","FieldLabel","useForm","useField","withCondition","fieldBaseClass","Radio","baseClass","FieldDescription","FieldError","useFieldProps","RadioGroupField","props","name","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","layout","onChange","onChangeFromProps","options","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","value","valueFromProps","width","uuid","memoizedValidate","validationOptions","pathFromContext","readOnlyFromContext","setValue","showError","valueFromContext","div","filter","Boolean","join","ul","id","replace","map","option","optionValue","isSelected","String","li","key","undefined","RadioGroup"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/RadioGroup/index.tsx"],"sourcesContent":["/* eslint-disable react/destructuring-assignment */\n/* eslint-disable react-hooks/exhaustive-deps */\n'use client'\nimport type { Option } from 'payload/types'\n\nimport { optionIsObject } from 'payload/types'\nimport React, { useCallback } from 'react'\n\nimport { FieldLabel } from '../../forms/FieldLabel/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { Radio } from './Radio/index.js'\nimport './index.scss'\n\nconst baseClass = 'radio-group'\n\nimport { FieldDescription } from '@payloadcms/ui/forms/FieldDescription'\nimport { FieldError } from '@payloadcms/ui/forms/FieldError'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RadioFieldProps = FormFieldBase & {\n layout?: 'horizontal' | 'vertical'\n name?: string\n onChange?: OnChange\n options?: Option[]\n path?: string\n value?: string\n width?: string\n}\n\nexport type OnChange<T = string> = (value: T) => void\n\nconst RadioGroupField: React.FC<RadioFieldProps> = (props) => {\n const {\n name,\n CustomDescription,\n CustomError,\n CustomLabel,\n className,\n descriptionProps,\n errorProps,\n label,\n labelProps,\n layout = 'horizontal',\n onChange: onChangeFromProps,\n options = [],\n path: pathFromProps,\n readOnly: readOnlyFromProps,\n required,\n style,\n validate,\n value: valueFromProps,\n width,\n } = props\n\n const { uuid } = useForm()\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function')\n return validate(value, { ...validationOptions, options, required })\n },\n [validate, options, required],\n )\n\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n const readOnly = readOnlyFromProps || readOnlyFromContext\n\n const {\n path,\n setValue,\n showError,\n value: valueFromContext,\n } = useField<string>({\n path: pathFromContext || pathFromProps || name,\n validate: memoizedValidate,\n })\n\n const value = valueFromContext || valueFromProps\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n `${baseClass}--layout-${layout}`,\n showError && 'error',\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={{\n ...style,\n width,\n }}\n >\n <div className={`${baseClass}__error-wrap`}>\n <FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <ul className={`${baseClass}--group`} id={`field-${path.replace(/\\./g, '__')}`}>\n {options.map((option) => {\n let optionValue = ''\n\n if (optionIsObject(option)) {\n optionValue = option.value\n } else {\n optionValue = option\n }\n\n const isSelected = String(optionValue) === String(value)\n\n const id = `field-${path}-${optionValue}${uuid ? `-${uuid}` : ''}`\n\n return (\n <li key={`${path} - ${optionValue}`}>\n <Radio\n id={id}\n isSelected={isSelected}\n onChange={() => {\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(optionValue)\n }\n\n if (!readOnly) {\n setValue(optionValue)\n }\n }}\n option={optionIsObject(option) ? option : { label: option, value: option }}\n path={path}\n readOnly={readOnly}\n uuid={uuid}\n />\n </li>\n )\n })}\n </ul>\n {CustomDescription !== undefined ? (\n CustomDescription\n ) : (\n <FieldDescription {...(descriptionProps || {})} />\n )}\n </div>\n )\n}\n\nexport const RadioGroup = withCondition(RadioGroupField)\n"],"names":["optionIsObject","React","useCallback","FieldLabel","useForm","useField","withCondition","fieldBaseClass","Radio","baseClass","FieldDescription","FieldError","useFieldProps","RadioGroupField","props","name","CustomDescription","CustomError","CustomLabel","className","descriptionProps","errorProps","label","labelProps","layout","onChange","onChangeFromProps","options","path","pathFromProps","readOnly","readOnlyFromProps","required","style","validate","value","valueFromProps","width","uuid","memoizedValidate","validationOptions","pathFromContext","readOnlyFromContext","setValue","showError","valueFromContext","div","filter","Boolean","join","ul","id","replace","map","option","optionValue","isSelected","String","li","key","undefined","RadioGroup"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,iDAAiD,GACjD,8CAA8C,GAC9C;AAGA,SAASA,cAAc,QAAQ,gBAAe;AAC9C,OAAOC,SAASC,WAAW,QAAQ,QAAO;AAE1C,SAASC,UAAU,QAAQ,kCAAiC;AAC5D,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,QAAQ,QAAQ,gCAA+B;AACxD,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,KAAK,QAAQ,mBAA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
|
|
|
32
|
+
.radio-group--read-only {
|
|
33
|
+
.radio-input {
|
|
34
|
+
cursor: default;
|
|
35
|
+
|
|
36
|
+
&__label {
|
|
37
|
+
color: var(--theme-elevation-400);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--is-selected {
|
|
41
|
+
.radio-input__styled-radio {
|
|
42
|
+
&:before {
|
|
43
|
+
background-color: var(--theme-elevation-100);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:not(.radio-input--is-selected) {
|
|
49
|
+
&:hover {
|
|
50
|
+
.radio-input__styled-radio {
|
|
51
|
+
&:before {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
32
60
|
html[data-theme='light'] {
|
|
33
61
|
.radio-group {
|
|
34
62
|
&.error {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { ClientCollectionConfig, RelationshipField } from 'payload/types';
|
|
3
3
|
import type { SanitizedConfig } from 'payload/types';
|
|
4
4
|
import type { FormFieldBase } from '../shared/index.js';
|
|
@@ -33,14 +33,14 @@ type UPDATE = {
|
|
|
33
33
|
collection: ClientCollectionConfig;
|
|
34
34
|
config: SanitizedConfig;
|
|
35
35
|
doc: any;
|
|
36
|
-
i18n:
|
|
36
|
+
i18n: I18nClient;
|
|
37
37
|
type: 'UPDATE';
|
|
38
38
|
};
|
|
39
39
|
type ADD = {
|
|
40
40
|
collection: ClientCollectionConfig;
|
|
41
41
|
config: SanitizedConfig;
|
|
42
42
|
docs: any[];
|
|
43
|
-
i18n:
|
|
43
|
+
i18n: I18nClient;
|
|
44
44
|
ids?: (number | string)[];
|
|
45
45
|
sort?: boolean;
|
|
46
46
|
type: 'ADD';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/Relationship/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAa,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,WAAW,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC5C,WAAW,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAA;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE,sBAAsB,CAAA;IAClC,MAAM,EAAE,eAAe,CAAA;IACvB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;CACf,CAAA;AAED,KAAK,GAAG,GAAG;IACT,UAAU,EAAE,sBAAsB,CAAA;IAClC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,IAAI,EAAE,UAAU,CAAA;IAChB,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACzB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,KAAK,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,MAAM,CAAA;AAEzC,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,CAAA;CACxB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/fields/Relationship/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientCollectionConfig, FieldBase, RelationshipField } from 'payload/types'\nimport type { SanitizedConfig } from 'payload/types'\n\nimport type { FormFieldBase } from '../shared/index.js'\n\nexport type RelationshipFieldProps = FormFieldBase & {\n allowCreate?: RelationshipField['admin']['allowCreate']\n hasMany?: boolean\n isSortable?: boolean\n name: string\n relationTo?: RelationshipField['relationTo']\n sortOptions?: RelationshipField['admin']['sortOptions']\n width?: string\n}\n\nexport type Option = {\n label: string\n options?: Option[]\n relationTo?: string\n value: number | string\n}\n\nexport type OptionGroup = {\n label: string\n options: Option[]\n}\n\nexport type ValueWithRelation = {\n relationTo: string\n value: number | string\n}\n\nexport type Value = ValueWithRelation | number | string\n\ntype CLEAR = {\n type: 'CLEAR'\n}\n\ntype UPDATE = {\n collection: ClientCollectionConfig\n config: SanitizedConfig\n doc: any\n i18n: I18nClient\n type: 'UPDATE'\n}\n\ntype ADD = {\n collection: ClientCollectionConfig\n config: SanitizedConfig\n docs: any[]\n i18n: I18nClient\n ids?: (number | string)[]\n sort?: boolean\n type: 'ADD'\n}\n\nexport type Action = ADD | CLEAR | UPDATE\n\nexport type GetResults = (args: {\n lastFullyLoadedRelation?: number\n lastLoadedPage: Record<string, number>\n onSuccess?: () => void\n search?: string\n sort?: boolean\n value?: Value | Value[]\n}) => Promise<void>\n"],"names":[],"rangeMappings":"","mappings":"AA2DA,WAOmB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { LabelProps } from 'payload/types';
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
export type Props = {
|
|
5
5
|
RowLabelComponent?: React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
|
-
i18n:
|
|
7
|
+
i18n: I18nClient;
|
|
8
8
|
path: string;
|
|
9
9
|
rowLabel?: LabelProps['label'];
|
|
10
10
|
rowNumber?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RowLabel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/RowLabel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,KAAK,GAAG;IAClB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/forms/RowLabel/types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/forms/RowLabel/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { LabelProps } from 'payload/types'\nimport type React from 'react'\n\nexport type Props = {\n RowLabelComponent?: React.ReactNode\n className?: string\n i18n: I18nClient\n path: string\n rowLabel?: LabelProps['label']\n rowNumber?: number\n}\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Logo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/graphics/Logo/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAgCzB,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAoBA,CAAA"}
|
|
@@ -32,13 +32,14 @@ const PayloadLogo = ()=>/*#__PURE__*/ React.createElement("svg", {
|
|
|
32
32
|
d: "M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z"
|
|
33
33
|
}));
|
|
34
34
|
export const Logo = (props)=>{
|
|
35
|
-
const {
|
|
35
|
+
const { payload } = props;
|
|
36
36
|
const { admin: { components: { graphics: { Logo: CustomLogo } = {
|
|
37
37
|
Logo: undefined
|
|
38
|
-
} } = {} } = {} } = config;
|
|
38
|
+
} } = {} } = {} } = payload.config;
|
|
39
39
|
return /*#__PURE__*/ React.createElement(RenderCustomComponent, {
|
|
40
40
|
CustomComponent: CustomLogo,
|
|
41
|
-
DefaultComponent: PayloadLogo
|
|
41
|
+
DefaultComponent: PayloadLogo,
|
|
42
|
+
payload: payload
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
45
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/graphics/Logo/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/graphics/Logo/index.tsx"],"sourcesContent":["import type { Payload } from 'payload'\n\nimport React from 'react'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\n\nconst css = `\n .graphic-logo path {\n fill: var(--theme-elevation-1000);\n }\n`\n\nconst PayloadLogo: React.FC = () => (\n <svg\n className=\"graphic-logo\"\n fill=\"none\"\n height=\"50\"\n viewBox=\"0 0 180 50\"\n width=\"180\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <style>{css}</style>\n <path d=\"M65.922 13.8685C71.1075 13.8685 77.0257 14.6014 77.0257 22.2185C77.0257 28.6587 71.8736 30.2243 66.0664 30.2243H62.2689V39.0961H57.2944V13.8685H65.922ZM62.2689 17.7659V26.3602H66.3773C69.4752 26.3602 71.9069 25.594 71.9069 22.2518C71.9069 18.1101 68.7424 17.7659 66.022 17.7659H62.2689Z\" />\n <path d=\"M84.3209 39.5514C80.7344 39.5514 77.5698 37.4639 77.5698 34.0884C77.5698 29.6358 82.5443 28.3145 89.8949 27.4706V27.1264C89.8949 24.2394 88.3626 23.2623 86.3084 23.2623C84.2542 23.2623 82.7219 24.2394 82.622 26.2936H78.1361C78.4803 22.6072 81.7226 19.8867 86.4861 19.8867C91.1163 19.8867 94.7028 21.7633 94.7028 28.1035C94.7028 28.692 94.6362 31.2014 94.6362 32.9114C94.6362 35.865 94.8472 37.5416 95.1914 39.1073H90.7721C90.6278 38.5188 90.4945 37.6083 90.4279 36.7089C89.0844 38.6853 87.1412 39.5514 84.3209 39.5514ZM90.0282 30.5463C84.6651 31.1015 82.511 31.7344 82.511 33.8219C82.511 35.1766 83.588 36.298 85.7532 36.298C88.7512 36.298 90.0393 34.5547 90.0393 31.4901V30.5463H90.0282Z\" />\n <path d=\"M97.2899 45.1921V41.5057H99.0998C100.699 41.5057 101.432 41.539 102.231 39.5514L102.442 39.0295L95.269 20.3753H100.521L104.763 33.8774L109.115 20.3753H113.99L107.139 38.541C104.951 44.3593 103.974 45.1921 99.3108 45.1921H97.2899Z\" />\n <path d=\"M120.263 39.1073H115.456V13.8685H120.263V39.1073Z\" />\n <path d=\"M122.406 29.7801C122.406 23.2067 126.826 19.9645 131.7 19.9645C136.575 19.9645 140.994 23.2067 140.994 29.7801C140.994 36.3535 136.575 39.5625 131.7 39.5625C126.826 39.5514 122.406 36.3535 122.406 29.7801ZM127.281 29.7801C127.281 33.6775 128.913 35.7984 131.7 35.7984C134.487 35.7984 136.119 33.6775 136.119 29.7801C136.119 25.8494 134.487 23.7286 131.7 23.7286C128.913 23.7286 127.281 25.8383 127.281 29.7801Z\" />\n <path d=\"M149.167 39.5514C145.58 39.5514 142.416 37.4639 142.416 34.0884C142.416 29.6358 147.39 28.3145 154.741 27.4706V27.1264C154.741 24.2394 153.208 23.2623 151.154 23.2623C149.1 23.2623 147.568 24.2394 147.468 26.2936H142.982C143.326 22.6072 146.568 19.8867 151.332 19.8867C155.962 19.8867 159.549 21.7633 159.549 28.1035C159.549 28.692 159.482 31.2014 159.482 32.9114C159.482 35.865 159.693 37.5416 160.037 39.1073H155.618C155.473 38.5188 155.34 37.6083 155.274 36.7089C153.941 38.6853 151.987 39.5514 149.167 39.5514ZM154.874 30.5463C149.511 31.1015 147.357 31.7344 147.357 33.8219C147.357 35.1766 148.434 36.298 150.599 36.298C153.597 36.298 154.885 34.5547 154.885 31.4901V30.5463H154.874Z\" />\n <path d=\"M175.06 39.1073V36.7422C173.872 38.7964 171.618 39.5625 169.664 39.5625C165.067 39.5625 161.625 35.7317 161.625 29.7468C161.625 23.8619 165 19.9645 169.664 19.9645C172.029 19.9645 174.05 21.0415 175.06 22.7848V13.8796H179.868V39.1073H175.06ZM175.238 29.7357C175.238 25.9716 173.494 23.6398 170.852 23.6398C168.242 23.6398 166.677 26.1159 166.677 29.7691C166.677 33.4222 168.242 35.865 170.852 35.865C173.494 35.865 175.238 33.5665 175.238 29.7357Z\" />\n <path d=\"M19.1531 0L42.049 13.8019V39.9956L24.8049 50V23.8064L1.89795 10.0155L19.1531 0Z\" />\n <path d=\"M17.4097 48.5454V28.1035L0.132324 38.1301L17.4097 48.5454Z\" />\n </svg>\n)\n\nexport const Logo: React.FC<{\n payload: Payload\n}> = (props) => {\n const { payload } = props\n\n const {\n admin: {\n components: {\n graphics: { Logo: CustomLogo } = {\n Logo: undefined,\n },\n } = {},\n } = {},\n } = payload.config\n\n return (\n <RenderCustomComponent\n CustomComponent={CustomLogo}\n DefaultComponent={PayloadLogo}\n payload={payload}\n />\n )\n}\n"],"names":["React","RenderCustomComponent","css","PayloadLogo","svg","className","fill","height","viewBox","width","xmlns","style","path","d","Logo","props","payload","admin","components","graphics","CustomLogo","undefined","config","CustomComponent","DefaultComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,WAAW,QAAO;AAEzB,SAASC,qBAAqB,QAAQ,gDAA+C;AAErF,MAAMC,MAAM,CAAC;;;;AAIb,CAAC;AAED,MAAMC,cAAwB,kBAC5B,oBAACC;QACCC,WAAU;QACVC,MAAK;QACLC,QAAO;QACPC,SAAQ;QACRC,OAAM;QACNC,OAAM;qBAEN,oBAACC,eAAOT,oBACR,oBAACU;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;sBACR,oBAACD;QAAKC,GAAE;;AAIZ,OAAO,MAAMC,OAER,CAACC;IACJ,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,MAAM,EACJE,OAAO,EACLC,YAAY,EACVC,UAAU,EAAEL,MAAMM,UAAU,EAAE,GAAG;QAC/BN,MAAMO;IACR,CAAC,EACF,GAAG,CAAC,CAAC,EACP,GAAG,CAAC,CAAC,EACP,GAAGL,QAAQM,MAAM;IAElB,qBACE,oBAACrB;QACCsB,iBAAiBH;QACjBI,kBAAkBrB;QAClBa,SAASA;;AAGf,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { AdminViewProps, EditViewProps, SanitizedCollectionConfig, SanitizedConfig, WithServerSideProps as WithServerSidePropsType } from 'payload/types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { CollectionComponentMap } from './types.js';
|
|
@@ -8,7 +8,7 @@ export declare const mapCollections: (args: {
|
|
|
8
8
|
WithServerSideProps: WithServerSidePropsType;
|
|
9
9
|
collections: SanitizedCollectionConfig[];
|
|
10
10
|
config: SanitizedConfig;
|
|
11
|
-
i18n:
|
|
11
|
+
i18n: I18nClient;
|
|
12
12
|
readOnly?: boolean;
|
|
13
13
|
}) => {
|
|
14
14
|
[key: SanitizedCollectionConfig['slug']]: CollectionComponentMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,eAAe,EACf,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKxD,eAAO,MAAM,cAAc,SAAU;IACnC,eAAe,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,CAAA;IACxC,eAAe,EAAE,MAAM,EAAE,CAAC,cAAc,CAAC,CAAA;IACzC,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,KAAG;IACF,CAAC,GAAG,EAAE,yBAAyB,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAA;CAiKjE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { ViewDescriptionProps } from '@payloadcms/ui/elements/ViewDescription'\nimport type {\n AdminViewProps,\n EditViewProps,\n SanitizedCollectionConfig,\n SanitizedConfig,\n WithServerSideProps as WithServerSidePropsType,\n} from 'payload/types'\n\nimport { ViewDescription } from '@payloadcms/ui/elements/ViewDescription'\nimport React from 'react'\n\nimport type { CollectionComponentMap } from './types.js'\n\nimport { mapActions } from './actions.js'\nimport { mapFields } from './fields.js'\n\nexport const mapCollections = (args: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n WithServerSideProps: WithServerSidePropsType\n collections: SanitizedCollectionConfig[]\n config: SanitizedConfig\n i18n: I18n\n readOnly?: boolean\n}): {\n [key: SanitizedCollectionConfig['slug']]: CollectionComponentMap\n} => {\n const {\n DefaultEditView,\n DefaultListView,\n WithServerSideProps,\n collections,\n config,\n i18n,\n i18n: { t },\n readOnly: readOnlyOverride,\n } = args\n\n return collections.reduce((acc, collectionConfig) => {\n const { slug, fields } = collectionConfig\n\n const internalCollections = ['payload-preferences', 'payload-migrations']\n\n if (internalCollections.includes(slug)) {\n return acc\n }\n\n const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit\n\n const listViewFromConfig = collectionConfig?.admin?.components?.views?.List\n\n const CustomEditView =\n typeof editViewFromConfig === 'function'\n ? editViewFromConfig\n : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function'\n ? editViewFromConfig.Default\n : typeof editViewFromConfig?.Default === 'object' &&\n 'Component' in editViewFromConfig.Default &&\n typeof editViewFromConfig.Default.Component === 'function'\n ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>)\n : undefined\n\n const CustomListView =\n typeof listViewFromConfig === 'function'\n ? listViewFromConfig\n : typeof listViewFromConfig === 'object' &&\n typeof listViewFromConfig.Component === 'function'\n ? listViewFromConfig.Component\n : undefined\n\n const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView\n\n const List = CustomListView || DefaultListView\n\n const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton\n\n const SaveButton = SaveButtonComponent ? (\n <WithServerSideProps Component={SaveButtonComponent} />\n ) : undefined\n\n const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton\n\n const SaveDraftButton = SaveDraftButtonComponent ? (\n <WithServerSideProps Component={SaveDraftButtonComponent} />\n ) : undefined\n\n const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton\n\n const PreviewButton = PreviewButtonComponent ? (\n <WithServerSideProps Component={PreviewButtonComponent} />\n ) : undefined\n\n const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton\n\n const PublishButton = PublishButtonComponent ? (\n <WithServerSideProps Component={PublishButtonComponent} />\n ) : undefined\n\n const beforeList = collectionConfig?.admin?.components?.BeforeList\n\n const BeforeList =\n (beforeList &&\n Array.isArray(beforeList) &&\n beforeList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable\n\n const BeforeListTable =\n (beforeListTable &&\n Array.isArray(beforeListTable) &&\n beforeListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterList = collectionConfig?.admin?.components?.AfterList\n\n const AfterList =\n (afterList &&\n Array.isArray(afterList) &&\n afterList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterListTable = collectionConfig?.admin?.components?.AfterListTable\n\n const AfterListTable =\n (afterListTable &&\n Array.isArray(afterListTable) &&\n afterListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n let description = undefined\n if (collectionConfig.admin && 'description' in collectionConfig.admin) {\n if (\n typeof collectionConfig.admin?.description === 'string' ||\n typeof collectionConfig.admin?.description === 'object'\n ) {\n description = collectionConfig.admin.description\n } else if (typeof collectionConfig.admin?.description === 'function') {\n description = collectionConfig.admin?.description({ t })\n }\n }\n\n const descriptionProps: ViewDescriptionProps = {\n description,\n }\n\n const DescriptionComponent =\n collectionConfig.admin?.components?.edit?.Description ||\n (description ? ViewDescription : undefined)\n\n const Description =\n DescriptionComponent !== undefined ? (\n <WithServerSideProps Component={DescriptionComponent} {...(descriptionProps || {})} />\n ) : undefined\n\n const componentMap: CollectionComponentMap = {\n AfterList,\n AfterListTable,\n BeforeList,\n BeforeListTable,\n Description,\n Edit: <Edit collectionSlug={collectionConfig.slug} />,\n List: <List collectionSlug={collectionConfig.slug} />,\n PreviewButton,\n PublishButton,\n SaveButton,\n SaveDraftButton,\n actionsMap: mapActions({\n WithServerSideProps,\n collectionConfig,\n }),\n fieldMap: mapFields({\n WithServerSideProps,\n config,\n fieldSchema: fields,\n i18n,\n readOnly: readOnlyOverride,\n }),\n isPreviewEnabled: !!collectionConfig?.admin?.preview,\n }\n\n return {\n ...acc,\n [slug]: componentMap,\n }\n }, {})\n}\n"],"names":["ViewDescription","React","mapActions","mapFields","mapCollections","args","DefaultEditView","DefaultListView","WithServerSideProps","collections","config","i18n","t","readOnly","readOnlyOverride","reduce","acc","collectionConfig","slug","fields","internalCollections","includes","editViewFromConfig","admin","components","views","Edit","listViewFromConfig","List","CustomEditView","Default","Component","undefined","CustomListView","SaveButtonComponent","edit","SaveButton","SaveDraftButtonComponent","SaveDraftButton","PreviewButtonComponent","PreviewButton","PublishButtonComponent","PublishButton","beforeList","BeforeList","Array","isArray","map","beforeListTable","BeforeListTable","afterList","AfterList","afterListTable","AfterListTable","description","descriptionProps","DescriptionComponent","Description","componentMap","collectionSlug","actionsMap","fieldMap","fieldSchema","isPreviewEnabled","preview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAUA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,OAAOC,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,cAAa;AAEvC,OAAO,MAAMC,iBAAiB,CAACC;IAW7B,MA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AAY;oBAAE1C;gBAAE;YACxD;QACF;QAEA,MAAM2C,mBAAyC;YAC7CD;QACF;QAEA,MAAME,uBACJvC,iBAAiBM,KAAK,EAAEC,YAAYW,MAAMsB,eACzCH,CAAAA,cAActD,kBAAkBgC,SAAQ;QAE3C,MAAMyB,cACJD,yBAAyBxB,0BACvB,oBAACxB;YAAoBuB,WAAWyB;YAAuB,GAAID,oBAAoB,CAAC,CAAC;aAC/EvB;QAEN,MAAM0B,eAAuC;YAC3CP;YACAE;YACAT;YACAK;YACAQ;YACA/B,oBAAM,oBAACA;gBAAKiC,gBAAgB1C,iBAAiBC,IAAI;;YACjDU,oBAAM,oBAACA;gBAAK+B,gBAAgB1C,iBAAiBC,IAAI;;YACjDsB;YACAE;YACAN;YACAE;YACAsB,YAAY1D,WAAW;gBACrBM;gBACAS;YACF;YACA4C,UAAU1D,UAAU;gBAClBK;gBACAE;gBACAoD,aAAa3C;gBACbR;gBACAE,UAAUC;YACZ;YACAiD,kBAAkB,CAAC,CAAC9C,kBAAkBM,OAAOyC;QAC/C;QAEA,OAAO;YACL,GAAGhD,GAAG;YACN,CAACE,KAAK,EAAEwC;QACV;IACF,GAAG,CAAC;AACN,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/providers/ComponentMap/buildComponentMap/collections.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ViewDescriptionProps } from '@payloadcms/ui/elements/ViewDescription'\nimport type {\n AdminViewProps,\n EditViewProps,\n SanitizedCollectionConfig,\n SanitizedConfig,\n WithServerSideProps as WithServerSidePropsType,\n} from 'payload/types'\n\nimport { ViewDescription } from '@payloadcms/ui/elements/ViewDescription'\nimport React from 'react'\n\nimport type { CollectionComponentMap } from './types.js'\n\nimport { mapActions } from './actions.js'\nimport { mapFields } from './fields.js'\n\nexport const mapCollections = (args: {\n DefaultEditView: React.FC<EditViewProps>\n DefaultListView: React.FC<AdminViewProps>\n WithServerSideProps: WithServerSidePropsType\n collections: SanitizedCollectionConfig[]\n config: SanitizedConfig\n i18n: I18nClient\n readOnly?: boolean\n}): {\n [key: SanitizedCollectionConfig['slug']]: CollectionComponentMap\n} => {\n const {\n DefaultEditView,\n DefaultListView,\n WithServerSideProps,\n collections,\n config,\n i18n,\n i18n: { t },\n readOnly: readOnlyOverride,\n } = args\n\n return collections.reduce((acc, collectionConfig) => {\n const { slug, fields } = collectionConfig\n\n const internalCollections = ['payload-preferences', 'payload-migrations']\n\n if (internalCollections.includes(slug)) {\n return acc\n }\n\n const editViewFromConfig = collectionConfig?.admin?.components?.views?.Edit\n\n const listViewFromConfig = collectionConfig?.admin?.components?.views?.List\n\n const CustomEditView =\n typeof editViewFromConfig === 'function'\n ? editViewFromConfig\n : typeof editViewFromConfig === 'object' && typeof editViewFromConfig.Default === 'function'\n ? editViewFromConfig.Default\n : typeof editViewFromConfig?.Default === 'object' &&\n 'Component' in editViewFromConfig.Default &&\n typeof editViewFromConfig.Default.Component === 'function'\n ? (editViewFromConfig.Default.Component as React.FC<EditViewProps>)\n : undefined\n\n const CustomListView =\n typeof listViewFromConfig === 'function'\n ? listViewFromConfig\n : typeof listViewFromConfig === 'object' &&\n typeof listViewFromConfig.Component === 'function'\n ? listViewFromConfig.Component\n : undefined\n\n const Edit = (CustomEditView as React.FC<EditViewProps>) || DefaultEditView\n\n const List = CustomListView || DefaultListView\n\n const SaveButtonComponent = collectionConfig?.admin?.components?.edit?.SaveButton\n\n const SaveButton = SaveButtonComponent ? (\n <WithServerSideProps Component={SaveButtonComponent} />\n ) : undefined\n\n const SaveDraftButtonComponent = collectionConfig?.admin?.components?.edit?.SaveDraftButton\n\n const SaveDraftButton = SaveDraftButtonComponent ? (\n <WithServerSideProps Component={SaveDraftButtonComponent} />\n ) : undefined\n\n const PreviewButtonComponent = collectionConfig?.admin?.components?.edit?.PreviewButton\n\n const PreviewButton = PreviewButtonComponent ? (\n <WithServerSideProps Component={PreviewButtonComponent} />\n ) : undefined\n\n const PublishButtonComponent = collectionConfig?.admin?.components?.edit?.PublishButton\n\n const PublishButton = PublishButtonComponent ? (\n <WithServerSideProps Component={PublishButtonComponent} />\n ) : undefined\n\n const beforeList = collectionConfig?.admin?.components?.BeforeList\n\n const BeforeList =\n (beforeList &&\n Array.isArray(beforeList) &&\n beforeList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const beforeListTable = collectionConfig?.admin?.components?.BeforeListTable\n\n const BeforeListTable =\n (beforeListTable &&\n Array.isArray(beforeListTable) &&\n beforeListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterList = collectionConfig?.admin?.components?.AfterList\n\n const AfterList =\n (afterList &&\n Array.isArray(afterList) &&\n afterList?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n const afterListTable = collectionConfig?.admin?.components?.AfterListTable\n\n const AfterListTable =\n (afterListTable &&\n Array.isArray(afterListTable) &&\n afterListTable?.map((Component) => <WithServerSideProps Component={Component} />)) ||\n null\n\n let description = undefined\n if (collectionConfig.admin && 'description' in collectionConfig.admin) {\n if (\n typeof collectionConfig.admin?.description === 'string' ||\n typeof collectionConfig.admin?.description === 'object'\n ) {\n description = collectionConfig.admin.description\n } else if (typeof collectionConfig.admin?.description === 'function') {\n description = collectionConfig.admin?.description({ t })\n }\n }\n\n const descriptionProps: ViewDescriptionProps = {\n description,\n }\n\n const DescriptionComponent =\n collectionConfig.admin?.components?.edit?.Description ||\n (description ? ViewDescription : undefined)\n\n const Description =\n DescriptionComponent !== undefined ? (\n <WithServerSideProps Component={DescriptionComponent} {...(descriptionProps || {})} />\n ) : undefined\n\n const componentMap: CollectionComponentMap = {\n AfterList,\n AfterListTable,\n BeforeList,\n BeforeListTable,\n Description,\n Edit: <Edit collectionSlug={collectionConfig.slug} />,\n List: <List collectionSlug={collectionConfig.slug} />,\n PreviewButton,\n PublishButton,\n SaveButton,\n SaveDraftButton,\n actionsMap: mapActions({\n WithServerSideProps,\n collectionConfig,\n }),\n fieldMap: mapFields({\n WithServerSideProps,\n config,\n fieldSchema: fields,\n i18n,\n readOnly: readOnlyOverride,\n }),\n isPreviewEnabled: !!collectionConfig?.admin?.preview,\n }\n\n return {\n ...acc,\n [slug]: componentMap,\n }\n }, {})\n}\n"],"names":["ViewDescription","React","mapActions","mapFields","mapCollections","args","DefaultEditView","DefaultListView","WithServerSideProps","collections","config","i18n","t","readOnly","readOnlyOverride","reduce","acc","collectionConfig","slug","fields","internalCollections","includes","editViewFromConfig","admin","components","views","Edit","listViewFromConfig","List","CustomEditView","Default","Component","undefined","CustomListView","SaveButtonComponent","edit","SaveButton","SaveDraftButtonComponent","SaveDraftButton","PreviewButtonComponent","PreviewButton","PublishButtonComponent","PublishButton","beforeList","BeforeList","Array","isArray","map","beforeListTable","BeforeListTable","afterList","AfterList","afterListTable","AfterListTable","description","descriptionProps","DescriptionComponent","Description","componentMap","collectionSlug","actionsMap","fieldMap","fieldSchema","isPreviewEnabled","preview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAUA,SAASA,eAAe,QAAQ,0CAAyC;AACzE,OAAOC,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,cAAa;AAEvC,OAAO,MAAMC,iBAAiB,CAACC;IAW7B,MAAM,EACJC,eAAe,EACfC,eAAe,EACfC,mBAAmB,EACnBC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJA,MAAM,EAAEC,CAAC,EAAE,EACXC,UAAUC,gBAAgB,EAC3B,GAAGT;IAEJ,OAAOI,YAAYM,MAAM,CAAC,CAACC,KAAKC;QAC9B,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGF;QAEzB,MAAMG,sBAAsB;YAAC;YAAuB;SAAqB;QAEzE,IAAIA,oBAAoBC,QAAQ,CAACH,OAAO;YACtC,OAAOF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oBAACA;gBAAKiC,gBAAgB1C,iBAAiBC,IAAI;;YACjDU,oBAAM,oBAACA;gBAAK+B,gBAAgB1C,iBAAiBC,IAAI;;YACjDsB;YACAE;YACAN;YACAE;YACAsB,YAAY1D,WAAW;gBACrBM;gBACAS;YACF;YACA4C,UAAU1D,UAAU;gBAClBK;gBACAE;gBACAoD,aAAa3C;gBACbR;gBACAE,UAAUC;YACZ;YACAiD,kBAAkB,CAAC,CAAC9C,kBAAkBM,OAAOyC;QAC/C;QAEA,OAAO;YACL,GAAGhD,GAAG;YACN,CAACE,KAAK,EAAEwC;QACV;IACF,GAAG,CAAC;AACN,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
2
|
import type { Field, FieldWithPath, SanitizedConfig, WithServerSideProps as WithServerSidePropsType } from 'payload/types';
|
|
3
3
|
import type { FieldMap } from './types.js';
|
|
4
4
|
export declare const mapFields: (args: {
|
|
@@ -10,7 +10,7 @@ export declare const mapFields: (args: {
|
|
|
10
10
|
disableAddingID?: boolean;
|
|
11
11
|
fieldSchema: FieldWithPath[];
|
|
12
12
|
filter?: (field: Field) => boolean;
|
|
13
|
-
i18n:
|
|
13
|
+
i18n: I18nClient;
|
|
14
14
|
parentPath?: string;
|
|
15
15
|
readOnly?: boolean;
|
|
16
16
|
}) => FieldMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/providers/ComponentMap/buildComponentMap/fields.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,KAAK,EAEV,KAAK,EAEL,aAAa,EAGb,eAAe,EACf,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,eAAe,CAAA;AA2BtB,OAAO,KAAK,EAEV,QAAQ,EAIT,MAAM,YAAY,CAAA;AAInB,eAAO,MAAM,SAAS,SAAU;IAC9B,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,MAAM,EAAE,eAAe,CAAA;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,WAAW,EAAE,aAAa,EAAE,CAAA;IAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,aAuuBA,CAAA"}
|