<wxs module="computed" src="./index.wxs"/>
<wxs module="utils" src="../wxs/utils.wxs"/>
<view class="van-calendar">
    <header
            bind:click-subtitle="onClickSubtitle"
            firstDayOfWeek="{{ firstDayOfWeek }}"
            showSubtitle="{{ showSubtitle }}"
            showTitle="{{ showTitle }}"
            subtitle="{{ subtitle }}"
            title="{{ title }}"
    >
        <slot slot="title" name="title"></slot>
    </header>

    <scroll-view
            class="van-calendar__body"
            scroll-into-view="{{ scrollIntoView }}"
            scroll-y
    >
        <month
                id="month{{ index }}"
                allowSameDay="{{ allowSameDay }}"
                bind:click="onClickDay"
                class="month"
                color="{{ color }}"
                currentDate="{{ currentDate }}"
                data-date="{{ item }}"
                date="{{ item }}"
                firstDayOfWeek="{{ firstDayOfWeek }}"
                formatter="{{ formatter }}"
                maxDate="{{ maxDate }}"
                minDate="{{ minDate }}"
                rowHeight="{{ rowHeight }}"
                showMark="{{ showMark }}"
                showMonthTitle="{{ index !== 0 || !showSubtitle }}"
                showSubtitle="{{ showSubtitle }}"
                type="{{ type }}"
                wx:for="{{ computed.getMonths(minDate, maxDate) }}"
                wx:key="index"
        />
    </scroll-view>

    <view
            class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
    >
        <slot name="footer"></slot>
    </view>

    <view
            class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}"
    >
        <van-button
                bind:click="onConfirm"
                block
                color="{{ color }}"
                custom-class="van-calendar__confirm"
                disabled="{{ computed.getButtonDisabled(type, currentDate, minRange) }}"
                nativeType="text"
                round
                type="danger"
                wx:if="{{ showConfirm }}"
        >
            {{
                computed.getButtonDisabled(type, currentDate, minRange)
                        ? confirmDisabledText
                        : confirmText
            }}
        </van-button>
    </view>
</view>
