fast-control
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -120,2 +120,12 @@ module.exports = | ||
hourStart: { | ||
type: Number, | ||
value: 0 | ||
}, | ||
hourEnd: { | ||
type: Number, | ||
value: 23 | ||
}, | ||
minuteStep: { | ||
@@ -153,3 +163,2 @@ type: Number, | ||
_init: function _init() { | ||
console.log('observer init'); | ||
var _data = this.data, | ||
@@ -206,6 +215,12 @@ startAt = _data.startAt, | ||
_yearRange: function _yearRange() { | ||
return (0, _common.arrayFrom)(this._startAtYear, this._endAtYear, this.data.yearStep); | ||
return (0, _common.arrayFrom)(this._startAtYear, this._endAtYear, this.data.yearStep).map(function (y) { | ||
return y + '\u5E74'; | ||
}); | ||
}, | ||
_monthRange: function _monthRange(sameAsStart, sameAsEnd) { | ||
return (0, _common.arrayFrom)(sameAsStart ? this._startAtMonth : 1, sameAsEnd ? this._endAtMonth : 12, this.data.monthRange); | ||
return (0, _common.arrayFrom)(sameAsStart ? this._startAtMonth : 1, sameAsEnd ? this._endAtMonth : 12, this.data.monthRange).map(function (m) { | ||
return String(m).padStart(2, '0'); | ||
}).map(function (m) { | ||
return m + '\u6708'; | ||
}); | ||
}, | ||
@@ -218,9 +233,28 @@ _dateRange: function _dateRange(sameAsStart, sameAsEnd) { | ||
return (0, _date.dateCount)(value.getFullYear(), value.getMonth() + 1); | ||
}(), this.data.dateRange); | ||
}(), this.data.dateRange).map(function (d) { | ||
return String(d).padStart(2, '0'); | ||
}).map(function (d) { | ||
return d + '\u65E5'; | ||
}); | ||
}, | ||
_hourRange: function _hourRange(sameAsStart, sameAsEnd) { | ||
return (0, _common.arrayFrom)(sameAsStart ? this._startAtHour : 0, sameAsEnd ? this._endAtHour : 23, this.data.hourStep); | ||
var _data2 = this.data, | ||
hourStart = _data2.hourStart, | ||
hourEnd = _data2.hourEnd; | ||
var head = sameAsStart ? this._startAtHour : 0; | ||
var tail = sameAsEnd ? this._endAtHour : 23; | ||
head = Math.max(hourStart, head); | ||
tail = Math.min(hourEnd, tail); | ||
return (0, _common.arrayFrom)(head, tail, this.data.hourStep).map(function (d) { | ||
return String(d).padStart(2, '0'); | ||
}); | ||
}, | ||
_minuteRange: function _minuteRange(sameAsStart, sameAsEnd) { | ||
return (0, _common.arrayFrom)(sameAsStart ? this._startAtMinute : 0, sameAsEnd ? this._endAtMinute : 59, this.data.minuteStep); | ||
return (0, _common.arrayFrom)(sameAsStart ? this._startAtMinute : 0, sameAsEnd ? this._endAtMinute : 59, this.data.minuteStep).map(function (d) { | ||
return String(d).padStart(2, '0'); | ||
}); | ||
}, | ||
@@ -231,10 +265,12 @@ value: function value() { | ||
var _value$map = _value.map(function (v, i) { | ||
var _value$map$map = _value.map(function (v, i) { | ||
return ranges[i][v]; | ||
}).map(function (s) { | ||
return s && s.match(/^\d+/g); | ||
}), | ||
year = _value$map[0], | ||
month = _value$map[1], | ||
date = _value$map[2], | ||
hour = _value$map[3], | ||
minute = _value$map[4]; | ||
year = _value$map$map[0], | ||
month = _value$map$map[1], | ||
date = _value$map$map[2], | ||
hour = _value$map$map[3], | ||
minute = _value$map$map[4]; | ||
@@ -241,0 +277,0 @@ return new Date([year, month, date].join('/') + ' ' + [hour, minute].join(':')); |
{ | ||
"name": "fast-control", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -43,3 +43,7 @@ "main": "miniprogram_dist/date-picker.js", | ||
"eslint": "^5.3.0", | ||
"eslint-config-airbnb-base": "13.1.0", | ||
"eslint-loader": "^2.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"gulp": "^4.0.0", | ||
@@ -56,9 +60,5 @@ "gulp-clean": "^0.4.0", | ||
"webpack": "^4.16.5", | ||
"webpack-node-externals": "^1.7.2", | ||
"eslint-config-airbnb-base": "13.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^3.8.0" | ||
"webpack-node-externals": "^1.7.2" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -25,2 +25,12 @@ import { arrayFrom } from './common' | ||
hourStart: { | ||
type: Number, | ||
value: 0 | ||
}, | ||
hourEnd: { | ||
type: Number, | ||
value: 23 | ||
}, | ||
minuteStep: { | ||
@@ -58,3 +68,2 @@ type: Number, | ||
_init() { | ||
console.log('observer init') | ||
const { startAt, endAt } = this.data | ||
@@ -117,3 +126,3 @@ this._value = Array(5).fill(0) | ||
this.data.yearStep | ||
) | ||
).map(y => `${y}年`) | ||
}, | ||
@@ -127,2 +136,4 @@ | ||
) | ||
.map(m => String(m).padStart(2, '0')) | ||
.map(m => `${m}月`) | ||
}, | ||
@@ -139,10 +150,19 @@ | ||
) | ||
.map(d => String(d).padStart(2, '0')) | ||
.map(d => `${d}日`) | ||
}, | ||
_hourRange(sameAsStart, sameAsEnd) { | ||
const { hourStart, hourEnd } = this.data | ||
let head = sameAsStart ? this._startAtHour : 0 | ||
let tail = sameAsEnd ? this._endAtHour : 23 | ||
head = Math.max(hourStart, head) | ||
tail = Math.min(hourEnd, tail) | ||
return arrayFrom( | ||
sameAsStart ? this._startAtHour : 0, | ||
sameAsEnd ? this._endAtHour : 23, | ||
head, tail, | ||
this.data.hourStep | ||
) | ||
).map(d => String(d).padStart(2, '0')) | ||
}, | ||
@@ -155,3 +175,3 @@ | ||
this.data.minuteStep | ||
) | ||
).map(d => String(d).padStart(2, '0')) | ||
}, | ||
@@ -163,4 +183,5 @@ | ||
const [year, month, date, hour, minute] = | ||
_value.map((v, i) => ranges[i][v]) | ||
const [year, month, date, hour, minute] = _value | ||
.map((v, i) => ranges[i][v]) | ||
.map(s => s && s.match(/^\d+/g)) | ||
@@ -167,0 +188,0 @@ return new Date(`${[year, month, date].join('/')} ${[hour, minute].join(':')}`) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23549
509