pass unique to api
This commit is contained in:
@@ -6,9 +6,24 @@ import { ManifestEntityAction } from 'libs/extensions-registry/entity-action.mod
|
||||
|
||||
@customElement('umb-entity-action')
|
||||
class UmbEntityActionElement extends UmbLitElement {
|
||||
private _unique?: string;
|
||||
@property({ type: String })
|
||||
public get unique() {
|
||||
return this._unique;
|
||||
}
|
||||
public set unique(value: string | undefined) {
|
||||
if (!value) return;
|
||||
const oldValue = this._unique;
|
||||
this._unique = value;
|
||||
if (oldValue !== this._unique) {
|
||||
this.#createApi();
|
||||
this.requestUpdate('unique', oldValue);
|
||||
}
|
||||
}
|
||||
|
||||
private _manifest?: ManifestEntityAction;
|
||||
@property({ type: Object, attribute: false })
|
||||
public get entityType() {
|
||||
public get manifest() {
|
||||
return this._manifest;
|
||||
}
|
||||
public set manifest(value: ManifestEntityAction | undefined) {
|
||||
@@ -16,11 +31,16 @@ class UmbEntityActionElement extends UmbLitElement {
|
||||
const oldValue = this._manifest;
|
||||
this._manifest = value;
|
||||
if (oldValue !== this._manifest) {
|
||||
this.#api = new this._manifest.meta.api(this);
|
||||
this.#createApi();
|
||||
this.requestUpdate('manifest', oldValue);
|
||||
}
|
||||
}
|
||||
|
||||
#createApi() {
|
||||
if (!this._manifest?.meta.api) return;
|
||||
this.#api = new this._manifest.meta.api(this, this.unique);
|
||||
}
|
||||
|
||||
#api: any;
|
||||
|
||||
async #onClickLabel() {
|
||||
|
||||
@@ -28,6 +28,9 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
`,
|
||||
];
|
||||
|
||||
@property({ type: String })
|
||||
public unique?: string;
|
||||
|
||||
private _entityType = '';
|
||||
@property({ type: String, attribute: 'entity-type' })
|
||||
public get entityType() {
|
||||
@@ -73,7 +76,9 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
<uui-button slot="trigger" label="Actions" @click=${this.#open}></uui-button>
|
||||
<div id="action-menu-dropdown" slot="popover">
|
||||
<uui-scroll-container>
|
||||
${this._entityActions?.map((manifest) => html`<umb-entity-action .manifest=${manifest}></umb-entity-action>`)}
|
||||
${this._entityActions?.map(
|
||||
(manifest) => html`<umb-entity-action .unique=${this.unique} .manifest=${manifest}></umb-entity-action>`
|
||||
)}
|
||||
</uui-scroll-container>
|
||||
</div>
|
||||
</uui-popover>
|
||||
|
||||
Reference in New Issue
Block a user