{"version":3,"file":"workspace-action-menu-item.element-BonLBodN.js","sources":["../../../src/packages/core/workspace/components/workspace-action-menu-item/default/workspace-action-menu-item.element.ts"],"sourcesContent":["import type { UmbWorkspaceActionMenuItem } from '../index.js';\nimport { UmbActionExecutedEvent } from '@umbraco-cms/backoffice/event';\nimport { html, customElement, property, state, ifDefined, nothing } from '@umbraco-cms/backoffice/external/lit';\nimport { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';\nimport type {\n\tManifestWorkspaceActionMenuItemDefaultKind,\n\tMetaWorkspaceActionMenuItemDefaultKind,\n} from '@umbraco-cms/backoffice/extension-registry';\nimport type { UUIMenuItemEvent } from '@umbraco-cms/backoffice/external/uui';\n\n@customElement('umb-workspace-action-menu-item')\nexport class UmbWorkspaceActionMenuItemElement<\n\tMetaType extends MetaWorkspaceActionMenuItemDefaultKind = MetaWorkspaceActionMenuItemDefaultKind,\n\tApiType extends UmbWorkspaceActionMenuItem = UmbWorkspaceActionMenuItem,\n> extends UmbLitElement {\n\t#api?: ApiType;\n\n\t@state()\n\t_href?: string;\n\n\t@property({ attribute: false })\n\tpublic manifest?: ManifestWorkspaceActionMenuItemDefaultKind;\n\n\tpublic set api(api: ApiType | undefined) {\n\t\tthis.#api = api;\n\n\t\t// TODO: Fix so when we use a HREF it does not refresh the page?\n\t\tthis.#api?.getHref?.().then((href) => {\n\t\t\tthis._href = href;\n\t\t\t// TODO: Do we need to update the component here? [NL]\n\t\t});\n\t}\n\n\tasync #onClickLabel(event: UUIMenuItemEvent) {\n\t\tif (!this._href) {\n\t\t\tevent.stopPropagation();\n\t\t\tawait this.#api?.execute();\n\t\t}\n\t\tthis.dispatchEvent(new UmbActionExecutedEvent());\n\t}\n\n\t// TODO: we need to stop the regular click event from bubbling up to the table so it doesn't select the row.\n\t// This should probably be handled in the UUI Menu item component. so we don't dispatch a label-click event and click event at the same time.\n\t#onClick(event: PointerEvent) {\n\t\tevent.stopPropagation();\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t\n\t\t\t\t${this.manifest?.meta.icon\n\t\t\t\t\t? html``\n\t\t\t\t\t: nothing}\n\t\t\t\n\t\t`;\n\t}\n}\n\nexport default UmbWorkspaceActionMenuItemElement;\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'umb-workspace-action-menu-item': UmbWorkspaceActionMenuItemElement;\n\t}\n}\n"],"names":["_api","_UmbWorkspaceActionMenuItemElement_instances","onClickLabel_fn","onClick_fn","UmbWorkspaceActionMenuItemElement","UmbLitElement","__privateAdd","api","__privateSet","__privateGet","href","html","ifDefined","__privateMethod","nothing","event","UmbActionExecutedEvent","__decorateClass","state","property","customElement","UmbWorkspaceActionMenuItemElement$1"],"mappings":";;;;;;;;;wXAAAA,GAAAC,GAAAC,GAAAC;AAWa,IAAAC,IAAN,cAGGC,EAAc;AAAA,EAHjB,cAAA;AAAA,UAAA,GAAA,SAAA,GAAAC,EAAA,MAAAL,CAAA,GAINK,EAAA,MAAAN,CAAA;AAAA,EAAA;AAAA,EAQA,IAAW,IAAIO,GAA0B;AACxC,IAAAC,EAAA,MAAKR,GAAOO,CAAA,GAGZE,EAAA,MAAKT,CAAM,GAAA,UAAA,EAAY,KAAK,CAACU,MAAS;AACrC,WAAK,QAAQA;AAAA,IAAA,CAEb;AAAA,EACF;AAAA,EAgBS,SAAS;AACV,WAAAC;AAAA;AAAA,YAEGC;AAAA,MACP,KAAK,UAAU,KAAK,QAAQ,KAAK,SAAS,OAAO,KAAK,SAAS,KAAK,KAAK,IAAI,KAAK,UAAU;AAAA,IAAA,CAC5F;AAAA,WACMA,EAAU,KAAK,KAAK,CAAC;AAAA,mBACbC,QAAKZ,GAAaC,CAAA,CAAA;AAAA,aACxBW,QAAKZ,GAAQE,CAAA,CAAA;AAAA,MACpB,KAAK,UAAU,KAAK,OACnBQ,gCAAmC,KAAK,UAAU,KAAK,IAAI,kBAC3DG,CAAO;AAAA;AAAA;AAAA,EAGb;AACD;AA/CCd,IAAA,oBAAA,QAAA;AA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