build: compile 1.10.19

This commit is contained in:
landluck 2023-05-19 15:14:20 +08:00
parent 4b86663562
commit 51bd751453
10 changed files with 66 additions and 61 deletions

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}

View File

@ -15,7 +15,6 @@ VantComponent({
title: String,
value: {
type: String,
observer: 'updateValue',
},
placeholder: {
type: String,
@ -28,7 +27,6 @@ VantComponent({
options: {
type: Array,
value: [],
observer: 'updateOptions',
},
swipeable: {
type: Boolean,
@ -58,15 +56,20 @@ VantComponent({
textKey: FieldName.TEXT,
valueKey: FieldName.VALUE,
childrenKey: FieldName.CHILDREN,
innerValue: '',
},
watch: {
options() {
this.updateTabs();
},
value(newVal) {
this.updateValue(newVal);
},
},
created() {
this.updateTabs();
},
methods: {
updateOptions(val, oldVal) {
const isAsync = !!(val.length && oldVal.length);
this.updateTabs(isAsync);
},
updateValue(val) {
if (val !== undefined) {
const values = this.data.tabs.map((tab) => tab.selected && tab.selected[this.data.valueKey]);
@ -74,6 +77,7 @@ VantComponent({
return;
}
}
this.innerValue = val;
this.updateTabs();
},
updateFieldNames() {
@ -98,10 +102,14 @@ VantComponent({
}
}
},
updateTabs(isAsync = false) {
const { options, value } = this.data;
if (value !== undefined) {
const selectedOptions = this.getSelectedOptionsByValue(options, value);
updateTabs() {
const { options } = this.data;
const { innerValue } = this;
if (!options.length) {
return;
}
if (innerValue !== undefined) {
const selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
if (selectedOptions) {
let optionsCursor = options;
const tabs = selectedOptions.map((option) => {
@ -132,16 +140,6 @@ VantComponent({
return;
}
}
// 异步更新
if (isAsync) {
const { tabs } = this.data;
tabs[tabs.length - 1].options =
options[options.length - 1][this.data.childrenKey];
this.setData({
tabs,
});
return;
}
this.setData({
tabs: [
{
@ -194,11 +192,13 @@ VantComponent({
tabs,
});
const selectedOptions = tabs.map((tab) => tab.selected).filter(Boolean);
const value = option[valueKey];
const params = {
value: option[valueKey],
value,
tabIndex,
selectedOptions,
};
this.innerValue = value;
this.$emit('change', params);
if (!option[childrenKey]) {
this.$emit('finish', params);

View File

@ -37,14 +37,14 @@
wx:for="{{ tab.options }}"
wx:for-item="option"
wx:key="index"
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
data-option="{{ option }}"
data-tab-index="{{ tabIndex }}"
bind:tap="onSelect"
>
<text>{{ option[textKey] }}</text>
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
</view>
</view>
<!-- 暂不支持 -->

View File

@ -1,16 +1,16 @@
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function isSelected(tab, textKey, option) {
return tab.selected && tab.selected[textKey] === option[textKey]
function isSelected(tab, valueKey, option) {
return tab.selected && tab.selected[valueKey] === option[valueKey]
}
function optionClass(tab, textKey, option) {
return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
function optionClass(tab, valueKey, option) {
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
}
function optionStyle(data) {
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
return style({
color
});

3
dist/tabs/index.js vendored
View File

@ -160,6 +160,9 @@ VantComponent({
});
});
if (currentIndex === data.currentIndex) {
if (!data.inited) {
this.resize();
}
return;
}
const shouldEmitChange = data.currentIndex !== null;

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}
@import '../common/index.wxss';.van-calendar{background-color:var(--calendar-background-color,#fff);display:flex;flex-direction:column;height:var(--calendar-height,100%)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:var(--calendar-popup-height,90%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-overflow-scrolling:touch;flex:1;overflow:auto}.van-calendar__footer{flex-shrink:0;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:var(--calendar-confirm-button-height,36px)!important;line-height:var(--calendar-confirm-button-line-height,34px)!important;margin:var(--calendar-confirm-button-margin,7px 0)!important}

View File

@ -26,7 +26,6 @@ var defaultFieldNames = {
title: String,
value: {
type: String,
observer: 'updateValue',
},
placeholder: {
type: String,
@ -39,7 +38,6 @@ var defaultFieldNames = {
options: {
type: Array,
value: [],
observer: 'updateOptions',
},
swipeable: {
type: Boolean,
@ -69,15 +67,20 @@ var defaultFieldNames = {
textKey: FieldName.TEXT,
valueKey: FieldName.VALUE,
childrenKey: FieldName.CHILDREN,
innerValue: '',
},
watch: {
options: function () {
this.updateTabs();
},
value: function (newVal) {
this.updateValue(newVal);
},
},
created: function () {
this.updateTabs();
},
methods: {
updateOptions: function (val, oldVal) {
var isAsync = !!(val.length && oldVal.length);
this.updateTabs(isAsync);
},
updateValue: function (val) {
var _this = this;
if (val !== undefined) {
@ -86,6 +89,7 @@ var defaultFieldNames = {
return;
}
}
this.innerValue = val;
this.updateTabs();
},
updateFieldNames: function () {
@ -110,12 +114,15 @@ var defaultFieldNames = {
}
}
},
updateTabs: function (isAsync) {
updateTabs: function () {
var _this = this;
if (isAsync === void 0) { isAsync = false; }
var _a = this.data, options = _a.options, value = _a.value;
if (value !== undefined) {
var selectedOptions = this.getSelectedOptionsByValue(options, value);
var options = this.data.options;
var innerValue = this.innerValue;
if (!options.length) {
return;
}
if (innerValue !== undefined) {
var selectedOptions = this.getSelectedOptionsByValue(options, innerValue);
if (selectedOptions) {
var optionsCursor_1 = options;
var tabs_1 = selectedOptions.map(function (option) {
@ -146,16 +153,6 @@ var defaultFieldNames = {
return;
}
}
// 异步更新
if (isAsync) {
var tabs = this.data.tabs;
tabs[tabs.length - 1].options =
options[options.length - 1][this.data.childrenKey];
this.setData({
tabs: tabs,
});
return;
}
this.setData({
tabs: [
{
@ -209,11 +206,13 @@ var defaultFieldNames = {
tabs: tabs,
});
var selectedOptions = tabs.map(function (tab) { return tab.selected; }).filter(Boolean);
var value = option[valueKey];
var params = {
value: option[valueKey],
value: value,
tabIndex: tabIndex,
selectedOptions: selectedOptions,
};
this.innerValue = value;
this.$emit('change', params);
if (!option[childrenKey]) {
this.$emit('finish', params);

View File

@ -37,14 +37,14 @@
wx:for="{{ tab.options }}"
wx:for-item="option"
wx:key="index"
class="{{ option.className }} {{ utils.optionClass(tab, textKey, option) }}"
style="{{ utils.optionStyle({ tab, textKey, option, activeColor }) }}"
class="{{ option.className }} {{ utils.optionClass(tab, valueKey, option) }}"
style="{{ utils.optionStyle({ tab, valueKey, option, activeColor }) }}"
data-option="{{ option }}"
data-tab-index="{{ tabIndex }}"
bind:tap="onSelect"
>
<text>{{ option[textKey] }}</text>
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
<van-icon wx:if="{{ utils.isSelected(tab, valueKey, option) }}" name="success" size="18" />
</view>
</view>
<!-- 暂不支持 -->

View File

@ -1,16 +1,16 @@
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function isSelected(tab, textKey, option) {
return tab.selected && tab.selected[textKey] === option[textKey]
function isSelected(tab, valueKey, option) {
return tab.selected && tab.selected[valueKey] === option[valueKey]
}
function optionClass(tab, textKey, option) {
return utils.bem('cascader__option', { selected: isSelected({ tab, textKey, option }), disabled: option.disabled })
function optionClass(tab, valueKey, option) {
return utils.bem('cascader__option', { selected: isSelected(tab, valueKey, option), disabled: option.disabled })
}
function optionStyle(data) {
var color = data.option.color || (isSelected(data.tab, data.textKey, data.option) ? data.activeColor : undefined);
var color = data.option.color || (isSelected(data.tab, data.valueKey, data.option) ? data.activeColor : undefined);
return style({
color
});

View File

@ -179,6 +179,9 @@ var relation_1 = require("../common/relation");
});
});
if (currentIndex === data.currentIndex) {
if (!data.inited) {
this.resize();
}
return;
}
var shouldEmitChange = data.currentIndex !== null;