style: format code

pull/3131/head^2
tangjinzhou 2020-11-07 21:19:50 +08:00
parent a13dd20f58
commit b155627923
19 changed files with 48 additions and 44 deletions

View File

@ -50,11 +50,14 @@
"camelcase": "off", "camelcase": "off",
"no-extra-boolean-cast": "off", "no-extra-boolean-cast": "off",
"semi": ["error", "always"], "semi": ["error", "always"],
"vue/require-explicit-emits": "off",
"vue/require-prop-types": "off", "vue/require-prop-types": "off",
"vue/require-default-prop": "off", "vue/require-default-prop": "off",
"vue/no-reserved-keys": "off", "vue/no-reserved-keys": "off",
"vue/comment-directive": "off", "vue/comment-directive": "off",
"vue/prop-name-casing": "off", "vue/prop-name-casing": "off",
"vue/one-component-per-file": "off",
"vue/custom-event-name-casing": "off",
"vue/max-attributes-per-line": [ "vue/max-attributes-per-line": [
2, 2,
{ {

@ -1 +1 @@
Subproject commit 7f7141a1dd62488287157dee6a1af52716924c62 Subproject commit 937ccc4896088f148db3a1742517de351161ec5d

View File

@ -25,7 +25,6 @@ const AutoCompleteProps = {
const AutoComplete = defineComponent({ const AutoComplete = defineComponent({
name: 'AAutoComplete', name: 'AAutoComplete',
inheritAttrs: false, inheritAttrs: false,
emits: ['change', 'select', 'focus', 'blur'],
props: { props: {
...AutoCompleteProps, ...AutoCompleteProps,
prefixCls: PropTypes.string.def('ant-select'), prefixCls: PropTypes.string.def('ant-select'),
@ -38,6 +37,7 @@ const AutoComplete = defineComponent({
filterOption: PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func]).def(false), filterOption: PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func]).def(false),
defaultActiveFirstOption: PropTypes.looseBool.def(true), defaultActiveFirstOption: PropTypes.looseBool.def(true),
}, },
emits: ['change', 'select', 'focus', 'blur'],
Option: { ...Option, name: 'AAutoCompleteOption' }, Option: { ...Option, name: 'AAutoCompleteOption' },
OptGroup: { ...OptGroup, name: 'AAutoCompleteOptGroup' }, OptGroup: { ...OptGroup, name: 'AAutoCompleteOptGroup' },
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -20,11 +20,11 @@ const BackTop = defineComponent({
name: 'ABackTop', name: 'ABackTop',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
emits: ['click'],
props: { props: {
...props, ...props,
visibilityHeight: PropTypes.number.def(400), visibilityHeight: PropTypes.number.def(400),
}, },
emits: ['click'],
setup() { setup() {
return { return {
configProvider: inject('configProvider', defaultConfigProvider), configProvider: inject('configProvider', defaultConfigProvider),

View File

@ -1,3 +1,4 @@
/* eslint-disable */
import PropTypes from '../_util/vue-types'; import PropTypes from '../_util/vue-types';
import { defaultConfigProvider } from '../config-provider'; import { defaultConfigProvider } from '../config-provider';
import BaseMixin from '../_util/BaseMixin'; import BaseMixin from '../_util/BaseMixin';
@ -12,6 +13,9 @@ let colors = '#194d33';
export default { export default {
name: 'AColorPicker', name: 'AColorPicker',
mixins: [BaseMixin], mixins: [BaseMixin],
inject: {
configProvider: { default: () => defaultConfigProvider },
},
model: { model: {
prop: 'value', prop: 'value',
event: 'change.value', //v-model ,pickrchange event: 'change.value', //v-model ,pickrchange
@ -30,9 +34,7 @@ export default {
alpha: PropTypes.looseBool.def(false), // alpha: PropTypes.looseBool.def(false), //
hue: PropTypes.looseBool.def(true), // hue: PropTypes.looseBool.def(true), //
}, },
inject: {
configProvider: { default: () => defaultConfigProvider },
},
data() { data() {
return { return {
colors, colors,
@ -82,7 +84,7 @@ export default {
this.createPickr(); this.createPickr();
this.eventsBinding(); this.eventsBinding();
}, },
destroyed() { unmounted() {
this.pickr.destroyAndRemove(); this.pickr.destroyAndRemove();
}, },
methods: { methods: {

View File

@ -32,13 +32,13 @@ export default function createPicker<P>(
): DefineComponent<any> { ): DefineComponent<any> {
return defineComponent({ return defineComponent({
name, name,
mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
...props, ...props,
allowClear: PropTypes.looseBool.def(true), allowClear: PropTypes.looseBool.def(true),
showToday: PropTypes.looseBool.def(true), showToday: PropTypes.looseBool.def(true),
}, },
mixins: [BaseMixin],
setup() { setup() {
return { return {
configProvider: inject('configProvider', defaultConfigProvider), configProvider: inject('configProvider', defaultConfigProvider),

View File

@ -13,6 +13,7 @@ const PlacementTypes = tuple('top', 'right', 'bottom', 'left');
type placementType = typeof PlacementTypes[number]; type placementType = typeof PlacementTypes[number];
const Drawer = defineComponent({ const Drawer = defineComponent({
name: 'ADrawer', name: 'ADrawer',
mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
closable: PropTypes.looseBool.def(true), closable: PropTypes.looseBool.def(true),
@ -40,7 +41,6 @@ const Drawer = defineComponent({
onClose: PropTypes.func, onClose: PropTypes.func,
'onUpdate:visible': PropTypes.func, 'onUpdate:visible': PropTypes.func,
}, },
mixins: [BaseMixin],
setup(props) { setup(props) {
const configProvider = inject('configProvider', defaultConfigProvider); const configProvider = inject('configProvider', defaultConfigProvider);
return { return {

View File

@ -150,7 +150,6 @@ export const destroyFns = [];
export default defineComponent({ export default defineComponent({
name: 'AModal', name: 'AModal',
inheritAttrs: false, inheritAttrs: false,
emits: ['update:visible', 'cancel', 'change', 'ok'],
props: initDefaultProps(modalProps, { props: initDefaultProps(modalProps, {
width: 520, width: 520,
transitionName: 'zoom', transitionName: 'zoom',
@ -159,6 +158,7 @@ export default defineComponent({
visible: false, visible: false,
okType: 'primary', okType: 'primary',
}), }),
emits: ['update:visible', 'cancel', 'change', 'ok'],
setup() { setup() {
return { return {
configProvider: inject('configProvider', defaultConfigProvider), configProvider: inject('configProvider', defaultConfigProvider),

View File

@ -18,6 +18,7 @@ const btnProps = buttonTypes();
const Popconfirm = defineComponent({ const Popconfirm = defineComponent({
name: 'APopconfirm', name: 'APopconfirm',
mixins: [BaseMixin],
props: { props: {
...tooltipProps, ...tooltipProps,
prefixCls: PropTypes.string, prefixCls: PropTypes.string,
@ -36,7 +37,6 @@ const Popconfirm = defineComponent({
onCancel: PropTypes.func, onCancel: PropTypes.func,
onVisibleChange: PropTypes.func, onVisibleChange: PropTypes.func,
}, },
mixins: [BaseMixin],
emits: ['update:visible', 'confirm', 'cancel', 'visibleChange'], emits: ['update:visible', 'confirm', 'cancel', 'visibleChange'],
setup() { setup() {
return { return {

View File

@ -55,6 +55,9 @@ const Slider = defineComponent({
name: 'ASlider', name: 'ASlider',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
props: {
...SliderProps(),
},
emits: ['update:value', 'change'], emits: ['update:value', 'change'],
setup() { setup() {
return { return {
@ -62,9 +65,6 @@ const Slider = defineComponent({
configProvider: inject('configProvider', defaultConfigProvider), configProvider: inject('configProvider', defaultConfigProvider),
}; };
}, },
props: {
...SliderProps(),
},
data() { data() {
return { return {
visibles: {}, visibles: {},

View File

@ -78,7 +78,6 @@ const TimePicker = defineComponent({
name: 'ATimePicker', name: 'ATimePicker',
mixins: [BaseMixin], mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
emits: ['update:value', 'update:open', 'change', 'openChange', 'focus', 'blur', 'keydown'],
props: initDefaultProps(TimePickerProps(), { props: initDefaultProps(TimePickerProps(), {
align: { align: {
offset: [0, -2], offset: [0, -2],
@ -93,6 +92,7 @@ const TimePicker = defineComponent({
focusOnOpen: true, focusOnOpen: true,
allowClear: true, allowClear: true,
}), }),
emits: ['update:value', 'update:open', 'change', 'openChange', 'focus', 'blur', 'keydown'],
setup() { setup() {
return { return {
popupRef: null, popupRef: null,

View File

@ -24,6 +24,7 @@ const getMomentObjectIfValid = date => {
const Calendar = defineComponent({ const Calendar = defineComponent({
name: 'Calendar', name: 'Calendar',
mixins: [BaseMixin, CommonMixin, CalendarMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
locale: PropTypes.object.def(enUs), locale: PropTypes.object.def(enUs),
@ -66,8 +67,6 @@ const Calendar = defineComponent({
monthCellContentRender: PropTypes.func, monthCellContentRender: PropTypes.func,
}, },
mixins: [BaseMixin, CommonMixin, CalendarMixin],
data() { data() {
const props = this.$props; const props = this.$props;
return { return {

View File

@ -11,6 +11,7 @@ import enUs from './locale/en_US';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
const FullCalendar = defineComponent({ const FullCalendar = defineComponent({
name: 'FullCalendar', name: 'FullCalendar',
mixins: [BaseMixin, CommonMixin, CalendarMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
locale: PropTypes.object.def(enUs), locale: PropTypes.object.def(enUs),
@ -36,7 +37,6 @@ const FullCalendar = defineComponent({
renderFooter: PropTypes.func.def(() => null), renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null), renderSidebar: PropTypes.func.def(() => null),
}, },
mixins: [BaseMixin, CommonMixin, CalendarMixin],
data() { data() {
let type; let type;
if (hasProp(this, 'type')) { if (hasProp(this, 'type')) {

View File

@ -10,6 +10,7 @@ import enUs from './locale/en_US';
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
const MonthCalendar = defineComponent({ const MonthCalendar = defineComponent({
name: 'MonthCalendar', name: 'MonthCalendar',
mixins: [BaseMixin, CommonMixin, CalendarMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
locale: PropTypes.object.def(enUs), locale: PropTypes.object.def(enUs),
@ -26,7 +27,6 @@ const MonthCalendar = defineComponent({
renderFooter: PropTypes.func.def(() => null), renderFooter: PropTypes.func.def(() => null),
renderSidebar: PropTypes.func.def(() => null), renderSidebar: PropTypes.func.def(() => null),
}, },
mixins: [BaseMixin, CommonMixin, CalendarMixin],
data() { data() {
const props = this.$props; const props = this.$props;

View File

@ -27,6 +27,7 @@ function refFn(field, component) {
const Picker = defineComponent({ const Picker = defineComponent({
name: 'Picker', name: 'Picker',
mixins: [BaseMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
animation: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), animation: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
@ -48,7 +49,6 @@ const Picker = defineComponent({
dateRender: PropTypes.func, dateRender: PropTypes.func,
children: PropTypes.func, children: PropTypes.func,
}, },
mixins: [BaseMixin],
data() { data() {
const props = this.$props; const props = this.$props;

View File

@ -82,6 +82,7 @@ function onInputSelect(direction, value, cause) {
const RangeCalendar = defineComponent({ const RangeCalendar = defineComponent({
name: 'RangeCalendar', name: 'RangeCalendar',
mixins: [BaseMixin, CommonMixin],
inheritAttrs: false, inheritAttrs: false,
props: { props: {
locale: PropTypes.object.def(enUs), locale: PropTypes.object.def(enUs),
@ -123,8 +124,6 @@ const RangeCalendar = defineComponent({
inputReadOnly: PropTypes.looseBool, inputReadOnly: PropTypes.looseBool,
}, },
mixins: [BaseMixin, CommonMixin],
data() { data() {
const props = this.$props; const props = this.$props;
const selectedValue = props.selectedValue || props.defaultSelectedValue; const selectedValue = props.selectedValue || props.defaultSelectedValue;

View File

@ -9,11 +9,11 @@ import { defineComponent } from 'vue';
export default defineComponent({ export default defineComponent({
name: 'Slider', name: 'Slider',
mixins: [BaseMixin],
inheritAttrs: false,
props: { props: {
...defaultProps, ...defaultProps,
}, },
mixins: [BaseMixin],
inheritAttrs: false,
data() { data() {
this._responsiveMediaHandlers = []; this._responsiveMediaHandlers = [];
return { return {

View File

@ -193,22 +193,7 @@ const Select = defineComponent({
...newState, ...newState,
}; };
}, },
created() {
provide('vcTreeSelect', {
onSelectorFocus: this.onSelectorFocus,
onSelectorBlur: this.onSelectorBlur,
onSelectorKeyDown: this.onComponentKeyDown,
onSelectorClear: this.onSelectorClear,
onMultipleSelectorRemove: this.onMultipleSelectorRemove,
onTreeNodeSelect: this.onTreeNodeSelect,
onTreeNodeCheck: this.onTreeNodeCheck,
onPopupKeyDown: this.onComponentKeyDown,
onSearchInputChange: this.onSearchInputChange,
onSearchInputKeyDown: this.onSearchInputKeyDown,
});
},
watch: { watch: {
...getWatch(['treeData', 'defaultValue', 'value']), ...getWatch(['treeData', 'defaultValue', 'value']),
__propsSymbol__() { __propsSymbol__() {
@ -258,6 +243,22 @@ const Select = defineComponent({
}); });
}, },
}, },
created() {
provide('vcTreeSelect', {
onSelectorFocus: this.onSelectorFocus,
onSelectorBlur: this.onSelectorBlur,
onSelectorKeyDown: this.onComponentKeyDown,
onSelectorClear: this.onSelectorClear,
onMultipleSelectorRemove: this.onMultipleSelectorRemove,
onTreeNodeSelect: this.onTreeNodeSelect,
onTreeNodeCheck: this.onTreeNodeCheck,
onPopupKeyDown: this.onComponentKeyDown,
onSearchInputChange: this.onSearchInputChange,
onSearchInputKeyDown: this.onSearchInputKeyDown,
});
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
const { autofocus, disabled } = this.$props; const { autofocus, disabled } = this.$props;

View File

@ -44,6 +44,11 @@ function getWatch(keys = []) {
const Tree = defineComponent({ const Tree = defineComponent({
name: 'Tree', name: 'Tree',
mixins: [BaseMixin], mixins: [BaseMixin],
provide() {
return {
vcTree: this,
};
},
inheritAttrs: false, inheritAttrs: false,
props: initDefaultProps( props: initDefaultProps(
{ {
@ -136,11 +141,6 @@ const Tree = defineComponent({
...this.getDerivedState(getOptionProps(this), state), ...this.getDerivedState(getOptionProps(this), state),
}; };
}, },
provide() {
return {
vcTree: this,
};
},
watch: { watch: {
// watch // watch