Skip to content

Make moment.js tree-shakable by moving ConfigConsumerProps to own file (v1) #3524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/_util/wave.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TransitionEvents from './css-animation/Event';
import raf from './raf';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
let styleForPesudo;

// Where el is the DOM element you'd like to test for visibility
Expand Down
2 changes: 1 addition & 1 deletion components/affix/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import omit from 'omit.js';
import ResizeObserver from '../vc-resize-observer';
import BaseMixin from '../_util/BaseMixin';
import throttleByAnimationFrame from '../_util/throttleByAnimationFrame';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';
import warning from '../_util/warning';
import {
Expand Down
2 changes: 1 addition & 1 deletion components/alert/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from '../_util/vue-types';
import getTransitionProps from '../_util/getTransitionProps';
import { getComponentFromProp, isValidElement } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';

function noop() {}
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/Anchor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scrollTo from '../_util/scrollTo';
import getScroll from '../_util/getScroll';
import { initDefaultProps } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

function getDefaultContainer() {
return window;
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/AnchorLink.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from '../_util/vue-types';
import { initDefaultProps, getComponentFromProp } from '../_util/props-util';
import classNames from 'classnames';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

export const AnchorLinkProps = {
prefixCls: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion components/auto-complete/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Select, { AbstractSelectProps, SelectValue } from '../select';
import Input from '../input';
import InputElement from './InputElement';
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import {
getComponentFromProp,
getOptionProps,
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/Avatar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Icon from '../icon';
import { getListeners, getComponentFromProp } from '../_util/props-util';
import PropTypes from '../_util/vue-types';
Expand Down
2 changes: 1 addition & 1 deletion components/back-top/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import addEventListener from '../vc-util/Dom/addEventListener';
import getScroll from '../_util/getScroll';
import BaseMixin from '../_util/BaseMixin';
import getTransitionProps from '../_util/getTransitionProps';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';
import { getListeners } from '../_util/props-util';
import scrollTo from '../_util/scrollTo';
Expand Down
2 changes: 1 addition & 1 deletion components/badge/Badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { cloneElement } from '../_util/vnode';
import getTransitionProps from '../_util/getTransitionProps';
import isNumeric from '../_util/isNumeric';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

const BadgeProps = {
/** Number to show in badge */
Expand Down
2 changes: 1 addition & 1 deletion components/badge/ScrollNumber.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BaseMixin from '../_util/BaseMixin';
import { getStyle } from '../_util/props-util';
import omit from 'omit.js';
import { cloneElement } from '../_util/vnode';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

function getNumberArray(num) {
return num
Expand Down
2 changes: 1 addition & 1 deletion components/breadcrumb/Breadcrumb.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import { cloneElement } from '../_util/vnode';
import { filterEmpty, getComponentFromProp, getSlotOptions } from '../_util/props-util';
import warning from '../_util/warning';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import BreadcrumbItem from './BreadcrumbItem';
import Menu from '../menu';

Expand Down
2 changes: 1 addition & 1 deletion components/breadcrumb/BreadcrumbItem.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types';
import { hasProp, getComponentFromProp } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import DropDown from '../dropdown/dropdown';
import Icon from '../icon';

Expand Down
2 changes: 1 addition & 1 deletion components/breadcrumb/BreadcrumbSeparator.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import PropTypes from '../_util/vue-types';

export default {
Expand Down
2 changes: 1 addition & 1 deletion components/button/button-group.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { filterEmpty } from '../_util/props-util';
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

const ButtonGroupProps = {
prefixCls: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion components/button/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Wave from '../_util/wave';
import Icon from '../icon';
import buttonTypes from './buttonTypes';
import { filterEmpty, getListeners, getComponentFromProp } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Select from '../select';
import { Group, Button } from '../radio';
import PropTypes from '../_util/vue-types';
import { initDefaultProps } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

const { Option } = Select;

Expand Down
2 changes: 1 addition & 1 deletion components/calendar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FullCalendar from '../vc-calendar/src/FullCalendar';
import Header from './Header';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import interopDefault from '../_util/interopDefault';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import enUS from './locale/en_US';
import Base from '../base';
import { checkValidate, stringToMoment, momentToString, TimeType } from '../_util/moment-util';
Expand Down
2 changes: 1 addition & 1 deletion components/card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
getListeners,
} from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

const { TabPane } = Tabs;
export default {
Expand Down
2 changes: 1 addition & 1 deletion components/card/Grid.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import { getListeners } from '../_util/props-util';

export default {
Expand Down
2 changes: 1 addition & 1 deletion components/card/Meta.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types';
import { getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

export default {
name: 'ACardMeta',
Expand Down
2 changes: 1 addition & 1 deletion components/carousel/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import hasProp, {
filterEmpty,
getListeners,
} from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';
import warning from '../_util/warning';
import classNames from 'classnames';
Expand Down
2 changes: 1 addition & 1 deletion components/cascader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import BaseMixin from '../_util/BaseMixin';
import { cloneElement } from '../_util/vnode';
import warning from '../_util/warning';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';

const CascaderOptionType = PropTypes.shape({
Expand Down
2 changes: 1 addition & 1 deletion components/checkbox/Checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from '../_util/vue-types';
import classNames from 'classnames';
import VcCheckbox from '../vc-checkbox';
import hasProp, { getOptionProps, getAttrs, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import warning from '../_util/warning';
function noop() {}

Expand Down
2 changes: 1 addition & 1 deletion components/checkbox/Group.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from '../_util/vue-types';
import Checkbox from './Checkbox';
import hasProp from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

function noop() {}
export default {
Expand Down
2 changes: 1 addition & 1 deletion components/collapse/Collapse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { cloneElement } from '../_util/vnode';
import VcCollapse, { collapseProps } from '../vc-collapse';
import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

export default {
name: 'ACollapse',
Expand Down
2 changes: 1 addition & 1 deletion components/collapse/CollapsePanel.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getOptionProps, getComponentFromProp, getListeners } from '../_util/props-util';
import VcCollapse, { panelProps } from '../vc-collapse';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

export default {
name: 'ACollapsePanel',
Expand Down
2 changes: 1 addition & 1 deletion components/color-picker/ColorPicker.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import BaseMixin from '../_util/BaseMixin';
import Pickr from '@simonwep/pickr/dist/pickr.es5.min';
import Icon from '../icon';
Expand Down
2 changes: 1 addition & 1 deletion components/comment/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropsTypes from '../_util/vue-types';
import { getComponentFromProp, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';
export const CommentProps = {
actions: PropsTypes.array,
Expand Down
9 changes: 9 additions & 0 deletions components/config-provider/configConsumerProps.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import defaultRenderEmpty from './renderEmpty';

export const ConfigConsumerProps = {
getPrefixCls: (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) return customizePrefixCls;
return `ant-${suffixCls}`;
},
renderEmpty: defaultRenderEmpty,
};
8 changes: 0 additions & 8 deletions components/config-provider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ const ConfigProvider = {
},
};

export const ConfigConsumerProps = {
getPrefixCls: (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) return customizePrefixCls;
return `ant-${suffixCls}`;
},
renderEmpty: defaultRenderEmpty,
};

/* istanbul ignore next */
ConfigProvider.install = function(Vue) {
Vue.use(Base);
Expand Down
2 changes: 1 addition & 1 deletion components/config-provider/renderEmpty.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types';
import Empty from '../empty';
import { ConfigConsumerProps } from './';
import { ConfigConsumerProps } from './configConsumerProps';

const RenderEmpty = {
functional: true,
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/RangePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames';
import shallowequal from 'shallowequal';
import Icon from '../icon';
import Tag from '../tag';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import interopDefault from '../_util/interopDefault';
import { RangePickerProps } from './interface';
import {
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/WeekPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as moment from 'moment';
import Calendar from '../vc-calendar';
import VcDatePicker from '../vc-calendar/src/Picker';
import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import {
hasProp,
getOptionProps,
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/createPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MonthCalendar from '../vc-calendar/src/MonthCalendar';
import VcDatePicker from '../vc-calendar/src/Picker';
import classNames from 'classnames';
import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import interopDefault from '../_util/interopDefault';
import BaseMixin from '../_util/BaseMixin';
import {
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/wrapPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { generateShowHourMinuteSecond } from '../time-picker';
import enUS from './locale/en_US';
import { getOptionProps, initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import { checkValidate, stringToMoment, momentToString } from '../_util/moment-util';

const DEFAULT_FORMAT = {
Expand Down
2 changes: 1 addition & 1 deletion components/descriptions/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import warning from '../_util/warning';
import ResponsiveObserve, { responsiveArray } from '../_util/responsiveObserve';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Col from './Col';
import PropTypes from '../_util/vue-types';
import {
Expand Down
2 changes: 1 addition & 1 deletion components/divider/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';

const Divider = {
Expand Down
2 changes: 1 addition & 1 deletion components/drawer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
import Icon from '../icon';
import { getComponentFromProp, getOptionProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';

const Drawer = {
Expand Down
2 changes: 1 addition & 1 deletion components/dropdown/dropdown-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Dropdown from './dropdown';
import PropTypes from '../_util/vue-types';
import { hasProp, getComponentFromProp } from '../_util/props-util';
import getDropdownProps from './getDropdownProps';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Icon from '../icon';

const ButtonTypesProps = buttonTypes();
Expand Down
2 changes: 1 addition & 1 deletion components/dropdown/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getListeners,
} from '../_util/props-util';
import getDropdownProps from './getDropdownProps';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Icon from '../icon';

const DropdownProps = getDropdownProps();
Expand Down
2 changes: 1 addition & 1 deletion components/empty/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import { getComponentFromProp, getListeners } from '../_util/props-util';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import DefaultEmptyImg from './empty';
Expand Down
2 changes: 1 addition & 1 deletion components/form-model/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import isRegExp from 'lodash/isRegExp';
import warning from '../_util/warning';
import FormItem from './FormItem';
import { initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

export const FormProps = {
layout: PropTypes.oneOf(['horizontal', 'inline', 'vertical']),
Expand Down
2 changes: 1 addition & 1 deletion components/form-model/FormItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
isValidElement,
} from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import FormItem from '../form/FormItem';
import { cloneElement } from '../_util/vnode';

Expand Down
2 changes: 1 addition & 1 deletion components/form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import createFormField from '../vc-form/src/createFormField';
import FormItem from './FormItem';
import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants';
import { initDefaultProps, getListeners } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import Base from '../base';

export const FormCreateOption = {
Expand Down
2 changes: 1 addition & 1 deletion components/form/FormItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import getTransitionProps from '../_util/getTransitionProps';
import BaseMixin from '../_util/BaseMixin';
import { cloneElement, cloneVNodes } from '../_util/vnode';
import Icon from '../icon';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';

function noop() {}

Expand Down
2 changes: 1 addition & 1 deletion components/grid/Col.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import { getListeners } from '../_util/props-util';

const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
Expand Down
Loading