bulk action permission
This commit is contained in:
committed by
Jacob Overgaard
parent
b66069b524
commit
e42787bd9d
@@ -1,9 +1,28 @@
|
||||
import { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
|
||||
import { UUIBooleanInputEvent } from '@umbraco-cms/backoffice/external/uui';
|
||||
import {
|
||||
UmbPropertyEditorConfigCollection,
|
||||
UmbPropertyValueChangeEvent,
|
||||
} from '@umbraco-cms/backoffice/property-editor';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
|
||||
type BulkActionPermissionType =
|
||||
| 'allowBulkCopy'
|
||||
| 'allowBulkDelete'
|
||||
| 'allowBulkMove'
|
||||
| 'allowBulkPublish'
|
||||
| 'allowBulkUnpublish';
|
||||
|
||||
interface BulkActionPermissions {
|
||||
allowBulkCopy?: boolean;
|
||||
allowBulkDelete?: boolean;
|
||||
allowBulkMove?: boolean;
|
||||
allowBulkPublish?: boolean;
|
||||
allowBulkUnpublish?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @element umb-property-editor-ui-collection-view-bulk-action-permissions
|
||||
*/
|
||||
@@ -12,14 +31,49 @@ export class UmbPropertyEditorUICollectionViewBulkActionPermissionsElement
|
||||
extends UmbLitElement
|
||||
implements UmbPropertyEditorUiElement
|
||||
{
|
||||
@property()
|
||||
value = '';
|
||||
@property({ type: Object })
|
||||
value: BulkActionPermissions = {};
|
||||
|
||||
@property({ type: Object, attribute: false })
|
||||
public config?: UmbPropertyEditorConfigCollection;
|
||||
|
||||
#onChange(e: UUIBooleanInputEvent, type: BulkActionPermissionType) {
|
||||
switch (type) {
|
||||
case 'allowBulkPublish':
|
||||
this.value.allowBulkPublish = e.target.checked;
|
||||
break;
|
||||
case 'allowBulkUnpublish':
|
||||
this.value.allowBulkUnpublish = e.target.checked;
|
||||
break;
|
||||
case 'allowBulkMove':
|
||||
this.value.allowBulkMove = e.target.checked;
|
||||
break;
|
||||
case 'allowBulkCopy':
|
||||
this.value.allowBulkCopy = e.target.checked;
|
||||
break;
|
||||
case 'allowBulkDelete':
|
||||
this.value.allowBulkDelete = e.target.checked;
|
||||
break;
|
||||
}
|
||||
this.dispatchEvent(new UmbPropertyValueChangeEvent());
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`<div>umb-property-editor-ui-collection-view-bulk-action-permissions</div>`;
|
||||
return html`<uui-checkbox
|
||||
@change=${(e: UUIBooleanInputEvent) => this.#onChange(e, 'allowBulkPublish')}
|
||||
label="Allow bulk publish (content only)"></uui-checkbox>
|
||||
<uui-checkbox
|
||||
@change=${(e: UUIBooleanInputEvent) => this.#onChange(e, 'allowBulkUnpublish')}
|
||||
label="Allow bulk unpublish (content only)"></uui-checkbox>
|
||||
<uui-checkbox
|
||||
@change=${(e: UUIBooleanInputEvent) => this.#onChange(e, 'allowBulkCopy')}
|
||||
label="Allow bulk copy (content only)"></uui-checkbox>
|
||||
<uui-checkbox
|
||||
@change=${(e: UUIBooleanInputEvent) => this.#onChange(e, 'allowBulkMove')}
|
||||
label="Allow bulk move"></uui-checkbox>
|
||||
<uui-checkbox
|
||||
@change=${(e: UUIBooleanInputEvent) => this.#onChange(e, 'allowBulkDelete')}
|
||||
label="Allow bulk delete"></uui-checkbox> `;
|
||||
}
|
||||
|
||||
static styles = [UmbTextStyles];
|
||||
|
||||
Reference in New Issue
Block a user