-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed as not planned
Labels
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch ant-design-vue@4.2.6 for the project I'm working on.
官网限制7天的例子中,增加show-time属性,然后先选择开始时间,不点击确定按钮,鼠标聚焦到结束时间会发现日期范围限制无效
Here is the diff that solved my problem:
diff --git a/node_modules/ant-design-vue/es/vc-picker/RangePicker.js b/node_modules/ant-design-vue/es/vc-picker/RangePicker.js
index 90b4734..83240ed 100644
--- a/node_modules/ant-design-vue/es/vc-picker/RangePicker.js
+++ b/node_modules/ant-design-vue/es/vc-picker/RangePicker.js
@@ -523,6 +523,16 @@ function RangerPicker() {
return null;
}
});
+ const handlePanelSelect = (value) => {
+ let values = []
+ if (mergedActivePickerIndex.value === 0) {
+ values = [value, selectedValue.value?.[1]]
+ } else {
+ values = [selectedValue.value?.[0], value]
+ }
+ const info = { range: mergedActivePickerIndex.value === 0 ? 'start' : 'end' };
+ props.onCalendarChange?.(values, [startStr.value, endStr.value], info);
+ }
function renderPanel() {
let panelPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
let panelProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -602,7 +612,7 @@ function RangerPicker() {
setViewDate(viewDate, mergedActivePickerIndex.value);
},
"onOk": null,
- "onSelect": undefined,
+ "onSelect": handlePanelSelect,
"onChange": undefined,
"defaultValue": mergedActivePickerIndex.value === 0 ? getValue(selectedValue.value, 1) : getValue(selectedValue.value, 0)
}), null)]This issue body was partially generated by patch-package.