{"version":3,"file":"property-action.element-DwGJ8fLV.js","sources":["../../../src/packages/core/property-action/components/property-action/default/property-action.element.ts"],"sourcesContent":["import type { UmbPropertyAction } 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\tManifestPropertyActionDefaultKind,\n\tMetaPropertyActionDefaultKind,\n} from '@umbraco-cms/backoffice/extension-registry';\nimport type { UUIMenuItemEvent } from '@umbraco-cms/backoffice/external/uui';\n\n@customElement('umb-property-action')\nexport class UmbPropertyActionElement<\n\tMetaType extends MetaPropertyActionDefaultKind = MetaPropertyActionDefaultKind,\n\tApiType extends UmbPropertyAction = UmbPropertyAction,\n> extends UmbLitElement {\n\t#api?: ApiType;\n\n\t@state()\n\t_href?: string;\n\n\t@property({ attribute: false })\n\tpublic manifest?: ManifestPropertyActionDefaultKind;\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 UmbPropertyActionElement;\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'umb-property-action': UmbPropertyActionElement;\n\t}\n}\n"],"names":["_api","_UmbPropertyActionElement_instances","onClickLabel_fn","onClick_fn","UmbPropertyActionElement","UmbLitElement","__privateAdd","api","__privateSet","__privateGet","href","html","ifDefined","__privateMethod","nothing","event","UmbActionExecutedEvent","__decorateClass","state","property","customElement","UmbPropertyActionElement$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,EAAU,KAAK,UAAU,KAAK,KAAK,CAAC;AAAA,WACrCA,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;AA7CCd,IAAA,oBAAA,QAAA;AAJMC,IAAA,oBAAA,QAAA;AAsBAC,IAAa,eAACa,GAAyB;AACxC,EAAC,KAAK,UACTA,EAAM,gBAAgB,GAChB,MAAAN,EAAA,MAAKT,IAAM,QAAQ,IAErB,KAAA,cAAc,IAAIgB,EAAA,CAAwB;AAChD;AAIAb,IAAQ,SAACY,GAAqB;AAC7B,EAAAA,EAAM,gBAAgB;AACvB;AA3BAE,EAAA;AAAA,EADCC,EAAM;AAAA,GANKd,EAOZ,WAAA,SAAA,CAAA;AAGOa,EAAA;AAAA,EADNE,EAAS,EAAE,WAAW,IAAO;AAAA,GATlBf,EAUL,WAAA,YAAA,CAAA;AAVKA,IAANa,EAAA;AAAA,EADNG,EAAc,qBAAqB;AAAA,GACvBhB,CAAA;AAmDb,MAAAiB,IAAejB;"}