p-ad58c01e.system.js 2.1 KB

123456
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. System.register(["./p-3de000e5.system.js"],(function(e){"use strict";var t,n;return{setters:[function(e){t=e.q;n=e.c}],execute:function(){e({c:f,d:m,g:b});var r="calciteInternalLabelClick";var a=e("l","calciteInternalLabelConnected");var i=e("a","calciteInternaLabelDisconnected");var l="calcite-label";var c=new WeakMap;var o=new WeakMap;var s=new WeakMap;var v=new Set;var u=function(e){var r=e.id;var a=r&&t(e,{selector:"".concat(l,'[for="').concat(r,'"]')});if(a){return a}var i=n(e,l);if(!i||d(i,e)){return null}return i};function d(e,t){var n;var r="custom-element-ancestor-check";var a=function(r){r.stopImmediatePropagation();var a=r.composedPath();n=a.slice(a.indexOf(t),a.indexOf(e))};e.addEventListener(r,a,{once:true});t.dispatchEvent(new CustomEvent(r,{composed:true,bubbles:true}));e.removeEventListener(r,a);var i=n.filter((function(n){return n!==t&&n!==e})).filter((function(e){var t;return(t=e.tagName)===null||t===void 0?void 0:t.includes("-")}));return i.length>0}function f(e){var t=u(e.el);if(c.has(t)||!t&&v.has(e)){return}var n=L.bind(e);if(t){e.labelEl=t;var l=E.bind(e);c.set(e.labelEl,l);e.labelEl.addEventListener(r,l);v.delete(e);document.removeEventListener(a,o.get(e));s.set(e,n);document.addEventListener(i,n)}else if(!v.has(e)){n();document.removeEventListener(i,s.get(e))}}function m(e){v.delete(e);document.removeEventListener(a,o.get(e));document.removeEventListener(i,s.get(e));o.delete(e);s.delete(e);if(!e.labelEl){return}var t=c.get(e.labelEl);e.labelEl.removeEventListener(r,t);c.delete(e.labelEl)}function b(e){var t,n;return e.label||((n=(t=e.labelEl)===null||t===void 0?void 0:t.textContent)===null||n===void 0?void 0:n.trim())||""}function E(e){if(this.disabled){return}var t=this.el.contains(e.detail.sourceEvent.target);if(t){return}this.onLabelClick(e)}function h(){if(v.has(this)){f(this)}}function L(){v.add(this);var e=o.get(this)||h.bind(this);o.set(this,e);document.addEventListener(a,e)}}}}));