New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mini-antui

Package Overview
Dependencies
Maintainers
4
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-antui - npm Package Compare versions

Comparing version 0.4.12 to 0.4.13

es/pagination/index.acss

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 0.4.13
`2019-01-18`
- **Feature**
- 新增`pagination`组件
## 0.4.12

@@ -2,0 +9,0 @@

15

es/_util/fmtEvent.js

@@ -1,5 +0,4 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
export default function fmtEvent(props, e) {
var dataset = {};
for (var key in props) {

@@ -10,6 +9,12 @@ if (/data-/gi.test(key)) {

}
return _extends({}, e, {
currentTarget: { dataset: dataset },
target: { dataset: dataset, targetDataset: dataset }
return Object.assign({}, e, {
currentTarget: {
dataset: dataset
},
target: {
dataset: dataset,
targetDataset: dataset
}
});
}
import fmtEvent from '../_util/fmtEvent';
Component({

@@ -4,0 +3,0 @@ props: {

import fmtEvent from '../_util/fmtEvent';
Component({

@@ -18,2 +17,3 @@ props: {

var event = fmtEvent(this.props, e);
if (this.props.onInput) {

@@ -25,2 +25,3 @@ this.props.onInput(event);

var event = fmtEvent(this.props, e);
if (this.props.onConfirm) {

@@ -40,2 +41,3 @@ this.props.onConfirm(event);

var event = fmtEvent(this.props, e);
if (this.props.onFocus) {

@@ -50,2 +52,3 @@ this.props.onFocus(event);

var event = fmtEvent(this.props, e);
if (this.props.onBlur) {

@@ -52,0 +55,0 @@ this.props.onBlur(event);

@@ -1,4 +0,3 @@

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
/* eslint-disable complexity, no-param-reassign */
/* eslint-disable complexity, no-param-reassign */
/* eslint max-depth: [2, 7] */

@@ -16,10 +15,9 @@ var leapYear = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

5: 'rgba(51, 51, 51, 0.4)'
};
}; // 获取某月第某天是星期几
// 获取某月第某天是星期几
function getDay(month, year, index) {
return new Date(year, month, index).getDay();
}
} // 获取某月有几天
// 获取某月有几天
function getMonthLength(month, year) {

@@ -31,10 +29,10 @@ if (year % 400 === 0 || year % 100 !== 0 && year % 4 === 0) {

}
}
} // 数字补位 1 -> 01
// 数字补位 1 -> 01
function prefixNum(num) {
if (num < 10) {
return '0' + num;
return "0" + num;
} else {
return '' + num;
return "" + num;
}

@@ -50,2 +48,3 @@ }

blockType: 1 // 1.没有待办纯数字 2.有待办 用于区分不同类型日期块的样式。
},

@@ -66,3 +65,2 @@ props: {

var month = date.getMonth();
this.setData({

@@ -77,4 +75,4 @@ selectedYear: year,

var dates = this.data.dates;
var blockType = 1;
var blockType = 1;
for (var i = 0; i < dates.length; i++) {

@@ -93,12 +91,10 @@ for (var j = 0; j < dates[i].length; j++) {

},
methods: {
onPrevMonthTap: function onPrevMonthTap() {
var _data = this.data,
selectedMonth = _data.selectedMonth,
selectedYear = _data.selectedYear;
var _this$data = this.data,
selectedMonth = _this$data.selectedMonth,
selectedYear = _this$data.selectedYear;
var year = selectedYear;
var month = selectedMonth; // 如果当前选中是一月份,前一月是去年的12月
var year = selectedYear;
var month = selectedMonth;
// 如果当前选中是一月份,前一月是去年的12月
if (selectedMonth === FIRST_MONTH) {

@@ -119,13 +115,11 @@ year = selectedYear - 1;

});
this.refreshdates(month, year);
},
onNextMonthTap: function onNextMonthTap() {
var _data2 = this.data,
selectedMonth = _data2.selectedMonth,
selectedYear = _data2.selectedYear;
var _this$data2 = this.data,
selectedMonth = _this$data2.selectedMonth,
selectedYear = _this$data2.selectedYear;
var year = selectedYear;
var month = selectedMonth; // 如果当前选中是十二月份,下一月是去年的12月
var year = selectedYear;
var month = selectedMonth;
// 如果当前选中是十二月份,下一月是去年的12月
if (selectedMonth === LAST_MONTH) {

@@ -146,3 +140,2 @@ year = selectedYear + 1;

});
this.refreshdates(month, year);

@@ -152,7 +145,6 @@ },

this.tapTimes = 1;
var _data3 = this.data,
selectedYear = _data3.selectedYear,
selectedMonth = _data3.selectedMonth,
currentDate = _data3.currentDate;
var _this$data3 = this.data,
selectedYear = _this$data3.selectedYear,
selectedMonth = _this$data3.selectedMonth,
currentDate = _this$data3.currentDate;
var firstDay = getDay(month, year, 1);

@@ -165,4 +157,4 @@ var days = getMonthLength(month, year);

for (var i = 0; i < firstDay; i++) {
num += 1;
// 如果当前选中的是一月份,前一个月是去年的12月
num += 1; // 如果当前选中的是一月份,前一个月是去年的12月
var _year = selectedYear;

@@ -193,3 +185,5 @@ var _month = selectedMonth;

num += 1;
var _date = _i + 1;
var dateTimeStamp = +new Date(selectedYear, selectedMonth, _date);

@@ -238,3 +232,5 @@ datesArray.push({

}
var blockType = 1;
for (var _i3 = 0; _i3 < datesArray.length; _i3++) {

@@ -248,6 +244,8 @@ if (this.hasTag(datesArray[_i3])) {

var weekDates = [];
for (var _i4 = 0; _i4 < datesArray.length; _i4++) {
weekDates.push(datesArray[_i4]);
if ((_i4 + 1) % DAYS_PER_ROW === 0) {
dates.push([].concat(_toConsumableArray(weekDates)));
dates.push([].concat(weekDates));
weekDates = [];

@@ -263,4 +261,3 @@ }

hasTag: function hasTag(dateObj) {
var tagData = this.props.tagData;
// 去重由调用者处理
var tagData = this.props.tagData; // 去重由调用者处理

@@ -271,11 +268,13 @@ if (tagData.length === 0) {

}
return tagData.some(function (item) {
var dateArr = item.date.split('-');
var dateStr = [];
// 兼容ios下new Date('2018-1-1')格式返回invalid Date的问题
var dateStr = []; // 兼容ios下new Date('2018-1-1')格式返回invalid Date的问题
for (var i = 0; i < dateArr.length; i++) {
dateStr.push(dateArr[i].length > 1 ? dateArr[i] : '0' + dateArr[i]);
dateStr.push(dateArr[i].length > 1 ? dateArr[i] : "0" + dateArr[i]);
}
var date = new Date(dateStr.join('-'));
if (dateObj.year === date.getFullYear() && dateObj.month === date.getMonth() && dateObj.date === date.getDate()) {

@@ -298,3 +297,3 @@ dateObj.tag = item.tag;

makeDate: function makeDate(dateObj) {
return new Date(dateObj.year + '-' + prefixNum(dateObj.month + 1) + '-' + prefixNum(dateObj.date));
return new Date(dateObj.year + "-" + prefixNum(dateObj.month + 1) + "-" + prefixNum(dateObj.date));
},

@@ -309,7 +308,10 @@ onDateTap: function onDateTap(event) {

if (type === 'range') {
if (this.tapTimes % 2 === 0) {
this.tapTimes += 1;
this.endDate = { year: year, month: month, date: date };
this.endDate = {
year: year,
month: month,
date: date
};
var dateGap = this.getDateGap(this.startDate, this.endDate);

@@ -324,2 +326,3 @@

var hasDisable = false;
for (var i = 0; i < dates.length; i++) {

@@ -331,3 +334,2 @@ for (var j = 0; j < dates[i].length; j++) {

dateObj.isEnd = false;
var startDateGap = this.getDateGap(dateObj, this.startDate);

@@ -339,2 +341,3 @@ var endDateGap = this.getDateGap(dateObj, this.endDate);

}
if (startDateGap > 0 && endDateGap < 0) {

@@ -375,2 +378,3 @@ if (dateObj.disable) {

}
if (hasDisable) {

@@ -386,5 +390,7 @@ this.props.onSelectHasDisableDate([this.makeDate(this.startDate), this.makeDate(this.endDate)]);

var isDisable = false;
for (var _i5 = 0; _i5 < dates.length; _i5++) {
for (var _j = 0; _j < dates[_i5].length; _j++) {
var _dateObj = dates[_i5][_j];
if (_dateObj.year === year && _dateObj.month === month && _dateObj.date === date) {

@@ -398,2 +404,3 @@ if (_dateObj.disable) {

}
_dateObj.isStart = false;

@@ -410,6 +417,12 @@ _dateObj.isMiddle = false;

}
if (!isDisable) {
this.tapTimes += 1;
}
this.startDate = { year: year, month: month, date: date };
this.startDate = {
year: year,
month: month,
date: date
};
}

@@ -422,7 +435,10 @@

var _isDisable = false;
for (var _i6 = 0; _i6 < dates.length; _i6++) {
for (var _j2 = 0; _j2 < dates[_i6].length; _j2++) {
var _dateObj2 = dates[_i6][_j2];
if (_dateObj2.year === year && _dateObj2.month === month && _dateObj2.date === date) {
_dateObj2.isSelected = true;
if (_dateObj2.disable) {

@@ -446,3 +462,7 @@ _isDisable = true;

if (this.props.onSelect) {
this.props.onSelect([this.makeDate({ year: year, month: month, date: date }), undefined]);
this.props.onSelect([this.makeDate({
year: year,
month: month,
date: date
}), undefined]);
}

@@ -449,0 +469,0 @@ }

@@ -9,9 +9,10 @@ Component({

onCardClick: function onCardClick() {
var _props = this.props,
info = _props.info,
onClick = _props.onClick;
onClick({ info: info });
var _this$props = this.props,
info = _this$props.info,
onClick = _this$props.onClick;
onClick({
info: info
});
}
}
});

@@ -17,5 +17,6 @@ Component({

didUnMount: function didUnMount() {
this.webViewContext.postMessage({ action: 'releaseCamera' });
this.webViewContext.postMessage({
action: 'releaseCamera'
});
},
methods: {

@@ -27,3 +28,10 @@ doLeftFaceCheck: function doLeftFaceCheck() {

_this.isDidFaceLeftResolve = false;
_this.webViewContext.postMessage({ action: 'doFaceLeft', data: { minRotate: _this.props.minRotate } });
_this.webViewContext.postMessage({
action: 'doFaceLeft',
data: {
minRotate: _this.props.minRotate
}
});
_this.doFaceLeftResolve = resolve;

@@ -42,3 +50,10 @@ setTimeout(function () {

_this2.isDidFaceRightResolve = false;
_this2.webViewContext.postMessage({ action: 'doFaceRight', data: { minRotate: _this2.props.minRotate } });
_this2.webViewContext.postMessage({
action: 'doFaceRight',
data: {
minRotate: _this2.props.minRotate
}
});
_this2.doFaceRightResolve = resolve;

@@ -55,6 +70,6 @@ setTimeout(function () {

var _props = this.props,
onFaceStatusChange = _props.onFaceStatusChange,
onFail = _props.onFail,
onSuccessBtnTap = _props.onSuccessBtnTap;
var _this$props = this.props,
onFaceStatusChange = _this$props.onFaceStatusChange,
onFail = _this$props.onFail,
onSuccessBtnTap = _this$props.onSuccessBtnTap;
var _e$detail = e.detail,

@@ -64,3 +79,2 @@ action = _e$detail.action,

if (action === 'resignSuccessBtnClick') {

@@ -96,8 +110,14 @@ if (onSuccessBtnTap) {

promise.then(function () {
_this3.webViewContext.postMessage({ action: 'requestSuccess' });
})['catch'](function () {
_this3.webViewContext.postMessage({ action: 'requestFailure' });
_this3.webViewContext.postMessage({
action: 'requestSuccess'
});
}).catch(function () {
_this3.webViewContext.postMessage({
action: 'requestFailure'
});
});
} else {
this.webViewContext.postMessage({ action: 'requestSuccess' });
this.webViewContext.postMessage({
action: 'requestSuccess'
});
}

@@ -108,3 +128,6 @@ }

if (onFail) {
onFail({ code: data.code, message: data.message });
onFail({
code: data.code,
message: data.message
});
}

@@ -111,0 +134,0 @@ }

import lifecycle from '../mixins/lifecycle';
Component({

@@ -8,3 +7,2 @@ mixins: [lifecycle],

},
props: {

@@ -18,15 +16,21 @@ className: '',

},
didMount: function didMount() {
var _data = this.data,
results = _data.results,
items = _data.items;
var _props = this.props,
selected = _props.selected,
id = _props.id,
value = _props.value;
var _this$data = this.data,
results = _this$data.results,
items = _this$data.items;
var _this$props = this.props,
selected = _this$props.selected,
id = _this$props.id,
value = _this$props.value;
if (selected) {
results.push({ id: id, value: value });
items.push({ id: id, value: value, setData: this.setData });
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
this.setData({

@@ -37,15 +41,13 @@ confirmStyle: true

},
methods: {
handleClick: function handleClick() {
var _props2 = this.props,
id = _props2.id,
value = _props2.value,
onChange = _props2.onChange;
var _this$props2 = this.props,
id = _this$props2.id,
value = _this$props2.value,
onChange = _this$props2.onChange;
var confirmStyle = this.data.confirmStyle;
var _data2 = this.data,
results = _data2.results,
items = _data2.items,
commonProps = _data2.commonProps;
var _this$data2 = this.data,
results = _this$data2.results,
items = _this$data2.items,
commonProps = _this$data2.commonProps;

@@ -61,6 +63,14 @@ if (commonProps.max === 1) {

confirmStyle = true;
results.push({ id: id, value: value });
items.push({ id: id, value: value, setData: this.setData });
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
onChange(results);
}
this.setData({

@@ -71,10 +81,21 @@ confirmStyle: confirmStyle

}
if (confirmStyle === '' && results.length < commonProps.max) {
confirmStyle = true;
results.push({ id: id, value: value });
items.push({ id: id, value: value, setData: this.setData });
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
} else {
confirmStyle = '';
results.some(function (key, index) {
if (JSON.stringify(key) === JSON.stringify({ id: id, value: value })) {
if (JSON.stringify(key) === JSON.stringify({
id: id,
value: value
})) {
results.splice(index, 1);

@@ -87,2 +108,3 @@ return true;

}
this.setData({

@@ -89,0 +111,0 @@ confirmStyle: confirmStyle

import lifecycle from './mixins/lifecycle';
Component({

@@ -16,12 +15,9 @@ mixins: [lifecycle],

var max = this.props.max;
commonProps.max = max;
},
methods: {
resetFn: function resetFn() {
var _data = this.data,
items = _data.items,
results = _data.results;
var _this$data = this.data,
items = _this$data.items,
results = _this$data.results;
items.forEach(function (element) {

@@ -37,3 +33,2 @@ element.setData({

var results = this.data.results;
onChange(results);

@@ -40,0 +35,0 @@ }

@@ -9,8 +9,6 @@ export default {

},
didUnmount: function didUnmount() {
var _data = this.data,
items = _data.items,
results = _data.results;
var _this$data = this.data,
items = _this$data.items,
results = _this$data.results;
results.splice(0, results.length);

@@ -17,0 +15,0 @@ items.splice(0, items.length);

@@ -13,6 +13,5 @@ Component({

didMount: function didMount() {
var _props = this.props,
list = _props.list,
columnNum = _props.columnNum;
var _this$props = this.props,
list = _this$props.list,
columnNum = _this$props.columnNum;
var rows = list.length / columnNum;

@@ -23,3 +22,2 @@ this.setData({

},
methods: {

@@ -26,0 +24,0 @@ onGridItemClick: function onGridItemClick(e) {

import fmtEvent from '../_util/fmtEvent';
Component({

@@ -19,5 +18,7 @@ props: {

focus: false,
clear: false, // 是否带清除功能
clear: false,
// 是否带清除功能
syncInput: false,
enableNative: false, // 兼容安卓input的输入bug
enableNative: false,
// 兼容安卓input的输入bug
onInput: function onInput() {},

@@ -24,0 +25,0 @@ onConfirm: function onConfirm() {},

@@ -11,2 +11,3 @@ Component({

this.dataset = {};
for (var key in this.props) {

@@ -18,8 +19,7 @@ if (/data-/gi.test(key)) {

},
methods: {
onItemTap: function onItemTap(ev) {
var _props = this.props,
onClick = _props.onClick,
disabled = _props.disabled;
var _this$props = this.props,
onClick = _this$props.onClick,
disabled = _this$props.disabled;

@@ -29,3 +29,5 @@ if (onClick && !disabled) {

index: ev.target.dataset.index,
target: { dataset: this.dataset }
target: {
dataset: this.dataset
}
});

@@ -32,0 +34,0 @@ }

Component({
props: {
className: '',
mode: '', // closable,link
action: '', // 文本按钮
show: true, // 是否显示
enableMarquee: false, // 是否开启marquee
mode: '',
// closable,link
action: '',
// 文本按钮
show: true,
// 是否显示
enableMarquee: false,
// 是否开启marquee
onClick: function onClick() {},

@@ -23,2 +27,3 @@ marqueeProps: {

this._measureText();
this._startAnimation();

@@ -29,4 +34,6 @@ }

this._measureText();
if (this.props.enableMarquee && !this._marqueeTimer) {
this._measureText();
this._startAnimation();

@@ -41,3 +48,2 @@ }

},
methods: {

@@ -48,4 +54,5 @@ _measureText: function _measureText() {

// 计算文本所占据的宽度,计算需要滚动的宽度
my.createSelectorQuery().select('.am-notice-marquee-' + this.$id).boundingClientRect().select('.am-notice-content-' + this.$id).boundingClientRect().exec(function (ret) {
my.createSelectorQuery().select(".am-notice-marquee-" + this.$id).boundingClientRect().select(".am-notice-content-" + this.$id).boundingClientRect().exec(function (ret) {
var overflowWidth = ret && ret[0] && ret[1] && ret[0].width - ret[1].width || 0;
_this.setData({

@@ -63,8 +70,7 @@ overflowWidth: overflowWidth

var _props$marqueeProps = this.props.marqueeProps,
loop = _props$marqueeProps.loop,
fps = _props$marqueeProps.fps,
trailing = _props$marqueeProps.trailing,
leading = _props$marqueeProps.leading;
var _this$props$marqueePr = this.props.marqueeProps,
loop = _this$props$marqueePr.loop,
fps = _this$props$marqueePr.fps,
trailing = _this$props$marqueePr.trailing,
leading = _this$props$marqueePr.leading;
var TIMEOUT = 1 / fps * 1000;

@@ -76,3 +82,2 @@ var isLeading = this.data.animatedWidth === 0;

var overflowWidth = _this2.data.overflowWidth;
var animatedWidth = _this2.data.animatedWidth + 1;

@@ -111,5 +116,5 @@ var isRoundOver = animatedWidth > overflowWidth;

onNoticeTap: function onNoticeTap() {
var _props = this.props,
mode = _props.mode,
onClick = _props.onClick;
var _this$props = this.props,
mode = _this$props.mode,
onClick = _this$props.onClick;

@@ -121,5 +126,5 @@ if (mode === 'link' && typeof onClick === 'function') {

onOperationTap: function onOperationTap() {
var _props2 = this.props,
mode = _props2.mode,
onClick = _props2.onClick;
var _this$props2 = this.props,
mode = _this$props2.mode,
onClick = _this$props2.onClick;

@@ -126,0 +131,0 @@ if (mode === 'closable' && typeof onClick === 'function') {

import fmtEvent from '../_util/fmtEvent';
Component({

@@ -4,0 +3,0 @@ props: {

@@ -14,3 +14,2 @@ Component({

if (onClose) {

@@ -17,0 +16,0 @@ onClose();

@@ -24,3 +24,2 @@ Component({

},
methods: {

@@ -30,3 +29,2 @@ handleInput: function handleInput(e) {

if (!('value' in this.props)) {

@@ -46,3 +44,2 @@ this.setData({

// });
if (!('value' in this.props)) {

@@ -99,3 +96,2 @@ this.setData({

if (this.props.onSubmit) {

@@ -102,0 +98,0 @@ this.props.onSubmit(value);

@@ -18,7 +18,6 @@ Component({

didMount: function didMount() {
var _props = this.props,
value = _props.value,
min = _props.min,
max = _props.max;
var _this$props = this.props,
value = _this$props.value,
min = _this$props.min,
max = _this$props.max;
this.setData({

@@ -29,6 +28,6 @@ value: Math.min(Math.max(min, value), max)

didUpdate: function didUpdate(preProps) {
var _props2 = this.props,
value = _props2.value,
min = _props2.min,
max = _props2.max;
var _this$props2 = this.props,
value = _this$props2.value,
min = _this$props2.min,
max = _this$props2.max;

@@ -43,20 +42,18 @@ if (preProps.value !== value) {

},
methods: {
changeFn: function changeFn(ev) {
var _props3 = this.props,
min = _props3.min,
max = _props3.max,
onChange = _props3.onChange,
disabled = _props3.disabled,
readOnly = _props3.readOnly,
step = _props3.step;
var _this$props3 = this.props,
min = _this$props3.min,
max = _this$props3.max,
onChange = _this$props3.onChange,
disabled = _this$props3.disabled,
readOnly = _this$props3.readOnly,
step = _this$props3.step;
var evType = ev.target.dataset.type;
var _data = this.data,
opaReduce = _data.opaReduce,
opaAdd = _data.opaAdd,
value = _data.value;
var _this$data = this.data,
opaReduce = _this$data.opaReduce,
opaAdd = _this$data.opaAdd,
value = _this$data.value;
var enable = disabled || readOnly;
var enable = disabled || readOnly;
if (!enable) {

@@ -77,2 +74,3 @@ if (evType === 'reduce') {

}
this.setData({

@@ -88,14 +86,13 @@ value: value,

var value = event.detail.value;
this.resetFn(value);
},
resetFn: function resetFn(value) {
var _props4 = this.props,
max = _props4.max,
min = _props4.min,
onChange = _props4.onChange;
var _this$props4 = this.props,
max = _this$props4.max,
min = _this$props4.min,
onChange = _this$props4.onChange;
var calculatedVal = value;
var opaAdd = 1;
var opaReduce = 1;
if (value >= max) {

@@ -108,2 +105,3 @@ calculatedVal = max;

}
this.setData({

@@ -110,0 +108,0 @@ value: calculatedVal,

@@ -5,3 +5,2 @@ var _my$getSystemInfoSync = my.getSystemInfoSync(),

var isV2 = my.canIUse('movable-view.onTouchStart');
Component({

@@ -29,3 +28,2 @@ data: {

var enableNew = this.props.enableNew;
var useV2 = isV2 && enableNew;

@@ -37,2 +35,3 @@ this.btnWidth = 0;

this.setBtnWidth();
if (useV2) {

@@ -48,5 +47,5 @@ setTimeout(function () {

var restore = this.props.restore;
var _data = this.data,
holdSwipe = _data.holdSwipe,
useV2 = _data.useV2;
var _this$data = this.data,
holdSwipe = _this$data.holdSwipe,
useV2 = _this$data.useV2;

@@ -58,2 +57,3 @@ if (restore === true && _prevProps.restore !== restore || prevData.holdSwipe === true && holdSwipe === false) {

x: this.btnWidth // V2
});

@@ -66,3 +66,2 @@ }

},
methods: {

@@ -72,4 +71,5 @@ setBtnWidth: function setBtnWidth() {

my.createSelectorQuery().select('.am-swipe-right-' + this.$id).boundingClientRect().exec(function (ret) {
my.createSelectorQuery().select(".am-swipe-right-" + this.$id).boundingClientRect().exec(function (ret) {
_this2.btnWidth = ret && ret[0] && ret[0].width || 0;
if (isV2 && _this2.props.enableNew) {

@@ -97,8 +97,10 @@ _this2.setData({

};
var _props = this.props,
index = _props.index,
onSwipeStart = _props.onSwipeStart;
var _this$props = this.props,
index = _this$props.index,
onSwipeStart = _this$props.onSwipeStart;
if (onSwipeStart) {
onSwipeStart({ index: index });
onSwipeStart({
index: index
});
}

@@ -108,16 +110,10 @@ },

var touchObject = this.touchObject;
var touchePoint = e.touches[0];
var leftPos = this.data.leftPos;
touchObject.endX = touchePoint.pageX; // 首次触发时,计算滑动角度
touchObject.endX = touchePoint.pageX;
// 首次触发时,计算滑动角度
if (touchObject.direction === undefined) {
var direction = 0;
var xDist = touchObject.startX - touchePoint.pageX || 0;
var yDist = touchObject.startY - touchePoint.pageY || 0;
var r = Math.atan2(yDist, xDist);

@@ -129,8 +125,11 @@ var swipeAngle = Math.round(r * 180 / Math.PI);

}
if (swipeAngle <= 45 && swipeAngle >= 0) {
direction = 1;
}
if (swipeAngle <= 360 && swipeAngle >= 315) {
direction = 1;
}
if (swipeAngle >= 135 && swipeAngle <= 225) {

@@ -141,16 +140,16 @@ direction = -1;

touchObject.direction = direction;
}
} // 通过角度判断是左右方向
// 通过角度判断是左右方向
if (touchObject.direction !== 0) {
var newLeftPos = leftPos;
// 滑动距离
var distance = touchObject.endX - touchObject.startX;
// 左划
var newLeftPos = leftPos; // 滑动距离
var distance = touchObject.endX - touchObject.startX; // 左划
if (distance < 0) {
newLeftPos = Math.max(distance, -this.btnWidth);
// 右划
newLeftPos = Math.max(distance, -this.btnWidth); // 右划
} else {
newLeftPos = 0;
}
if (Math.abs(distance) > 10) {

@@ -169,9 +168,7 @@ this.setData({

var touchePoint = e.changedTouches[0];
touchObject.endX = touchePoint.pageX;
var leftPos = this.data.leftPos;
var distance = touchObject.endX - touchObject.startX;
var newLeftPos = leftPos;
if (distance < 0) {

@@ -184,2 +181,3 @@ if (Math.abs(distance + leftPos) > this.btnWidth * 0.7) {

}
this.setData({

@@ -203,3 +201,2 @@ leftPos: newLeftPos,

var x = e.detail.x;
this.setData({

@@ -233,3 +230,2 @@ x: x < actionWidth / 2 ? -1 : actionWidth - 1,

var index = e.target.dataset.index;
onRightItemClick({

@@ -236,0 +232,0 @@ index: index,

@@ -8,11 +8,17 @@ var _my$getSystemInfoSync = my.getSystemInfoSync(),

activeCls: '',
tabBarUnderlineColor: '#108ee9', // 选中选项卡下划线颜色
tabBarActiveTextColor: '#108ee9', // 选中选项卡字体颜色
tabBarInactiveTextColor: '#333333', // 未选中选项卡字体颜色
tabBarBackgroundColor: '#ffffff', // 选项卡背景颜色
tabBarUnderlineColor: '#108ee9',
// 选中选项卡下划线颜色
tabBarActiveTextColor: '#108ee9',
// 选中选项卡字体颜色
tabBarInactiveTextColor: '#333333',
// 未选中选项卡字体颜色
tabBarBackgroundColor: '#ffffff',
// 选项卡背景颜色
showPlus: false,
swipeable: true,
activeTab: 0, // 当前激活tab
activeTab: 0,
// 当前激活tab
animation: true,
tabBarCls: '', // tabbar的自定义样式class
tabBarCls: '',
// tabbar的自定义样式class
duration: 500

@@ -28,6 +34,5 @@ },

didMount: function didMount() {
var _props = this.props,
tabs = _props.tabs,
animation = _props.animation;
var _this$props = this.props,
tabs = _this$props.tabs,
animation = _this$props.animation;
this.setData({

@@ -48,3 +53,2 @@ tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length,

},
methods: {

@@ -54,5 +58,6 @@ handleSwiperChange: function handleSwiperChange(e) {

if (this.props.onChange) {
this.props.onChange({ index: current });
this.props.onChange({
index: current
});
}

@@ -63,5 +68,6 @@ },

if (this.props.onTabClick) {
this.props.onTabClick({ index: index });
this.props.onTabClick({
index: index
});
}

@@ -68,0 +74,0 @@ },

@@ -11,3 +11,2 @@ Component({

if (onCloseTap) {

@@ -14,0 +13,0 @@ onCloseTap();

@@ -15,3 +15,2 @@ Component({

var time = this.props.time;
setTimeout(function () {

@@ -23,3 +22,2 @@ _this.setData({

},
methods: {

@@ -26,0 +24,0 @@ onClose: function onClose() {

@@ -36,3 +36,2 @@ Component({

},
methods: {

@@ -42,6 +41,5 @@ calcHeight: function calcHeight() {

var _props = this.props,
tabs = _props.tabs,
activeTab = _props.activeTab;
var _this$props = this.props,
tabs = _this$props.tabs,
activeTab = _this$props.activeTab;
this.anchorMap = {};

@@ -51,7 +49,5 @@ this.indexMap = {};

this.scrollWrapHeight = 0;
my.createSelectorQuery().select('.am-vtabs-slides').boundingClientRect().exec(function (ret) {
_this.wrapHeight = ret[0].height;
});
var cacheHeight = 0;

@@ -63,5 +59,6 @@

my.createSelectorQuery().select('#am-vtab-slide-' + anchor).boundingClientRect().exec(function (ret) {
my.createSelectorQuery().select("#am-vtab-slide-" + anchor).boundingClientRect().exec(function (ret) {
_this.anchorMap[anchor] = cacheHeight;
_this.indexMap[i] = cacheHeight;
if (activeTab === i) {

@@ -72,2 +69,3 @@ _this.setData({

}
cacheHeight += ret[0].height;

@@ -87,3 +85,2 @@ _this.scrollWrapHeight = cacheHeight;

if (!this.isScrolling || !this.props.swipeable) {

@@ -93,2 +90,3 @@ if (this.props.activeTab !== index) {

}
this.setData({

@@ -101,3 +99,3 @@ wrapScrollTop: this.anchorMap[anchor]

moveScrollBar: function moveScrollBar(current) {
var tabTop = void 0;
var tabTop;

@@ -109,2 +107,3 @@ if (current < 6) {

}
if (this.props.activeTab !== current) {

@@ -117,2 +116,3 @@ if (this.props.onChange) {

}
this.setData({

@@ -127,3 +127,2 @@ tabTop: tabTop,

var scrollTop = e.detail.scrollTop;
var keys = Object.keys(this.anchorMap);

@@ -139,4 +138,4 @@

}, 300);
var anchorLength = keys.length;
var anchorLength = keys.length;
for (var i = 0; i < anchorLength; i++) {

@@ -150,2 +149,3 @@ if (i === anchorLength - 1) {

}
if (scrollTop >= Math.floor(this.anchorMap[keys[i]]) && scrollTop < Math.floor(this.anchorMap[keys[i + 1]])) {

@@ -156,2 +156,3 @@ // 如果没个vtab-content高度小于scroll-view高度,到达底部后就不需要根据scrollTop再去判断左侧的选择项

}
break;

@@ -158,0 +159,0 @@ }

{
"name": "mini-antui",
"version": "0.4.12",
"version": "0.4.13",
"description": "小程序版AntUI",

@@ -17,12 +17,21 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/preset-typescript": "^7.1.0",
"eslint": "^4.19.1",
"eslint-config-ali": "^3.1.0",
"eslint-plugin-import": "^2.11.0",
"pre-commit-eslint": "^0.0.6",
"rc-tools": "6.x"
"gulp": "^3.9.1",
"gulp-babel": "^8.0.0",
"gulp-clean-css": "^4.0.0",
"gulp-less": "^4.0.1",
"gulp-rename": "^1.2.3",
"pre-commit-eslint": "^0.0.6"
},
"scripts": {
"build": "rc-tools run compile && node scripts/cp.js && node scripts/rm.js",
"pub": "npm run build && node scripts/pub.js"
"build": "NODE_ENV=production node scripts/compiler.js",
"pub": "npm run build && node scripts/pub.js",
"dev": "node scripts/compiler.js"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc