more bugfixes

This commit is contained in:
JesmoDev
2024-02-15 16:44:57 +01:00
parent e37bbcbc9b
commit be9be956b6
2 changed files with 21 additions and 8 deletions

View File

@@ -44,6 +44,8 @@ export class UmbInputUploadFieldFileElement extends UmbLitElement {
if (_changedProperties.has('path')) {
if (this.#serverUrl) {
if (this.file) return;
this.extension = this.path.split('.').pop() || '';
this.label = this.#serverUrl ? this.path.substring(this.#serverUrl.length) : 'loading...';
}
@@ -51,9 +53,9 @@ export class UmbInputUploadFieldFileElement extends UmbLitElement {
}
#renderLabel() {
if (this.path) return html`<a href=${this.path}>${this.label}</a>`;
if (this.path) return html`<a id="label" href=${this.path}>${this.label}</a>`;
return html`<span>${this.label}</span>`;
return html`<span id="label">${this.label}</span>`;
}
render() {
@@ -81,6 +83,21 @@ export class UmbInputUploadFieldFileElement extends UmbLitElement {
max-width: 100%;
max-height: 100%;
}
#label {
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--uui-color-text);
}
a#label {
text-decoration: none;
color: var(--uui-color-interactive);
}
a#label:hover {
text-decoration: underline;
color: var(--uui-color-interactive-emphasis);
}
`,
];
}

View File

@@ -221,7 +221,7 @@ export class UmbInputUploadFieldElement extends FormControlMixin(UmbLitElement)
const type = this.#getFileTypeFromPath(file.path);
return html`
<div style="position:relative; display: flex">
<div style="position:relative; display: flex; width: fit-content; max-width: 100%">
${getElementTemplate()}
${file.queueItem?.status === 'waiting' ? html`<umb-temporary-file-badge></umb-temporary-file-badge>` : nothing}
</div>
@@ -270,7 +270,7 @@ export class UmbInputUploadFieldElement extends FormControlMixin(UmbLitElement)
#renderButtonRemove() {
if (!this._files.length && !this._files.length) return;
return html`<uui-button compact @click=${this.#handleRemove} label="Remove files">
<uui-icon name="icon-trash"></uui-icon> Remove file(s)
<uui-icon name="icon-trash"></uui-icon> Remove file ${this._files.length > 1 ? 's' : ''}
</uui-button>`;
}
@@ -299,10 +299,6 @@ export class UmbInputUploadFieldElement extends FormControlMixin(UmbLitElement)
padding: var(--uui-size-space-4);
border: 1px solid var(--uui-color-border);
border-radius: var(--uui-border-radius);
justify-items: center;
}
#wrapper:has(* + *) {
justify-items: unset;
}
uui-file-dropzone {