@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "SENSELESS_COMPARISON", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uni.UNIHelloUniAppX
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.unicloud.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlin.properties.Delegates
open class GenPagesComponentPickerPicker : BasePage {
    constructor(__ins: ComponentInternalInstance, __renderer: String?) : super(__ins, __renderer) {
        onLoad(fun(_: OnLoadOptions) {
            stat_instance.onLoad(this)
        }
        , __ins)
        onPageShow(fun() {
            stat_instance.onShow(this)
        }
        , __ins)
        onPageHide(fun() {
            stat_instance.onHide(this)
        }
        , __ins)
        onUnload(fun() {
            stat_instance.onUnload(this)
        }
        , __ins)
    }
    open var data: PageDataType
        get() {
            return unref(this.`$exposed`["data"]) as PageDataType
        }
        set(value) {
            setRefValue(this.`$exposed`, "data", value)
        }
    open var setSelectorValue: () -> Unit
        get() {
            return unref(this.`$exposed`["setSelectorValue"]) as () -> Unit
        }
        set(value) {
            setRefValue(this.`$exposed`, "setSelectorValue", value)
        }
    companion object {
        @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
        var setup: (__props: GenPagesComponentPickerPicker, __setupCtx: SetupContext) -> Any? = fun(__props, __setupCtx): Any? {
            val __expose = __setupCtx.expose
            val __ins = getCurrentInstance()!!
            val _ctx = __ins.proxy as GenPagesComponentPickerPicker
            val _cache = __ins.renderCache
            fun getDate(date_text: String = "day", type: String?): String {
                val date = Date()
                var year: Any = date.getFullYear()
                var month: Any = date.getMonth() + 1
                var day: Any = date.getDate()
                if (type == "start") {
                    year = (year as Number) - 90
                } else if (type == "end") {
                    year = (year as Number) + 10
                }
                month = if (month as Number > 9) {
                    month as Number
                } else {
                    "0" + (month as Number)
                }
                day = if (day as Number > 9) {
                    day as Number
                } else {
                    "0" + (day as Number)
                }
                if (date_text == "month") {
                    return "" + year as Number + "-" + month
                } else if (date_text == "year") {
                    return "" + year as Number
                }
                return "" + year as Number + "-" + month + "-" + day
            }
            val data = reactive(PageDataType(title = "picker", selectorArray = _uA(
                DataType__41(name = "中国"),
                DataType__41(name = "美国"),
                DataType__41(name = "巴西"),
                DataType__41(name = "日本")
            ), index = 0, multiArray = _uA(
                _uA(
                    "亚洲",
                    "欧洲"
                ),
                _uA(
                    "中国",
                    "日本"
                ),
                _uA(
                    "北京",
                    "上海",
                    "广州"
                )
            ), multiIndex = _uA(
                0,
                0,
                0
            ), cityArray = _uA(
                _uA(),
                _uA(),
                _uA()
            ), allCityData = _uA(), region = _uA(), cityIndex = _uA(
                0,
                0,
                0
            ), dayDate = getDate("day", ""), monthDate = getDate("month", ""), yearDate = getDate("year", ""), startDate = getDate("day", "start"), endDate = getDate("day", "end"), time = "12:01"))
            fun gen_getSafeCityValue_fn(column: Number, index: Number): String {
                if (column < 0 || column >= data.cityArray.length) {
                    return ""
                }
                val columnData = data.cityArray[column]
                if (index < 0 || index >= columnData.length) {
                    return ""
                }
                return columnData[index]
            }
            val getSafeCityValue = ::gen_getSafeCityValue_fn
            fun gen_getCityDisplayText_fn(): String {
                val province = getSafeCityValue(0, data.cityIndex[0])
                val city = getSafeCityValue(1, data.cityIndex[1])
                val district = getSafeCityValue(2, data.cityIndex[2])
                var text = province
                if (city != "") {
                    text += "，" + city
                }
                if (district != "") {
                    text += "，" + district
                }
                return text
            }
            val getCityDisplayText = ::gen_getCityDisplayText_fn
            fun gen_initCityData_fn() {
                val cityDataList = JSON.parse<UTSArray<CityItemData>>(cityData)
                if (cityDataList == null) {
                    return
                }
                data.allCityData = cityDataList
                data.cityArray[0] = cityDataList.map(fun(item): String {
                    return item.title
                }
                )
                val provinceIndex = data.cityIndex[0]
                if (cityDataList[provinceIndex] != null && cityDataList[provinceIndex].children != null) {
                    data.cityArray[1] = cityDataList[provinceIndex].children.map(fun(item): String {
                        return item.title
                    })
                    val cityIndex = data.cityIndex[1]
                    if (cityDataList[provinceIndex].children[cityIndex] != null && cityDataList[provinceIndex].children[cityIndex].children != null) {
                        data.cityArray[2] = cityDataList[provinceIndex].children[cityIndex].children.map(fun(item): String {
                            return item.title
                        })
                    } else {
                        data.cityArray[2] = _uA()
                    }
                } else {
                    data.cityArray[1] = _uA()
                    data.cityArray[2] = _uA()
                }
            }
            val initCityData = ::gen_initCityData_fn
            val bindPickerChange = fun(e: UniPickerChangeEvent){
                console.log("picker发送选择改变，携带值为：" + e.detail.value)
                data.index = e.detail.value as Number
            }
            val bindMultiPickerColumnChange = fun(e: UniPickerColumnChangeEvent){
                console.log("修改的列为：" + e.detail.column + "，值为：" + e.detail.value)
                data.multiIndex[e.detail.column] = e.detail.value
                when (e.detail.column) {
                    0 -> 
                        {
                            when (data.multiIndex[0]) {
                                0 -> 
                                    {
                                        data.multiArray[1] = _uA(
                                            "中国",
                                            "日本"
                                        )
                                        data.multiArray[2] = _uA(
                                            "北京",
                                            "上海",
                                            "广州"
                                        )
                                    }
                                1 -> 
                                    {
                                        data.multiArray[1] = _uA(
                                            "英国",
                                            "法国"
                                        )
                                        data.multiArray[2] = _uA(
                                            "伦敦",
                                            "曼彻斯特"
                                        )
                                    }
                            }
                            data.multiIndex.splice(1, 1, 0)
                            data.multiIndex.splice(2, 1, 0)
                        }
                    1 -> 
                        {
                            when (data.multiIndex[0]) {
                                0 -> 
                                    when (data.multiIndex[1]) {
                                        0 -> 
                                            data.multiArray[2] = _uA(
                                                "北京",
                                                "上海",
                                                "广州"
                                            )
                                        1 -> 
                                            data.multiArray[2] = _uA(
                                                "东京",
                                                "北海道"
                                            )
                                    }
                                1 -> 
                                    when (data.multiIndex[1]) {
                                        0 -> 
                                            data.multiArray[2] = _uA(
                                                "伦敦",
                                                "曼彻斯特"
                                            )
                                        1 -> 
                                            data.multiArray[2] = _uA(
                                                "巴黎",
                                                "马赛"
                                            )
                                    }
                            }
                            data.multiIndex.splice(2, 1, 0)
                        }
                }
                nextTick(fun(){})
            }
            val bindCityPickerColumnChange = fun(e: UniPickerColumnChangeEvent){
                console.log("修改的列为：" + e.detail.column + "，值为：" + e.detail.value)
                data.cityIndex[e.detail.column] = e.detail.value
                when (e.detail.column) {
                    0 -> 
                        {
                            val provinceIndex = data.cityIndex[0]
                            val cities = data.allCityData[provinceIndex].children
                            data.cityArray[1] = cities.map(fun(item): String {
                                return item.title
                            }
                            )
                            if (cities.length > 0) {
                                data.cityArray[2] = cities[0].children.map(fun(item): String {
                                    return item.title
                                })
                            } else {
                                data.cityArray[2] = _uA()
                            }
                            data.cityIndex.splice(1, 1, 0)
                            data.cityIndex.splice(2, 1, 0)
                        }
                    1 -> 
                        {
                            val cityIndex = data.cityIndex[1]
                            val province = data.allCityData[data.cityIndex[0]]
                            if (province != null && province.children != null && province.children[cityIndex] != null) {
                                val districts = province.children[cityIndex].children
                                data.cityArray[2] = districts.map(fun(item): String {
                                    return item.title
                                })
                            } else {
                                data.cityArray[2] = _uA()
                            }
                            data.cityIndex.splice(2, 1, 0)
                        }
                }
            }
            val bindDayDateChange = fun(e: UniPickerChangeEvent){
                data.dayDate = e.detail.value as String
            }
            val bindMonthDateChange = fun(e: UniPickerChangeEvent){
                data.monthDate = e.detail.value as String
            }
            val bindYearDateChange = fun(e: UniPickerChangeEvent){
                data.yearDate = e.detail.value as String
            }
            val bindTimeChange = fun(e: UniPickerChangeEvent){
                data.time = e.detail.value as String
            }
            val setSelectorValue = fun(){
                data.index = 2
            }
            __expose(_uM("data" to data, "setSelectorValue" to setSelectorValue))
            return fun(): Any? {
                val _component_page_head = resolveEasyComponent("page-head", GenComponentsPageHeadPageHeadClass)
                val _component_picker = resolveComponent("picker")
                return _cE("scroll-view", _uM("style" to _nS(_uM("flex" to "1"))), _uA(
                    _cV(_component_page_head, _uM("title" to unref(data).title), null, 8, _uA(
                        "title"
                    )),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "普通选择器"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("view", _uM("class" to "uni-list-cell-left"), "当前选择"),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-selector--test", "onChange" to bindPickerChange, "value" to unref(data).index, "range" to unref(data).selectorArray, "range-key" to "name"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input picker-selector--value"), _tD(unref(data).selectorArray[unref(data).index].name), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "range"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "多列选择器"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("text", _uM("class" to "uni-list-cell-left"), "当前选择"),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-multi--test", "mode" to "multiSelector", "onColumnchange" to bindMultiPickerColumnChange, "value" to unref(data).multiIndex, "range" to unref(data).multiArray), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input picker-multi--value"), _tD(unref(data).multiArray[0][unref(data).multiIndex[0]]) + "，" + _tD(unref(data).multiArray[1][unref(data).multiIndex[1]]) + "，" + _tD(unref(data).multiArray[2][unref(data).multiIndex[2]]), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "range"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "time选择器"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("view", _uM("class" to "uni-list-cell-left"), "当前选择"),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-time--test", "mode" to "time", "value" to unref(data).time, "start" to "09:01", "end" to "21:01", "onChange" to bindTimeChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input"), _tD(unref(data).time), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：选择 09:01 ~ 21:01 之间的时间, 不在区间内不能选中"),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "date选择器 fields = day"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("text", _uM("class" to "uni-list-cell-left"), "当前选择 "),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-date-day--test", "mode" to "date", "value" to unref(data).dayDate, "start" to unref(data).startDate, "end" to unref(data).endDate, "onChange" to bindDayDateChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input"), _tD(unref(data).dayDate), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "start",
                                    "end"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：选择当前时间往前90年和往后10年之间的时间, 不在区间内不能选中"),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "日期选择器 fields = month"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("text", _uM("class" to "uni-list-cell-left"), "当前选择 "),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-date-month--test", "mode" to "date", "fields" to "month", "value" to unref(data).monthDate, "start" to unref(data).startDate, "end" to unref(data).endDate, "onChange" to bindMonthDateChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input"), _tD(unref(data).monthDate), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "start",
                                    "end"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：选择当前时间往前90年和往后10年之间的时间, 不在区间内不能选中。且只能选年和月"),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "日期选择器 fields = year"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("text", _uM("class" to "uni-list-cell-left"), "当前选择 "),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-date-year--test", "mode" to "date", "fields" to "year", "value" to unref(data).yearDate, "start" to unref(data).startDate, "end" to unref(data).endDate, "onChange" to bindYearDateChange), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input"), _tD(unref(data).yearDate), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "start",
                                    "end"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：选择当前时间往前90年和往后10年之间的时间, 不在区间内不能选中"),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "省市地区选择器"),
                    _cE("view", _uM("class" to "uni-list", "style" to _nS(_uM("margin-bottom" to "15px"))), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("text", _uM("class" to "uni-list-cell-left"), "当前选择"),
                            _cE("view", _uM("class" to "uni-list-cell-db", "onClick" to initCityData), _uA(
                                _cV(_component_picker, _uM("class" to "picker-city--test", "mode" to "multiSelector", "onColumnchange" to bindCityPickerColumnChange, "value" to unref(data).cityIndex, "range" to unref(data).cityArray), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input picker-city--value"), _tD(getCityDisplayText()), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "range"
                                ))
                            ))
                        ))
                    ), 4),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：省市地区数据并没有内置到uni-app x框架中，仅微信下由微信内置了，其他平台需单独加载地区数据"),
                    _cE("text", _uM("class" to "uni-title uni-common-pl"), "已禁用的picker，点击无效"),
                    _cE("view", _uM("class" to "uni-list"), _uA(
                        _cE("view", _uM("class" to "uni-list-cell"), _uA(
                            _cE("view", _uM("class" to "uni-list-cell-left"), "当前选择"),
                            _cE("view", _uM("class" to "uni-list-cell-db"), _uA(
                                _cV(_component_picker, _uM("class" to "picker-disabled--test", "onChange" to bindPickerChange, "disabled" to "", "value" to unref(data).index, "range" to unref(data).selectorArray, "range-key" to "name"), _uM("default" to withSlotCtx(fun(): UTSArray<Any> {
                                    return _uA(
                                        _cE("text", _uM("class" to "uni-input picker-disabled--value"), _tD(unref(data).selectorArray[unref(data).index].name), 1)
                                    )
                                }
                                ), "_" to 1), 8, _uA(
                                    "value",
                                    "range"
                                ))
                            ))
                        ))
                    )),
                    _cE("text", _uM("class" to "uni-picker-tips"), "注：值与普通选择器同步，但不可选择")
                ), 4)
            }
        }
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            _nCS(_uA(
                styles0
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return _uM("uni-title" to _pS(_uM("fontSize" to 14)), "uni-picker-tips" to _pS(_uM("fontSize" to 12, "color" to "#666666", "marginTop" to 5, "marginBottom" to 15, "paddingTop" to 0, "paddingRight" to 15, "paddingBottom" to 0, "paddingLeft" to 15)))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = _uM()
        var emits: Map<String, Any?> = _uM()
        var props = _nP(_uM())
        var propsNeedCastKeys: UTSArray<String> = _uA()
        var components: Map<String, CreateVueComponent> = _uM()
    }
}
