@payloadcms/richtext-lexical 3.0.0-beta.57 → 3.0.0-beta.59
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/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +2 -2
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Field-5TCNFYE2.js +2 -0
- package/dist/exports/client/Field-5TCNFYE2.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-CUMDYP5E.js +2 -0
- package/dist/exports/client/chunk-CUMDYP5E.js.map +7 -0
- package/dist/exports/client/component-7J2IXLN3.js +2 -0
- package/dist/exports/client/component-7J2IXLN3.js.map +7 -0
- package/dist/exports/client/{component-V5QZ7EVZ.js → component-RV346GAA.js} +2 -2
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/component/index.js +3 -3
- package/dist/features/blocks/component/index.js.map +1 -1
- package/dist/features/createFeaturePropComponent.js +1 -1
- package/dist/features/createFeaturePropComponent.js.map +1 -1
- package/dist/features/experimental_table/feature.client.d.ts +2 -0
- package/dist/features/experimental_table/feature.client.d.ts.map +1 -0
- package/dist/features/experimental_table/feature.client.js +66 -0
- package/dist/features/experimental_table/feature.client.js.map +1 -0
- package/dist/features/experimental_table/feature.server.d.ts +2 -0
- package/dist/features/experimental_table/feature.server.d.ts.map +1 -0
- package/dist/features/experimental_table/feature.server.js +52 -0
- package/dist/features/experimental_table/feature.server.js.map +1 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.d.ts +4 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js +602 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js.map +1 -0
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts +4 -0
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js +322 -0
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js.map +1 -0
- package/dist/features/experimental_table/plugins/TablePlugin/index.d.ts +24 -0
- package/dist/features/experimental_table/plugins/TablePlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TablePlugin/index.js +99 -0
- package/dist/features/experimental_table/plugins/TablePlugin/index.js.map +1 -0
- package/dist/features/typesClient.d.ts +5 -1
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +24 -4
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +4 -0
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.d.ts +3 -0
- package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Meatballs/index.js +25 -0
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -0
- package/dist/lexical/ui/icons/Table/index.d.ts +3 -0
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Table/index.js +19 -0
- package/dist/lexical/ui/icons/Table/index.js.map +1 -0
- package/dist/utilities/fieldsDrawer/DrawerContent.js +2 -2
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +3 -3
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/dist/utilities/generateSchemaMap.js +1 -1
- package/dist/utilities/generateSchemaMap.js.map +1 -1
- package/package.json +12 -11
- package/dist/exports/client/Field-XBUN6QOM.js +0 -2
- package/dist/exports/client/Field-XBUN6QOM.js.map +0 -7
- package/dist/exports/client/chunk-OAQL5GDK.js +0 -2
- package/dist/exports/client/chunk-OAQL5GDK.js.map +0 -7
- package/dist/exports/client/component-YNZTTMBY.js +0 -2
- package/dist/exports/client/component-YNZTTMBY.js.map +0 -7
- /package/dist/exports/client/{component-V5QZ7EVZ.js.map → component-RV346GAA.js.map} +0 -0
|
@@ -17,8 +17,8 @@ export const BlockComponent = (props)=>{
|
|
|
17
17
|
const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext();
|
|
18
18
|
const [initialState, setInitialState] = useState(false);
|
|
19
19
|
const { field: { richTextComponentMap } } = useEditorConfigContext();
|
|
20
|
-
const componentMapRenderedFieldsPath = `
|
|
21
|
-
const schemaFieldsPath = `${schemaPath}.
|
|
20
|
+
const componentMapRenderedFieldsPath = `lexical_internal_feature.blocks.fields.${formData?.blockType}`;
|
|
21
|
+
const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.${formData?.blockType}`;
|
|
22
22
|
const reducedBlock = editorConfig?.resolvedFeatureMap?.get('blocks')?.sanitizedClientFeatureProps?.reducedBlocks?.find((block)=>block.slug === formData?.blockType);
|
|
23
23
|
const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath);
|
|
24
24
|
// Field Schema
|
|
@@ -108,7 +108,7 @@ export const BlockComponent = (props)=>{
|
|
|
108
108
|
formData: formData,
|
|
109
109
|
formSchema: Array.isArray(fieldMap) ? fieldMap : [],
|
|
110
110
|
nodeKey: nodeKey,
|
|
111
|
-
path: `${path}.
|
|
111
|
+
path: `${path}.lexical_internal_feature.blocks.${formData.blockType}`,
|
|
112
112
|
reducedBlock: reducedBlock,
|
|
113
113
|
schemaPath: schemaFieldsPath
|
|
114
114
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Collapsible,\n Form,\n Pill,\n SectionTitle,\n ShimmerEffect,\n useConfig,\n useDocumentInfo,\n useFieldProps,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../typesClient.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\n\ntype Props = {\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.sanitizedClientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: formData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...state,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n classNames,\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n"],"names":["Collapsible","Form","Pill","SectionTitle","ShimmerEffect","useConfig","useDocumentInfo","useFieldProps","useFormSubmitted","useTranslation","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","BlockComponent","props","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","sanitizedClientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","operation","serverURL","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","fields","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","height"],"mappings":"AAAA;;AAIA,SACEA,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;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,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;gBACpDE,cAAcA;gBACdV,YAAYS;;2BAIhB,KAACvC;YACC6E,WAAWV;YACXW,kBAAiB;YACjBC,sBACE,KAACC;gBAAIH,WAAW,CAAC,EAAE9D,UAAU,cAAc,CAAC;0BAC1C,cAAA,MAACiE;;sCACC,KAAC9E;4BACC2E,WAAW,CAAC,EAAE9D,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAES,UAAUc,UAAU,CAAC;4BACrF2C,WAAU;sCAET,OAAOzC,aAAa0C,MAAM,CAACC,QAAQ,KAAK,WACrCnE,eAAewB,aAAa0C,MAAM,CAACC,QAAQ,EAAEjB,QAC7C;;sCAEN,KAAC/D;4BAAa0B,MAAK;4BAAYuD,UAAUnD,4BAA4BmD;;;;;sBAM3E,cAAA,KAAChF;gBAAciF,QAAO;;WAFjB;IAKX,GAAG;QACDlB;QACAnB;QACAf;QACAR;QACAyC;QACAvC;QACAO;QACAM;QACAuB;QACAxB;QACAV;KACD,EAAE,0DAA0D;;IAC7D,qBAAO,KAACmD;QAAIH,WAAW9D,YAAY,MAAMA,YAAY,MAAMS,SAASc,SAAS;kBAAGiC;;AAClF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Collapsible,\n Form,\n Pill,\n SectionTitle,\n ShimmerEffect,\n useConfig,\n useDocumentInfo,\n useFieldProps,\n useFormSubmitted,\n useTranslation,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../typesClient.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\n\ntype Props = {\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `lexical_internal_feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.sanitizedClientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: formData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...state,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.lexical_internal_feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n classNames,\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n"],"names":["Collapsible","Form","Pill","SectionTitle","ShimmerEffect","useConfig","useDocumentInfo","useFieldProps","useFormSubmitted","useTranslation","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","BlockComponent","props","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","sanitizedClientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","operation","serverURL","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","fields","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","height"],"mappings":"AAAA;;AAIA,SACEA,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,QACT,iBAAgB;AACvB,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAIlB,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAchD,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGF;IAC9B,MAAMG,SAASrB;IACf,MAAMsB,YAAYnB;IAClB,MAAM,EAAEoB,EAAE,EAAE,GAAGtB;IACf,MAAM,EAAEuB,IAAI,EAAEC,UAAU,EAAE,GAAGvB;IAC7B,MAAM,EAAEwB,YAAY,EAAEC,OAAOC,0BAA0B,EAAE,GAAGb;IAE5D,MAAM,CAACc,c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AAYuD,UAAUnD,4BAA4BmD;;;;;sBAM3E,cAAA,KAAChF;gBAAciF,QAAO;;WAFjB;IAKX,GAAG;QACDlB;QACAnB;QACAf;QACAR;QACAyC;QACAvC;QACAO;QACAM;QACAuB;QACAxB;QACAV;KACD,EAAE,0DAA0D;;IAC7D,qBAAO,KAACmD;QAAIH,WAAW9D,YAAY,MAAMA,YAAY,MAAMS,SAASc,SAAS;kBAAGiC;;AAClF,EAAC"}
|
|
@@ -6,7 +6,7 @@ const useLexicalFeatureProp = (featureKey, componentKey, prop)=>{
|
|
|
6
6
|
const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath;
|
|
7
7
|
const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.
|
|
8
8
|
;
|
|
9
|
-
useAddClientFunction(`lexicalFeature.${schemaPath}.${featureKey}.
|
|
9
|
+
useAddClientFunction(`lexicalFeature.${schemaPath}.${featureKey}.lexical_internal_components.${componentKey}`, prop);
|
|
10
10
|
};
|
|
11
11
|
export const createFeaturePropComponent = (prop)=>{
|
|
12
12
|
return (props)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui'\n\nconst useLexicalFeatureProp = <T,>(featureKey: string, componentKey: string, prop: T) => {\n const { schemaPath: schemaPathFromFieldProps } = useFieldProps()\n const tableCell = useTableCell()\n\n const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath\n\n const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.\n\n useAddClientFunction(\n `lexicalFeature.${schemaPath}.${featureKey}.
|
|
1
|
+
{"version":3,"sources":["../../src/features/createFeaturePropComponent.tsx"],"sourcesContent":["'use client'\n\nimport type React from 'react'\n\nimport { useAddClientFunction, useFieldProps, useTableCell } from '@payloadcms/ui'\n\nconst useLexicalFeatureProp = <T,>(featureKey: string, componentKey: string, prop: T) => {\n const { schemaPath: schemaPathFromFieldProps } = useFieldProps()\n const tableCell = useTableCell()\n\n const schemaPathFromCellProps = tableCell?.cellProps?.schemaPath\n\n const schemaPath = schemaPathFromCellProps || schemaPathFromFieldProps // schemaPathFromCellProps needs to have priority, as there can be cells within fields (e.g. list drawers) and the cell schemaPath needs to be used there - not the parent field schemaPath. There cannot be fields within cells.\n\n useAddClientFunction(\n `lexicalFeature.${schemaPath}.${featureKey}.lexical_internal_components.${componentKey}`,\n prop,\n )\n}\n\nexport const createFeaturePropComponent = <T = unknown,>(\n prop: T,\n): React.FC<{ componentKey: string; featureKey: string }> => {\n return (props) => {\n useLexicalFeatureProp(props.featureKey, props.componentKey, prop)\n return null\n }\n}\n"],"names":["useAddClientFunction","useFieldProps","useTableCell","useLexicalFeatureProp","featureKey","componentKey","prop","schemaPath","schemaPathFromFieldProps","tableCell","schemaPathFromCellProps","cellProps","createFeaturePropComponent","props"],"mappings":"AAAA;AAIA,SAASA,oBAAoB,EAAEC,aAAa,EAAEC,YAAY,QAAQ,iBAAgB;AAElF,MAAMC,wBAAwB,CAAKC,YAAoBC,cAAsBC;IAC3E,MAAM,EAAEC,YAAYC,wBAAwB,EAAE,GAAGP;IACjD,MAAMQ,YAAYP;IAElB,MAAMQ,0BAA0BD,WAAWE,WAAWJ;IAEtD,MAAMA,aAAaG,2BAA2BF,yBAAyB,iOAAiO;;IAExSR,qBACE,CAAC,eAAe,EAAEO,WAAW,CAAC,EAAEH,WAAW,6BAA6B,EAAEC,aAAa,CAAC,EACxFC;AAEJ;AAEA,OAAO,MAAMM,6BAA6B,CACxCN;IAEA,OAAO,CAACO;QACNV,sBAAsBU,MAAMT,UAAU,EAAES,MAAMR,YAAY,EAAEC;QAC5D,OAAO;IACT;AACF,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../src/features/experimental_table/feature.client.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,kBAAkB,yBA8C7B,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
|
|
3
|
+
import { TableIcon } from '../../lexical/ui/icons/Table/index.js';
|
|
4
|
+
import { createClientFeature } from '../../utilities/createClientFeature.js';
|
|
5
|
+
import { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js';
|
|
6
|
+
import { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js';
|
|
7
|
+
import { TableActionMenuPlugin } from './plugins/TableActionMenuPlugin/index.js';
|
|
8
|
+
import { TableCellResizerPlugin } from './plugins/TableCellResizerPlugin/index.js';
|
|
9
|
+
import { OPEN_TABLE_DRAWER_COMMAND, TableContext, TablePlugin } from './plugins/TablePlugin/index.js';
|
|
10
|
+
export const TableFeatureClient = createClientFeature({
|
|
11
|
+
nodes: [
|
|
12
|
+
TableNode,
|
|
13
|
+
TableCellNode,
|
|
14
|
+
TableRowNode
|
|
15
|
+
],
|
|
16
|
+
plugins: [
|
|
17
|
+
{
|
|
18
|
+
Component: TablePlugin,
|
|
19
|
+
position: 'normal'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
Component: TableCellResizerPlugin,
|
|
23
|
+
position: 'normal'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
Component: TableActionMenuPlugin,
|
|
27
|
+
position: 'floatingAnchorElem'
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
providers: [
|
|
31
|
+
TableContext
|
|
32
|
+
],
|
|
33
|
+
slashMenu: {
|
|
34
|
+
groups: [
|
|
35
|
+
slashMenuBasicGroupWithItems([
|
|
36
|
+
{
|
|
37
|
+
Icon: TableIcon,
|
|
38
|
+
key: 'table',
|
|
39
|
+
keywords: [
|
|
40
|
+
'table'
|
|
41
|
+
],
|
|
42
|
+
label: 'Table',
|
|
43
|
+
onSelect: ({ editor })=>{
|
|
44
|
+
editor.dispatchCommand(OPEN_TABLE_DRAWER_COMMAND, {});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
])
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
toolbarFixed: {
|
|
51
|
+
groups: [
|
|
52
|
+
toolbarAddDropdownGroupWithItems([
|
|
53
|
+
{
|
|
54
|
+
ChildComponent: TableIcon,
|
|
55
|
+
key: 'table',
|
|
56
|
+
label: 'Table',
|
|
57
|
+
onSelect: ({ editor })=>{
|
|
58
|
+
editor.dispatchCommand(OPEN_TABLE_DRAWER_COMMAND, {});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
])
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=feature.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/features/experimental_table/feature.client.ts"],"sourcesContent":["'use client'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\n\nimport { TableIcon } from '../../lexical/ui/icons/Table/index.js'\nimport { createClientFeature } from '../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js'\nimport { TableActionMenuPlugin } from './plugins/TableActionMenuPlugin/index.js'\nimport { TableCellResizerPlugin } from './plugins/TableCellResizerPlugin/index.js'\nimport {\n OPEN_TABLE_DRAWER_COMMAND,\n TableContext,\n TablePlugin,\n} from './plugins/TablePlugin/index.js'\n\nexport const TableFeatureClient = createClientFeature({\n nodes: [TableNode, TableCellNode, TableRowNode],\n plugins: [\n {\n Component: TablePlugin,\n position: 'normal',\n },\n {\n Component: TableCellResizerPlugin,\n position: 'normal',\n },\n {\n Component: TableActionMenuPlugin,\n position: 'floatingAnchorElem',\n },\n ],\n providers: [TableContext],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: TableIcon,\n key: 'table',\n keywords: ['table'],\n label: 'Table',\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OPEN_TABLE_DRAWER_COMMAND, {})\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: TableIcon,\n key: 'table',\n label: 'Table',\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OPEN_TABLE_DRAWER_COMMAND, {})\n },\n },\n ]),\n ],\n },\n})\n"],"names":["TableCellNode","TableNode","TableRowNode","TableIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","TableActionMenuPlugin","TableCellResizerPlugin","OPEN_TABLE_DRAWER_COMMAND","TableContext","TablePlugin","TableFeatureClient","nodes","plugins","Component","position","providers","slashMenu","groups","Icon","key","keywords","label","onSelect","editor","dispatchCommand","toolbarFixed","ChildComponent"],"mappings":"AAAA;AAEA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAEvE,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,mBAAmB,QAAQ,yCAAwC;AAC5E,SAASC,4BAA4B,QAAQ,oCAAmC;AAChF,SAASC,gCAAgC,QAAQ,wCAAuC;AACxF,SAASC,qBAAqB,QAAQ,2CAA0C;AAChF,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SACEC,yBAAyB,EACzBC,YAAY,EACZC,WAAW,QACN,iCAAgC;AAEvC,OAAO,MAAMC,qBAAqBR,oBAAoB;IACpDS,OAAO;QAACZ;QAAWD;QAAeE;KAAa;IAC/CY,SAAS;QACP;YACEC,WAAWJ;YACXK,UAAU;QACZ;QACA;YACED,WAAWP;YACXQ,UAAU;QACZ;QACA;YACED,WAAWR;YACXS,UAAU;QACZ;KACD;IACDC,WAAW;QAACP;KAAa;IACzBQ,WAAW;QACTC,QAAQ;YACNd,6BAA6B;gBAC3B;oBACEe,MAAMjB;oBACNkB,KAAK;oBACLC,UAAU;wBAAC;qBAAQ;oBACnBC,OAAO;oBACPC,UAAU,CAAC,EAAEC,MAAM,EAAE;wBACnBA,OAAOC,eAAe,CAACjB,2BAA2B,CAAC;oBACrD;gBACF;aACD;SACF;IACH;IACAkB,cAAc;QACZR,QAAQ;YACNb,iCAAiC;gBAC/B;oBACEsB,gBAAgBzB;oBAChBkB,KAAK;oBACLE,OAAO;oBACPC,UAAU,CAAC,EAAEC,MAAM,EAAE;wBACnBA,OAAOC,eAAe,CAACjB,2BAA2B,CAAC;oBACrD;gBACF;aACD;SACF;IACH;AACF,GAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../src/features/experimental_table/feature.server.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,yBAAyB,sFAiCpC,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
|
|
2
|
+
import { sanitizeFields } from 'payload';
|
|
3
|
+
// eslint-disable-next-line payload/no-imports-from-exports-dir
|
|
4
|
+
import { TableFeatureClient } from '../../exports/client/index.js';
|
|
5
|
+
import { createServerFeature } from '../../utilities/createServerFeature.js';
|
|
6
|
+
const fields = [
|
|
7
|
+
{
|
|
8
|
+
name: 'rows',
|
|
9
|
+
type: 'number',
|
|
10
|
+
defaultValue: 5,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'columns',
|
|
15
|
+
type: 'number',
|
|
16
|
+
defaultValue: 5,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
21
|
+
feature: async ({ config, isRoot })=>{
|
|
22
|
+
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
23
|
+
const sanitizedFields = await sanitizeFields({
|
|
24
|
+
config: config,
|
|
25
|
+
fields,
|
|
26
|
+
requireFieldLevelRichTextEditor: isRoot,
|
|
27
|
+
validRelationships
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
ClientFeature: TableFeatureClient,
|
|
31
|
+
generateSchemaMap: ()=>{
|
|
32
|
+
const schemaMap = new Map();
|
|
33
|
+
schemaMap.set('fields', sanitizedFields);
|
|
34
|
+
return schemaMap;
|
|
35
|
+
},
|
|
36
|
+
nodes: [
|
|
37
|
+
{
|
|
38
|
+
node: TableNode
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
node: TableCellNode
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
node: TableRowNode
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
key: 'experimental_table'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=feature.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/features/experimental_table/feature.server.ts"],"sourcesContent":["import type { Config, Field } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TableFeatureClient } from '../../exports/client/index.js'\nimport { createServerFeature } from '../../utilities/createServerFeature.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: TableFeatureClient,\n generateSchemaMap: () => {\n const schemaMap = new Map<string, Field[]>()\n\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n nodes: [\n {\n node: TableNode,\n },\n {\n node: TableCellNode,\n },\n {\n node: TableRowNode,\n },\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","TableFeatureClient","createServerFeature","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","nodes","node","key"],"mappings":"AAEA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AACvE,SAASC,cAAc,QAAQ,UAAS;AAExC,+DAA+D;AAC/D,SAASC,kBAAkB,QAAQ,gCAA+B;AAClE,SAASC,mBAAmB,QAAQ,yCAAwC;AAE5E,MAAMC,SAAkB;IACtB;QACEC,MAAM;QACNC,MAAM;QACNC,cAAc;QACdC,UAAU;IACZ;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,cAAc;QACdC,UAAU;IACZ;CACD;AACD,OAAO,MAAMC,4BAA4BN,oBAAoB;IAC3DO,SAAS,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAE;QAChC,MAAMC,qBAAqBF,OAAOG,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;QAEtE,MAAMC,kBAAkB,MAAMjB,eAAe;YAC3CU,QAAQA;YACRP;YACAe,iCAAiCP;YACjCC;QACF;QACA,OAAO;YACLO,eAAelB;YACfmB,mBAAmB;gBACjB,MAAMC,YAAY,IAAIC;gBAEtBD,UAAUE,GAAG,CAAC,UAAUN;gBAExB,OAAOI;YACT;YACAG,OAAO;gBACL;oBACEC,MAAM3B;gBACR;gBACA;oBACE2B,MAAM5B;gBACR;gBACA;oBACE4B,MAAM1B;gBACR;aACD;QACH;IACF;IACA2B,KAAK;AACP,GAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAIxE,OAAO,cAAc,CAAA;AAkoBrB,eAAO,MAAM,qBAAqB,EAAE,yBAQnC,CAAA"}
|