fix(ui): jumping hasmany uploads when form is submitting or in readonly mode (#9198)

This commit is contained in:
Paul
2024-11-14 13:39:31 -06:00
committed by GitHub
parent 2d7626c3e9
commit 315b4e566b
3 changed files with 12 additions and 4 deletions

View File

@@ -5,6 +5,14 @@
position: relative; position: relative;
max-width: 100%; max-width: 100%;
&__drag {
&[aria-disabled='true'] {
&:hover {
cursor: default;
}
}
}
&__draggable-rows { &__draggable-rows {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -76,7 +76,7 @@ export function UploadComponentHasMany(props: Props) {
} }
return ( return (
<DraggableSortableItem disabled={!isSortable} id={id} key={id}> <DraggableSortableItem disabled={!isSortable || readonly} id={id} key={id}>
{(draggableSortableItemProps) => ( {(draggableSortableItemProps) => (
<div <div
className={[ className={[
@@ -93,7 +93,7 @@ export function UploadComponentHasMany(props: Props) {
}} }}
> >
<UploadCard size="small"> <UploadCard size="small">
{isSortable && draggableSortableItemProps && ( {draggableSortableItemProps && (
<div <div
className={`${baseClass}__drag`} className={`${baseClass}__drag`}
{...draggableSortableItemProps.attributes} {...draggableSortableItemProps.attributes}

View File

@@ -158,7 +158,7 @@ export function UploadInput(props: UploadInputProps) {
const loadedValueDocsRef = React.useRef<boolean>(false) const loadedValueDocsRef = React.useRef<boolean>(false)
const canCreate = useMemo(() => { const canCreate = useMemo(() => {
if (readOnly || !allowCreate) { if (!allowCreate) {
return false return false
} }
@@ -558,7 +558,7 @@ export function UploadInput(props: UploadInputProps) {
/> />
</div> </div>
{canCreate && ( {canCreate && !readOnly && (
<p className={`${baseClass}__dragAndDropText`}> <p className={`${baseClass}__dragAndDropText`}>
{t('general:or')} {t('upload:dragAndDrop')} {t('general:or')} {t('upload:dragAndDrop')}
</p> </p>