antd-mini
Advanced tools
Comparing version 2.35.1 to 2.35.2
@@ -175,3 +175,4 @@ var __assign = (this && this.__assign) || function () { | ||
'onFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3]; | ||
'onMonthFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3], onMonthFormatter = _a[4]; | ||
var localeText = Object.assign({}, defaultLocaleText, plocaleText); | ||
@@ -191,3 +192,3 @@ var markItems = __spreadArray([], localeText.weekdayNames, true); | ||
var _a; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className; | ||
var newState = (_a = onFormatter({ | ||
@@ -201,7 +202,8 @@ time: time, | ||
isSelected: isSelected, | ||
className: className, | ||
}, value)) !== null && _a !== void 0 ? _a : {}; | ||
var result = __assign({}, o); | ||
if (typeof newState === 'object') { | ||
// 只允许修改三个字段 | ||
['top', 'bottom', 'disabled'].forEach(function (key) { | ||
// 只允许修改的字段字段 | ||
['top', 'bottom', 'disabled', 'className'].forEach(function (key) { | ||
if (key in newState) { | ||
@@ -215,6 +217,11 @@ result[key] = newState[key]; | ||
} | ||
return { | ||
var month = { | ||
title: p.format(localeText.title), | ||
className: '', | ||
cells: cells, | ||
}; | ||
if (onMonthFormatter && typeof onMonthFormatter === 'function') { | ||
month = __assign(__assign({}, month), onMonthFormatter(p)); | ||
} | ||
return month; | ||
}); | ||
@@ -221,0 +228,0 @@ this.setData({ markItems: markItems, monthList: monthList }); |
@@ -33,2 +33,3 @@ --- | ||
| onFormatter | 用于设置单元格的自定义数据 | (cell: CellState, currentValue: CalendarValue) => CellState | 无 | | ||
| onMonthFormatter | 用于设置月份的自定义数据 | (month: any) => CellState | 无 | | ||
| localeText | 国际化文案 | Partial`<LocaleText>` | 无 | | ||
@@ -35,0 +36,0 @@ | changedScrollIntoView | 选中值改变后是否滚动视图 | boolean | 无 | |
@@ -18,3 +18,4 @@ import { defaultMonthRange } from './utils'; | ||
onFormatter: null, | ||
onMonthFormatter: null, | ||
changedScrollIntoView: null, | ||
}; |
@@ -120,3 +120,4 @@ import { __assign, __awaiter, __generator, __spreadArray } from "tslib"; | ||
'onFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3]; | ||
'onMonthFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3], onMonthFormatter = _a[4]; | ||
var localeText = Object.assign({}, defaultLocaleText, plocaleText); | ||
@@ -136,3 +137,3 @@ var markItems = __spreadArray([], localeText.weekdayNames, true); | ||
var _a; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className; | ||
var newState = (_a = onFormatter({ | ||
@@ -146,7 +147,8 @@ time: time, | ||
isSelected: isSelected, | ||
className: className, | ||
}, value)) !== null && _a !== void 0 ? _a : {}; | ||
var result = __assign({}, o); | ||
if (typeof newState === 'object') { | ||
// 只允许修改三个字段 | ||
['top', 'bottom', 'disabled'].forEach(function (key) { | ||
// 只允许修改的字段字段 | ||
['top', 'bottom', 'disabled', 'className'].forEach(function (key) { | ||
if (key in newState) { | ||
@@ -160,6 +162,11 @@ result[key] = newState[key]; | ||
} | ||
return { | ||
var month = { | ||
title: p.format(localeText.title), | ||
className: '', | ||
cells: cells, | ||
}; | ||
if (onMonthFormatter && typeof onMonthFormatter === 'function') { | ||
month = __assign(__assign({}, month), onMonthFormatter(p)); | ||
} | ||
return month; | ||
}); | ||
@@ -166,0 +173,0 @@ this.setData({ markItems: markItems, monthList: monthList }); |
@@ -44,2 +44,6 @@ import { IBaseProps } from '../_util/base'; | ||
/** | ||
* 类名 | ||
*/ | ||
className?: string; | ||
/** | ||
* 是否被禁止 | ||
@@ -132,3 +136,12 @@ */ | ||
*/ | ||
onFormatter?: (cell: Pick<CellState, 'disabled' | 'top' | 'bottom' | 'time' | 'isSelectedBegin' | 'isSelectedEnd' | 'isSelected'>, currentValue: CalendarValue) => Pick<CellState, 'disabled' | 'top' | 'bottom'>; | ||
onFormatter?: (cell: Pick<CellState, 'className' | 'disabled' | 'top' | 'bottom' | 'time' | 'isSelectedBegin' | 'isSelectedEnd' | 'isSelected'>, currentValue: CalendarValue) => Pick<CellState, 'disabled' | 'top' | 'bottom'>; | ||
/** | ||
* onMonthFormatter 用于设置月份的自定义数据 | ||
* @param month 原始数据 | ||
* @returns 返回新的数据 | ||
*/ | ||
onMonthFormatter?: (month: any) => { | ||
title?: string; | ||
className?: string; | ||
}; | ||
} | ||
@@ -150,3 +163,4 @@ export declare const CalendarDefaultProps: { | ||
onFormatter: any; | ||
onMonthFormatter: any; | ||
changedScrollIntoView: any; | ||
}; |
@@ -18,3 +18,4 @@ import { defaultMonthRange } from './utils'; | ||
onFormatter: null, | ||
onMonthFormatter: null, | ||
changedScrollIntoView: null, | ||
}; |
@@ -120,3 +120,4 @@ import { __assign, __awaiter, __generator, __spreadArray } from "tslib"; | ||
'onFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3]; | ||
'onMonthFormatter', | ||
]), monthRange = _a[0], plocaleText = _a[1], pweekStartsOn = _a[2], onFormatter = _a[3], onMonthFormatter = _a[4]; | ||
var localeText = Object.assign({}, defaultLocaleText, plocaleText); | ||
@@ -136,3 +137,3 @@ var markItems = __spreadArray([], localeText.weekdayNames, true); | ||
var _a; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected; | ||
var time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className; | ||
var newState = (_a = onFormatter({ | ||
@@ -146,7 +147,8 @@ time: time, | ||
isSelected: isSelected, | ||
className: className, | ||
}, value)) !== null && _a !== void 0 ? _a : {}; | ||
var result = __assign({}, o); | ||
if (typeof newState === 'object') { | ||
// 只允许修改三个字段 | ||
['top', 'bottom', 'disabled'].forEach(function (key) { | ||
// 只允许修改的字段字段 | ||
['top', 'bottom', 'disabled', 'className'].forEach(function (key) { | ||
if (key in newState) { | ||
@@ -160,6 +162,11 @@ result[key] = newState[key]; | ||
} | ||
return { | ||
var month = { | ||
title: p.format(localeText.title), | ||
className: '', | ||
cells: cells, | ||
}; | ||
if (onMonthFormatter && typeof onMonthFormatter === 'function') { | ||
month = __assign(__assign({}, month), onMonthFormatter(p)); | ||
} | ||
return month; | ||
}); | ||
@@ -166,0 +173,0 @@ this.setData({ markItems: markItems, monthList: monthList }); |
@@ -44,2 +44,6 @@ import { IBaseProps } from '../_util/base'; | ||
/** | ||
* 类名 | ||
*/ | ||
className?: string; | ||
/** | ||
* 是否被禁止 | ||
@@ -132,3 +136,12 @@ */ | ||
*/ | ||
onFormatter?: (cell: Pick<CellState, 'disabled' | 'top' | 'bottom' | 'time' | 'isSelectedBegin' | 'isSelectedEnd' | 'isSelected'>, currentValue: CalendarValue) => Pick<CellState, 'disabled' | 'top' | 'bottom'>; | ||
onFormatter?: (cell: Pick<CellState, 'className' | 'disabled' | 'top' | 'bottom' | 'time' | 'isSelectedBegin' | 'isSelectedEnd' | 'isSelected'>, currentValue: CalendarValue) => Pick<CellState, 'disabled' | 'top' | 'bottom'>; | ||
/** | ||
* onMonthFormatter 用于设置月份的自定义数据 | ||
* @param month 原始数据 | ||
* @returns 返回新的数据 | ||
*/ | ||
onMonthFormatter?: (month: any) => { | ||
title?: string; | ||
className?: string; | ||
}; | ||
} | ||
@@ -150,3 +163,4 @@ export declare const CalendarDefaultProps: { | ||
onFormatter: any; | ||
onMonthFormatter: any; | ||
changedScrollIntoView: any; | ||
}; |
@@ -18,3 +18,4 @@ import { defaultMonthRange } from './utils'; | ||
onFormatter: null, | ||
onMonthFormatter: null, | ||
changedScrollIntoView: null, | ||
}; |
{ | ||
"name": "antd-mini", | ||
"version": "2.35.1", | ||
"version": "2.35.2", | ||
"description": "antd-mini 是支付宝小程序 UI 组件库,遵循 Ant Design 规范。", | ||
@@ -5,0 +5,0 @@ "miniprogram": "compiled/wechat/src", |
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
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
3713026
38633