From f692f191f6888cee0b9f0bc53915942d8e23d649 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Sun, 9 Dec 2018 17:34:27 +0800
Subject: [PATCH] feat: update time-picker modal locale-provider
---
components/_util/props-util.js | 11 +-
components/cascader/index.jsx | 7 +-
.../__tests__/__snapshots__/demo.test.js.snap | 32 +-
.../__tests__/__snapshots__/demo.test.js.snap | 16 +-
.../__tests__/__snapshots__/demo.test.js.snap | 2 +-
.../__snapshots__/index.test.js.snap | 449 ++++++++++++++++--
components/modal/ActionButton.jsx | 10 +-
components/modal/ConfirmDialog.jsx | 34 +-
components/modal/Modal.jsx | 7 +
.../__snapshots__/Modal.test.js.snap | 6 +-
.../__tests__/__snapshots__/demo.test.js.snap | 12 +-
components/modal/__tests__/confirm.test.js | 12 +-
components/modal/confirm.js | 22 +-
components/modal/demo/async.md | 2 +-
components/modal/demo/basic.md | 2 +-
components/modal/demo/button-props.md | 2 +-
components/modal/demo/confirm.md | 21 +
components/modal/demo/footer.md | 2 +-
components/modal/demo/manual.md | 26 +-
components/modal/demo/position.md | 4 +-
components/modal/index.en-US.md | 17 +-
components/modal/index.js | 2 +-
components/modal/index.zh-CN.md | 15 +-
.../__tests__/__snapshots__/demo.test.js.snap | 4 +-
.../__tests__/__snapshots__/demo.test.js.snap | 22 +-
.../time-picker/__tests__/index.test.js | 2 +-
components/time-picker/demo/addon.md | 4 +-
components/time-picker/index.en-US.md | 2 +-
components/time-picker/index.jsx | 12 +-
components/time-picker/index.zh-CN.md | 2 +-
components/vc-time-picker/Panel.jsx | 5 +-
components/vc-time-picker/TimePicker.jsx | 9 +-
32 files changed, 625 insertions(+), 150 deletions(-)
diff --git a/components/_util/props-util.js b/components/_util/props-util.js
index 9bb66df42..6dba0f19f 100644
--- a/components/_util/props-util.js
+++ b/components/_util/props-util.js
@@ -95,19 +95,22 @@ const getOptionProps = (instance) => {
return filterProps($props, $options.propsData)
}
-const getComponentFromProp = (instance, prop, options) => {
+const getComponentFromProp = (instance, prop, options = instance, execute = true) => {
if (instance.$createElement) {
const h = instance.$createElement
const temp = instance[prop]
if (temp !== undefined) {
- return typeof temp === 'function' ? temp(h, options) : temp
+ return typeof temp === 'function' && execute ? temp(h, options) : temp
}
- return instance.$slots[prop] || (instance.$scopedSlots[prop] && instance.$scopedSlots[prop](options)) || undefined
+ return instance.$slots[prop] ||
+ (instance.$scopedSlots[prop] && execute && instance.$scopedSlots[prop](options)) ||
+ (instance.$scopedSlots[prop] && instance.$scopedSlots[prop]) ||
+ undefined
} else {
const h = instance.context.$createElement
const temp = getPropsData(instance)[prop]
if (temp !== undefined) {
- return typeof temp === 'function' ? temp(h, options) : temp
+ return typeof temp === 'function' && execute ? temp(h, options) : temp
}
const slotsProp = []
const componentOptions = instance.componentOptions || {};
diff --git a/components/cascader/index.jsx b/components/cascader/index.jsx
index 2cc36d73b..9c7620c40 100644
--- a/components/cascader/index.jsx
+++ b/components/cascader/index.jsx
@@ -310,7 +310,8 @@ const Cascader = {
const { $slots, sPopupVisible, inputValue, $listeners } = this
const { sValue: value, inputFocused } = this.$data
const props = getOptionProps(this)
- const suffixIcon = getComponentFromProp(this, 'suffixIcon')
+ let suffixIcon = getComponentFromProp(this, 'suffixIcon')
+ suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon
const {
prefixCls, inputPrefixCls, placeholder, size, disabled,
allowClear, showSearch = false, ...otherProps } = props
@@ -408,9 +409,9 @@ const Cascader = {
}
const children = filterEmpty($slots.default)
const inputIcon = suffixIcon && (
- isValidElement(suffixIcon[0])
+ isValidElement(suffixIcon)
? cloneElement(
- suffixIcon[0],
+ suffixIcon,
{
class: {
[`${prefixCls}-picker-arrow`]: true,
diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap
index a3588a5c1..99969e364 100644
--- a/components/form/__tests__/__snapshots__/demo.test.js.snap
+++ b/components/form/__tests__/__snapshots__/demo.test.js.snap
@@ -4,7 +4,7 @@ exports[`renders ./components/form/demo/advanced-search.vue correctly 1`] = `
- ~