Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleShortcutClick(data: Shortcut) {
const value = data.onClick.call(this)
if (Yox.is.array(value)) {
if (!value[0] || !value[1]) {
Yox.logger.warn(`shortcuts value 传值错误`)
return
}
this.dateRangeChange(
toTimestamp(value[0]),
toTimestamp(value[1])
)
}
else {
if (!value) {
Yox.logger.warn(`shortcuts value 传值错误`)
return
}
const type = this.get('type')
if (type === RAW_TYPE_DATE_RANGE || type === RAW_TYPE_WEEK) {
Yox.logger.warn(`shortcuts value 需返回数组类型`)
return
}
this.dateChange(
toTimestamp(value as any)
)
}
},
return function (key: string, value: any, componentName: string | undefined) {
if (!Yox.array.has(values, value)) {
Yox.logger.warn(`${key} 期望是 ${values.join(',')} 中的值,实际传值 [${value}]。`, componentName)
}
return TRUE
}
}
shortcutClick: function (data) {
var date = data.value && data.value();
if (!date) {
Yox.logger.warn("shortcuts value \u4F20\u503C\u9519\u8BEF");
return;
}
if (!Yox.is.array(date)) {
date = simplifyDate(date);
this.dateChange(date);
}
else {
this.dateRangeChange({
start: simplifyDate(date[0]),
end: simplifyDate(date[1])
});
}
this.set({
value: date
});
data.onClick && data.onClick();
return function (key: string, value: Date) {
if (value instanceof Date) {
return true
}
Yox.logger.warn(`${key} 期望是 Date 类型,实际传值 ${value}。`)
}
}
type: function (props, key) {
if (props['trigger'] !== RAW_CUSTOM) {
Yox.logger.warn(key + " \u671F\u671B\u5728 trigger \u53D6\u503C\u4E3A custom \u65F6\u4F20\u503C");
}
return true;
}
},
afterMount() {
const me = this
let container: Document | HTMLElement = DOCUMENT
let containerElement = DOCUMENT.documentElement
const target = me.get('target')
if (target) {
containerElement = Yox.dom.find(target) as HTMLElement
if (!containerElement) {
Yox.logger.fatal(`target is not existed: ${target}`)
return
}
container = containerElement
}
const height = toNumber(me.get('height'))
const onRefresh = function () {
me.set({
visible: containerElement.scrollTop >= height
})
}
const duration = toNumber(this.get('duration'))
me.on('click', function () {
scrollTop(
containerElement,