From 70da259d3e4fa05f14960d5d9e2c811cfdd4ba73 Mon Sep 17 00:00:00 2001 From: mguihal Date: Sat, 20 Apr 2024 23:18:48 +0200 Subject: [PATCH] fix: MultiUrlField - Handle not url values correctly --- .../packages/field-components/dist/index.cjs.js | 8 ++++++-- .../packages/field-components/dist/index.cjs.js.map | 2 +- .../packages/field-components/dist/index.d.ts.map | 2 +- .../packages/field-components/dist/index.es.js | 8 ++++++-- .../packages/field-components/dist/index.es.js.map | 2 +- .../packages/field-components/src/MultiUrlField.js | 10 ++++++++-- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/frontend/packages/field-components/dist/index.cjs.js b/src/frontend/packages/field-components/dist/index.cjs.js index d285e1f43..27507f841 100644 --- a/src/frontend/packages/field-components/dist/index.cjs.js +++ b/src/frontend/packages/field-components/dist/index.cjs.js @@ -644,8 +644,12 @@ const $732a429355ed7119$var$MultiUrlField = ({ source: source, domainMapping: do ] : []; return urlArray.map((url, index)=>{ if (!url.startsWith("http")) url = `https://${url}`; - const parsedUrl = new URL(url); - if (!parsedUrl) return null; + let parsedUrl = null; + try { + parsedUrl = new URL(url); + } catch (e) { + return url; + } const chip = newDomainMapping[parsedUrl.hostname] || { label: "Site web", icon: /*#__PURE__*/ (0, $gJbUX$reactjsxruntime.jsx)((0, ($parcel$interopDefault($gJbUX$muiiconsmaterialLanguage))), {}), diff --git a/src/frontend/packages/field-components/dist/index.cjs.js.map b/src/frontend/packages/field-components/dist/index.cjs.js.map index 3bf87c001..14f3851ef 100644 --- a/src/frontend/packages/field-components/dist/index.cjs.js.map +++ b/src/frontend/packages/field-components/dist/index.cjs.js.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,MAAM,kCAAY,CAAA,GAAA,oDAAS,EAAE,CAAA,QAAU,CAAA;QACrC,QAAQ,CAAA,QAAU,CAAA;gBAChB,UAAU;gBACV,GAAG,MAAM,MAAM;YACjB,CAAA;QACA,Q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;;;;;;;ACpGf,+DAA+D;AAC/D,MAAM,wCAAkB,CAAA,IAAK,EAAE,eAAe;AAE9C,+EAA+E;AAC/E,6DAA6D;AAC7D,uFAAuF;AACvF,MAAM,oCAAc,KAAO;AAE3B,MAAM,2CAAqB,CAAA;IACzB,IAAI,YAAE,QAAQ,QAAE,OAAO,kBAAQ,QAAQ,aAAE,YAAY,SAAW,GAAG;IACnE,MAAM,QAAE,IAAI,aAAE,SAAS,YAAE,QAAQ,EAAE,GAAG,CAAA,GAAA,gCAAa,EAAE;IACrD,MAAM,aAAa,CAAA,GAAA,+BAAY;IAE/B,IAAI,aAAa,WAAW;QAC1B,QAAQ,IAAI,CAAC;QACb,OAAO;IACT;IAEA,IAAI,WAAW,qBAAO,gCAAC,CAAA,GAAA,iCAAa;IAEpC,qBACE;kBACG,KAAK,GAAG,CAAC,CAAC,QAAQ;YACjB,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO;YACvB,MAAM,mBACJ,SAAS,SACR,CAAA,OAAO,SAAS,aAAa,KAAK,OAAO,EAAE,IAAI,WAAW;0BAAE;gBAAU,IAAI,OAAO,EAAE;gBAAE,MAAM;YAAK,EAAC;YACpG,IAAI,kBACF,qBACE,iCAAC;;kCACC,gCAAC,CAAA,GAAA,sBAAG;wBAAE,IAAI;wBAAkB,SAAS;kCAClC,cAAA,CAAA,GAAA,yBAAW,EAAE,CAAA,GAAA,qBAAO,EAAE,IAAI,CAAC,WAAW;4BACrC,gDAAgD;4BAChD,SAAS;wBACX;;oBAED,IAAI,KAAK,MAAM,GAAG,KAAK;;eAPf,OAAO,EAAE;YAYxB,qBACE,iCAAC;;kCACC,gCAAC,CAAA,GAAA,uCAAoB;wBAAE,OAAO;kCAAS;;oBACtC,IAAI,KAAK,MAAM,GAAG,KAAK;;eAFf,OAAO,EAAE;QAKxB;;AAGN;IAEA,2CAAe;;","sources":["packages/field-components/src/index.ts","packages/field-components/src/AvatarWithLabelField.js","packages/field-components/src/ReferenceArrayField.js","packages/field-components/src/ReferenceField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/MultiUrlField.js","packages/field-components/src/SeparatedListField.js"],"sourcesContent":["export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Box, Avatar, Chip } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\nconst useStyles = makeStyles(theme => ({\n parent: props => ({\n position: 'relative',\n ...props.parent\n }),\n square: {\n width: '100%',\n paddingBottom: '100%',\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n // backgroundColor: theme.palette.primary.main,\n '& svg': {\n width: '55%',\n height: '55%'\n }\n },\n chip: {\n position: 'absolute',\n bottom: -10,\n left: 0,\n right: 0,\n paddingTop: 3,\n paddingBottom: 3,\n paddingLeft: 6,\n paddingRight: 6,\n marginBottom: 10,\n cursor: 'pointer'\n },\n launchIcon: {\n width: 14\n }\n}));\n\nconst handleClick = () => {};\n\nconst AvatarWithLabelField = ({ label, defaultLabel, image, fallback, externalLink, labelColor, classes, ...rest }) => {\n classes = useStyles(classes);\n const record = useRecordContext();\n\n const computedLabel = (typeof label === 'function' ? label(record) : record[label]) || defaultLabel;\n const computedImage = typeof image === 'function' ? image(record) : record[image];\n const computedFallback = typeof fallback === 'function' ? fallback(record) : fallback;\n\n return (\n \n
\n \n
\n {!computedLabel ? null : externalLink ? (\n }\n onDelete={handleClick}\n />\n ) : (\n \n )}\n
\n );\n};\n\nAvatarWithLabelField.defaultProps = {\n labelColor: 'secondary',\n externalLink: false\n};\n\nexport default AvatarWithLabelField;\n","import React from 'react';\nimport { ReferenceArrayField as RaReferenceArrayField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceArrayField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record?.[source]) {\n if (!Array.isArray(record[source])) {\n record[source] = [record[source]];\n }\n record[source] = record[source].map(i => i['@id'] || i.id || i);\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceArrayField;\n","import React from 'react';\nimport { ReferenceField as RaReferenceField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record[source]) {\n if (typeof record[source] === 'object') {\n record[source] = record[source]['@id'] || record[source].id;\n }\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceField;\n","import React, { useState, useMemo } from 'react';\nimport { useRecordContext, usePermissions } from 'react-admin';\nimport { ReferenceArrayField } from '../index';\nimport QuickAppendDialog from './QuickAppendDialog';\n\nconst QuickAppendReferenceArrayField = ({ reference, source, resource, children, ...otherProps }) => {\n const record = useRecordContext();\n const [showDialog, setShowDialog] = useState(false);\n const { permissions } = usePermissions(record.id);\n\n const canAppend = useMemo(\n () => !!permissions && permissions.some(p => ['acl:Append', 'acl:Write', 'acl:Control'].includes(p['acl:mode'])),\n [permissions]\n );\n\n return (\n <>\n \n {React.Children.only(children) &&\n React.cloneElement(children, { appendLink: canAppend ? () => setShowDialog(true) : undefined })}\n \n {canAppend && showDialog && (\n setShowDialog(false)}\n subjectUri={record.id}\n resource={resource}\n source={source}\n reference={reference}\n />\n )}\n \n );\n};\n\nexport default QuickAppendReferenceArrayField;\n","import React, { useState, useCallback } from 'react';\nimport {\n Button,\n useDataProvider,\n useTranslate,\n useRefresh,\n useNotify,\n useGetResourceLabel,\n useShowContext\n} from 'react-admin';\nimport { Dialog, DialogTitle, TextField, DialogContent, DialogActions } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useForm } from 'react-hook-form';\nimport AddIcon from '@mui/icons-material/Add';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport ResultsList from './ResultsList';\n\nconst useStyles = makeStyles(() => ({\n title: {\n paddingBottom: 8\n },\n actions: {\n padding: 15\n },\n addForm: {\n paddingTop: 0\n },\n listForm: {\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 0,\n paddingBottom: 0,\n maxHeight: 210\n }\n}));\n\nconst QuickAppendDialog = ({ open, onClose, subjectUri, source, reference }) => {\n const classes = useStyles();\n const { resource } = useShowContext();\n const [keyword, setKeyword] = useState('');\n const [panel, setPanel] = useState('find');\n const dataProvider = useDataProvider();\n const translate = useTranslate();\n const refresh = useRefresh();\n const notify = useNotify();\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n const { register, setValue, handleSubmit } = useForm();\n\n const appendLink = useCallback(\n async objectUri => {\n // Get the freshest data so that the put operation doesn't overwrite anything\n const { data } = await dataProvider.getOne(resource, { id: subjectUri });\n\n await dataProvider.update(resource, {\n id: subjectUri,\n data: {\n ...data,\n [source]: data[source]\n ? Array.isArray(data[source])\n ? [...data[source], objectUri]\n : [data[source], objectUri]\n : objectUri\n },\n previousData: data\n });\n\n refresh();\n\n onClose();\n },\n [dataProvider, subjectUri, resource, source, refresh, onClose]\n );\n\n const create = useCallback(\n async values => {\n const { data } = await dataProvider.create(reference, {\n data: {\n [dataModel.fieldsMapping.title]: values.title\n }\n });\n\n await appendLink(data.id);\n\n notify(`La resource \"${values.title}\" a été créée`, { type: 'success' });\n },\n [dataProvider, dataModel, appendLink, reference, notify]\n );\n\n return (\n \n {panel === 'find' ? (\n <>\n Ajouter une relation\n \n setKeyword(e.target.value)}\n fullWidth\n />\n \n \n {\n setValue('title', keyword);\n setPanel('create');\n }}\n />\n \n \n \n );\n};\n\nexport default QuickAppendDialog;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport {\n useDataProvider,\n useRecordContext,\n useCreatePath,\n useGetResourceLabel,\n useResourceDefinition,\n useTranslate\n} from 'react-admin';\nimport debounce from 'lodash.debounce';\nimport {\n Box,\n IconButton,\n List,\n ListItem,\n ListItemAvatar,\n ListItemText,\n ListItemSecondaryAction,\n Avatar,\n CircularProgress\n} from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport AddIcon from '@mui/icons-material/Add';\nimport VisibilityIcon from '@mui/icons-material/Visibility';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport { useDataServers, useDataModel } from '@semapps/semantic-data-provider';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n maxWidth: '100%',\n backgroundColor: theme.palette.background.paper,\n paddingTop: 0,\n paddingBottom: 0\n },\n primaryText: {\n width: '30%'\n },\n secondaryText: {\n fontStyle: 'italic',\n color: 'grey'\n }\n}));\n\nconst getServerName = (resourceUri, dataServers) => {\n const server = dataServers && Object.values(dataServers).find(server => resourceUri.startsWith(server.baseUrl));\n return server ? server.name : 'Inconnu';\n};\n\nconst ResultsList = ({ keyword, source, reference, appendLink, switchToCreate }) => {\n const classes = useStyles();\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [results, setResults] = useState([]);\n const translate = useTranslate();\n const dataProvider = useDataProvider();\n const dataServers = useDataServers();\n const record = useRecordContext();\n const createPath = useCreatePath();\n\n const referenceDefinition = useResourceDefinition({ resource: reference });\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n\n if (dataModel && Object.keys(dataModel).length > 0 && !dataModel?.fieldsMapping?.title) {\n throw new Error(`No fieldsMapping.title config found for ${reference} dataModel`);\n }\n\n const search = useMemo(\n () =>\n debounce(keyword => {\n dataProvider\n .getList(reference, {\n pagination: { page: 1, perPage: 100 },\n sort: { field: dataModel?.fieldsMapping?.title, order: 'ASC' },\n filter: { q: keyword, _predicates: [dataModel.fieldsMapping.title], _servers: '@all' }\n })\n .then(({ data }) => {\n const existingLinks = record[source]\n ? Array.isArray(record[source])\n ? record[source]\n : [record[source]]\n : [];\n const newLinks = data.filter(record => !existingLinks.includes(record.id));\n setResults(newLinks);\n setLoaded(true);\n setLoading(false);\n })\n .catch(e => {\n setLoading(false);\n });\n }, 700),\n [dataProvider, dataModel, record, source, reference, setResults, setLoading, setLoaded]\n );\n\n useEffect(() => {\n if (!keyword) {\n return undefined;\n }\n setLoading(true);\n setLoaded(false);\n search(keyword);\n\n return () => search.cancel();\n }, [keyword, search, setLoading]);\n\n if (!keyword) return null;\n\n return (\n \n {loaded &&\n results.map(resource => (\n appendLink(resource.id)}>\n \n {React.createElement(referenceDefinition.icon)}\n \n \n \n \n \n \n \n \n \n \n \n ))}\n {loaded && results.length === 0 && (\n \n \n \n \n \n \n \n \n )}\n {loaded && referenceDefinition.hasCreate && (\n \n \n \n \n \n \n \n \n )}\n {loading && (\n \n \n \n )}\n \n );\n};\n\nexport default ResultsList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Chip, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LanguageIcon from '@mui/icons-material/Language';\nimport FacebookIcon from '@mui/icons-material/Facebook';\nimport GitHubIcon from '@mui/icons-material/GitHub';\nimport TwitterIcon from '@mui/icons-material/Twitter';\nimport InstagramIcon from '@mui/icons-material/Instagram';\nimport YouTubeIcon from '@mui/icons-material/YouTube';\nimport { FiGitlab } from 'react-icons/fi';\n\nconst defaultdomainMapping = {\n 'github.com': {\n label: 'GitHub',\n icon: ,\n color: 'black',\n contrastText: 'white'\n },\n 'gitlab.com': {\n label: 'GitLab',\n icon: ,\n color: 'orange',\n contrastText: 'black'\n },\n 'opencollective.com': {\n label: 'Open Collective',\n icon: ,\n color: 'white',\n contrastText: '#297EFF'\n },\n 'facebook.com': {\n label: 'Facebook',\n icon: ,\n color: '#4267B2',\n contrastText: 'white'\n },\n 'twitter.com': {\n label: 'Twitter',\n icon: ,\n color: '#00ACEE',\n contrastText: 'white'\n },\n 'instagram.com': {\n label: 'Instagram',\n icon: ,\n color: '#8a3ab9',\n contrastText: 'white'\n },\n 'youtube.com': {\n label: 'YouTube',\n icon: ,\n color: '#FF0000',\n contrastText: 'white'\n }\n};\n\nconst useStyles = makeStyles(() => ({\n link: {\n textDecoration: 'unset',\n '& :hover': {\n cursor: 'pointer'\n }\n },\n chip: {\n paddingLeft: 5,\n paddingRight: 5,\n marginRight: 5,\n marginBottom: 5\n },\n label: {\n marginTop: -1\n }\n}));\n\nconst MultiUrlField = ({ source, domainMapping }) => {\n const newDomainMapping = { ...defaultdomainMapping, ...domainMapping };\n const record = useRecordContext();\n const classes = useStyles();\n const urlArray = record[source] ? (Array.isArray(record[source]) ? record[source] : [record[source]]) : [];\n return urlArray.map((url, index) => {\n if (!url.startsWith('http')) url = `https://${url}`;\n const parsedUrl = new URL(url);\n if (!parsedUrl) return null;\n const chip = newDomainMapping[parsedUrl.hostname] || {\n label: 'Site web',\n icon: ,\n color: '#ea',\n contrastText: 'black'\n };\n return (\n \n \n \n );\n });\n};\n\nexport default MultiUrlField;\n","import * as React from 'react';\nimport { cloneElement, Children } from 'react';\nimport { useCreatePath, useListContext, Link, RecordContextProvider } from 'react-admin';\nimport { LinearProgress } from '@mui/material';\n\n// useful to prevent click bubbling in a datagrid with rowClick\nconst stopPropagation = e => e.stopPropagation();\n\n// Our handleClick does nothing as we wrap the children inside a Link but it is\n// required by ChipField, which uses a Chip from material-ui.\n// The material-ui Chip requires an onClick handler to behave like a clickable element.\nconst handleClick = () => {};\n\nconst SeparatedListField = props => {\n let { children, link = 'edit', linkType, separator = ',\\u00A0' } = props;\n const { data, isLoading, resource } = useListContext(props);\n const createPath = useCreatePath();\n\n if (linkType !== undefined) {\n console.warn(\"The 'linkType' prop is deprecated and should be named to 'link' in \");\n link = linkType;\n }\n\n if (isLoading) return ;\n\n return (\n <>\n {data.map((record, i) => {\n if (!record.id) return null;\n const resourceLinkPath =\n link !== false &&\n (typeof link === 'function' ? link(record.id) : createPath({ resource, id: record.id, type: link }));\n if (resourceLinkPath) {\n return (\n \n \n {cloneElement(Children.only(children), {\n // Workaround to force ChipField to be clickable\n onClick: handleClick\n })}\n \n {i < data.length - 1 && separator}\n \n );\n }\n\n return (\n \n {children}\n {i < data.length - 1 && separator}\n \n );\n })}\n \n );\n};\n\nexport default SeparatedListField;\n"],"names":[],"version":3,"file":"index.cjs.js.map"} \ No newline at end of file +{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,MAAM,kCAAY,CAAA,GAAA,oDAAS,EAAE,CAAA,QAAU,CAAA;QACrC,QAAQ,CAAA,QAAU,CAAA;gBAChB,UAAU;gBACV,GAAG,MAAM,MAAM;YACjB,CAAA;QACA,QAAQ;YACN,OAAO;YACP,eAAe;YACf,UAAU;QACZ;QACA,QAAQ;YACN,UAAU;YACV,KAAK;YACL,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,cAAc;YACd,+CAA+C;YAC/C,SAAS;gBACP,OAAO;gBACP,QAAQ;YACV;QACF;QACA,MAAM;YACJ,UAAU;YACV,QAAQ;YACR,MAAM;YACN,OAAO;YACP,YAAY;YACZ,eAAe;YACf,aAAa;YACb,cAAc;YACd,cAAc;YACd,QAAQ;QACV;QACA,YAAY;YACV,OAAO;QACT;IACF,CAAA;AAEA,MAAM,oCAAc,KAAO;AAE3B,MAAM,6CAAuB,CAAC,SAAE,KAAK,gBAAE,YAAY,SAAE,KAAK,YAAE,QAAQ,gBAAE,YAAY,cAAE,UAAU,WAAE,OAAO,EAAE,GAAG,MAAM;IAChH,UAAU,gCAAU;IACpB,MAAM,SAAS,CAAA,GAAA,kCAAe;IAE9B,MAAM,gBAAgB,AAAC,CAAA,OAAO,UAAU,aAAa,MAAM,UAAU,MAAM,CAAC,MAAM,AAAD,KAAM;IACvF,MAAM,gBAAgB,OAAO,UAAU,aAAa,MAAM,UAAU,MAAM,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AI,OAAO,EAAE;gBAAE,MAAM;YAAK,EAAC;YACpG,IAAI,kBACF,qBACE,iCAAC;;kCACC,gCAAC,CAAA,GAAA,sBAAG;wBAAE,IAAI;wBAAkB,SAAS;kCAClC,cAAA,CAAA,GAAA,yBAAW,EAAE,CAAA,GAAA,qBAAO,EAAE,IAAI,CAAC,WAAW;4BACrC,gDAAgD;4BAChD,SAAS;wBACX;;oBAED,IAAI,KAAK,MAAM,GAAG,KAAK;;eAPf,OAAO,EAAE;YAYxB,qBACE,iCAAC;;kCACC,gCAAC,CAAA,GAAA,uCAAoB;wBAAE,OAAO;kCAAS;;oBACtC,IAAI,KAAK,MAAM,GAAG,KAAK;;eAFf,OAAO,EAAE;QAKxB;;AAGN;IAEA,2CAAe;;","sources":["packages/field-components/src/index.ts","packages/field-components/src/AvatarWithLabelField.js","packages/field-components/src/ReferenceArrayField.js","packages/field-components/src/ReferenceField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/MultiUrlField.js","packages/field-components/src/SeparatedListField.js"],"sourcesContent":["export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Box, Avatar, Chip } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\nconst useStyles = makeStyles(theme => ({\n parent: props => ({\n position: 'relative',\n ...props.parent\n }),\n square: {\n width: '100%',\n paddingBottom: '100%',\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n // backgroundColor: theme.palette.primary.main,\n '& svg': {\n width: '55%',\n height: '55%'\n }\n },\n chip: {\n position: 'absolute',\n bottom: -10,\n left: 0,\n right: 0,\n paddingTop: 3,\n paddingBottom: 3,\n paddingLeft: 6,\n paddingRight: 6,\n marginBottom: 10,\n cursor: 'pointer'\n },\n launchIcon: {\n width: 14\n }\n}));\n\nconst handleClick = () => {};\n\nconst AvatarWithLabelField = ({ label, defaultLabel, image, fallback, externalLink, labelColor, classes, ...rest }) => {\n classes = useStyles(classes);\n const record = useRecordContext();\n\n const computedLabel = (typeof label === 'function' ? label(record) : record[label]) || defaultLabel;\n const computedImage = typeof image === 'function' ? image(record) : record[image];\n const computedFallback = typeof fallback === 'function' ? fallback(record) : fallback;\n\n return (\n \n
\n \n
\n {!computedLabel ? null : externalLink ? (\n }\n onDelete={handleClick}\n />\n ) : (\n \n )}\n
\n );\n};\n\nAvatarWithLabelField.defaultProps = {\n labelColor: 'secondary',\n externalLink: false\n};\n\nexport default AvatarWithLabelField;\n","import React from 'react';\nimport { ReferenceArrayField as RaReferenceArrayField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceArrayField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record?.[source]) {\n if (!Array.isArray(record[source])) {\n record[source] = [record[source]];\n }\n record[source] = record[source].map(i => i['@id'] || i.id || i);\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceArrayField;\n","import React from 'react';\nimport { ReferenceField as RaReferenceField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record[source]) {\n if (typeof record[source] === 'object') {\n record[source] = record[source]['@id'] || record[source].id;\n }\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceField;\n","import React, { useState, useMemo } from 'react';\nimport { useRecordContext, usePermissions } from 'react-admin';\nimport { ReferenceArrayField } from '../index';\nimport QuickAppendDialog from './QuickAppendDialog';\n\nconst QuickAppendReferenceArrayField = ({ reference, source, resource, children, ...otherProps }) => {\n const record = useRecordContext();\n const [showDialog, setShowDialog] = useState(false);\n const { permissions } = usePermissions(record.id);\n\n const canAppend = useMemo(\n () => !!permissions && permissions.some(p => ['acl:Append', 'acl:Write', 'acl:Control'].includes(p['acl:mode'])),\n [permissions]\n );\n\n return (\n <>\n \n {React.Children.only(children) &&\n React.cloneElement(children, { appendLink: canAppend ? () => setShowDialog(true) : undefined })}\n \n {canAppend && showDialog && (\n setShowDialog(false)}\n subjectUri={record.id}\n resource={resource}\n source={source}\n reference={reference}\n />\n )}\n \n );\n};\n\nexport default QuickAppendReferenceArrayField;\n","import React, { useState, useCallback } from 'react';\nimport {\n Button,\n useDataProvider,\n useTranslate,\n useRefresh,\n useNotify,\n useGetResourceLabel,\n useShowContext\n} from 'react-admin';\nimport { Dialog, DialogTitle, TextField, DialogContent, DialogActions } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useForm } from 'react-hook-form';\nimport AddIcon from '@mui/icons-material/Add';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport ResultsList from './ResultsList';\n\nconst useStyles = makeStyles(() => ({\n title: {\n paddingBottom: 8\n },\n actions: {\n padding: 15\n },\n addForm: {\n paddingTop: 0\n },\n listForm: {\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 0,\n paddingBottom: 0,\n maxHeight: 210\n }\n}));\n\nconst QuickAppendDialog = ({ open, onClose, subjectUri, source, reference }) => {\n const classes = useStyles();\n const { resource } = useShowContext();\n const [keyword, setKeyword] = useState('');\n const [panel, setPanel] = useState('find');\n const dataProvider = useDataProvider();\n const translate = useTranslate();\n const refresh = useRefresh();\n const notify = useNotify();\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n const { register, setValue, handleSubmit } = useForm();\n\n const appendLink = useCallback(\n async objectUri => {\n // Get the freshest data so that the put operation doesn't overwrite anything\n const { data } = await dataProvider.getOne(resource, { id: subjectUri });\n\n await dataProvider.update(resource, {\n id: subjectUri,\n data: {\n ...data,\n [source]: data[source]\n ? Array.isArray(data[source])\n ? [...data[source], objectUri]\n : [data[source], objectUri]\n : objectUri\n },\n previousData: data\n });\n\n refresh();\n\n onClose();\n },\n [dataProvider, subjectUri, resource, source, refresh, onClose]\n );\n\n const create = useCallback(\n async values => {\n const { data } = await dataProvider.create(reference, {\n data: {\n [dataModel.fieldsMapping.title]: values.title\n }\n });\n\n await appendLink(data.id);\n\n notify(`La resource \"${values.title}\" a été créée`, { type: 'success' });\n },\n [dataProvider, dataModel, appendLink, reference, notify]\n );\n\n return (\n \n {panel === 'find' ? (\n <>\n Ajouter une relation\n \n setKeyword(e.target.value)}\n fullWidth\n />\n \n \n {\n setValue('title', keyword);\n setPanel('create');\n }}\n />\n \n \n \n );\n};\n\nexport default QuickAppendDialog;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport {\n useDataProvider,\n useRecordContext,\n useCreatePath,\n useGetResourceLabel,\n useResourceDefinition,\n useTranslate\n} from 'react-admin';\nimport debounce from 'lodash.debounce';\nimport {\n Box,\n IconButton,\n List,\n ListItem,\n ListItemAvatar,\n ListItemText,\n ListItemSecondaryAction,\n Avatar,\n CircularProgress\n} from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport AddIcon from '@mui/icons-material/Add';\nimport VisibilityIcon from '@mui/icons-material/Visibility';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport { useDataServers, useDataModel } from '@semapps/semantic-data-provider';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n maxWidth: '100%',\n backgroundColor: theme.palette.background.paper,\n paddingTop: 0,\n paddingBottom: 0\n },\n primaryText: {\n width: '30%'\n },\n secondaryText: {\n fontStyle: 'italic',\n color: 'grey'\n }\n}));\n\nconst getServerName = (resourceUri, dataServers) => {\n const server = dataServers && Object.values(dataServers).find(server => resourceUri.startsWith(server.baseUrl));\n return server ? server.name : 'Inconnu';\n};\n\nconst ResultsList = ({ keyword, source, reference, appendLink, switchToCreate }) => {\n const classes = useStyles();\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [results, setResults] = useState([]);\n const translate = useTranslate();\n const dataProvider = useDataProvider();\n const dataServers = useDataServers();\n const record = useRecordContext();\n const createPath = useCreatePath();\n\n const referenceDefinition = useResourceDefinition({ resource: reference });\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n\n if (dataModel && Object.keys(dataModel).length > 0 && !dataModel?.fieldsMapping?.title) {\n throw new Error(`No fieldsMapping.title config found for ${reference} dataModel`);\n }\n\n const search = useMemo(\n () =>\n debounce(keyword => {\n dataProvider\n .getList(reference, {\n pagination: { page: 1, perPage: 100 },\n sort: { field: dataModel?.fieldsMapping?.title, order: 'ASC' },\n filter: { q: keyword, _predicates: [dataModel.fieldsMapping.title], _servers: '@all' }\n })\n .then(({ data }) => {\n const existingLinks = record[source]\n ? Array.isArray(record[source])\n ? record[source]\n : [record[source]]\n : [];\n const newLinks = data.filter(record => !existingLinks.includes(record.id));\n setResults(newLinks);\n setLoaded(true);\n setLoading(false);\n })\n .catch(e => {\n setLoading(false);\n });\n }, 700),\n [dataProvider, dataModel, record, source, reference, setResults, setLoading, setLoaded]\n );\n\n useEffect(() => {\n if (!keyword) {\n return undefined;\n }\n setLoading(true);\n setLoaded(false);\n search(keyword);\n\n return () => search.cancel();\n }, [keyword, search, setLoading]);\n\n if (!keyword) return null;\n\n return (\n \n {loaded &&\n results.map(resource => (\n appendLink(resource.id)}>\n \n {React.createElement(referenceDefinition.icon)}\n \n \n \n \n \n \n \n \n \n \n \n ))}\n {loaded && results.length === 0 && (\n \n \n \n \n \n \n \n \n )}\n {loaded && referenceDefinition.hasCreate && (\n \n \n \n \n \n \n \n \n )}\n {loading && (\n \n \n \n )}\n \n );\n};\n\nexport default ResultsList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Chip, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LanguageIcon from '@mui/icons-material/Language';\nimport FacebookIcon from '@mui/icons-material/Facebook';\nimport GitHubIcon from '@mui/icons-material/GitHub';\nimport TwitterIcon from '@mui/icons-material/Twitter';\nimport InstagramIcon from '@mui/icons-material/Instagram';\nimport YouTubeIcon from '@mui/icons-material/YouTube';\nimport { FiGitlab } from 'react-icons/fi';\n\nconst defaultdomainMapping = {\n 'github.com': {\n label: 'GitHub',\n icon: ,\n color: 'black',\n contrastText: 'white'\n },\n 'gitlab.com': {\n label: 'GitLab',\n icon: ,\n color: 'orange',\n contrastText: 'black'\n },\n 'opencollective.com': {\n label: 'Open Collective',\n icon: ,\n color: 'white',\n contrastText: '#297EFF'\n },\n 'facebook.com': {\n label: 'Facebook',\n icon: ,\n color: '#4267B2',\n contrastText: 'white'\n },\n 'twitter.com': {\n label: 'Twitter',\n icon: ,\n color: '#00ACEE',\n contrastText: 'white'\n },\n 'instagram.com': {\n label: 'Instagram',\n icon: ,\n color: '#8a3ab9',\n contrastText: 'white'\n },\n 'youtube.com': {\n label: 'YouTube',\n icon: ,\n color: '#FF0000',\n contrastText: 'white'\n }\n};\n\nconst useStyles = makeStyles(() => ({\n link: {\n textDecoration: 'unset',\n '& :hover': {\n cursor: 'pointer'\n }\n },\n chip: {\n paddingLeft: 5,\n paddingRight: 5,\n marginRight: 5,\n marginBottom: 5\n },\n label: {\n marginTop: -1\n }\n}));\n\nconst MultiUrlField = ({ source, domainMapping }) => {\n const newDomainMapping = { ...defaultdomainMapping, ...domainMapping };\n const record = useRecordContext();\n const classes = useStyles();\n const urlArray = record[source] ? (Array.isArray(record[source]) ? record[source] : [record[source]]) : [];\n return urlArray.map((url, index) => {\n if (!url.startsWith('http')) url = `https://${url}`;\n\n let parsedUrl = null;\n try {\n parsedUrl = new URL(url);\n } catch (e) {\n return url;\n }\n\n const chip = newDomainMapping[parsedUrl.hostname] || {\n label: 'Site web',\n icon: ,\n color: '#ea',\n contrastText: 'black'\n };\n return (\n \n \n \n );\n });\n};\n\nexport default MultiUrlField;\n","import * as React from 'react';\nimport { cloneElement, Children } from 'react';\nimport { useCreatePath, useListContext, Link, RecordContextProvider } from 'react-admin';\nimport { LinearProgress } from '@mui/material';\n\n// useful to prevent click bubbling in a datagrid with rowClick\nconst stopPropagation = e => e.stopPropagation();\n\n// Our handleClick does nothing as we wrap the children inside a Link but it is\n// required by ChipField, which uses a Chip from material-ui.\n// The material-ui Chip requires an onClick handler to behave like a clickable element.\nconst handleClick = () => {};\n\nconst SeparatedListField = props => {\n let { children, link = 'edit', linkType, separator = ',\\u00A0' } = props;\n const { data, isLoading, resource } = useListContext(props);\n const createPath = useCreatePath();\n\n if (linkType !== undefined) {\n console.warn(\"The 'linkType' prop is deprecated and should be named to 'link' in \");\n link = linkType;\n }\n\n if (isLoading) return ;\n\n return (\n <>\n {data.map((record, i) => {\n if (!record.id) return null;\n const resourceLinkPath =\n link !== false &&\n (typeof link === 'function' ? link(record.id) : createPath({ resource, id: record.id, type: link }));\n if (resourceLinkPath) {\n return (\n \n \n {cloneElement(Children.only(children), {\n // Workaround to force ChipField to be clickable\n onClick: handleClick\n })}\n \n {i < data.length - 1 && separator}\n \n );\n }\n\n return (\n \n {children}\n {i < data.length - 1 && separator}\n \n );\n })}\n \n );\n};\n\nexport default SeparatedListField;\n"],"names":[],"version":3,"file":"index.cjs.js.map"} \ No newline at end of file diff --git a/src/frontend/packages/field-components/dist/index.d.ts.map b/src/frontend/packages/field-components/dist/index.d.ts.map index 1fe4d9199..1f59bd255 100644 --- a/src/frontend/packages/field-components/dist/index.d.ts.map +++ b/src/frontend/packages/field-components/dist/index.d.ts.map @@ -1 +1 @@ -{"mappings":";;;;;;ACGA;;;4CAaC;ACbD;;;4CAYC;AGVD;;;;;;4CA4BC;AC0CD;;;QA4BC;AC1FD,wFA0CC","sources":["packages/field-components/src/src/AvatarWithLabelField.js","packages/field-components/src/src/ReferenceArrayField.js","packages/field-components/src/src/ReferenceField.js","packages/field-components/src/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/src/MultiUrlField.js","packages/field-components/src/src/SeparatedListField.js","packages/field-components/src/src/index.ts","packages/field-components/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n"],"names":[],"version":3,"file":"index.d.ts.map"} \ No newline at end of file +{"mappings":";;;;;;ACGA;;;4CAaC;ACbD;;;4CAYC;AGVD;;;;;;4CA4BC;AC0CD;;;QAkCC;AChGD,wFA0CC","sources":["packages/field-components/src/src/AvatarWithLabelField.js","packages/field-components/src/src/ReferenceArrayField.js","packages/field-components/src/src/ReferenceField.js","packages/field-components/src/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/src/MultiUrlField.js","packages/field-components/src/src/SeparatedListField.js","packages/field-components/src/src/index.ts","packages/field-components/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n"],"names":[],"version":3,"file":"index.d.ts.map"} \ No newline at end of file diff --git a/src/frontend/packages/field-components/dist/index.es.js b/src/frontend/packages/field-components/dist/index.es.js index 8fb12d24e..48ed735ce 100644 --- a/src/frontend/packages/field-components/dist/index.es.js +++ b/src/frontend/packages/field-components/dist/index.es.js @@ -629,8 +629,12 @@ const $3964a2ca9e598444$var$MultiUrlField = ({ source: source, domainMapping: do ] : []; return urlArray.map((url, index)=>{ if (!url.startsWith("http")) url = `https://${url}`; - const parsedUrl = new URL(url); - if (!parsedUrl) return null; + let parsedUrl = null; + try { + parsedUrl = new URL(url); + } catch (e) { + return url; + } const chip = newDomainMapping[parsedUrl.hostname] || { label: "Site web", icon: /*#__PURE__*/ (0, $9pxSs$jsx)((0, $9pxSs$muiiconsmaterialLanguage), {}), diff --git a/src/frontend/packages/field-components/dist/index.es.js.map b/src/frontend/packages/field-components/dist/index.es.js.map index 86fc01957..ce7e35c50 100644 --- a/src/frontend/packages/field-components/dist/index.es.js.map +++ b/src/frontend/packages/field-components/dist/index.es.js.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,MAAM,kCAAY,CAAA,GAAA,0BAAS,EAAE,CAAA,QAAU,CAAA;QACrC,QAAQ,CAAA,QAAU,CAAA;gBAChB,UAAU;gBACV,GAAG,MAAM,MAAM;YACjB,CAAA;QACA,QAAQ;YACN,OAAO;YACP,eAAe;YACf,UAAU;QACZ;QACA,QAAQ;YACN,UAAU;YACV,KAAK;YACL,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,cAAc;YACd,+CAA+C;YAC/C,SAAS;gBACP,OAAO;gBACP,QAAQ;YACV;QACF;QACA,MAAM;YACJ,UAAU;YACV,QAAQ;YACR,MAAM;YACN,OAAO;YACP,YAAY;YACZ,eAAe;YACf,aAAa;YACb,cAAc;YACd,cAAc;YACd,QAAQ;QACV;QACA,YAAY;YACV,OAAO;QACT;IACF,CAAA;AAEA,MAAM,oCAAc,KAAO;AAE3B,MAAM,6CAAuB,CAAC,SAAE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I,WAAW,qBAAO,gBAAC,CAAA,GAAA,qBAAa;IAEpC,qBACE;kBACG,KAAK,GAAG,CAAC,CAAC,QAAQ;YACjB,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO;YACvB,MAAM,mBACJ,SAAS,SACR,CAAA,OAAO,SAAS,aAAa,KAAK,OAAO,EAAE,IAAI,WAAW;0BAAE;gBAAU,IAAI,OAAO,EAAE;gBAAE,MAAM;YAAK,EAAC;YACpG,IAAI,kBACF,qBACE,iBAAC;;kCACC,gBAAC,CAAA,GAAA,WAAG;wBAAE,IAAI;wBAAkB,SAAS;kCAClC,cAAA,CAAA,GAAA,mBAAW,EAAE,CAAA,GAAA,eAAO,EAAE,IAAI,CAAC,WAAW;4BACrC,gDAAgD;4BAChD,SAAS;wBACX;;oBAED,IAAI,KAAK,MAAM,GAAG,KAAK;;eAPf,OAAO,EAAE;YAYxB,qBACE,iBAAC;;kCACC,gBAAC,CAAA,GAAA,4BAAoB;wBAAE,OAAO;kCAAS;;oBACtC,IAAI,KAAK,MAAM,GAAG,KAAK;;eAFf,OAAO,EAAE;QAKxB;;AAGN;IAEA,2CAAe;;","sources":["packages/field-components/src/index.ts","packages/field-components/src/AvatarWithLabelField.js","packages/field-components/src/ReferenceArrayField.js","packages/field-components/src/ReferenceField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/MultiUrlField.js","packages/field-components/src/SeparatedListField.js"],"sourcesContent":["export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Box, Avatar, Chip } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\nconst useStyles = makeStyles(theme => ({\n parent: props => ({\n position: 'relative',\n ...props.parent\n }),\n square: {\n width: '100%',\n paddingBottom: '100%',\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n // backgroundColor: theme.palette.primary.main,\n '& svg': {\n width: '55%',\n height: '55%'\n }\n },\n chip: {\n position: 'absolute',\n bottom: -10,\n left: 0,\n right: 0,\n paddingTop: 3,\n paddingBottom: 3,\n paddingLeft: 6,\n paddingRight: 6,\n marginBottom: 10,\n cursor: 'pointer'\n },\n launchIcon: {\n width: 14\n }\n}));\n\nconst handleClick = () => {};\n\nconst AvatarWithLabelField = ({ label, defaultLabel, image, fallback, externalLink, labelColor, classes, ...rest }) => {\n classes = useStyles(classes);\n const record = useRecordContext();\n\n const computedLabel = (typeof label === 'function' ? label(record) : record[label]) || defaultLabel;\n const computedImage = typeof image === 'function' ? image(record) : record[image];\n const computedFallback = typeof fallback === 'function' ? fallback(record) : fallback;\n\n return (\n \n
\n \n
\n {!computedLabel ? null : externalLink ? (\n }\n onDelete={handleClick}\n />\n ) : (\n \n )}\n
\n );\n};\n\nAvatarWithLabelField.defaultProps = {\n labelColor: 'secondary',\n externalLink: false\n};\n\nexport default AvatarWithLabelField;\n","import React from 'react';\nimport { ReferenceArrayField as RaReferenceArrayField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceArrayField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record?.[source]) {\n if (!Array.isArray(record[source])) {\n record[source] = [record[source]];\n }\n record[source] = record[source].map(i => i['@id'] || i.id || i);\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceArrayField;\n","import React from 'react';\nimport { ReferenceField as RaReferenceField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record[source]) {\n if (typeof record[source] === 'object') {\n record[source] = record[source]['@id'] || record[source].id;\n }\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceField;\n","import React, { useState, useMemo } from 'react';\nimport { useRecordContext, usePermissions } from 'react-admin';\nimport { ReferenceArrayField } from '../index';\nimport QuickAppendDialog from './QuickAppendDialog';\n\nconst QuickAppendReferenceArrayField = ({ reference, source, resource, children, ...otherProps }) => {\n const record = useRecordContext();\n const [showDialog, setShowDialog] = useState(false);\n const { permissions } = usePermissions(record.id);\n\n const canAppend = useMemo(\n () => !!permissions && permissions.some(p => ['acl:Append', 'acl:Write', 'acl:Control'].includes(p['acl:mode'])),\n [permissions]\n );\n\n return (\n <>\n \n {React.Children.only(children) &&\n React.cloneElement(children, { appendLink: canAppend ? () => setShowDialog(true) : undefined })}\n \n {canAppend && showDialog && (\n setShowDialog(false)}\n subjectUri={record.id}\n resource={resource}\n source={source}\n reference={reference}\n />\n )}\n \n );\n};\n\nexport default QuickAppendReferenceArrayField;\n","import React, { useState, useCallback } from 'react';\nimport {\n Button,\n useDataProvider,\n useTranslate,\n useRefresh,\n useNotify,\n useGetResourceLabel,\n useShowContext\n} from 'react-admin';\nimport { Dialog, DialogTitle, TextField, DialogContent, DialogActions } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useForm } from 'react-hook-form';\nimport AddIcon from '@mui/icons-material/Add';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport ResultsList from './ResultsList';\n\nconst useStyles = makeStyles(() => ({\n title: {\n paddingBottom: 8\n },\n actions: {\n padding: 15\n },\n addForm: {\n paddingTop: 0\n },\n listForm: {\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 0,\n paddingBottom: 0,\n maxHeight: 210\n }\n}));\n\nconst QuickAppendDialog = ({ open, onClose, subjectUri, source, reference }) => {\n const classes = useStyles();\n const { resource } = useShowContext();\n const [keyword, setKeyword] = useState('');\n const [panel, setPanel] = useState('find');\n const dataProvider = useDataProvider();\n const translate = useTranslate();\n const refresh = useRefresh();\n const notify = useNotify();\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n const { register, setValue, handleSubmit } = useForm();\n\n const appendLink = useCallback(\n async objectUri => {\n // Get the freshest data so that the put operation doesn't overwrite anything\n const { data } = await dataProvider.getOne(resource, { id: subjectUri });\n\n await dataProvider.update(resource, {\n id: subjectUri,\n data: {\n ...data,\n [source]: data[source]\n ? Array.isArray(data[source])\n ? [...data[source], objectUri]\n : [data[source], objectUri]\n : objectUri\n },\n previousData: data\n });\n\n refresh();\n\n onClose();\n },\n [dataProvider, subjectUri, resource, source, refresh, onClose]\n );\n\n const create = useCallback(\n async values => {\n const { data } = await dataProvider.create(reference, {\n data: {\n [dataModel.fieldsMapping.title]: values.title\n }\n });\n\n await appendLink(data.id);\n\n notify(`La resource \"${values.title}\" a été créée`, { type: 'success' });\n },\n [dataProvider, dataModel, appendLink, reference, notify]\n );\n\n return (\n \n {panel === 'find' ? (\n <>\n Ajouter une relation\n \n setKeyword(e.target.value)}\n fullWidth\n />\n \n \n {\n setValue('title', keyword);\n setPanel('create');\n }}\n />\n \n \n \n );\n};\n\nexport default QuickAppendDialog;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport {\n useDataProvider,\n useRecordContext,\n useCreatePath,\n useGetResourceLabel,\n useResourceDefinition,\n useTranslate\n} from 'react-admin';\nimport debounce from 'lodash.debounce';\nimport {\n Box,\n IconButton,\n List,\n ListItem,\n ListItemAvatar,\n ListItemText,\n ListItemSecondaryAction,\n Avatar,\n CircularProgress\n} from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport AddIcon from '@mui/icons-material/Add';\nimport VisibilityIcon from '@mui/icons-material/Visibility';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport { useDataServers, useDataModel } from '@semapps/semantic-data-provider';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n maxWidth: '100%',\n backgroundColor: theme.palette.background.paper,\n paddingTop: 0,\n paddingBottom: 0\n },\n primaryText: {\n width: '30%'\n },\n secondaryText: {\n fontStyle: 'italic',\n color: 'grey'\n }\n}));\n\nconst getServerName = (resourceUri, dataServers) => {\n const server = dataServers && Object.values(dataServers).find(server => resourceUri.startsWith(server.baseUrl));\n return server ? server.name : 'Inconnu';\n};\n\nconst ResultsList = ({ keyword, source, reference, appendLink, switchToCreate }) => {\n const classes = useStyles();\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [results, setResults] = useState([]);\n const translate = useTranslate();\n const dataProvider = useDataProvider();\n const dataServers = useDataServers();\n const record = useRecordContext();\n const createPath = useCreatePath();\n\n const referenceDefinition = useResourceDefinition({ resource: reference });\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n\n if (dataModel && Object.keys(dataModel).length > 0 && !dataModel?.fieldsMapping?.title) {\n throw new Error(`No fieldsMapping.title config found for ${reference} dataModel`);\n }\n\n const search = useMemo(\n () =>\n debounce(keyword => {\n dataProvider\n .getList(reference, {\n pagination: { page: 1, perPage: 100 },\n sort: { field: dataModel?.fieldsMapping?.title, order: 'ASC' },\n filter: { q: keyword, _predicates: [dataModel.fieldsMapping.title], _servers: '@all' }\n })\n .then(({ data }) => {\n const existingLinks = record[source]\n ? Array.isArray(record[source])\n ? record[source]\n : [record[source]]\n : [];\n const newLinks = data.filter(record => !existingLinks.includes(record.id));\n setResults(newLinks);\n setLoaded(true);\n setLoading(false);\n })\n .catch(e => {\n setLoading(false);\n });\n }, 700),\n [dataProvider, dataModel, record, source, reference, setResults, setLoading, setLoaded]\n );\n\n useEffect(() => {\n if (!keyword) {\n return undefined;\n }\n setLoading(true);\n setLoaded(false);\n search(keyword);\n\n return () => search.cancel();\n }, [keyword, search, setLoading]);\n\n if (!keyword) return null;\n\n return (\n \n {loaded &&\n results.map(resource => (\n appendLink(resource.id)}>\n \n {React.createElement(referenceDefinition.icon)}\n \n \n \n \n \n \n \n \n \n \n \n ))}\n {loaded && results.length === 0 && (\n \n \n \n \n \n \n \n \n )}\n {loaded && referenceDefinition.hasCreate && (\n \n \n \n \n \n \n \n \n )}\n {loading && (\n \n \n \n )}\n \n );\n};\n\nexport default ResultsList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Chip, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LanguageIcon from '@mui/icons-material/Language';\nimport FacebookIcon from '@mui/icons-material/Facebook';\nimport GitHubIcon from '@mui/icons-material/GitHub';\nimport TwitterIcon from '@mui/icons-material/Twitter';\nimport InstagramIcon from '@mui/icons-material/Instagram';\nimport YouTubeIcon from '@mui/icons-material/YouTube';\nimport { FiGitlab } from 'react-icons/fi';\n\nconst defaultdomainMapping = {\n 'github.com': {\n label: 'GitHub',\n icon: ,\n color: 'black',\n contrastText: 'white'\n },\n 'gitlab.com': {\n label: 'GitLab',\n icon: ,\n color: 'orange',\n contrastText: 'black'\n },\n 'opencollective.com': {\n label: 'Open Collective',\n icon: ,\n color: 'white',\n contrastText: '#297EFF'\n },\n 'facebook.com': {\n label: 'Facebook',\n icon: ,\n color: '#4267B2',\n contrastText: 'white'\n },\n 'twitter.com': {\n label: 'Twitter',\n icon: ,\n color: '#00ACEE',\n contrastText: 'white'\n },\n 'instagram.com': {\n label: 'Instagram',\n icon: ,\n color: '#8a3ab9',\n contrastText: 'white'\n },\n 'youtube.com': {\n label: 'YouTube',\n icon: ,\n color: '#FF0000',\n contrastText: 'white'\n }\n};\n\nconst useStyles = makeStyles(() => ({\n link: {\n textDecoration: 'unset',\n '& :hover': {\n cursor: 'pointer'\n }\n },\n chip: {\n paddingLeft: 5,\n paddingRight: 5,\n marginRight: 5,\n marginBottom: 5\n },\n label: {\n marginTop: -1\n }\n}));\n\nconst MultiUrlField = ({ source, domainMapping }) => {\n const newDomainMapping = { ...defaultdomainMapping, ...domainMapping };\n const record = useRecordContext();\n const classes = useStyles();\n const urlArray = record[source] ? (Array.isArray(record[source]) ? record[source] : [record[source]]) : [];\n return urlArray.map((url, index) => {\n if (!url.startsWith('http')) url = `https://${url}`;\n const parsedUrl = new URL(url);\n if (!parsedUrl) return null;\n const chip = newDomainMapping[parsedUrl.hostname] || {\n label: 'Site web',\n icon: ,\n color: '#ea',\n contrastText: 'black'\n };\n return (\n \n \n \n );\n });\n};\n\nexport default MultiUrlField;\n","import * as React from 'react';\nimport { cloneElement, Children } from 'react';\nimport { useCreatePath, useListContext, Link, RecordContextProvider } from 'react-admin';\nimport { LinearProgress } from '@mui/material';\n\n// useful to prevent click bubbling in a datagrid with rowClick\nconst stopPropagation = e => e.stopPropagation();\n\n// Our handleClick does nothing as we wrap the children inside a Link but it is\n// required by ChipField, which uses a Chip from material-ui.\n// The material-ui Chip requires an onClick handler to behave like a clickable element.\nconst handleClick = () => {};\n\nconst SeparatedListField = props => {\n let { children, link = 'edit', linkType, separator = ',\\u00A0' } = props;\n const { data, isLoading, resource } = useListContext(props);\n const createPath = useCreatePath();\n\n if (linkType !== undefined) {\n console.warn(\"The 'linkType' prop is deprecated and should be named to 'link' in \");\n link = linkType;\n }\n\n if (isLoading) return ;\n\n return (\n <>\n {data.map((record, i) => {\n if (!record.id) return null;\n const resourceLinkPath =\n link !== false &&\n (typeof link === 'function' ? link(record.id) : createPath({ resource, id: record.id, type: link }));\n if (resourceLinkPath) {\n return (\n \n \n {cloneElement(Children.only(children), {\n // Workaround to force ChipField to be clickable\n onClick: handleClick\n })}\n \n {i < data.length - 1 && separator}\n \n );\n }\n\n return (\n \n {children}\n {i < data.length - 1 && separator}\n \n );\n })}\n \n );\n};\n\nexport default SeparatedListField;\n"],"names":[],"version":3,"file":"index.es.js.map"} \ No newline at end of file +{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;ACMA,MAAM,kCAAY,CAAA,GAAA,0BAAS,EAAE,CAAA,QAAU,CAAA;QACrC,QAAQ,CAAA,QAAU,CAAA;gBAChB,UAA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abelField.js","packages/field-components/src/ReferenceArrayField.js","packages/field-components/src/ReferenceField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendReferenceArrayField.js","packages/field-components/src/QuickAppendReferenceArrayField/QuickAppendDialog.js","packages/field-components/src/QuickAppendReferenceArrayField/ResultsList.js","packages/field-components/src/MultiUrlField.js","packages/field-components/src/SeparatedListField.js"],"sourcesContent":["export { default as AvatarWithLabelField } from './AvatarWithLabelField';\nexport { default as ReferenceArrayField } from './ReferenceArrayField';\nexport { default as ReferenceField } from './ReferenceField';\nexport { default as QuickAppendReferenceArrayField } from './QuickAppendReferenceArrayField/QuickAppendReferenceArrayField';\nexport { default as MultiUrlField } from './MultiUrlField';\nexport { default as SeparatedListField } from './SeparatedListField';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Box, Avatar, Chip } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\nconst useStyles = makeStyles(theme => ({\n parent: props => ({\n position: 'relative',\n ...props.parent\n }),\n square: {\n width: '100%',\n paddingBottom: '100%',\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n width: '100%',\n height: '100%',\n borderRadius: '50%',\n // backgroundColor: theme.palette.primary.main,\n '& svg': {\n width: '55%',\n height: '55%'\n }\n },\n chip: {\n position: 'absolute',\n bottom: -10,\n left: 0,\n right: 0,\n paddingTop: 3,\n paddingBottom: 3,\n paddingLeft: 6,\n paddingRight: 6,\n marginBottom: 10,\n cursor: 'pointer'\n },\n launchIcon: {\n width: 14\n }\n}));\n\nconst handleClick = () => {};\n\nconst AvatarWithLabelField = ({ label, defaultLabel, image, fallback, externalLink, labelColor, classes, ...rest }) => {\n classes = useStyles(classes);\n const record = useRecordContext();\n\n const computedLabel = (typeof label === 'function' ? label(record) : record[label]) || defaultLabel;\n const computedImage = typeof image === 'function' ? image(record) : record[image];\n const computedFallback = typeof fallback === 'function' ? fallback(record) : fallback;\n\n return (\n \n
\n \n
\n {!computedLabel ? null : externalLink ? (\n }\n onDelete={handleClick}\n />\n ) : (\n \n )}\n
\n );\n};\n\nAvatarWithLabelField.defaultProps = {\n labelColor: 'secondary',\n externalLink: false\n};\n\nexport default AvatarWithLabelField;\n","import React from 'react';\nimport { ReferenceArrayField as RaReferenceArrayField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceArrayField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record?.[source]) {\n if (!Array.isArray(record[source])) {\n record[source] = [record[source]];\n }\n record[source] = record[source].map(i => i['@id'] || i.id || i);\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceArrayField;\n","import React from 'react';\nimport { ReferenceField as RaReferenceField, useRecordContext, RecordContextProvider } from 'react-admin';\n\nconst ReferenceField = ({ source, ...otherProps }) => {\n const record = useRecordContext();\n if (record[source]) {\n if (typeof record[source] === 'object') {\n record[source] = record[source]['@id'] || record[source].id;\n }\n }\n return (\n \n \n \n );\n};\n\nexport default ReferenceField;\n","import React, { useState, useMemo } from 'react';\nimport { useRecordContext, usePermissions } from 'react-admin';\nimport { ReferenceArrayField } from '../index';\nimport QuickAppendDialog from './QuickAppendDialog';\n\nconst QuickAppendReferenceArrayField = ({ reference, source, resource, children, ...otherProps }) => {\n const record = useRecordContext();\n const [showDialog, setShowDialog] = useState(false);\n const { permissions } = usePermissions(record.id);\n\n const canAppend = useMemo(\n () => !!permissions && permissions.some(p => ['acl:Append', 'acl:Write', 'acl:Control'].includes(p['acl:mode'])),\n [permissions]\n );\n\n return (\n <>\n \n {React.Children.only(children) &&\n React.cloneElement(children, { appendLink: canAppend ? () => setShowDialog(true) : undefined })}\n \n {canAppend && showDialog && (\n setShowDialog(false)}\n subjectUri={record.id}\n resource={resource}\n source={source}\n reference={reference}\n />\n )}\n \n );\n};\n\nexport default QuickAppendReferenceArrayField;\n","import React, { useState, useCallback } from 'react';\nimport {\n Button,\n useDataProvider,\n useTranslate,\n useRefresh,\n useNotify,\n useGetResourceLabel,\n useShowContext\n} from 'react-admin';\nimport { Dialog, DialogTitle, TextField, DialogContent, DialogActions } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useForm } from 'react-hook-form';\nimport AddIcon from '@mui/icons-material/Add';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport ResultsList from './ResultsList';\n\nconst useStyles = makeStyles(() => ({\n title: {\n paddingBottom: 8\n },\n actions: {\n padding: 15\n },\n addForm: {\n paddingTop: 0\n },\n listForm: {\n paddingLeft: 8,\n paddingRight: 8,\n paddingTop: 0,\n paddingBottom: 0,\n maxHeight: 210\n }\n}));\n\nconst QuickAppendDialog = ({ open, onClose, subjectUri, source, reference }) => {\n const classes = useStyles();\n const { resource } = useShowContext();\n const [keyword, setKeyword] = useState('');\n const [panel, setPanel] = useState('find');\n const dataProvider = useDataProvider();\n const translate = useTranslate();\n const refresh = useRefresh();\n const notify = useNotify();\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n const { register, setValue, handleSubmit } = useForm();\n\n const appendLink = useCallback(\n async objectUri => {\n // Get the freshest data so that the put operation doesn't overwrite anything\n const { data } = await dataProvider.getOne(resource, { id: subjectUri });\n\n await dataProvider.update(resource, {\n id: subjectUri,\n data: {\n ...data,\n [source]: data[source]\n ? Array.isArray(data[source])\n ? [...data[source], objectUri]\n : [data[source], objectUri]\n : objectUri\n },\n previousData: data\n });\n\n refresh();\n\n onClose();\n },\n [dataProvider, subjectUri, resource, source, refresh, onClose]\n );\n\n const create = useCallback(\n async values => {\n const { data } = await dataProvider.create(reference, {\n data: {\n [dataModel.fieldsMapping.title]: values.title\n }\n });\n\n await appendLink(data.id);\n\n notify(`La resource \"${values.title}\" a été créée`, { type: 'success' });\n },\n [dataProvider, dataModel, appendLink, reference, notify]\n );\n\n return (\n \n {panel === 'find' ? (\n <>\n Ajouter une relation\n \n setKeyword(e.target.value)}\n fullWidth\n />\n \n \n {\n setValue('title', keyword);\n setPanel('create');\n }}\n />\n \n \n \n );\n};\n\nexport default QuickAppendDialog;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport {\n useDataProvider,\n useRecordContext,\n useCreatePath,\n useGetResourceLabel,\n useResourceDefinition,\n useTranslate\n} from 'react-admin';\nimport debounce from 'lodash.debounce';\nimport {\n Box,\n IconButton,\n List,\n ListItem,\n ListItemAvatar,\n ListItemText,\n ListItemSecondaryAction,\n Avatar,\n CircularProgress\n} from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport AddIcon from '@mui/icons-material/Add';\nimport VisibilityIcon from '@mui/icons-material/Visibility';\nimport ErrorIcon from '@mui/icons-material/Error';\nimport { useDataServers, useDataModel } from '@semapps/semantic-data-provider';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: '100%',\n maxWidth: '100%',\n backgroundColor: theme.palette.background.paper,\n paddingTop: 0,\n paddingBottom: 0\n },\n primaryText: {\n width: '30%'\n },\n secondaryText: {\n fontStyle: 'italic',\n color: 'grey'\n }\n}));\n\nconst getServerName = (resourceUri, dataServers) => {\n const server = dataServers && Object.values(dataServers).find(server => resourceUri.startsWith(server.baseUrl));\n return server ? server.name : 'Inconnu';\n};\n\nconst ResultsList = ({ keyword, source, reference, appendLink, switchToCreate }) => {\n const classes = useStyles();\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [results, setResults] = useState([]);\n const translate = useTranslate();\n const dataProvider = useDataProvider();\n const dataServers = useDataServers();\n const record = useRecordContext();\n const createPath = useCreatePath();\n\n const referenceDefinition = useResourceDefinition({ resource: reference });\n const getResourceLabel = useGetResourceLabel();\n const dataModel = useDataModel(reference);\n\n if (dataModel && Object.keys(dataModel).length > 0 && !dataModel?.fieldsMapping?.title) {\n throw new Error(`No fieldsMapping.title config found for ${reference} dataModel`);\n }\n\n const search = useMemo(\n () =>\n debounce(keyword => {\n dataProvider\n .getList(reference, {\n pagination: { page: 1, perPage: 100 },\n sort: { field: dataModel?.fieldsMapping?.title, order: 'ASC' },\n filter: { q: keyword, _predicates: [dataModel.fieldsMapping.title], _servers: '@all' }\n })\n .then(({ data }) => {\n const existingLinks = record[source]\n ? Array.isArray(record[source])\n ? record[source]\n : [record[source]]\n : [];\n const newLinks = data.filter(record => !existingLinks.includes(record.id));\n setResults(newLinks);\n setLoaded(true);\n setLoading(false);\n })\n .catch(e => {\n setLoading(false);\n });\n }, 700),\n [dataProvider, dataModel, record, source, reference, setResults, setLoading, setLoaded]\n );\n\n useEffect(() => {\n if (!keyword) {\n return undefined;\n }\n setLoading(true);\n setLoaded(false);\n search(keyword);\n\n return () => search.cancel();\n }, [keyword, search, setLoading]);\n\n if (!keyword) return null;\n\n return (\n \n {loaded &&\n results.map(resource => (\n appendLink(resource.id)}>\n \n {React.createElement(referenceDefinition.icon)}\n \n \n \n \n \n \n \n \n \n \n \n ))}\n {loaded && results.length === 0 && (\n \n \n \n \n \n \n \n \n )}\n {loaded && referenceDefinition.hasCreate && (\n \n \n \n \n \n \n \n \n )}\n {loading && (\n \n \n \n )}\n \n );\n};\n\nexport default ResultsList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport { Chip, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport LanguageIcon from '@mui/icons-material/Language';\nimport FacebookIcon from '@mui/icons-material/Facebook';\nimport GitHubIcon from '@mui/icons-material/GitHub';\nimport TwitterIcon from '@mui/icons-material/Twitter';\nimport InstagramIcon from '@mui/icons-material/Instagram';\nimport YouTubeIcon from '@mui/icons-material/YouTube';\nimport { FiGitlab } from 'react-icons/fi';\n\nconst defaultdomainMapping = {\n 'github.com': {\n label: 'GitHub',\n icon: ,\n color: 'black',\n contrastText: 'white'\n },\n 'gitlab.com': {\n label: 'GitLab',\n icon: ,\n color: 'orange',\n contrastText: 'black'\n },\n 'opencollective.com': {\n label: 'Open Collective',\n icon: ,\n color: 'white',\n contrastText: '#297EFF'\n },\n 'facebook.com': {\n label: 'Facebook',\n icon: ,\n color: '#4267B2',\n contrastText: 'white'\n },\n 'twitter.com': {\n label: 'Twitter',\n icon: ,\n color: '#00ACEE',\n contrastText: 'white'\n },\n 'instagram.com': {\n label: 'Instagram',\n icon: ,\n color: '#8a3ab9',\n contrastText: 'white'\n },\n 'youtube.com': {\n label: 'YouTube',\n icon: ,\n color: '#FF0000',\n contrastText: 'white'\n }\n};\n\nconst useStyles = makeStyles(() => ({\n link: {\n textDecoration: 'unset',\n '& :hover': {\n cursor: 'pointer'\n }\n },\n chip: {\n paddingLeft: 5,\n paddingRight: 5,\n marginRight: 5,\n marginBottom: 5\n },\n label: {\n marginTop: -1\n }\n}));\n\nconst MultiUrlField = ({ source, domainMapping }) => {\n const newDomainMapping = { ...defaultdomainMapping, ...domainMapping };\n const record = useRecordContext();\n const classes = useStyles();\n const urlArray = record[source] ? (Array.isArray(record[source]) ? record[source] : [record[source]]) : [];\n return urlArray.map((url, index) => {\n if (!url.startsWith('http')) url = `https://${url}`;\n\n let parsedUrl = null;\n try {\n parsedUrl = new URL(url);\n } catch (e) {\n return url;\n }\n\n const chip = newDomainMapping[parsedUrl.hostname] || {\n label: 'Site web',\n icon: ,\n color: '#ea',\n contrastText: 'black'\n };\n return (\n \n \n \n );\n });\n};\n\nexport default MultiUrlField;\n","import * as React from 'react';\nimport { cloneElement, Children } from 'react';\nimport { useCreatePath, useListContext, Link, RecordContextProvider } from 'react-admin';\nimport { LinearProgress } from '@mui/material';\n\n// useful to prevent click bubbling in a datagrid with rowClick\nconst stopPropagation = e => e.stopPropagation();\n\n// Our handleClick does nothing as we wrap the children inside a Link but it is\n// required by ChipField, which uses a Chip from material-ui.\n// The material-ui Chip requires an onClick handler to behave like a clickable element.\nconst handleClick = () => {};\n\nconst SeparatedListField = props => {\n let { children, link = 'edit', linkType, separator = ',\\u00A0' } = props;\n const { data, isLoading, resource } = useListContext(props);\n const createPath = useCreatePath();\n\n if (linkType !== undefined) {\n console.warn(\"The 'linkType' prop is deprecated and should be named to 'link' in \");\n link = linkType;\n }\n\n if (isLoading) return ;\n\n return (\n <>\n {data.map((record, i) => {\n if (!record.id) return null;\n const resourceLinkPath =\n link !== false &&\n (typeof link === 'function' ? link(record.id) : createPath({ resource, id: record.id, type: link }));\n if (resourceLinkPath) {\n return (\n \n \n {cloneElement(Children.only(children), {\n // Workaround to force ChipField to be clickable\n onClick: handleClick\n })}\n \n {i < data.length - 1 && separator}\n \n );\n }\n\n return (\n \n {children}\n {i < data.length - 1 && separator}\n \n );\n })}\n \n );\n};\n\nexport default SeparatedListField;\n"],"names":[],"version":3,"file":"index.es.js.map"} \ No newline at end of file diff --git a/src/frontend/packages/field-components/src/MultiUrlField.js b/src/frontend/packages/field-components/src/MultiUrlField.js index de4535e96..72b3c94b4 100644 --- a/src/frontend/packages/field-components/src/MultiUrlField.js +++ b/src/frontend/packages/field-components/src/MultiUrlField.js @@ -80,8 +80,14 @@ const MultiUrlField = ({ source, domainMapping }) => { const urlArray = record[source] ? (Array.isArray(record[source]) ? record[source] : [record[source]]) : []; return urlArray.map((url, index) => { if (!url.startsWith('http')) url = `https://${url}`; - const parsedUrl = new URL(url); - if (!parsedUrl) return null; + + let parsedUrl = null; + try { + parsedUrl = new URL(url); + } catch (e) { + return url; + } + const chip = newDomainMapping[parsedUrl.hostname] || { label: 'Site web', icon: ,