diff --git a/components/vc-calendar/index.js b/components/vc-calendar/index.js
index 3091680aa..24744582f 100644
--- a/components/vc-calendar/index.js
+++ b/components/vc-calendar/index.js
@@ -1,4 +1,4 @@
-// based on rc-calendar 9.8.2
+// based on rc-calendar 9.10.8
import Vue from 'vue';
import ref from 'vue-ref';
import Calendar from './src/';
diff --git a/components/vc-cascader/Cascader.jsx b/components/vc-cascader/Cascader.jsx
index a747dd2c5..8682e1b90 100644
--- a/components/vc-cascader/Cascader.jsx
+++ b/components/vc-cascader/Cascader.jsx
@@ -5,7 +5,7 @@ import Menus from './Menus';
import KeyCode from '../_util/KeyCode';
import arrayTreeFilter from 'array-tree-filter';
import shallowEqualArrays from 'shallow-equal/arrays';
-import { hasProp, getEvents } from '../_util/props-util';
+import { hasProp, getEvents, getSlot } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { cloneElement } from '../_util/vnode';
@@ -53,7 +53,7 @@ export default {
props: {
value: PropTypes.array,
defaultValue: PropTypes.array,
- options: PropTypes.array.def([]).isRequired,
+ options: PropTypes.array,
// onChange: PropTypes.func,
// onPopupVisibleChange: PropTypes.func,
popupVisible: PropTypes.bool,
@@ -96,12 +96,11 @@ export default {
if (!shallowEqualArrays(val, oldValue)) {
const newValues = {
sValue: val || [],
- sActiveValue: val || [],
};
// allow activeValue diff from value
// https://github.com/ant-design/ant-design/issues/2767
- if (hasProp(this, 'loadData')) {
- delete newValues.sActiveValue;
+ if (!hasProp(this, 'loadData')) {
+ newValues.sActiveValue = val || [];
}
this.setState(newValues);
}
@@ -124,7 +123,7 @@ export default {
return this.fieldNames;
},
getCurrentLevelOptions() {
- const { options, sActiveValue = [] } = this;
+ const { options = [], sActiveValue = [] } = this;
const result = arrayTreeFilter(
options,
(o, level) => o[this.getFieldName('value')] === sActiveValue[level],
@@ -137,7 +136,7 @@ export default {
},
getActiveOptions(activeValue) {
return arrayTreeFilter(
- this.options,
+ this.options || [],
(o, level) => o[this.getFieldName('value')] === activeValue[level],
{ childrenKeyName: this.getFieldName('children') },
);
@@ -214,6 +213,12 @@ export default {
}
this.setState(newState);
},
+ handleItemDoubleClick () {
+ const { changeOnSelect } = this.$props;
+ if (changeOnSelect) {
+ this.setPopupVisible(false);
+ }
+ },
handleKeyDown(e) {
const { $slots } = this;
const children = $slots.default && $slots.default[0];
@@ -313,7 +318,7 @@ export default {
prefixCls,
transitionName,
popupClassName,
- options,
+ options = [],
disabled,
builtinPlacements,
popupPlacement,
@@ -338,6 +343,7 @@ export default {
on: {
...$listeners,
select: handleMenuSelect,
+ itemDoubleClick: this.handleItemDoubleClick
},
};
menus = ;
@@ -362,10 +368,11 @@ export default {
},
ref: 'trigger',
};
+ const children = getSlot(this, 'default')[0]
return (
- {$slots.default &&
- cloneElement($slots.default[0], {
+ {children &&
+ cloneElement(children[0], {
on: {
keydown: handleKeyDown,
},
diff --git a/components/vc-cascader/Menus.jsx b/components/vc-cascader/Menus.jsx
index 6ea9cca6d..cb8e53101 100644
--- a/components/vc-cascader/Menus.jsx
+++ b/components/vc-cascader/Menus.jsx
@@ -9,7 +9,7 @@ export default {
props: {
value: PropTypes.array.def([]),
activeValue: PropTypes.array.def([]),
- options: PropTypes.array.isRequired,
+ options: PropTypes.array,
prefixCls: PropTypes.string.def('rc-cascader-menus'),
expandTrigger: PropTypes.string.def('click'),
// onSelect: PropTypes.func,
@@ -51,11 +51,15 @@ export default {
const onSelect = e => {
this.__emit('select', option, menuIndex, e);
};
+ const onItemDoubleClick = e => {
+ this.__emit('itemDoubleClick', option, menuIndex, e);
+ };
const key = option[this.getFieldName('value')];
const expandProps = {
attrs: {},
on: {
click: onSelect,
+ doubleclick: onItemDoubleClick,
},
key: Array.isArray(key) ? key.join('__ant__') : key,
};
diff --git a/components/vc-cascader/index.js b/components/vc-cascader/index.js
index bb97eb555..e3d0e9b3a 100644
--- a/components/vc-cascader/index.js
+++ b/components/vc-cascader/index.js
@@ -1,3 +1,3 @@
-// based on rc-cascader 0.16.2
+// based on rc-cascader 0.17.1
import Cascader from './Cascader';
export default Cascader;