Merge branch 'main' into v14/chore/bundle-templating-package

This commit is contained in:
Mads Rasmussen
2024-07-02 12:01:12 +02:00
committed by GitHub
5 changed files with 92 additions and 35 deletions

View File

@@ -35,7 +35,10 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
*/
sortBy(sortMethod?: (a: T, b: T) => number) {
this.#sortMethod = sortMethod;
super.setValue(this.getValue().sort(this.#sortMethod));
const value = this.getValue();
if(value) {
super.setValue([...value].sort(this.#sortMethod));
}
return this;
}
@@ -51,7 +54,7 @@ export class UmbArrayState<T> extends UmbDeepState<T[]> {
*/
override setValue(value: T[]) {
if (this.#sortMethod) {
super.setValue(value.sort(this.#sortMethod));
super.setValue([...value].sort(this.#sortMethod));
} else {
super.setValue(value);
}

View File

@@ -1,5 +1,5 @@
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { manifest as blockListSchemaManifest } from './Umbraco.BlockList.js';
export const UMB_BLOCK_LIST_PROPERTY_EDITOR_ALIAS = 'Umbraco.BlockList';

View File

@@ -294,7 +294,7 @@ export class UmbSplitPanelElement extends LitElement {
#divider-touch-area {
position: absolute;
top: 0;
left: 0;
left: 5px;
height: 100%;
width: var(--umb-split-panel-divider-touch-area-width);
transform: translateX(-50%);

View File

@@ -1,9 +1,9 @@
import type { UmbDocumentTreeItemModel, UmbDocumentTreeItemVariantModel } from '../types.js';
import { css, html, nothing, customElement, state, classMap } from '@umbraco-cms/backoffice/external/lit';
import type { UmbAppLanguageContext } from '@umbraco-cms/backoffice/language';
import { UMB_APP_LANGUAGE_CONTEXT } from '@umbraco-cms/backoffice/language';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UmbTreeItemElementBase } from '@umbraco-cms/backoffice/tree';
import type { UmbDocumentTreeItemModel, UmbDocumentTreeItemVariantModel } from '../types.js';
@customElement('umb-document-tree-item')
export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocumentTreeItemModel> {
@@ -74,11 +74,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
${this.item?.documentType.icon
? html`
<umb-icon id="icon" slot="icon" name="${this.item.documentType.icon}"></umb-icon>
${this.item.isProtected ? this.#renderIsProtectedIcon() : nothing}
<!--
// TODO: implement correct status symbol
<span id="status-symbol"></span>
-->
${this.#renderStateIcon()}
`
: nothing}
</span>
@@ -91,8 +87,24 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
> `;
}
#renderStateIcon() {
if (this.item?.isProtected) {
return this.#renderIsProtectedIcon();
}
if (this.item?.documentType.collection) {
return this.#renderIsCollectionIcon();
}
return nothing;
}
#renderIsCollectionIcon() {
return html`<umb-icon id="state-icon" slot="icon" name="icon-grid" title="Collection"></umb-icon>`;
}
#renderIsProtectedIcon() {
return html`<umb-icon id="icon-lock" slot="icon" name="icon-lock" title="Protected"></umb-icon>`;
return html`<umb-icon id="state-icon" slot="icon" name="icon-lock" title="Protected"></umb-icon>`;
}
static override styles = [
@@ -106,19 +118,13 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
vertical-align: middle;
}
#status-symbol {
width: 5px;
height: 5px;
border: 1px solid white;
background-color: blue;
display: block;
position: absolute;
bottom: 0;
right: 0;
border-radius: 100%;
#label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#icon-lock {
#state-icon {
position: absolute;
bottom: -5px;
right: -5px;
@@ -130,36 +136,30 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
line-height: 14px;
}
#label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
:hover #icon-lock {
:hover #state-icon {
background: var(--uui-color-surface-emphasis);
}
/** Active */
[active] #icon-lock {
[active] #state-icon {
background: var(--uui-color-current);
}
[active]:hover #icon-lock {
[active]:hover #state-icon {
background: var(--uui-color-current-emphasis);
}
/** Selected */
[selected] #icon-lock {
[selected] #state-icon {
background-color: var(--uui-color-selected);
}
[selected]:hover #icon-lock {
[selected]:hover #state-icon {
background-color: var(--uui-color-selected-emphasis);
}
/** Disabled */
[disabled] #icon-lock {
[disabled] #state-icon {
background-color: var(--uui-color-disabled);
}

View File

@@ -10,7 +10,10 @@ export class UmbMediaTreeItemElement extends UmbTreeItemElementBase<UmbMediaTree
return html`
<span id="icon-container" slot="icon">
${this.item?.mediaType.icon
? html` <umb-icon id="icon" slot="icon" name="${this.item.mediaType.icon}"></umb-icon> `
? html`
<umb-icon id="icon" slot="icon" name="${this.item.mediaType.icon}"></umb-icon>
${this.#renderStateIcon()}
`
: nothing}
</span>
`;
@@ -20,6 +23,18 @@ export class UmbMediaTreeItemElement extends UmbTreeItemElementBase<UmbMediaTree
return html`<span id="label" slot="label">${this._item?.variants[0].name}</span> `;
}
#renderStateIcon() {
if (this.item?.mediaType.collection) {
return this.#renderIsCollectionIcon();
}
return nothing;
}
#renderIsCollectionIcon() {
return html`<umb-icon id="state-icon" slot="icon" name="icon-grid" title="Collection"></umb-icon>`;
}
static override styles = [
UmbTextStyles,
css`
@@ -36,6 +51,45 @@ export class UmbMediaTreeItemElement extends UmbTreeItemElementBase<UmbMediaTree
overflow: hidden;
text-overflow: ellipsis;
}
#state-icon {
position: absolute;
bottom: -5px;
right: -5px;
font-size: 10px;
background: var(--uui-color-surface);
width: 14px;
height: 14px;
border-radius: 100%;
line-height: 14px;
}
:hover #state-icon {
background: var(--uui-color-surface-emphasis);
}
/** Active */
[active] #state-icon {
background: var(--uui-color-current);
}
[active]:hover #state-icon {
background: var(--uui-color-current-emphasis);
}
/** Selected */
[selected] #state-icon {
background-color: var(--uui-color-selected);
}
[selected]:hover #state-icon {
background-color: var(--uui-color-selected-emphasis);
}
/** Disabled */
[disabled] #state-icon {
background-color: var(--uui-color-disabled);
}
`,
];
}