Merge branch 'main' into feature/folder-structure-based-on-domain-v2

This commit is contained in:
Mads Rasmussen
2023-01-02 11:30:00 +01:00
9 changed files with 80 additions and 18 deletions

View File

@@ -247,6 +247,8 @@ export class UmbUserGroupWorkspaceElement extends UmbContextProviderMixin(
import('../../../backoffice/core/components/workspace/actions/save/workspace-action-node-save.element'),
meta: {
workspaces: ['Umb.Workspace.UserGroup'],
look: 'primary',
color: 'positive'
},
},
];

View File

@@ -165,6 +165,8 @@ export class UmbWorkspaceUserElement extends UmbContextProviderMixin(
import('../../../backoffice/core/components/workspace/actions/save/workspace-action-node-save.element'),
meta: {
workspaces: ['Umb.Workspace.User'],
look: 'primary',
color: 'positive'
},
},
];

View File

@@ -0,0 +1,40 @@
import { UUITextStyles } from '@umbraco-ui/uui-css';
import { css, html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
import type { UmbCollectionContext } from '../collection.context';
import type { ManifestCollectionBulkAction } from '@umbraco-cms/models';
import { UmbContextConsumerMixin } from '@umbraco-cms/context-api';
@customElement('umb-collection-bulk-action-media-delete')
export class UmbCollectionBulkActionDeleteElement extends UmbContextConsumerMixin(LitElement) {
static styles = [UUITextStyles, css``];
// TODO: make a UmbCollectionContextMedia:
private _collectionContext?: UmbCollectionContext<any, any>;
public manifest?: ManifestCollectionBulkAction;
constructor() {
super();
this.consumeContext('umbCollectionContext', (context) => {
this._collectionContext = context;
});
}
render() {
// TODO: make a UmbCollectionContextMedia and use a deleteSelection method.
return html`<uui-button
@click=${() => this._collectionContext?.clearSelection()}
label=${ifDefined(this.manifest?.meta.label)}
color="default"
look="secondary"></uui-button>`;
}
}
declare global {
interface HTMLElementTagNameMap {
'umb-collection-bulk-action-media-delete': UmbCollectionBulkActionDeleteElement;
}
}

View File

@@ -4,6 +4,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import type { UUIButtonState } from '@umbraco-ui/uui';
import type { UmbWorkspaceNodeContext } from '../../workspace-context/workspace-node.context';
import { UmbContextConsumerMixin } from '@umbraco-cms/context-api';
import type { ManifestWorkspaceAction } from '@umbraco-cms/models';
@customElement('umb-workspace-action-node-save')
export class UmbWorkspaceActionNodeSaveElement extends UmbContextConsumerMixin(LitElement) {
@@ -15,6 +16,8 @@ export class UmbWorkspaceActionNodeSaveElement extends UmbContextConsumerMixin(L
private _workspaceContext?: UmbWorkspaceNodeContext;
public manifest?: ManifestWorkspaceAction;
constructor() {
super();
@@ -24,7 +27,7 @@ export class UmbWorkspaceActionNodeSaveElement extends UmbContextConsumerMixin(L
);
}
private async _handleSave() {
private async _onSave() {
if (!this._workspaceContext) return;
this._saveButtonState = 'waiting';
@@ -36,12 +39,14 @@ export class UmbWorkspaceActionNodeSaveElement extends UmbContextConsumerMixin(L
}
render() {
return html`<uui-button
@click=${this._handleSave}
look="primary"
color="positive"
label="save"
.state="${this._saveButtonState}"></uui-button>`;
return html`
<uui-button
@click=${this._onSave}
look=${this.manifest?.meta.look || 'default'}
color=${this.manifest?.meta.color || 'default'}
label=${this.manifest?.meta.label || 'Save'}
.state="${this._saveButtonState}"></uui-button>
`;
}
}

View File

@@ -187,15 +187,6 @@ export class UmbWorkspaceContentElement extends UmbContextProviderMixin(
</div>
<div id="footer" slot="footer">Breadcrumbs</div>
<!-- TODO: convert document workspace actions to extensions: -->
<uui-button slot="actions" @click=${this._onSaveAndPreview} label="Save and preview"></uui-button>
<uui-button slot="actions" @click=${this._onSave} look="secondary" label="Save"></uui-button>
<uui-button
slot="actions"
@click=${this._onSaveAndPublish}
look="primary"
color="positive"
label="Save and publish"></uui-button>
</umb-workspace-entity>
`;
}

View File

@@ -48,6 +48,11 @@ export class UmbWorkspaceEntity extends UmbContextConsumerMixin(UmbObserverMixin
router-slot {
height: 100%;
}
umb-extension-slot[slot='actions'] {
display: flex;
gap: 6px;
}
`,
];

View File

@@ -111,6 +111,8 @@ export class UmbWorkspaceDataTypeElement extends UmbContextProviderMixin(
loader: () => import('../../components/workspace/actions/save/workspace-action-node-save.element'),
meta: {
workspaces: ['Umb.Workspace.DataType'],
look: 'primary',
color: 'positive'
},
},
];

View File

@@ -2,7 +2,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { UmbWorkspaceMediaContext } from './workspace-media.context';
import type { ManifestWorkspaceView, ManifestWorkspaceViewCollection } from '@umbraco-cms/models';
import type { ManifestWorkspaceAction, ManifestWorkspaceView, ManifestWorkspaceViewCollection } from '@umbraco-cms/models';
import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry';
import { UmbContextConsumerMixin, UmbContextProviderMixin } from '@umbraco-cms/context-api';
@@ -57,7 +57,7 @@ export class UmbWorkspaceMediaElement extends UmbContextConsumerMixin(UmbContext
}
private _registerWorkspaceViews() {
const dashboards: Array<ManifestWorkspaceView | ManifestWorkspaceViewCollection> = [
const dashboards: Array<ManifestWorkspaceView | ManifestWorkspaceViewCollection | ManifestWorkspaceAction> = [
{
type: 'workspaceViewCollection',
alias: 'Umb.WorkspaceView.Media.Collection',
@@ -100,6 +100,17 @@ export class UmbWorkspaceMediaElement extends UmbContextConsumerMixin(UmbContext
icon: 'info',
},
},
{
type: 'workspaceAction',
alias: 'Umb.WorkspaceAction.Media.Save',
name: 'Save Media Workspace Action',
loader: () => import('../shared/actions/save/workspace-action-node-save.element'),
meta: {
workspaces: ['Umb.Workspace.Media'],
look: 'primary',
color: 'positive'
},
}
];
dashboards.forEach((dashboard) => {

View File

@@ -1,3 +1,4 @@
import type { InterfaceColor, InterfaceLook } from '@umbraco-ui/uui-base/lib/types/index'
import type { ManifestElement } from './models';
export interface ManifestWorkspaceAction extends ManifestElement {
@@ -7,4 +8,7 @@ export interface ManifestWorkspaceAction extends ManifestElement {
export interface MetaEditorAction {
workspaces: Array<string>;
label?: string, //TODO: Use or implement additional label-key
look?: InterfaceLook,
color?: InterfaceColor,
}