quarkd
Version:
Mobile UI Components built on Web Components.
2 lines (1 loc) • 2.41 kB
JavaScript
import{_ as t,a as e}from"../typeof.js";import{_ as n,a as r,b as o,c as i,P as a,H as s,d as c,N as u,B as f}from"../index2.js";import{_ as d}from"../defineProperty.js";import{s as l}from"../public.js";import"../tabbaritem/index.js";function v(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var o,i=n(t);if(e){var a=n(this).constructor;o=Reflect.construct(i,arguments,a)}else o=i.apply(this,arguments);return r(this,o)}}var p=function(n){o(c,s);var r=v(c);function c(){var e;t(this,c);for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return e=r.call.apply(r,[this].concat(o)),d(i(e),"fixed",!1),d(i(e),"active","0"),d(i(e),"slotRef",a()),d(i(e),"slotchange",(function(){var t,n=null===(t=e.slotRef.current)||void 0===t?void 0:t.assignedNodes();l(n).forEach((function(t,n){null===t.getAttribute("index")&&t.setAttribute("index",String(n)),t.addEventListener("click",e.eventListener),t.getAttribute("index")===e.active&&t.setAttribute("active","")}))})),d(i(e),"eventListener",(function(t){e.active=t.currentTarget.getAttribute("index"),e.$emit("change",{detail:{value:t.currentTarget.getAttribute("index")}})})),e}return e(c,[{key:"shouldComponentUpdate",value:function(t,e,n){if("active"===t&&e!==n){var r,o=null===(r=this.slotRef.current)||void 0===r?void 0:r.assignedNodes();l(o).forEach((function(t){t.getAttribute("index")===n?t.setAttribute("active",""):t.removeAttribute("active")}))}return!0}},{key:"render",value:function(){return s.h("div",{class:"quark-tabbar",part:"root"},s.h("slot",{ref:this.slotRef,onslotchange:this.slotchange}))}}]),c}();c([u({type:Boolean})],p.prototype,"fixed",void 0),c([u()],p.prototype,"active",void 0);var b=p=c([f({tag:"quark-tabbar",style:":host {\n display: flex;\n width: 100%;\n padding-bottom: constant(safe-area-inset-bottom);\n padding-bottom: env(safe-area-inset-bottom);\n padding: 2.66667vw 0;\n background: #fff;\n font-size: 3.2vw;\n box-shadow: 0px -0.53333vw 2.13333vw 0px rgba(36, 39, 41, 0.08);\n}\n\n:host([fixed]) {\n position: fixed;\n bottom: 0;\n left: 0;\n}\n\n.quark-tabbar {\n width: 100%;\n display: flex;\n justify-content: space-around;\n}\n"})],p);export{b as default};