@payloadcms/ui 3.59.0-internal.58ab390 → 3.59.0-internal.6d584d1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/elements/CodeEditor/CodeEditor.js +2 -2
- package/dist/elements/CodeEditor/CodeEditor.js.map +1 -1
- package/dist/elements/Collapsible/index.d.ts +2 -15
- package/dist/elements/Collapsible/index.d.ts.map +1 -1
- package/dist/elements/Collapsible/index.js +60 -59
- package/dist/elements/Collapsible/index.js.map +1 -1
- package/dist/elements/Collapsible/index.scss +2 -6
- package/dist/elements/GroupByBuilder/index.js +1 -1
- package/dist/elements/GroupByBuilder/index.js.map +1 -1
- package/dist/exports/client/{CodeEditor-R4I2K7IG.js → CodeEditor-B56LZ4XC.js} +2 -2
- package/dist/exports/client/{chunk-F5UB7KI3.js → chunk-IOKOROQ2.js} +4 -4
- package/dist/exports/client/chunk-IOKOROQ2.js.map +7 -0
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Code/index.d.ts.map +1 -1
- package/dist/fields/Code/index.js +1 -3
- package/dist/fields/Code/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/dist/exports/client/chunk-F5UB7KI3.js.map +0 -7
- /package/dist/exports/client/{CodeEditor-R4I2K7IG.js.map → CodeEditor-B56LZ4XC.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAWxE,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAWxE,OAAO,cAAc,CAAA;AAkIrB,eAAO,MAAM,SAAS;;;;;;;+EAAoC,CAAA"}
|
|
@@ -25,7 +25,6 @@ const CodeFieldComponent = props => {
|
|
|
25
25
|
className,
|
|
26
26
|
description,
|
|
27
27
|
editorOptions,
|
|
28
|
-
editorProps,
|
|
29
28
|
language = 'javascript'
|
|
30
29
|
} = {},
|
|
31
30
|
label,
|
|
@@ -116,8 +115,7 @@ const CodeFieldComponent = props => {
|
|
|
116
115
|
value: stringValueRef.current,
|
|
117
116
|
wrapperProps: {
|
|
118
117
|
id: `field-${path?.replace(/\./g, '__')}`
|
|
119
|
-
}
|
|
120
|
-
...(editorProps || {})
|
|
118
|
+
}
|
|
121
119
|
}), AfterInput]
|
|
122
120
|
}), /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
123
121
|
CustomComponent: Description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useMemo","useState","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useMemo","useState","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","language","label","localized","required","onMount","path","pathFromProps","readOnly","validate","inputChangeFromRef","useRef","recalculatedHeightAt","setRecalculatedHeightAt","Date","now","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","initialValue","setValue","showError","potentiallyStalePath","stringValueRef","undefined","handleChange","val","current","e","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","defaultLanguage","onChange","wrapperProps","id","replace","CodeField"],"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport './index.scss'\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: CodeFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, description, editorOptions, language = 'javascript' } = {},\n label,\n localized,\n required,\n },\n onMount,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n\n const inputChangeFromRef = React.useRef<'formState' | 'internalEditor'>('formState')\n const [recalculatedHeightAt, setRecalculatedHeightAt] = useState<number | undefined>(Date.now())\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<string>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const stringValueRef = React.useRef<string>(\n (value || initialValue) !== undefined ? (value ?? initialValue) : undefined,\n )\n\n const handleChange = useCallback(\n (val: string) => {\n if (readOnly || disabled) {\n return\n }\n inputChangeFromRef.current = 'internalEditor'\n\n try {\n setValue(val ? val : null)\n stringValueRef.current = val\n } catch (e) {\n setValue(val ? val : null)\n stringValueRef.current = val\n }\n },\n [readOnly, disabled, setValue],\n )\n\n useEffect(() => {\n if (inputChangeFromRef.current === 'formState') {\n stringValueRef.current =\n (value || initialValue) !== undefined ? (value ?? initialValue) : undefined\n setRecalculatedHeightAt(Date.now())\n }\n\n inputChangeFromRef.current = 'formState'\n }, [initialValue, path, value])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n (readOnly || disabled) && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={handleChange}\n onMount={onMount}\n options={editorOptions}\n readOnly={readOnly || disabled}\n recalculatedHeightAt={recalculatedHeightAt}\n value={stringValueRef.current}\n wrapperProps={{\n id: `field-${path?.replace(/\\./g, '__')}`,\n }}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CodeField = withCondition(CodeFieldComponent)\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAEjE,SAASC,UAAU,QAAQ;AAC3B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAEP,MAAMC,wBAAA,GAA2B;EAC/BC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,SAAA,GAAY;AAEl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