quarkd
Version:
Mobile UI Components built on Web Components.
2 lines (1 loc) • 6.19 kB
JavaScript
import{_ as e,a as n}from"../typeof.js";import{_ as r,a as t,b as i,c as o,P as a,H as s,d as l,N as c,O as u,B as p}from"../index2.js";import{_ as h}from"../defineProperty.js";import{B as k}from"../core.esm.js";import{W as d}from"../wheel.esm.js";import"../popup/index.js";import"../button/index.js";import"../index4.js";import"../bodyScrollLock.esm.js";import"../index22.js";import"../loading/index.js";import"../util.js";function m(e){var n=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(e){return!1}}();return function(){var i,o=r(e);if(n){var a=r(this).constructor;i=Reflect.construct(o,arguments,a)}else i=o.apply(this,arguments);return t(this,i)}}k.use(d);var v=function(r){i(l,s);var t=m(l);function l(){var n;e(this,l);for(var r=arguments.length,i=new Array(r),c=0;c<r;c++)i[c]=arguments[c];return n=t.call.apply(t,[this].concat(i)),h(o(n),"forbidmaskclick",!1),h(o(n),"columns",[]),h(o(n),"wheels",[]),h(o(n),"values",[]),h(o(n),"wheelWrapper",a()),h(o(n),"confirm",(function(){var e=n.getValues();n.values=e,n.$emit("confirm",{detail:{value:e}})})),h(o(n),"createWheel",(function(e,r){if(n.wheels[r])n.wheels[r].refresh(),n.wheels[r].wheelTo(n.columns[r].defaultIndex,10);else{var t=n.columns[r];n.wheels[r]=new k(e.children[r],{wheel:{selectedIndex:t.defaultIndex||0,wheelWrapperClass:"quark-picker-wheel-scroll",wheelItemClass:"quark-picker-wheel-item"}}),n.wheels[r].on("scrollEnd",n.debounce((function(){var e=n.getValues(!1);n.$emit("change",{detail:{value:e}})}),30))}return n.wheels[r]})),h(o(n),"renderWheel",(function(){return n.columns?n.columns.map((function(e){return s.h("div",{class:"quark-picker-wheel",part:"wheel"},s.h("ul",{class:"quark-picker-wheel-scroll",part:"wheel-scroll"},e.values.map((function(e){return s.h("li",{class:"quark-picker-wheel-item",part:"wheel-item"},e)}))))})):null})),n}return n(l,[{key:"setColumns",value:function(e){this.columns=e;var n=this.wheelWrapper.current;if(n)for(var r=0;r<this.columns.length;r+=1)this.createWheel(n,r);else console.warn("dom not find")}},{key:"getValues",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e&&this.restorePosition();var n=this.wheels.map((function(e){return e.getSelectedIndex()})),r=this.columns.map((function(e,r){var t=n[r];return{value:e.values[t],index:t}}));return r}},{key:"restorePosition",value:function(){this.wheels.forEach((function(e){e.restorePosition()}))}},{key:"debounce",value:function(e,n){var r=null;return function(){null!==r&&clearTimeout(r),r=setTimeout(e,n)}}},{key:"render",value:function(){return s.h("div",{part:"root",class:"quark-picker-container"},s.h("div",{part:"content",class:"quark-picker-content"},s.h("div",{part:"mask-top",class:"quark-picker-mask-top"}),s.h("div",{part:"mask-bottom",class:"quark-picker-mask-bottom"}),s.h("div",{part:"current",class:"quark-picker-current"},s.h("div",{part:"current-mask",class:"quark-picker-current-mask"})),s.h("div",{part:"wheel-wrapper",class:"quark-picker-wheel-wrapper",ref:this.wheelWrapper},this.renderWheel())))}}]),l}();l([c({type:Boolean})],v.prototype,"forbidmaskclick",void 0),l([u()],v.prototype,"columns",void 0);var f=v=l([p({tag:"quark-pickerview",style:":host {\n width: 100%;\n display: block;\n}\n\n:host ul {\n list-style: none;\n padding: 0;\n}\n\n:host .quark-picker-container {\n width: 100%;\n height: var(--pickerview-height, 45.33333vw);\n overflow: hidden;\n position: relative;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n\n:host .quark-picker-content {\n /* position: absolute; */\n display: flex;\n /* top: 56px; */\n /* bottom: 72px; */\n /* left: 0; */\n /* right: 0; */\n background-color: white;\n box-sizing: border-box;\n}\n\n\n:host .quark-picker-mask-top {\n z-index: 10;\n width: 100%;\n height: var(--pickerview-row-top-mask-height, 18.13333vw);\n pointer-events: none;\n transform: translateZ(0);\n}\n:host .quark-picker-mask-bottom {\n z-index: 10;\n width: 100%;\n height: var(--pickerview-row-bottom-mask-height, 18.13333vw);\n pointer-events: none;\n transform: translateZ(0);\n}\n\n\n.quark-picker-mask-top {\n position: absolute;\n top: 0;\n background: linear-gradient(\n to top,\n rgba(255, 255, 255, 0.3),\n rgba(255, 255, 255, 0.8)\n );\n}\n\n:host .quark-picker-mask-bottom {\n position: absolute;\n bottom: 0;\n background: linear-gradient(\n to bottom,\n rgba(255, 255, 255, 0.3),\n rgba(255, 255, 255, 0.8)\n );\n}\n\n:host .quark-picker-current {\n position: absolute;\n top: var(--pickerview-current-top, 18.66667vw);\n height: var(--pickerview-item-height, 9.06667vw);\n width: 100%;\n /* padding: 0 16px; */\n box-sizing: border-box;\n}\n\n:host .quark-picker-current .quark-picker-current-mask {\n height: 100%;\n border: 1px solid #eee;\n border: var(--pickerview-border, 1px solid #eee);\n border-left: none;\n box-sizing: border-box;\n border-right: none;\n}\n\n:host .quark-picker-wheel-wrapper {\n display: flex;\n width: 100%;\n}\n\n:host .quark-picker-wheel {\n flex: 1;\n width: 1%;\n height: 100%;\n overflow: hidden;\n}\n\n:host .quark-picker-wheel-scroll {\n padding: 0;\n margin-top: var(--pickerview-scroll-margin-top, 18.93333vw);\n list-style: none;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n:host .quark-picker-wheel-item {\n font-family: PingFangSC-Semibold, PingFang SC;\n font-size: var(--pickerview-item-font-size, 4.26667vw);\n list-style: none;\n line-height: var(--pickerview-item-height, 9.06667vw);\n height: var(--pickerview-item-height, 9.06667vw);\n overflow: hidden;\n white-space: nowrap;\n color: var(--pickerview-item-color, #242729);\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n}\n\n:host([bottomhidden]) .quark-picker-picker-content {\n bottom: 0px;\n}\n\n:host([bottomhidden]) .quark-picker-picker-container {\n height: 70.93333vw;\n}\n"})],v);export{f as default};