(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["tuniao-ui/components/tn-select/tn-select"],{2118:function(t,e,l){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a={name:"tn-select",props:{value:{type:Boolean,default:!1},mode:{type:String,default:"single"},list:{type:Array,default:function(){return[]}},valueName:{type:String,default:"value"},labelName:{type:String,default:"label"},childName:{type:String,default:"children"},defaultValue:{type:Array,default:function(){return[0]}},title:{type:String,default:""},cancelText:{type:String,default:"取消"},cancelColor:{type:String,default:""},confirmText:{type:String,default:"确认"},confirmColor:{type:String,default:""},maskCloseable:{type:Boolean,default:!0},safeAreaInsetBottom:{type:Boolean,default:!1},zIndex:{type:Number,default:0},searchShow:{type:Boolean,default:!0},searchPlaceholder:{type:String,default:"搜索"}},computed:{elZIndex:function(){return this.zIndex?this.zIndex:this.$tn.zIndex.popup}},data:function(){return{moving:!1,defaultSelector:[0],columnData:[],selectValue:[],lastSelectIndex:[],columnNum:0}},watch:{value:{handler:function(t){var e=this;t&&setTimeout((function(){return e.init()}),10)},immediate:!0}},methods:{searchInput:function(t){console.log(t.detail.value),this.searchResult(t.detail.value)},search:function(t){console.log(t.detail.value),this.searchResult(t.detail.value)},searchResult:function(t){var e=this,l=[],a=this.list.filter((function(l){return l[e.labelName].indexOf(t)>-1}));a.length>0&&l.push(a),this.columnData=l,this.selectValue=[],this.columnData.length>0&&this.setSelectValue()},pickStart:function(){this.moving=!0},pickEnd:function(){this.moving=!1},init:function(){this.setColumnNum(),this.setDefaultSelector(),this.setColumnData(),this.setSelectValue()},setDefaultSelector:function(){this.defaultSelector=this.defaultValue.length===this.columnNum?this.defaultValue:Array(this.columnNum).fill(0),this.lastSelectIndex=this.$tn.deepClone(this.defaultSelector)},setColumnNum:function(){if("single"===this.mode)this.columnNum=1;else if("multi"===this.mode)this.columnNum=this.list.length;else if("multi-auto"===this.mode){var t=1,e=this.list;while(e[0][this.childName])e=e[0]?e[0][this.childName]:{},t++;this.columnNum=t}},setColumnData:function(){var t=[];if(this.selectValue=[],"multi-auto"===this.mode)for(var e=this.list[this.defaultSelector.length?this.defaultSelector[0]:0],l=0;l<this.columnNum;l++)0===l?(t[l]=this.list,e=e[this.childName]):(t[l]=e,e=e[this.defaultSelector[l]][this.childName]);else"single"===this.mode?t[0]=this.list:t=this.list;this.columnData=t},setSelectValue:function(){for(var t=null,e=0;e<this.columnNum;e++){t=this.columnData[e][this.defaultSelector[e]];var l={value:t?t[this.valueName]:null,label:t?t[this.labelName]:null};t&&t.extra&&(l.extra=t.extra),this.selectValue.push(l)}},columnChange:function(t){var e=this,l=null,a=t.detail.value;if(this.selectValue=[],"multi-auto"===this.mode){this.lastSelectIndex.map((function(t,e){t!=a[e]&&(l=e)})),this.defaultSelector=a;for(var n=l+1;n<this.columnNum;n++)this.columnData[n]=this.columnData[n-1][n-1==l?a[l]:0][this.childName],this.defaultSelector[n]=0;a.map((function(t,l){var n=e.columnData[l][a[l]],i={value:n?n[e.valueName]:null,label:n?n[e.labelName]:null};n&&void 0!==n.extra&&(i.extra=n.extra),e.selectValue.push(i)})),this.lastSelectIndex=a}else if("single"===this.mode){var i=this.columnData[0][a[0]],u={value:i?i[this.valueName]:null,label:i?i[this.labelName]:null};i&&void 0!==i.extra&&(u.extra=i.extra),this.selectValue.push(u)}else"multi"===this.mode&&a.map((function(t,l){var n=e.columnData[l][a[l]],i={value:n?n[e.valueName]:null,label:n?n[e.labelName]:null};n&&void 0!==n.extra&&(i.extra=n.extra),e.selectValue.push(i)}))},close:function(){this.$emit("input",!1)},getResult:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.moving||(t&&this.$emit(t,this.selectValue),this.close())}}};e.default=a},"4bac":function(t,e,l){"use strict";l.d(e,"b",(function(){return n})),l.d(e,"c",(function(){return i})),l.d(e,"a",(function(){return a}));var a={tnPopup:function(){return Promise.all([l.e("common/vendor"),l.e("tuniao-ui/components/tn-popup/tn-popup")]).then(l.bind(null,"3b24"))}},n=function(){var t=this.$createElement;this._self._c},i=[]},5809:function(t,e,l){"use strict";var a=l("e5e9"),n=l.n(a);n.a},a757:function(t,e,l){"use strict";l.r(e);var a=l("2118"),n=l.n(a);for(var i in a)["default"].indexOf(i)<0&&function(t){l.d(e,t,(function(){return a[t]}))}(i);e["default"]=n.a},e5e9:function(t,e,l){},eb22:function(t,e,l){"use strict";l.r(e);var a=l("4bac"),n=l("a757");for(var i in n)["default"].indexOf(i)<0&&function(t){l.d(e,t,(function(){return n[t]}))}(i);l("5809");var u=l("f0c5"),s=Object(u["a"])(n["default"],a["b"],a["c"],!1,null,"51c49b12",null,!1,a["a"],void 0);e["default"]=s.exports}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    'tuniao-ui/components/tn-select/tn-select-create-component',
    {
        'tuniao-ui/components/tn-select/tn-select-create-component':(function(module, exports, __webpack_require__){
            __webpack_require__('543d')['createComponent'](__webpack_require__("eb22"))
        })
    },
    [['tuniao-ui/components/tn-select/tn-select-create-component']]
]);
