fix(ui): jumping hasmany uploads when form is submitting or in readonly mode (#9198)
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user