Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antd-mini

Package Overview
Dependencies
Maintainers
0
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-mini - npm Package Compare versions

Comparing version 2.36.1 to 2.36.2

14

compiled/wechat/src/Calendar/index.js

@@ -186,8 +186,15 @@ var __assign = (this && this.__assign) || function () {

var value = this.getValue();
var monthList = getMonthListFromRange(dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]), dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1])).map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText);
var start = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]).startOf('d');
var end = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1]).startOf('d');
var monthRangeList = getMonthListFromRange(start, end);
var monthList = monthRangeList.map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText,
// 如果monthRange传入异常,用内置的时间范围
start.isAfter(end) || start.isSame(end)
? [monthRangeList[0], dayjs(monthRangeList[1]).endOf('month')]
: [start, end]);
if (onFormatter && typeof onFormatter === 'function') {
cells = cells.map(function (o) {
var _a;
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 time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className, isRange = o.isRange;
var newState = (_a = onFormatter({

@@ -202,2 +209,3 @@ time: time,

className: className,
isRange: isRange,
}, value)) !== null && _a !== void 0 ? _a : {};

@@ -204,0 +212,0 @@ var result = __assign({}, o);

@@ -24,14 +24,15 @@ ---

| 属性 | 说明 | 类型 | 默认值 |
| --------------------- | ---------------------------------------------- | ----------------------------------------------------------- | ----------- |
| defaultValue | 初始值 | CalendarValue | 无 |
| value | 日历选择的日期,传入后即为受控模式 | CalendarValue | 无 |
| selectionMode | 设置选择模式,单选或者连续区间,默认为 `range` | `single` \| `range` | `range` |
| monthRange | 月份范围,默认为最近 3 个月 | `[number, number]` | 最近 3 个月 |
| weekStartsOn | 星期栏,以周几作为第一天显示。默认为 `Sunday` | `Sunday` \| `Monday` | `Sunday` |
| onChange | 日期变化回调 | (date: CalendarValue) => void | 无 |
| onFormatter | 用于设置单元格的自定义数据 | (cell: CellState, currentValue: CalendarValue) => CellState | 无 |
| onMonthFormatter | 用于设置月份的自定义数据 | (month: any) => CellState | 无 |
| localeText | 国际化文案 | Partial`<LocaleText>` | 无 |
| changedScrollIntoView | 选中值改变后是否滚动视图 | boolean | 无 |
| 属性 | 说明 | 类型 | 默认值 |
| ----------------------- | ---------------------------------------------- | ----------------------------------------------------------- | ----------- |
| defaultValue | 初始值 | CalendarValue | 无 |
| value | 日历选择的日期,传入后即为受控模式 | CalendarValue | 无 |
| selectionMode | 设置选择模式,单选或者连续区间,默认为 `range` | `single` \| `range` | `range` |
| monthRange | 月份范围,默认为最近 3 个月 | `[number, number]` | 最近 3 个月 |
| weekStartsOn | 星期栏,以周几作为第一天显示。默认为 `Sunday` | `Sunday` \| `Monday` | `Sunday` |
| onChange | 日期变化回调 | (date: CalendarValue) => void | 无 |
| onFormatter | 用于设置单元格的自定义数据 | (cell: CellState, currentValue: CalendarValue) => CellState | 无 |
| onMonthFormatter | 用于设置月份的自定义数据 | (month: any) => CellState | 无 |
| localeText | 国际化文案 | Partial`<LocaleText>` | 无 |
| changedScrollIntoView | 选中值改变后是否滚动视图 | boolean | 无 |
| showSelectableDatesOnly | 只展示在可选范围内的日期 | boolean | false |

@@ -38,0 +39,0 @@ ### 类型

@@ -20,2 +20,3 @@ import { defaultMonthRange } from './utils';

changedScrollIntoView: null,
showSelectableDatesOnly: false,
};

@@ -46,4 +46,5 @@ import dayjs from 'dayjs';

}
export function renderCells(cellsMonth, weekStartsOn, value, localeText) {
export function renderCells(cellsMonth, weekStartsOn, value, localeText, monthRangeList) {
var _a;
var rangeStartDate = monthRangeList[0], rangeEndDate = monthRangeList[1];
var rowBeginDay = 0;

@@ -57,3 +58,3 @@ var rowEndDay = 6;

if (!value) {
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -70,2 +71,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') ||

return {
index: index,
disabled: false,

@@ -81,2 +83,4 @@ time: d.toDate().getTime(),

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -95,3 +99,3 @@ });

}
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -124,2 +128,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') || d.day() === rowBeginDay;

return {
index: index,
disabled: false,

@@ -135,2 +140,4 @@ time: time,

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -137,0 +144,0 @@ });

@@ -131,8 +131,15 @@ import { __assign, __awaiter, __generator, __spreadArray } from "tslib";

var value = this.getValue();
var monthList = getMonthListFromRange(dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]), dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1])).map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText);
var start = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]).startOf('d');
var end = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1]).startOf('d');
var monthRangeList = getMonthListFromRange(start, end);
var monthList = monthRangeList.map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText,
// 如果monthRange传入异常,用内置的时间范围
start.isAfter(end) || start.isSame(end)
? [monthRangeList[0], dayjs(monthRangeList[1]).endOf('month')]
: [start, end]);
if (onFormatter && typeof onFormatter === 'function') {
cells = cells.map(function (o) {
var _a;
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 time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className, isRange = o.isRange;
var newState = (_a = onFormatter({

@@ -147,2 +154,3 @@ time: time,

className: className,
isRange: isRange,
}, value)) !== null && _a !== void 0 ? _a : {};

@@ -149,0 +157,0 @@ var result = __assign({}, o);

@@ -91,2 +91,7 @@ import { IBaseProps } from '../_util/base';

inThisMonth: boolean;
/**
* 是否在传入范围内
*/
isRange: boolean;
index: number;
}

@@ -127,2 +132,6 @@ export type CalendarValue = number | number[];

/**
* 只展示在可选范围内的日期
*/
showSelectableDatesOnly?: boolean;
/**
* 日期变化回调

@@ -165,2 +174,3 @@ */

changedScrollIntoView: any;
showSelectableDatesOnly: boolean;
};

@@ -20,2 +20,3 @@ import { defaultMonthRange } from './utils';

changedScrollIntoView: null,
showSelectableDatesOnly: false,
};

@@ -12,4 +12,4 @@ import { Dayjs } from 'dayjs';

export declare function getDate(month: Dayjs, weekStartsOn: string): Dayjs[];
export declare function renderCells(cellsMonth: Dayjs, weekStartsOn: string, value: CalendarValue, localeText: LocaleText): CellState[];
export declare function renderCells(cellsMonth: Dayjs, weekStartsOn: string, value: CalendarValue, localeText: LocaleText, monthRangeList: Dayjs[]): CellState[];
export declare function getSelectionModeFromValue(value?: CalendarValue): SelectionMode;
export declare function getScrollIntoViewId(value: CalendarValue): string;

@@ -46,4 +46,5 @@ import dayjs from 'dayjs';

}
export function renderCells(cellsMonth, weekStartsOn, value, localeText) {
export function renderCells(cellsMonth, weekStartsOn, value, localeText, monthRangeList) {
var _a;
var rangeStartDate = monthRangeList[0], rangeEndDate = monthRangeList[1];
var rowBeginDay = 0;

@@ -57,3 +58,3 @@ var rowEndDay = 6;

if (!value) {
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -70,2 +71,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') ||

return {
index: index,
disabled: false,

@@ -81,2 +83,4 @@ time: d.toDate().getTime(),

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -95,3 +99,3 @@ });

}
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -124,2 +128,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') || d.day() === rowBeginDay;

return {
index: index,
disabled: false,

@@ -135,2 +140,4 @@ time: time,

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -137,0 +144,0 @@ });

@@ -131,8 +131,15 @@ import { __assign, __awaiter, __generator, __spreadArray } from "tslib";

var value = this.getValue();
var monthList = getMonthListFromRange(dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]), dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1])).map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText);
var start = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[0]).startOf('d');
var end = dayjs(monthRange === null || monthRange === void 0 ? void 0 : monthRange[1]).startOf('d');
var monthRangeList = getMonthListFromRange(start, end);
var monthList = monthRangeList.map(function (p) {
var cells = renderCells(p, weekStartsOn, value, localeText,
// 如果monthRange传入异常,用内置的时间范围
start.isAfter(end) || start.isSame(end)
? [monthRangeList[0], dayjs(monthRangeList[1]).endOf('month')]
: [start, end]);
if (onFormatter && typeof onFormatter === 'function') {
cells = cells.map(function (o) {
var _a;
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 time = o.time, top = o.top, bottom = o.bottom, disabled = o.disabled, isSelectedBegin = o.isSelectedBegin, isSelectedEnd = o.isSelectedEnd, isSelected = o.isSelected, className = o.className, isRange = o.isRange;
var newState = (_a = onFormatter({

@@ -147,2 +154,3 @@ time: time,

className: className,
isRange: isRange,
}, value)) !== null && _a !== void 0 ? _a : {};

@@ -149,0 +157,0 @@ var result = __assign({}, o);

@@ -91,2 +91,7 @@ import { IBaseProps } from '../_util/base';

inThisMonth: boolean;
/**
* 是否在传入范围内
*/
isRange: boolean;
index: number;
}

@@ -127,2 +132,6 @@ export type CalendarValue = number | number[];

/**
* 只展示在可选范围内的日期
*/
showSelectableDatesOnly?: boolean;
/**
* 日期变化回调

@@ -165,2 +174,3 @@ */

changedScrollIntoView: any;
showSelectableDatesOnly: boolean;
};

@@ -20,2 +20,3 @@ import { defaultMonthRange } from './utils';

changedScrollIntoView: null,
showSelectableDatesOnly: false,
};

@@ -12,4 +12,4 @@ import { Dayjs } from 'dayjs';

export declare function getDate(month: Dayjs, weekStartsOn: string): Dayjs[];
export declare function renderCells(cellsMonth: Dayjs, weekStartsOn: string, value: CalendarValue, localeText: LocaleText): CellState[];
export declare function renderCells(cellsMonth: Dayjs, weekStartsOn: string, value: CalendarValue, localeText: LocaleText, monthRangeList: Dayjs[]): CellState[];
export declare function getSelectionModeFromValue(value?: CalendarValue): SelectionMode;
export declare function getScrollIntoViewId(value: CalendarValue): string;

@@ -46,4 +46,5 @@ import dayjs from 'dayjs';

}
export function renderCells(cellsMonth, weekStartsOn, value, localeText) {
export function renderCells(cellsMonth, weekStartsOn, value, localeText, monthRangeList) {
var _a;
var rangeStartDate = monthRangeList[0], rangeEndDate = monthRangeList[1];
var rowBeginDay = 0;

@@ -57,3 +58,3 @@ var rowEndDay = 6;

if (!value) {
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -70,2 +71,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') ||

return {
index: index,
disabled: false,

@@ -81,2 +83,4 @@ time: d.toDate().getTime(),

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -95,3 +99,3 @@ });

}
return dates.map(function (d) {
return dates.map(function (d, index) {
var isToday = dayjs().isSame(d, 'day');

@@ -124,2 +128,3 @@ var isRowBegin = d.isSame(cellsMonth.startOf('month'), 'date') || d.day() === rowBeginDay;

return {
index: index,
disabled: false,

@@ -135,2 +140,4 @@ time: time,

isRowEnd: isRowEnd,
isRange: (d.isSame(rangeStartDate) || d.isAfter(rangeStartDate)) &&
(d.isSame(rangeEndDate) || d.isBefore(rangeEndDate)),
};

@@ -137,0 +144,0 @@ });

{
"name": "antd-mini",
"version": "2.36.1",
"version": "2.36.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

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