<template>
<uni-shadow-root class="vant-area-index"><van-picker class="van-area__picker" active-class="active-class" toolbar-class="toolbar-class" column-class="column-class" show-toolbar value-key="name" :title="title" :loading="loading" :columns="displayColumns" :item-height="itemHeight" :visible-item-count="visibleItemCount" :cancel-button-text="cancelButtonText" :confirm-button-text="confirmButtonText" @change="onChange" @confirm="onConfirm" @cancel="onCancel"></van-picker></uni-shadow-root>
</template>

<script>
import VanPicker from '../picker/index.vue'
global['__wxVueOptions'] = {components:{'van-picker': VanPicker}}

global['__wxRoute'] = 'vant/area/index'
"use strict";

var __assign = undefined && undefined.__assign || function () {
    __assign = Object.assign || function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) {
                if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require('./../common/component.js');
var shared_1 = require('./../picker/shared.js');
component_1.VantComponent({
    classes: ['active-class', 'toolbar-class', 'column-class'],
    props: __assign({}, shared_1.pickerProps, { value: String, areaList: {
            type: Object,
            value: {}
        }, columnsNum: {
            type: [String, Number],
            value: 3
        } }),
    data: {
        columns: [{ values: [] }, { values: [] }, { values: [] }],
        displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
    },
    watch: {
        value: function value(_value) {
            this.code = _value;
            this.setValues();
        },
        areaList: 'setValues',
        columnsNum: function columnsNum(value) {
            this.set({
                displayColumns: this.data.columns.slice(0, +value)
            });
        }
    },
    mounted: function mounted() {
        this.setValues();
    },
    methods: {
        getPicker: function getPicker() {
            if (this.picker == null) {
                this.picker = this.selectComponent('.van-area__picker');
            }
            return this.picker;
        },
        onCancel: function onCancel(event) {
            this.emit('cancel', event.detail);
        },
        onConfirm: function onConfirm(event) {
            this.emit('confirm', event.detail);
        },
        emit: function emit(type, detail) {
            detail.values = detail.value;
            delete detail.value;
            this.$emit(type, detail);
        },
        onChange: function onChange(event) {
            var _this = this;
            var _a = event.detail,
                index = _a.index,
                picker = _a.picker,
                value = _a.value;
            this.code = value[index].code;
            this.setValues().then(function () {
                _this.$emit('change', {
                    picker: picker,
                    values: picker.getValues(),
                    index: index
                });
            });
        },
        getConfig: function getConfig(type) {
            var areaList = this.data.areaList;
            return areaList && areaList[type + "_list"] || {};
        },
        getList: function getList(type, code) {
            var result = [];
            if (type !== 'province' && !code) {
                return result;
            }
            var list = this.getConfig(type);
            result = Object.keys(list).map(function (code) {
                return {
                    code: code,
                    name: list[code]
                };
            });
            if (code) {
                // oversea code
                if (code[0] === '9' && type === 'city') {
                    code = '9';
                }
                result = result.filter(function (item) {
                    return item.code.indexOf(code) === 0;
                });
            }
            return result;
        },
        getIndex: function getIndex(type, code) {
            var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
            var list = this.getList(type, code.slice(0, compareNum - 2));
            // oversea code
            if (code[0] === '9' && type === 'province') {
                compareNum = 1;
            }
            code = code.slice(0, compareNum);
            for (var i = 0; i < list.length; i++) {
                if (list[i].code.slice(0, compareNum) === code) {
                    return i;
                }
            }
            return 0;
        },
        setValues: function setValues() {
            var _this = this;
            var county = this.getConfig('county');
            var code = this.code || Object.keys(county)[0] || '';
            var province = this.getList('province');
            var city = this.getList('city', code.slice(0, 2));
            var picker = this.getPicker();
            if (!picker) {
                return;
            }
            var stack = [];
            stack.push(picker.setColumnValues(0, province, false));
            stack.push(picker.setColumnValues(1, city, false));
            if (city.length && code.slice(2, 4) === '00') {
                code = city[0].code;
            }
            stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
            return Promise.all(stack).catch(function () {}).then(function () {
                return picker.setIndexes([_this.getIndex('province', code), _this.getIndex('city', code), _this.getIndex('county', code)]);
            }).catch(function () {});
        },
        getValues: function getValues() {
            var picker = this.getPicker();
            return picker ? picker.getValues().filter(function (value) {
                return !!value;
            }) : [];
        },
        getDetail: function getDetail() {
            var values = this.getValues();
            var area = {
                code: '',
                country: '',
                province: '',
                city: '',
                county: ''
            };
            if (!values.length) {
                return area;
            }
            var names = values.map(function (item) {
                return item.name;
            });
            area.code = values[values.length - 1].code;
            if (area.code[0] === '9') {
                area.country = names[1] || '';
                area.province = names[2] || '';
            } else {
                area.province = names[0] || '';
                area.city = names[1] || '';
                area.county = names[2] || '';
            }
            return area;
        },
        reset: function reset() {
            this.code = '';
            return this.setValues();
        }
    }
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIl9fYXNzaWduIiwiT2JqZWN0IiwiaSIsIm4iLCJhcmd1bWVudHMiLCJzIiwidCIsInZhbHVlIiwiY29tcG9uZW50XzEiLCJyZXF1aXJlIiwic2hhcmVkXzEiLCJjbGFzc2VzIiwicHJvcHMiLCJhcmVhTGlzdCIsInR5cGUiLCJjb2x1bW5zTnVtIiwiZGF0YSIsImNvbHVtbnMiLCJ2YWx1ZXMiLCJkaXNwbGF5Q29sdW1ucyIsIndhdGNoIiwibW91bnRlZCIsIm1ldGhvZHMiLCJnZXRQaWNrZXIiLCJvbkNhbmNlbCIsImV2ZW50Iiwib25Db25maXJtIiwiZW1pdCIsImRldGFpbCIsIm9uQ2hhbmdlIiwiX3RoaXMiLCJfYSIsImluZGV4IiwicGlja2VyIiwiZ2V0Q29uZmlnIiwiZ2V0TGlzdCIsInJlc3VsdCIsImxpc3QiLCJjb2RlIiwibmFtZSIsIml0ZW0iLCJnZXRJbmRleCIsImNvbXBhcmVOdW0iLCJzZXRWYWx1ZXMiLCJjb3VudHkiLCJwcm92aW5jZSIsImNpdHkiLCJzdGFjayIsImdldFZhbHVlcyIsImdldERldGFpbCIsImFyZWEiLCJjb3VudHJ5IiwibmFtZXMiLCJyZXNldCJdLCJtYXBwaW5ncyI6Ijs7QUFDQSxJQUFJQSxXQUFZLGFBQVEsVUFBVCxRQUFDLElBQTBCLFlBQVk7QUFDbERBLGVBQVdDLE9BQUFBLE1BQUF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aGlzO1xuICAgICAgICAgICAgdmFyIF9hID0gZXZlbnQuZGV0YWlsLCBpbmRleCA9IF9hLmluZGV4LCBwaWNrZXIgPSBfYS5waWNrZXIsIHZhbHVlID0gX2EudmFsdWU7XG4gICAgICAgICAgICB0aGlzLmNvZGUgPSB2YWx1ZVtpbmRleF0uY29kZTtcbiAgICAgICAgICAgIHRoaXMuc2V0VmFsdWVzKCkudGhlbihmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgX3RoaXMuJGVtaXQoJ2NoYW5nZScsIHtcbiAgICAgICAgICAgICAgICAgICAgcGlja2VyOiBwaWNrZXIsXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlczogcGlja2VyLmdldFZhbHVlcygpLFxuICAgICAgICAgICAgICAgICAgICBpbmRleDogaW5kZXhcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICBnZXRDb25maWc6IGZ1bmN0aW9uICh0eXBlKSB7XG4gICAgICAgICAgICB2YXIgYXJlYUxpc3QgPSB0aGlzLmRhdGEuYXJlYUxpc3Q7XG4gICAgICAgICAgICByZXR1cm4gKGFyZWFMaXN0ICYmIGFyZWFMaXN0W3R5cGUgKyBcIl9saXN0XCJdKSB8fCB7fTtcbiAgICAgICAgfSxcbiAgICAgICAgZ2V0TGlzdDogZnVuY3Rpb24gKHR5cGUsIGNvZGUpIHtcbiAgICAgICAgICAgIHZhciByZXN1bHQgPSBbXTtcbiAgICAgICAgICAgIGlmICh0eXBlICE9PSAncHJvdmluY2UnICYmICFjb2RlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBsaXN0ID0gdGhpcy5nZXRDb25maWcodHlwZSk7XG4gICAgICAgICAgICByZXN1bHQgPSBPYmplY3Qua2V5cyhsaXN0KS5tYXAoZnVuY3Rpb24gKGNvZGUpIHsgcmV0dXJuICh7XG4gICAgICAgICAgICAgICAgY29kZTogY29kZSxcbiAgICAgICAgICAgICAgICBuYW1lOiBsaXN0W2NvZGVdXG4gICAgICAgICAgICB9KTsgfSk7XG4gICAgICAgICAgICBpZiAoY29kZSkge1xuICAgICAgICAgICAgICAgIC8vIG92ZXJzZWEgY29kZVxuICAgICAgICAgICAgICAgIGlmIChjb2RlWzBdID09PSAnOScgJiYgdHlwZSA9PT0gJ2NpdHknKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvZGUgPSAnOSc7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHJlc3VsdC5maWx0ZXIoZnVuY3Rpb24gKGl0ZW0pIHsgcmV0dXJuIGl0ZW0uY29kZS5pbmRleE9mKGNvZGUpID09PSAwOyB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgIH0sXG4gICAgICAgIGdldEluZGV4OiBmdW5jdGlvbiAodHlwZSwgY29kZSkge1xuICAgICAgICAgICAgdmFyIGNvbXBhcmVOdW0gPSB0eXBlID09PSAncHJvdmluY2UnID8gMiA6IHR5cGUgPT09ICdjaXR5JyA/IDQgOiA2O1xuICAgICAgICAgICAgdmFyIGxpc3QgPSB0aGlzLmdldExpc3QodHlwZSwgY29kZS5zbGljZSgwLCBjb21wYXJlTnVtIC0gMikpO1xuICAgICAgICAgICAgLy8gb3ZlcnNlYSBjb2RlXG4gICAgICAgICAgICBpZiAoY29kZVswXSA9PT0gJzknICYmIHR5cGUgPT09ICdwcm92aW5jZScpIHtcbiAgICAgICAgICAgICAgICBjb21wYXJlTnVtID0gMTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNvZGUgPSBjb2RlLnNsaWNlKDAsIGNvbXBhcmVOdW0pO1xuICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKGxpc3RbaV0uY29kZS5zbGljZSgwLCBjb21wYXJlTnVtKSA9PT0gY29kZSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgfSxcbiAgICAgICAgc2V0VmFsdWVzOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xuICAgICAgICAgICAgdmFyIGNvdW50eSA9IHRoaXMuZ2V0Q29uZmlnKCdjb3VudHknKTtcbiAgICAgICAgICAgIHZhciBjb2RlID0gdGhpcy5jb2RlIHx8IE9iamVjdC5rZXlzKGNvdW50eSlbMF0gfHwgJyc7XG4gICAgICAgICAgICB2YXIgcHJvdmluY2UgPSB0aGlzLmdldExpc3QoJ3Byb3ZpbmNlJyk7XG4gICAgICAgICAgICB2YXIgY2l0eSA9IHRoaXMuZ2V0TGlzdCgnY2l0eScsIGNvZGUuc2xpY2UoMCwgMikpO1xuICAgICAgICAgICAgdmFyIHBpY2tlciA9IHRoaXMuZ2V0UGlja2VyKCk7XG4gICAgICAgICAgICBpZiAoIXBpY2tlcikge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBzdGFjayA9IFtdO1xuICAgICAgICAgICAgc3RhY2sucHVzaChwaWNrZXIuc2V0Q29sdW1uVmFsdWVzKDAsIHByb3ZpbmNlLCBmYWxzZSkpO1xuICAgICAgICAgICAgc3RhY2sucHVzaChwaWNrZXIuc2V0Q29sdW1uVmFsdWVzKDEsIGNpdHksIGZhbHNlKSk7XG4gICAgICAgICAgICBpZiAoY2l0eS5sZW5ndGggJiYgY29kZS5zbGljZSgyLCA0KSA9PT0gJzAwJykge1xuICAgICAgICAgICAgICAgIGNvZGUgPSBjaXR5WzBdLmNvZGU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzdGFjay5wdXNoKHBpY2tlci5zZXRDb2x1bW5WYWx1ZXMoMiwgdGhpcy5nZXRMaXN0KCdjb3VudHknLCBjb2RlLnNsaWNlKDAsIDQpKSwgZmFsc2UpKTtcbiAgICAgICAgICAgIHJldHVybiBQcm9taXNlLmFsbChzdGFjaylcbiAgICAgICAgICAgICAgICAuY2F0Y2goZnVuY3Rpb24gKCkgeyB9KVxuICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcGlja2VyLnNldEluZGV4ZXMoW1xuICAgICAgICAgICAgICAgICAgICBfdGhpcy5nZXRJbmRleCgncHJvdmluY2UnLCBjb2RlKSxcbiAgICAgICAgICAgICAgICAgICAgX3RoaXMuZ2V0SW5kZXgoJ2NpdHknLCBjb2RlKSxcbiAgICAgICAgICAgICAgICAgICAgX3RoaXMuZ2V0SW5kZXgoJ2NvdW50eScsIGNvZGUpXG4gICAgICAgICAgICAgICAgXSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5jYXRjaChmdW5jdGlvbiAoKSB7IH0pO1xuICAgICAgICB9LFxuICAgICAgICBnZXRWYWx1ZXM6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBwaWNrZXIgPSB0aGlzLmdldFBpY2tlcigpO1xuICAgICAgICAgICAgcmV0dXJuIHBpY2tlciA/IHBpY2tlci5nZXRWYWx1ZXMoKS5maWx0ZXIoZnVuY3Rpb24gKHZhbHVlKSB7IHJldHVybiAhIXZhbHVlOyB9KSA6IFtdO1xuICAgICAgICB9LFxuICAgICAgICBnZXREZXRhaWw6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciB2YWx1ZXMgPSB0aGlzLmdldFZhbHVlcygpO1xuICAgICAgICAgICAgdmFyIGFyZWEgPSB7XG4gICAgICAgICAgICAgICAgY29kZTogJycsXG4gICAgICAgICAgICAgICAgY291bnRyeTogJycsXG4gICAgICAgICAgICAgICAgcHJvdmluY2U6ICcnLFxuICAgICAgICAgICAgICAgIGNpdHk6ICcnLFxuICAgICAgICAgICAgICAgIGNvdW50eTogJydcbiAgICAgICAgICAgIH07XG4gICAgICAgICAgICBpZiAoIXZhbHVlcy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gYXJlYTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBuYW1lcyA9IHZhbHVlcy5tYXAoZnVuY3Rpb24gKGl0ZW0pIHsgcmV0dXJuIGl0ZW0ubmFtZTsgfSk7XG4gICAgICAgICAgICBhcmVhLmNvZGUgPSB2YWx1ZXNbdmFsdWVzLmxlbmd0aCAtIDFdLmNvZGU7XG4gICAgICAgICAgICBpZiAoYXJlYS5jb2RlWzBdID09PSAnOScpIHtcbiAgICAgICAgICAgICAgICBhcmVhLmNvdW50cnkgPSBuYW1lc1sxXSB8fCAnJztcbiAgICAgICAgICAgICAgICBhcmVhLnByb3ZpbmNlID0gbmFtZXNbMl0gfHwgJyc7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICBhcmVhLnByb3ZpbmNlID0gbmFtZXNbMF0gfHwgJyc7XG4gICAgICAgICAgICAgICAgYXJlYS5jaXR5ID0gbmFtZXNbMV0gfHwgJyc7XG4gICAgICAgICAgICAgICAgYXJlYS5jb3VudHkgPSBuYW1lc1syXSB8fCAnJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBhcmVhO1xuICAgICAgICB9LFxuICAgICAgICByZXNldDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdGhpcy5jb2RlID0gJyc7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5zZXRWYWx1ZXMoKTtcbiAgICAgICAgfVxuICAgIH1cbn0pO1xuIl0sImZpbGUiOiJpbmRleC5qcyJ9
export default global['__wxComponents']['vant/area/index']
</script>
<style platform="mp-weixin">
@import '../common/index.css';
</style>