diff --git a/antdv-demo b/antdv-demo index 38ec9e4d5..31e7b308a 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 38ec9e4d590312ac56c01203ae13453bdf36a0c7 +Subproject commit 31e7b308adb6eabb97c003fbc7883e4d00c8f764 diff --git a/components/_util/util.js b/components/_util/util.js index 18252b386..8c8e7ced5 100644 --- a/components/_util/util.js +++ b/components/_util/util.js @@ -48,4 +48,13 @@ function resolvePropValue(options, props, key, value) { return value; } +export function getDataAndAriaProps(props) { + return Object.keys(props).reduce((memo, key) => { + if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-') { + memo[key] = props[key]; + } + return memo; + }, {}); +} + export { isOn, cacheStringFunction, camelize, hyphenate, capitalize, resolvePropValue }; diff --git a/components/anchor/Anchor.jsx b/components/anchor/Anchor.jsx index b24a6300c..9150d5f67 100644 --- a/components/anchor/Anchor.jsx +++ b/components/anchor/Anchor.jsx @@ -272,7 +272,6 @@ export default { $slots, getContainer, } = this; - const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('anchor', customizePrefixCls); this._sPrefixCls = prefixCls; @@ -281,7 +280,7 @@ export default { visible: activeLink, }); - const wrapperClass = classNames(this.$attrs.class, this.wrapperClass, `${prefixCls}-wrapper`); + const wrapperClass = classNames(this.wrapperClass, `${prefixCls}-wrapper`); const anchorClass = classNames(prefixCls, { fixed: !affix && !showInkInFixed, @@ -290,9 +289,7 @@ export default { const wrapperStyle = { maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh', ...this.wrapperStyle, - ...this.$attrs.style, }; - const anchorContent = (
@@ -307,7 +304,7 @@ export default { return !affix ? ( anchorContent ) : ( - + {anchorContent} ); diff --git a/components/anchor/AnchorLink.jsx b/components/anchor/AnchorLink.jsx index f80ba5f9b..40579b217 100644 --- a/components/anchor/AnchorLink.jsx +++ b/components/anchor/AnchorLink.jsx @@ -23,6 +23,7 @@ export default { registerLink: noop, unregisterLink: noop, scrollTo: noop, + $data: {}, }), antAnchorContext: inject('antAnchorContext', {}), configProvider: inject('configProvider', ConfigConsumerProps), @@ -62,7 +63,7 @@ export default { const prefixCls = getPrefixCls('anchor', customizePrefixCls); const title = getComponent(this, 'title'); - const active = this.antAnchor.activeLink === href; + const active = this.antAnchor.$data.activeLink === href; const wrapperClassName = classNames(`${prefixCls}-link`, { [`${prefixCls}-link-active`]: active, }); diff --git a/components/carousel/index.jsx b/components/carousel/index.jsx index dbd93ef74..22b87d849 100644 --- a/components/carousel/index.jsx +++ b/components/carousel/index.jsx @@ -153,7 +153,7 @@ const Carousel = { if (props.effect === 'fade') { props.fade = true; } - + const { class: cls, style, ...restAttrs } = this.$attrs; const getPrefixCls = this.configProvider.getPrefixCls; let className = getPrefixCls('carousel', props.prefixCls); const dotsClass = 'slick-dots'; @@ -162,17 +162,19 @@ const Carousel = { props.dotsClass = classNames(`${dotsClass}`, `${dotsClass}-${dotPosition || 'bottom'}`, { [`${props.dotsClass}`]: !!props.dotsClass, }); - if (props.vertical) { - className = `${className} ${className}-vertical`; - } + className = classNames({ + [cls]: !!cls, + [className]: !!className, + [`${className}-vertical`]: props.vertical, + }); const SlickCarouselProps = { ...props, - ...this.$attrs, + ...restAttrs, nextArrow: getComponent(this, 'nextArrow'), prevArrow: getComponent(this, 'prevArrow'), }; return ( -
+
); diff --git a/components/date-picker/RangePicker.jsx b/components/date-picker/RangePicker.jsx index a26892fe4..e332f899a 100644 --- a/components/date-picker/RangePicker.jsx +++ b/components/date-picker/RangePicker.jsx @@ -13,6 +13,7 @@ import { hasProp, getOptionProps, initDefaultProps, getComponent } from '../_uti import BaseMixin from '../_util/BaseMixin'; import { formatDate } from './utils'; import InputIcon from './InputIcon'; +import { getDataAndAriaProps } from '../_util/util'; function getShowDateFromValue(value, mode) { const [start, end] = value; @@ -413,6 +414,7 @@ export default { onBlur={onBlur} onMouseenter={this.onMouseEnter} onMouseleave={this.onMouseLeave} + {...getDataAndAriaProps(props)} > diff --git a/components/date-picker/WeekPicker.jsx b/components/date-picker/WeekPicker.jsx index 04f768614..b552fae00 100644 --- a/components/date-picker/WeekPicker.jsx +++ b/components/date-picker/WeekPicker.jsx @@ -10,6 +10,7 @@ import BaseMixin from '../_util/BaseMixin'; import { WeekPickerProps } from './interface'; import interopDefault from '../_util/interopDefault'; import InputIcon from './InputIcon'; +import { getDataAndAriaProps } from '../_util/util'; function formatValue(value, format) { return (value && value.format(format)) || ''; @@ -207,7 +208,12 @@ export default { style: popupStyle, }; return ( - + ); diff --git a/components/date-picker/createPicker.js b/components/date-picker/createPicker.js index 9aea18f82..cd12f4d9e 100644 --- a/components/date-picker/createPicker.js +++ b/components/date-picker/createPicker.js @@ -18,6 +18,7 @@ import { } from '../_util/props-util'; import { cloneElement } from '../_util/vnode'; import { formatDate } from './utils'; +import { getDataAndAriaProps } from '../_util/util'; // export const PickerProps = { // value?: moment.Moment; @@ -244,6 +245,7 @@ export default function createPicker(TheCalendar, props) { // tabindex={props.disabled ? -1 : 0} // onFocus={focus} // onBlur={blur} + {...getDataAndAriaProps(this.$attrs)} onMouseenter={this.onMouseEnter} onMouseleave={this.onMouseLeave} > diff --git a/components/drawer/index.jsx b/components/drawer/index.jsx index 91113842a..2584f95d8 100644 --- a/components/drawer/index.jsx +++ b/components/drawer/index.jsx @@ -213,7 +213,7 @@ const Drawer = { const handler = getComponent(this, 'handle') || false; const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('drawer', customizePrefixCls); - + const { class: className } = this.$attrs; const vcDrawerProps = { ...this.$attrs, ...omit(rest, [ @@ -241,6 +241,7 @@ const Drawer = { showMask: mask, placement, class: classnames({ + [className]: !!className, [wrapClassName]: !!wrapClassName, [haveMask]: !!haveMask, }), diff --git a/components/vc-collapse/src/Collapse.jsx b/components/vc-collapse/src/Collapse.jsx index 079e64190..31609e0dd 100644 --- a/components/vc-collapse/src/Collapse.jsx +++ b/components/vc-collapse/src/Collapse.jsx @@ -9,6 +9,7 @@ import { import { cloneElement } from '../../_util/vnode'; import openAnimationFactory from './openAnimationFactory'; import { collapseProps } from './commonProps'; +import { getDataAndAriaProps } from '../../_util/util'; function _toArray(activeKey) { let currentActiveKey = activeKey; @@ -131,7 +132,12 @@ export default { [className]: className, }; return ( -
+
{this.getItems()}
); diff --git a/components/vc-drawer/src/Drawer.js b/components/vc-drawer/src/Drawer.js index fb4cae9ac..932310a5c 100644 --- a/components/vc-drawer/src/Drawer.js +++ b/components/vc-drawer/src/Drawer.js @@ -381,7 +381,7 @@ const Drawer = { keyboard, maskClosable, } = this.$props; - const { class: cls, style } = this.$attrs; + const { class: cls, style, ...restAttrs } = this.$attrs; const children = getSlot(this); const wrapperClassname = classnames(prefixCls, { [`${prefixCls}-${placement}`]: true, @@ -424,6 +424,7 @@ const Drawer = { }); } const domContProps = { + ...restAttrs, class: wrapperClassname, onTransitionend: this.onWrapperTransitionEnd, onKeydown: open && keyboard ? this.onKeyDown : noop, diff --git a/components/vc-select/Select.jsx b/components/vc-select/Select.jsx index f7483e60d..e536b705f 100644 --- a/components/vc-select/Select.jsx +++ b/components/vc-select/Select.jsx @@ -48,6 +48,7 @@ import { SelectPropTypes } from './PropTypes'; import contains from '../vc-util/Dom/contains'; import { isIE, isEdge } from '../_util/env'; import isValid from '../_util/isValid'; +import { getDataAndAriaProps } from '../_util/util'; const SELECT_EMPTY_VALUE_KEY = 'RC_SELECT_EMPTY_VALUE_KEY'; @@ -1580,6 +1581,7 @@ const Select = { ariaId={this.$data._ariaId} >
- + + + + + + + + jjj + + + Home + + + + + +
+

1

+
+
+ Checkbox + + + +

{{ text }}

+
+ +

{{ text }}

+
+ +

{{ text }}

+
+
+ +
+ +
+ +
+ + + + No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China + + > + + ssss + +
- +>