You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/public/static/plug/picker.min.js

2 lines
46 KiB

10 months ago
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Picker=t():e.Picker=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=i(1),o=n(r);o.default.version="1.1.2",t.default=o.default,e.exports=t.default},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),l=i(2),h=n(l),c=i(3),p=n(c),u=i(4),f=i(5),d=i(6),m=n(d),v=i(14),g=n(v);i(15);var y=function(e){function t(e){r(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return i.options={data:[],title:"",selectedIndex:null,showCls:"show"},(0,u.extend)(i.options,e),i.data=i.options.data,i.pickerEl=(0,f.createDom)((0,m.default)({data:i.data,title:i.options.title})),document.body.appendChild(i.pickerEl),i.maskEl=i.pickerEl.getElementsByClassName("mask-hook")[0],i.wheelEl=i.pickerEl.getElementsByClassName("wheel-hook"),i.panelEl=i.pickerEl.getElementsByClassName("panel-hook")[0],i.confirmEl=i.pickerEl.getElementsByClassName("confirm-hook")[0],i.cancelEl=i.pickerEl.getElementsByClassName("cancel-hook")[0],i.scrollEl=i.pickerEl.getElementsByClassName("wheel-scroll-hook"),i._init(),i}return s(t,e),a(t,[{key:"_init",value:function(){if(this.selectedIndex=[],this.selectedVal=[],this.options.selectedIndex)this.selectedIndex=this.options.selectedIndex;else for(var e=0;e<this.data.length;e++)this.selectedIndex[e]=0;this._bindEvent()}},{key:"_bindEvent",value:function(){var e=this;(0,f.addEvent)(this.pickerEl,"touchmove",function(e){e.preventDefault()}),(0,f.addEvent)(this.confirmEl,"click",function(){e.hide();for(var t=!1,i=0;i<e.data.length;i++){var n=e.wheels[i].getSelectedIndex();e.selectedIndex[i]=n;var r=null;e.data[i].length&&(r=e.data[i][n].value),e.selectedVal[i]!==r&&(t=!0),e.selectedVal[i]=r}e.trigger("picker.select",e.selectedVal,e.selectedIndex),t&&e.trigger("picker.valuechange",e.selectedVal,e.selectedIndex)}),(0,f.addEvent)(this.cancelEl,"click",function(){e.hide(),e.trigger("picker.cancel")})}},{key:"_createWheel",value:function(e,t){var i=this;return this.wheels[t]=new h.default(e[t],{wheel:!0,selectedIndex:this.selectedIndex[t]}),function(e){i.wheels[e].on("scrollEnd",function(){var n=i.wheels[e].getSelectedIndex();i.selectedIndex[t]!==n&&(i.selectedIndex[t]=n,i.trigger("picker.change",e,n))})}(t),this.wheels[t]}},{key:"show",value:function(e){var t=this;this.pickerEl.style.display="block";var i=this.options.showCls;window.setTimeout(function(){if((0,f.addClass)(t.maskEl,i),(0,f.addClass)(t.panelEl,i),t.wheels)for(var n=0;n<t.data.length;n++)t.wheels[n].enable(),t.wheels[n].wheelTo(t.selectedIndex[n]);else{t.wheels=[];for(var r=0;r<t.data.length;r++)t._createWheel(t.wheelEl,r)}e&&e()},0)}},{key:"hide",value:function(){var e=this,t=this.options.showCls;(0,f.removeClass)(this.maskEl,t),(0,f.removeClass)(this.panelEl,t),window.setTimeout(function(){e.pickerEl.style.display="none";for(var t=0;t<e.data.length;t++)e.wheels
i.push(t),e.className=i.join(" ")}}function a(e,t){if(o(e,t)){var i=new RegExp("(^|\\s)"+t+"(\\s|$)","g");e.className=e.className.replace(i," ")}}t.__esModule=!0,t.createDom=i,t.addEvent=n,t.removeEvent=r,t.hasClass=o,t.addClass=s,t.removeClass=a},function(e,t,i){var n=i(7);e.exports=(n.default||n).template(function(e,t,i,n,r){function o(e,t){var n,r="";return r+='\n <div class="wheel wheel-hook">\n <ul class="wheel-scroll wheel-scroll-hook">\n ',n=i.each.call(e,e,{hash:{},inverse:u.noop,fn:u.program(2,s,t),data:t}),(n||0===n)&&(r+=n),r+="\n </ul>\n </div>\n "}function s(e,t){var n,r,o="";return o+='\n <li class="wheel-item" data-val="',(r=i.value)?n=r.call(e,{hash:{},data:t}):(r=e&&e.value,n=typeof r===c?r.call(e,{hash:{},data:t}):r),o+=p(n)+'">',(r=i.text)?n=r.call(e,{hash:{},data:t}):(r=e&&e.text,n=typeof r===c?r.call(e,{hash:{},data:t}):r),o+=p(n)+"</li>\n "}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),r=r||{};var a,l,h="",c="function",p=this.escapeExpression,u=this;return h+='<div class="picker">\n <div class="picker-mask mask-hook"></div>\n <div class="picker-panel panel-hook">\n <div class="picker-choose choose-hook">\n <span class="cancel cancel-hook">取消</span>\n <span class="confirm confirm-hook">确定</span>\n <h1 class="picker-title">',(l=i.title)?a=l.call(t,{hash:{},data:r}):(l=t&&t.title,a=typeof l===c?l.call(t,{hash:{},data:r}):l),h+=p(a)+'</h1>\n </div>\n <div class="picker-content">\n <div class="mask-top border-1px"></div>\n <div class="mask-bottom border-1px"></div>\n <div class="wheel-wrapper wheel-wrapper-hook">\n ',a=i.each.call(t,t&&t.data,{hash:{},inverse:u.noop,fn:u.program(1,o,r),data:r}),(a||0===a)&&(h+=a),h+='\n </div>\n </div>\n <div class="picker-footer footer-hook"></div>\n </div>\n</div>'})},function(e,t,i){e.exports=i(8)},function(e,t,i){"use strict";var n=i(9),r=i(11).default,o=i(12).default,s=i(10),a=i(13),l=function(){var e=new n.HandlebarsEnvironment;return s.extend(e,n),e.SafeString=r,e.Exception=o,e.Utils=s,e.VM=a,e.template=function(t){return a.template(t,e)},e},h=l();h.create=l,t.default=h},function(e,t,i){"use strict";function n(e,t){this.helpers=e||{},this.partials=t||{},r(this)}function r(e){e.registerHelper("helperMissing",function(e){if(2!==arguments.length)throw new a("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(t,i){var n=i.inverse||function(){},r=i.fn;return u(t)&&(t=t.call(this)),t===!0?r(this):t===!1||null==t?n(this):p(t)?t.length>0?e.helpers.each(t,i):n(this):r(t)}),e.registerHelper("each",function(e,t){var i,n=t.fn,r=t.inverse,o=0,s="";if(u(e)&&(e=e.call(this)),t.data&&(i=v(t.data)),e&&"object"==typeof e)if(p(e))for(var a=e.length;o<a;o++)i&&(i.index=o,i.first=0===o,i.last=o===e.length-1),s+=n(e[o],{data:i});else for(var l in e)e.hasOwnProperty(l)&&(i&&(i.key=l,i.index=o,i.first=0===o),s+=n(e[l],{data:i}),o++);return 0===o&&(s=r(this)),s}),e.registerHelper("if",function(e,t){return u(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||s.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper("unless",function(t,i){return e.helpers.if.call(this,t,{fn:i.inverse,inverse:i.fn,hash:i.hash})}),e.registerHelper("with",function(e,t){if(u(e)&&(e=e.call(this)),!s.isEmpty(e))return t.fn(e)}),e.registerHelper("log",function(t,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;e.log(n,t)})}function o(e,t){m.log(e,t)}var s=i(10),a=i(12).default,l="1.3.0";t.VERSION=l;var h=4;t.COMPILER_REVISION=h;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};t.REVISION_CHANGES=c;var p=s.isArray,u=s.isFunction,f=s.toString,d="[object Object]";t.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:m,log:o,registerHelper:function(e,t,i){if(f.call(e)===d){if(i||t)throw new a("Arg not supported with multiple helpers");s.extend(this.helpers,e)}else i&&(t.not=i),this.helpers[e]=t},registerPartial:function(e,t){f.call(e)===d?s.extend(this.partials,e):this.partials[e]=t}};var