style: update prettier & format code
parent
fdecafbbb3
commit
33c7230ee2
|
@ -11,7 +11,7 @@
|
|||
"parser": "babel-eslint"
|
||||
},
|
||||
"extends": ["plugin:vue/vue3-recommended", "prettier"],
|
||||
"plugins": ["markdown"],
|
||||
"plugins": ["markdown", "jest"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/demo/*.md"],
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"trailingComma": "all",
|
||||
"printWidth": 100,
|
||||
"proseWrap": "never",
|
||||
"arrowParens": "avoid",
|
||||
"overrides": [
|
||||
{
|
||||
"files": ".prettierrc",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { resolve } = require('./utils/projectHelper');
|
||||
|
||||
module.exports = function(modules) {
|
||||
module.exports = function (modules) {
|
||||
const plugins = [
|
||||
[
|
||||
resolve('@babel/plugin-transform-typescript'),
|
||||
|
|
|
@ -4,7 +4,7 @@ const fs = require('fs');
|
|||
const assign = require('object-assign');
|
||||
const { getProjectPath } = require('./utils/projectHelper');
|
||||
|
||||
module.exports = function() {
|
||||
module.exports = function () {
|
||||
let my = {};
|
||||
if (fs.existsSync(getProjectPath('tsconfig.json'))) {
|
||||
my = require(getProjectPath('tsconfig.json'));
|
||||
|
|
|
@ -80,7 +80,7 @@ function compileTs(stream) {
|
|||
return stream
|
||||
.pipe(ts(tsConfig))
|
||||
.js.pipe(
|
||||
through2.obj(function(file, encoding, next) {
|
||||
through2.obj(function (file, encoding, next) {
|
||||
// console.log(file.path, file.base);
|
||||
file.path = file.path.replace(/\.[jt]sx$/, '.js');
|
||||
this.push(file);
|
||||
|
@ -146,7 +146,7 @@ function compile(modules) {
|
|||
const less = gulp
|
||||
.src(['components/**/*.less'])
|
||||
.pipe(
|
||||
through2.obj(function(file, encoding, next) {
|
||||
through2.obj(function (file, encoding, next) {
|
||||
this.push(file.clone());
|
||||
if (
|
||||
file.path.match(/\/style\/index\.less$/) ||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
const fs = require('fs');
|
||||
|
||||
module.exports = function getChangelog(file, version) {
|
||||
const lines = fs
|
||||
.readFileSync(file)
|
||||
.toString()
|
||||
.split('\n');
|
||||
const lines = fs.readFileSync(file).toString().split('\n');
|
||||
const changeLog = [];
|
||||
const startPattern = new RegExp(`^## ${version}`);
|
||||
const stopPattern = /^## /; // 前一个版本
|
||||
|
|
|
@ -11,13 +11,7 @@ module.exports = function getRunCmdEnv() {
|
|||
const nodeModulesBinDir = path.join(__dirname, '../../node_modules/.bin');
|
||||
|
||||
Object.entries(env)
|
||||
.filter(
|
||||
v =>
|
||||
v
|
||||
.slice(0, 1)
|
||||
.pop()
|
||||
.toLowerCase() === 'path',
|
||||
)
|
||||
.filter(v => v.slice(0, 1).pop().toLowerCase() === 'path')
|
||||
.forEach(v => {
|
||||
const key = v.slice(0, 1).pop();
|
||||
env[key] = env[key] ? `${nodeModulesBinDir}:${env[key]}` : nodeModulesBinDir;
|
||||
|
|
|
@ -20,7 +20,7 @@ function injectRequire() {
|
|||
const Module = require('module');
|
||||
|
||||
const oriRequire = Module.prototype.require;
|
||||
Module.prototype.require = function(...args) {
|
||||
Module.prototype.require = function (...args) {
|
||||
const moduleName = args[0];
|
||||
try {
|
||||
return oriRequire.apply(this, args);
|
||||
|
|
|
@ -163,6 +163,6 @@ export class ClassList {
|
|||
* @return {ClassList}
|
||||
* @api public
|
||||
*/
|
||||
export default function(el: Element): ClassList {
|
||||
export default function (el: Element): ClassList {
|
||||
return new ClassList(el);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ function copy(text: string, options?: Options): boolean {
|
|||
mark.style.MozUserSelect = 'text';
|
||||
mark.style.msUserSelect = 'text';
|
||||
mark.style.userSelect = 'text';
|
||||
mark.addEventListener('copy', function(e) {
|
||||
mark.addEventListener('copy', function (e) {
|
||||
e.stopPropagation();
|
||||
if (options.format) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const deselectCurrent = (): (() => void) => {
|
||||
const selection = document.getSelection();
|
||||
if (!selection.rangeCount) {
|
||||
return function() {};
|
||||
return function () {};
|
||||
}
|
||||
let active = document.activeElement as any;
|
||||
|
||||
|
@ -26,11 +26,11 @@ const deselectCurrent = (): (() => void) => {
|
|||
}
|
||||
|
||||
selection.removeAllRanges();
|
||||
return function() {
|
||||
return function () {
|
||||
selection.type === 'Caret' && selection.removeAllRanges();
|
||||
|
||||
if (!selection.rangeCount) {
|
||||
ranges.forEach(function(range) {
|
||||
ranges.forEach(function (range) {
|
||||
selection.addRange(range);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import matches from './dom-matches';
|
|||
* @param context {Element=}
|
||||
* @return {Element}
|
||||
*/
|
||||
export default function(element, selector, context) {
|
||||
export default function (element, selector, context) {
|
||||
context = context || document;
|
||||
// guard against orphans
|
||||
element = { parentNode: element };
|
||||
|
|
|
@ -2,10 +2,10 @@ const availablePrefixs = ['moz', 'ms', 'webkit'];
|
|||
|
||||
function requestAnimationFramePolyfill() {
|
||||
let lastTime = 0;
|
||||
return function(callback) {
|
||||
return function (callback) {
|
||||
const currTime = new Date().getTime();
|
||||
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
const id = window.setTimeout(function() {
|
||||
const id = window.setTimeout(function () {
|
||||
callback(currTime + timeToCall);
|
||||
}, timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
|
|
|
@ -18,7 +18,7 @@ const useInjectSize = <T = SizeType>(props?: Record<any, any>): ComputedRef<T> =
|
|||
? computed(() => props.size)
|
||||
: inject(
|
||||
sizeProvider,
|
||||
computed(() => ('default' as unknown) as T),
|
||||
computed(() => 'default' as unknown as T),
|
||||
);
|
||||
return size;
|
||||
};
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
* https://github.com/akiran/json2mq.git
|
||||
*/
|
||||
|
||||
const camel2hyphen = function(str) {
|
||||
const camel2hyphen = function (str) {
|
||||
return str
|
||||
.replace(/[A-Z]/g, function(match) {
|
||||
.replace(/[A-Z]/g, function (match) {
|
||||
return '-' + match.toLowerCase();
|
||||
})
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
const isDimension = function(feature) {
|
||||
const isDimension = function (feature) {
|
||||
const re = /[height|width]$/;
|
||||
return re.test(feature);
|
||||
};
|
||||
|
||||
const obj2mq = function(obj) {
|
||||
const obj2mq = function (obj) {
|
||||
let mq = '';
|
||||
const features = Object.keys(obj);
|
||||
features.forEach(function(feature, index) {
|
||||
features.forEach(function (feature, index) {
|
||||
let value = obj[feature];
|
||||
feature = camel2hyphen(feature);
|
||||
// Add px to dimension features
|
||||
|
@ -40,14 +40,14 @@ const obj2mq = function(obj) {
|
|||
return mq;
|
||||
};
|
||||
|
||||
export default function(query) {
|
||||
export default function (query) {
|
||||
let mq = '';
|
||||
if (typeof query === 'string') {
|
||||
return query;
|
||||
}
|
||||
// Handling array of media queries
|
||||
if (query instanceof Array) {
|
||||
query.forEach(function(q, index) {
|
||||
query.forEach(function (q, index) {
|
||||
mq += obj2mq(q);
|
||||
if (index < query.length - 1) {
|
||||
mq += ', ';
|
||||
|
|
|
@ -28,7 +28,7 @@ const parseStyleText = (cssText = '', camel) => {
|
|||
const res = {};
|
||||
const listDelimiter = /;(?![^(]*\))/g;
|
||||
const propertyDelimiter = /:(.+)/;
|
||||
cssText.split(listDelimiter).forEach(function(item) {
|
||||
cssText.split(listDelimiter).forEach(function (item) {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiter);
|
||||
if (tmp.length > 1) {
|
||||
|
|
|
@ -45,6 +45,6 @@ function shallowEqual(objA, objB, compare, compareContext) {
|
|||
return true;
|
||||
}
|
||||
|
||||
export default function(value, other, customizer, thisArg) {
|
||||
export default function (value, other, customizer, thisArg) {
|
||||
return shallowEqual(toRaw(value), toRaw(other), customizer, thisArg);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ export default function throttleByAnimationFrame(fn: (...args: any[]) => void) {
|
|||
|
||||
export function throttleByAnimationFrameDecorator() {
|
||||
// eslint-disable-next-line func-names
|
||||
return function(target: any, key: string, descriptor: any) {
|
||||
return function (target: any, key: string, descriptor: any) {
|
||||
const fn = descriptor.value;
|
||||
let definingProperty = false;
|
||||
return {
|
||||
|
|
|
@ -34,7 +34,7 @@ export type VueNode = VNodeChild | JSX.Element;
|
|||
|
||||
export const withInstall = <T>(comp: T) => {
|
||||
const c = comp as any;
|
||||
c.install = function(app: App) {
|
||||
c.install = function (app: App) {
|
||||
app.component(c.displayName || c.name, comp);
|
||||
};
|
||||
|
||||
|
|
|
@ -175,9 +175,9 @@ export default defineComponent({
|
|||
`${prefixCls.value}-link-title-active`,
|
||||
)[0];
|
||||
if (linkNode) {
|
||||
(inkNodeRef.value as HTMLElement).style.top = `${linkNode.offsetTop +
|
||||
linkNode.clientHeight / 2 -
|
||||
4.5}px`;
|
||||
(inkNodeRef.value as HTMLElement).style.top = `${
|
||||
linkNode.offsetTop + linkNode.clientHeight / 2 - 4.5
|
||||
}px`;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import AnchorLink, { AnchorLinkProps } from './AnchorLink';
|
|||
Anchor.Link = AnchorLink;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Anchor.install = function(app: App) {
|
||||
Anchor.install = function (app: App) {
|
||||
app.component(Anchor.name, Anchor);
|
||||
app.component(Anchor.Link.name, Anchor.Link);
|
||||
return app;
|
||||
|
|
|
@ -146,7 +146,7 @@ const AutoComplete = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
AutoComplete.install = function(app: App) {
|
||||
AutoComplete.install = function (app: App) {
|
||||
app.component(AutoComplete.name, AutoComplete);
|
||||
app.component(AutoComplete.Option.displayName, AutoComplete.Option);
|
||||
app.component(AutoComplete.OptGroup.displayName, AutoComplete.OptGroup);
|
||||
|
|
|
@ -8,7 +8,7 @@ export { AvatarGroupProps } from './Group';
|
|||
Avatar.Group = Group;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Avatar.install = function(app: App) {
|
||||
Avatar.install = function (app: App) {
|
||||
app.component(Avatar.name, Avatar);
|
||||
app.component(Group.name, Group);
|
||||
return app;
|
||||
|
|
|
@ -44,9 +44,11 @@ export default defineComponent({
|
|||
|
||||
// ================================ Misc ================================
|
||||
const numberedDisplayCount = computed(() => {
|
||||
return ((props.count as number) > (props.overflowCount as number)
|
||||
? `${props.overflowCount}+`
|
||||
: props.count) as string | number | null;
|
||||
return (
|
||||
(props.count as number) > (props.overflowCount as number)
|
||||
? `${props.overflowCount}+`
|
||||
: props.count
|
||||
) as string | number | null;
|
||||
});
|
||||
|
||||
const hasStatus = computed(
|
||||
|
|
|
@ -35,7 +35,7 @@ export default defineComponent({
|
|||
count,
|
||||
title,
|
||||
show,
|
||||
component: Tag = ('sup' as unknown) as DefineComponent,
|
||||
component: Tag = 'sup' as unknown as DefineComponent,
|
||||
class: className,
|
||||
style,
|
||||
...restProps
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { App, Plugin } from 'vue';
|
||||
import Badge from './Badge';
|
||||
import Ribbon from './Ribbon';
|
||||
export type { BadgeProps } from './Badge'
|
||||
export type { BadgeProps } from './Badge';
|
||||
|
||||
Badge.install = function(app: App) {
|
||||
Badge.install = function (app: App) {
|
||||
app.component(Badge.name, Badge);
|
||||
app.component(Ribbon.name, Ribbon);
|
||||
return app;
|
||||
};
|
||||
|
||||
export {Ribbon as BadgeRibbon}
|
||||
export { Ribbon as BadgeRibbon };
|
||||
|
||||
export default Badge as typeof Badge &
|
||||
Plugin & {
|
||||
|
|
|
@ -4,14 +4,14 @@ import BreadcrumbItem from './BreadcrumbItem';
|
|||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||
|
||||
export type { BreadcrumbProps } from './Breadcrumb';
|
||||
export type { BreadcrumbItemProps } from './BreadcrumbItem';
|
||||
export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator';
|
||||
export type { BreadcrumbItemProps } from './BreadcrumbItem';
|
||||
export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator';
|
||||
|
||||
Breadcrumb.Item = BreadcrumbItem;
|
||||
Breadcrumb.Separator = BreadcrumbSeparator;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Breadcrumb.install = function(app: App) {
|
||||
Breadcrumb.install = function (app: App) {
|
||||
app.component(Breadcrumb.name, Breadcrumb);
|
||||
app.component(BreadcrumbItem.name, BreadcrumbItem);
|
||||
app.component(BreadcrumbSeparator.name, BreadcrumbSeparator);
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import { App, Plugin } from 'vue';
|
||||
import Button from './button';
|
||||
import ButtonGroup from './button-group';
|
||||
export type {ButtonProps} from './button'
|
||||
export type { ButtonProps } from './button';
|
||||
|
||||
Button.Group = ButtonGroup;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Button.install = function(app: App) {
|
||||
Button.install = function (app: App) {
|
||||
app.component(Button.name, Button);
|
||||
app.component(ButtonGroup.name, ButtonGroup);
|
||||
return app;
|
||||
};
|
||||
export {ButtonGroup}
|
||||
export { ButtonGroup };
|
||||
export default Button as typeof Button &
|
||||
Plugin & {
|
||||
readonly Group: typeof ButtonGroup;
|
||||
|
|
|
@ -3,20 +3,20 @@ import Card from './Card';
|
|||
import Meta from './Meta';
|
||||
import Grid from './Grid';
|
||||
|
||||
export type {CardProps} from './Card'
|
||||
export type { CardProps } from './Card';
|
||||
|
||||
Card.Meta = Meta;
|
||||
Card.Grid = Grid;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Card.install = function(app: App) {
|
||||
Card.install = function (app: App) {
|
||||
app.component(Card.name, Card);
|
||||
app.component(Meta.name, Meta);
|
||||
app.component(Grid.name, Grid);
|
||||
return app;
|
||||
};
|
||||
|
||||
export {Meta as CardMeta, Grid as CardGrid}
|
||||
export { Meta as CardMeta, Grid as CardGrid };
|
||||
|
||||
export default Card as typeof Card &
|
||||
Plugin & {
|
||||
|
|
|
@ -110,9 +110,7 @@ describe('Cascader', () => {
|
|||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
$$('.ant-cascader-menu')[0]
|
||||
.querySelectorAll('.ant-cascader-menu-item')[0]
|
||||
.click();
|
||||
$$('.ant-cascader-menu')[0].querySelectorAll('.ant-cascader-menu-item')[0].click();
|
||||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
|
@ -120,9 +118,7 @@ describe('Cascader', () => {
|
|||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
$$('.ant-cascader-menu')[1]
|
||||
.querySelectorAll('.ant-cascader-menu-item')[0]
|
||||
.click();
|
||||
$$('.ant-cascader-menu')[1].querySelectorAll('.ant-cascader-menu-item')[0].click();
|
||||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
|
@ -130,9 +126,7 @@ describe('Cascader', () => {
|
|||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
$$('.ant-cascader-menu')[2]
|
||||
.querySelectorAll('.ant-cascader-menu-item')[0]
|
||||
.click();
|
||||
$$('.ant-cascader-menu')[2].querySelectorAll('.ant-cascader-menu-item')[0].click();
|
||||
});
|
||||
|
||||
await asyncExpect(() => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import CheckboxGroup from './Group';
|
|||
Checkbox.Group = CheckboxGroup;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Checkbox.install = function(app: App) {
|
||||
Checkbox.install = function (app: App) {
|
||||
app.component(Checkbox.name, Checkbox);
|
||||
app.component(CheckboxGroup.name, CheckboxGroup);
|
||||
return app;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Col } from '../grid';
|
||||
import { withInstall } from '../_util/type';
|
||||
export type {ColProps} from '../grid'
|
||||
export type { ColProps } from '../grid';
|
||||
export default withInstall(Col);
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
import { App, Plugin } from 'vue';
|
||||
import Collapse from './Collapse';
|
||||
import CollapsePanel from './CollapsePanel';
|
||||
export type {CollapseProps} from './Collapse'
|
||||
export type {CollapsePanelProps} from './CollapsePanel'
|
||||
|
||||
export type { CollapseProps } from './Collapse';
|
||||
export type { CollapsePanelProps } from './CollapsePanel';
|
||||
|
||||
Collapse.Panel = CollapsePanel;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Collapse.install = function(app: App) {
|
||||
Collapse.install = function (app: App) {
|
||||
app.component(Collapse.name, Collapse);
|
||||
app.component(CollapsePanel.name, CollapsePanel);
|
||||
return app;
|
||||
};
|
||||
|
||||
export {CollapsePanel}
|
||||
export { CollapsePanel };
|
||||
export default Collapse as typeof Collapse &
|
||||
Plugin & {
|
||||
readonly Panel: typeof CollapsePanel;
|
||||
|
|
|
@ -97,7 +97,7 @@ export default {
|
|||
this.createPickr();
|
||||
this.eventsBinding();
|
||||
},
|
||||
setColor: debounce(function(val) {
|
||||
setColor: debounce(function (val) {
|
||||
this.pickr.setColor(val);
|
||||
}, 1000),
|
||||
eventsBinding() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ColorPicker from './ColorPicker';
|
||||
/* istanbul ignore next */
|
||||
ColorPicker.install = function(app) {
|
||||
ColorPicker.install = function (app) {
|
||||
app.component(ColorPicker.name, ColorPicker);
|
||||
return app;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
export type { AffixProps } from './affix';
|
||||
export { default as Affix } from './affix';
|
||||
|
||||
|
@ -6,7 +5,7 @@ export type { AnchorProps, AnchorLinkProps } from './anchor';
|
|||
export { default as Anchor, AnchorLink } from './anchor';
|
||||
|
||||
export type { AutoCompleteProps } from './auto-complete';
|
||||
export {default as AutoComplete, AutoCompleteOptGroup, AutoCompleteOption } from './auto-complete'
|
||||
export { default as AutoComplete, AutoCompleteOptGroup, AutoCompleteOption } from './auto-complete';
|
||||
|
||||
export type { AlertProps } from './alert';
|
||||
export { default as Alert } from './alert';
|
||||
|
@ -86,7 +85,7 @@ export { default as Layout, LayoutHeader, LayouSider, LayouFooter, LayouContent
|
|||
export type { ListProps } from './list';
|
||||
export { default as List, ListItem, ListItemMeta } from './list';
|
||||
|
||||
export type { MessageArgsProps } from './message';
|
||||
export type { MessageArgsProps } from './message';
|
||||
export { default as message } from './message';
|
||||
|
||||
export type { MenuProps, MenuTheme, SubMenuProps, MenuItemProps } from './menu';
|
||||
|
@ -131,7 +130,13 @@ export type { SelectProps } from './select';
|
|||
export { default as Select, SelectOptGroup, SelectOption } from './select';
|
||||
|
||||
export type { SkeletonProps } from './skeleton';
|
||||
export { default as Skeleton, SkeletonButton, SkeletonAvatar, SkeletonInput, SkeletonImage } from './skeleton';
|
||||
export {
|
||||
default as Skeleton,
|
||||
SkeletonButton,
|
||||
SkeletonAvatar,
|
||||
SkeletonInput,
|
||||
SkeletonImage,
|
||||
} from './skeleton';
|
||||
|
||||
export { default as Slider } from './slider';
|
||||
|
||||
|
@ -171,7 +176,13 @@ export type { TooltipProps } from './tooltip';
|
|||
export { default as Tooltip } from './tooltip';
|
||||
|
||||
export type { TypographyProps } from './typography';
|
||||
export { default as Typography, TypographyLink, TypographyParagraph, TypographyText, TypographyTitle } from './typography';
|
||||
export {
|
||||
default as Typography,
|
||||
TypographyLink,
|
||||
TypographyParagraph,
|
||||
TypographyText,
|
||||
TypographyTitle,
|
||||
} from './typography';
|
||||
|
||||
export type { UploadProps } from './upload';
|
||||
|
||||
|
|
|
@ -195,11 +195,9 @@ describe('RangePicker', () => {
|
|||
$$('.ant-calendar-picker-input')[0].click();
|
||||
});
|
||||
await asyncExpect(() => {
|
||||
expect(
|
||||
$$('.ant-calendar-cell')[23]
|
||||
.getAttribute('class')
|
||||
.split(' '),
|
||||
).toContain('ant-calendar-in-range-cell');
|
||||
expect($$('.ant-calendar-cell')[23].getAttribute('class').split(' ')).toContain(
|
||||
'ant-calendar-in-range-cell',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -124,30 +124,22 @@ describe('RangePicker with showTime', () => {
|
|||
);
|
||||
|
||||
await asyncExpect(() => {
|
||||
expect(
|
||||
$$('.ant-calendar-time-picker-btn')[0]
|
||||
.getAttribute('class')
|
||||
.split(' '),
|
||||
).toContain('ant-calendar-time-picker-btn-disabled');
|
||||
expect(
|
||||
$$('.ant-calendar-ok-btn')[0]
|
||||
.getAttribute('class')
|
||||
.split(' '),
|
||||
).toContain('ant-calendar-ok-btn-disabled');
|
||||
expect($$('.ant-calendar-time-picker-btn')[0].getAttribute('class').split(' ')).toContain(
|
||||
'ant-calendar-time-picker-btn-disabled',
|
||||
);
|
||||
expect($$('.ant-calendar-ok-btn')[0].getAttribute('class').split(' ')).toContain(
|
||||
'ant-calendar-ok-btn-disabled',
|
||||
);
|
||||
});
|
||||
$$('.ant-calendar-date')[10].click();
|
||||
$$('.ant-calendar-date')[11].click();
|
||||
await asyncExpect(() => {
|
||||
expect(
|
||||
$$('.ant-calendar-time-picker-btn')[0]
|
||||
.getAttribute('class')
|
||||
.split(' '),
|
||||
).not.toContain('ant-calendar-time-picker-btn-disabled');
|
||||
expect(
|
||||
$$('.ant-calendar-ok-btn')[0]
|
||||
.getAttribute('class')
|
||||
.split(' '),
|
||||
).not.toContain('ant-calendar-ok-btn-disabled');
|
||||
expect($$('.ant-calendar-time-picker-btn')[0].getAttribute('class').split(' ')).not.toContain(
|
||||
'ant-calendar-time-picker-btn-disabled',
|
||||
);
|
||||
expect($$('.ant-calendar-ok-btn')[0].getAttribute('class').split(' ')).not.toContain(
|
||||
'ant-calendar-ok-btn-disabled',
|
||||
);
|
||||
});
|
||||
expect(onChangeFn).toHaveBeenCalled();
|
||||
expect(onOpenChangeFn).not.toHaveBeenCalled();
|
||||
|
|
|
@ -13,33 +13,33 @@ import {
|
|||
WeekPickerPropsTypes,
|
||||
} from './interface';
|
||||
|
||||
const WrappedRangePicker = (wrapPicker(
|
||||
const WrappedRangePicker = wrapPicker(
|
||||
RangePicker as any,
|
||||
RangePickerProps,
|
||||
'date',
|
||||
) as unknown) as DefineComponent<RangePickerPropsTypes>;
|
||||
) as unknown as DefineComponent<RangePickerPropsTypes>;
|
||||
|
||||
const WrappedWeekPicker = (wrapPicker(
|
||||
const WrappedWeekPicker = wrapPicker(
|
||||
WeekPicker as any,
|
||||
WeekPickerProps,
|
||||
'week',
|
||||
) as unknown) as DefineComponent<WeekPickerPropsTypes>;
|
||||
) as unknown as DefineComponent<WeekPickerPropsTypes>;
|
||||
|
||||
const DatePicker = (wrapPicker(
|
||||
const DatePicker = wrapPicker(
|
||||
createPicker(VcCalendar as any, DatePickerProps, 'ADatePicker'),
|
||||
DatePickerProps,
|
||||
'date',
|
||||
) as unknown) as DefineComponent<DatePickerPropsTypes> & {
|
||||
) as unknown as DefineComponent<DatePickerPropsTypes> & {
|
||||
readonly RangePicker: typeof WrappedRangePicker;
|
||||
readonly MonthPicker: typeof MonthPicker;
|
||||
readonly WeekPicker: typeof WrappedWeekPicker;
|
||||
};
|
||||
|
||||
const MonthPicker = (wrapPicker(
|
||||
const MonthPicker = wrapPicker(
|
||||
createPicker(MonthCalendar as any, MonthPickerProps, 'AMonthPicker'),
|
||||
MonthPickerProps,
|
||||
'month',
|
||||
) as unknown) as DefineComponent<MonthPickerPropsTypes>;
|
||||
) as unknown as DefineComponent<MonthPickerPropsTypes>;
|
||||
|
||||
Object.assign(DatePicker, {
|
||||
RangePicker: WrappedRangePicker,
|
||||
|
@ -48,7 +48,7 @@ Object.assign(DatePicker, {
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
DatePicker.install = function(app: App) {
|
||||
DatePicker.install = function (app: App) {
|
||||
app.component(DatePicker.name, DatePicker);
|
||||
app.component(DatePicker.RangePicker.name, DatePicker.RangePicker);
|
||||
app.component(DatePicker.MonthPicker.name, DatePicker.MonthPicker);
|
||||
|
|
|
@ -56,9 +56,7 @@ export interface DatePickerPropsTypes extends PickerProps, SinglePickerProps {
|
|||
showTime?: Record<string, any> | boolean;
|
||||
showToday?: boolean;
|
||||
open?: boolean;
|
||||
disabledTime?: (
|
||||
current?: moment.Moment | null,
|
||||
) => {
|
||||
disabledTime?: (current?: moment.Moment | null) => {
|
||||
disabledHours?: () => number[];
|
||||
disabledMinutes?: () => number[];
|
||||
disabledSeconds?: () => number[];
|
||||
|
|
|
@ -154,9 +154,8 @@ export interface DescriptionsContextProp {
|
|||
contentStyle?: Ref<CSSProperties>;
|
||||
}
|
||||
|
||||
export const descriptionsContext: InjectionKey<DescriptionsContextProp> = Symbol(
|
||||
'descriptionsContext',
|
||||
);
|
||||
export const descriptionsContext: InjectionKey<DescriptionsContextProp> =
|
||||
Symbol('descriptionsContext');
|
||||
|
||||
const Descriptions = defineComponent({
|
||||
name: 'ADescriptions',
|
||||
|
@ -244,7 +243,7 @@ const Descriptions = defineComponent({
|
|||
},
|
||||
});
|
||||
|
||||
Descriptions.install = function(app: App) {
|
||||
Descriptions.install = function (app: App) {
|
||||
app.component(Descriptions.name, Descriptions);
|
||||
app.component(Descriptions.Item.name, Descriptions.Item);
|
||||
return app;
|
||||
|
|
|
@ -8,13 +8,13 @@ export type { DropdownButtonProps } from './dropdown-button';
|
|||
Dropdown.Button = DropdownButton;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Dropdown.install = function(app: App) {
|
||||
Dropdown.install = function (app: App) {
|
||||
app.component(Dropdown.name, Dropdown);
|
||||
app.component(DropdownButton.name, DropdownButton);
|
||||
return app;
|
||||
};
|
||||
|
||||
export {DropdownButton}
|
||||
export { DropdownButton };
|
||||
|
||||
export default Dropdown as typeof Dropdown &
|
||||
Plugin & {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { App, Plugin } from 'vue';
|
||||
import Form, {formProps} from './Form';
|
||||
import FormItem, {formItemProps} from './FormItem';
|
||||
import Form, { formProps } from './Form';
|
||||
import FormItem, { formItemProps } from './FormItem';
|
||||
|
||||
export type { FormProps } from './Form';
|
||||
export type { FormItemProps } from './FormItem';
|
||||
|
||||
/* istanbul ignore next */
|
||||
Form.install = function(app: App) {
|
||||
Form.install = function (app: App) {
|
||||
app.component(Form.name, Form);
|
||||
app.component(Form.Item.name, Form.Item);
|
||||
return app;
|
||||
|
|
|
@ -211,9 +211,8 @@ export function validateRules(
|
|||
validateRule(name, value, rule, options, messageVariables),
|
||||
);
|
||||
|
||||
summaryPromise = (validateFirst
|
||||
? finishOnFirstFailed(rulePromises)
|
||||
: finishOnAllFailed(rulePromises)
|
||||
summaryPromise = (
|
||||
validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)
|
||||
).then((errors: string[]): string[] | Promise<string[]> => {
|
||||
if (!errors.length) {
|
||||
return [];
|
||||
|
|
|
@ -28,7 +28,7 @@ export { imageProps };
|
|||
|
||||
Image.PreviewGroup = PreviewGroup;
|
||||
|
||||
Image.install = function(app: App) {
|
||||
Image.install = function (app: App) {
|
||||
app.component(Image.name, Image);
|
||||
app.component(Image.PreviewGroup.name, Image.PreviewGroup);
|
||||
return app;
|
||||
|
|
|
@ -4,7 +4,7 @@ import * as components from './components';
|
|||
import { default as version } from './version';
|
||||
export * from './components';
|
||||
|
||||
export const install = function(app: App) {
|
||||
export const install = function (app: App) {
|
||||
Object.keys(components).forEach(key => {
|
||||
const component = components[key];
|
||||
if (component.install) {
|
||||
|
|
|
@ -64,7 +64,12 @@ const InputNumber = defineComponent({
|
|||
},
|
||||
|
||||
render() {
|
||||
const { prefixCls: customizePrefixCls, size, class: className, ...others } = {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
size,
|
||||
class: className,
|
||||
...others
|
||||
} = {
|
||||
...getOptionProps(this),
|
||||
...this.$attrs,
|
||||
} as any;
|
||||
|
|
|
@ -11,7 +11,7 @@ Input.TextArea = TextArea;
|
|||
Input.Password = Password;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Input.install = function(app: App) {
|
||||
Input.install = function (app: App) {
|
||||
app.component(Input.name, Input);
|
||||
app.component(Input.Group.name, Input.Group);
|
||||
app.component(Input.Search.name, Input.Search);
|
||||
|
|
|
@ -8,7 +8,7 @@ export { SiderProps } from './Sider';
|
|||
Layout.Sider = Sider;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Layout.install = function(app: App) {
|
||||
Layout.install = function (app: App) {
|
||||
app.component(Layout.name, Layout);
|
||||
app.component(Layout.Header.name, Layout.Header);
|
||||
app.component(Layout.Footer.name, Layout.Footer);
|
||||
|
|
|
@ -322,7 +322,7 @@ const List = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
List.install = function(app: App) {
|
||||
List.install = function (app: App) {
|
||||
app.component(List.name, List);
|
||||
app.component(List.Item.name, List.Item);
|
||||
app.component(List.Item.Meta.name, List.Item.Meta);
|
||||
|
|
|
@ -221,9 +221,10 @@ describe('Locale Provider', () => {
|
|||
{ sync: false, attachTo: 'body' },
|
||||
);
|
||||
await sleep();
|
||||
const currentConfirmNode = document.querySelectorAll('.ant-modal-confirm')[
|
||||
document.querySelectorAll('.ant-modal-confirm').length - 1
|
||||
];
|
||||
const currentConfirmNode =
|
||||
document.querySelectorAll('.ant-modal-confirm')[
|
||||
document.querySelectorAll('.ant-modal-confirm').length - 1
|
||||
];
|
||||
let cancelButtonText = currentConfirmNode.querySelectorAll(
|
||||
'.ant-btn:not(.ant-btn-primary) span',
|
||||
)[0].innerHTML;
|
||||
|
|
|
@ -89,7 +89,7 @@ const LocaleProvider = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
LocaleProvider.install = function(app: App) {
|
||||
LocaleProvider.install = function (app: App) {
|
||||
app.component(LocaleProvider.name, LocaleProvider);
|
||||
return app;
|
||||
};
|
||||
|
|
|
@ -211,7 +211,7 @@ const Mentions = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
Mentions.install = function(app: App) {
|
||||
Mentions.install = function (app: App) {
|
||||
app.component(Mentions.name, Mentions);
|
||||
app.component(Mentions.Option.name, Mentions.Option);
|
||||
return app;
|
||||
|
|
|
@ -6,7 +6,7 @@ import Divider from './src/Divider';
|
|||
import { App, Plugin } from 'vue';
|
||||
import { MenuTheme } from './src/interface';
|
||||
/* istanbul ignore next */
|
||||
Menu.install = function(app: App) {
|
||||
Menu.install = function (app: App) {
|
||||
app.component(Menu.name, Menu);
|
||||
app.component(MenuItem.name, MenuItem);
|
||||
app.component(SubMenu.name, SubMenu);
|
||||
|
|
|
@ -133,9 +133,7 @@ export interface ModalFuncProps {
|
|||
|
||||
type getContainerFunc = () => HTMLElement;
|
||||
|
||||
export type ModalFunc = (
|
||||
props: ModalFuncProps,
|
||||
) => {
|
||||
export type ModalFunc = (props: ModalFuncProps) => {
|
||||
destroy: () => void;
|
||||
update: (newConfig: ModalFuncProps) => void;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import ExclamationCircleOutlined from '@ant-design/icons-vue/ExclamationCircleOu
|
|||
export { IActionButtonProps as ActionButtonProps } from './ActionButton';
|
||||
export { ModalProps, ModalFuncProps } from './Modal';
|
||||
|
||||
const info = function(props: ModalFuncProps) {
|
||||
const info = function (props: ModalFuncProps) {
|
||||
const config = {
|
||||
type: 'info',
|
||||
icon: <InfoCircleOutlined />,
|
||||
|
@ -19,7 +19,7 @@ const info = function(props: ModalFuncProps) {
|
|||
return modalConfirm(config);
|
||||
};
|
||||
|
||||
const success = function(props: ModalFuncProps) {
|
||||
const success = function (props: ModalFuncProps) {
|
||||
const config = {
|
||||
type: 'success',
|
||||
icon: <CheckCircleOutlined />,
|
||||
|
@ -29,7 +29,7 @@ const success = function(props: ModalFuncProps) {
|
|||
return modalConfirm(config);
|
||||
};
|
||||
|
||||
const error = function(props: ModalFuncProps) {
|
||||
const error = function (props: ModalFuncProps) {
|
||||
const config = {
|
||||
type: 'error',
|
||||
icon: <CloseCircleOutlined />,
|
||||
|
@ -39,7 +39,7 @@ const error = function(props: ModalFuncProps) {
|
|||
return modalConfirm(config);
|
||||
};
|
||||
|
||||
const warning = function(props: ModalFuncProps) {
|
||||
const warning = function (props: ModalFuncProps) {
|
||||
const config = {
|
||||
type: 'warning',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
|
@ -75,7 +75,7 @@ Modal.destroyAll = function destroyAllFn() {
|
|||
};
|
||||
|
||||
/* istanbul ignore next */
|
||||
Modal.install = function(app: App) {
|
||||
Modal.install = function (app: App) {
|
||||
app.component(Modal.name, Modal);
|
||||
return app;
|
||||
};
|
||||
|
|
|
@ -51,15 +51,8 @@ export const handleGradient = strokeColor => {
|
|||
};
|
||||
|
||||
const Line = (_, { attrs, slots }) => {
|
||||
const {
|
||||
prefixCls,
|
||||
percent,
|
||||
successPercent,
|
||||
strokeWidth,
|
||||
size,
|
||||
strokeColor,
|
||||
strokeLinecap,
|
||||
} = attrs;
|
||||
const { prefixCls, percent, successPercent, strokeWidth, size, strokeColor, strokeLinecap } =
|
||||
attrs;
|
||||
let backgroundProps;
|
||||
if (strokeColor && typeof strokeColor !== 'string') {
|
||||
backgroundProps = handleGradient(strokeColor);
|
||||
|
|
|
@ -9,7 +9,7 @@ Radio.Group = Group;
|
|||
Radio.Button = Button;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Radio.install = function(app: App) {
|
||||
Radio.install = function (app: App) {
|
||||
app.component(Radio.name, Radio);
|
||||
app.component(Radio.Group.name, Radio.Group);
|
||||
app.component(Radio.Button.name, Radio.Button);
|
||||
|
|
|
@ -93,7 +93,7 @@ Result.PRESENTED_IMAGE_404 = ExceptionMap[404];
|
|||
Result.PRESENTED_IMAGE_500 = ExceptionMap[500];
|
||||
|
||||
/* istanbul ignore next */
|
||||
Result.install = function(app: App) {
|
||||
Result.install = function (app: App) {
|
||||
app.component(Result.name, Result);
|
||||
return app;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Row } from '../grid';
|
||||
import { withInstall } from '../_util/type';
|
||||
|
||||
export type {RowProps} from '../grid'
|
||||
export type { RowProps } from '../grid';
|
||||
|
||||
export default withInstall(Row);
|
||||
|
|
|
@ -200,7 +200,7 @@ const Select = defineComponent({
|
|||
},
|
||||
});
|
||||
/* istanbul ignore next */
|
||||
Select.install = function(app: App) {
|
||||
Select.install = function (app: App) {
|
||||
app.component(Select.name, Select);
|
||||
app.component(Select.Option.displayName, Select.Option);
|
||||
app.component(Select.OptGroup.displayName, Select.OptGroup);
|
||||
|
|
|
@ -13,7 +13,7 @@ Skeleton.Input = SkeletonInput;
|
|||
Skeleton.Image = SkeletonImage;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Skeleton.install = function(app: App) {
|
||||
Skeleton.install = function (app: App) {
|
||||
app.component(Skeleton.name, Skeleton);
|
||||
app.component(Skeleton.Button.name, SkeletonButton);
|
||||
app.component(Skeleton.Avatar.name, SkeletonAvatar);
|
||||
|
|
|
@ -50,9 +50,12 @@ const Space = defineComponent({
|
|||
watch(
|
||||
size,
|
||||
() => {
|
||||
[horizontalSize.value, verticalSize.value] = ((Array.isArray(size.value)
|
||||
? size.value
|
||||
: [size.value, size.value]) as [SpaceSize, SpaceSize]).map(item => getNumberSize(item));
|
||||
[horizontalSize.value, verticalSize.value] = (
|
||||
(Array.isArray(size.value) ? size.value : [size.value, size.value]) as [
|
||||
SpaceSize,
|
||||
SpaceSize,
|
||||
]
|
||||
).map(item => getNumberSize(item));
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
|
|
@ -13,12 +13,7 @@ describe('delay spinning', () => {
|
|||
};
|
||||
const wrapper = mount(Spin, props);
|
||||
await asyncExpect(() => {
|
||||
expect(
|
||||
wrapper
|
||||
.find('.ant-spin')
|
||||
.classes()
|
||||
.includes('ant-spin-spinning'),
|
||||
).toEqual(false);
|
||||
expect(wrapper.find('.ant-spin').classes().includes('ant-spin-spinning')).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -32,23 +27,13 @@ describe('delay spinning', () => {
|
|||
};
|
||||
const wrapper = mount(Spin, props);
|
||||
|
||||
expect(
|
||||
wrapper
|
||||
.findAll('.ant-spin')[0]
|
||||
.classes()
|
||||
.includes('ant-spin-spinning'),
|
||||
).toEqual(false);
|
||||
expect(wrapper.findAll('.ant-spin')[0].classes().includes('ant-spin-spinning')).toEqual(false);
|
||||
|
||||
// use await not jest.runAllTimers()
|
||||
// because of https://github.com/facebook/jest/issues/3465
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
expect(
|
||||
wrapper
|
||||
.findAll('.ant-spin')[0]
|
||||
.classes()
|
||||
.includes('ant-spin-spinning'),
|
||||
).toEqual(true);
|
||||
expect(wrapper.findAll('.ant-spin')[0].classes().includes('ant-spin-spinning')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should cancel debounce function when unmount', async () => {
|
||||
|
|
|
@ -6,7 +6,7 @@ export { SpinProps, getSpinProps } from './Spin';
|
|||
Spin.setDefaultIndicator = setDefaultIndicator;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Spin.install = function(app: App) {
|
||||
Spin.install = function (app: App) {
|
||||
app.component(Spin.name, Spin);
|
||||
return app;
|
||||
};
|
||||
|
|
|
@ -65,12 +65,7 @@ describe('Statistic', () => {
|
|||
|
||||
describe('Countdown', () => {
|
||||
it('render correctly', () => {
|
||||
const now = moment()
|
||||
.add(2, 'd')
|
||||
.add(11, 'h')
|
||||
.add(28, 'm')
|
||||
.add(9, 's')
|
||||
.add(3, 'ms');
|
||||
const now = moment().add(2, 'd').add(11, 'h').add(28, 'm').add(9, 's').add(3, 'ms');
|
||||
|
||||
[
|
||||
['H:m:s', '59:28:9'],
|
||||
|
|
|
@ -2,17 +2,17 @@ import { App, Plugin } from 'vue';
|
|||
import Statistic from './Statistic';
|
||||
import Countdown from './Countdown';
|
||||
|
||||
export type {StatisticProps} from './Statistic'
|
||||
export type { StatisticProps } from './Statistic';
|
||||
|
||||
Statistic.Countdown = Countdown;
|
||||
/* istanbul ignore next */
|
||||
Statistic.install = function(app: App) {
|
||||
Statistic.install = function (app: App) {
|
||||
app.component(Statistic.name, Statistic);
|
||||
app.component(Statistic.Countdown.name, Statistic.Countdown);
|
||||
return app;
|
||||
};
|
||||
|
||||
export const StatisticCountdown = Statistic.Countdown
|
||||
export const StatisticCountdown = Statistic.Countdown;
|
||||
|
||||
export default Statistic as typeof Statistic &
|
||||
Plugin & {
|
||||
|
|
|
@ -70,7 +70,7 @@ const Steps = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
Steps.install = function(app: App) {
|
||||
Steps.install = function (app: App) {
|
||||
app.component(Steps.name, Steps);
|
||||
app.component(Steps.Step.name, Steps.Step);
|
||||
return app;
|
||||
|
|
|
@ -1216,10 +1216,8 @@ export default defineComponent({
|
|||
transformCellText: customizeTransformCellText,
|
||||
} = this;
|
||||
const data = this.getCurrentPageData();
|
||||
const {
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
transformCellText: tct,
|
||||
} = this.configProvider;
|
||||
const { getPopupContainer: getContextPopupContainer, transformCellText: tct } =
|
||||
this.configProvider;
|
||||
const getPopupContainer = this.getPopupContainer || getContextPopupContainer;
|
||||
const transformCellText = customizeTransformCellText || tct;
|
||||
let loading = this.loading;
|
||||
|
|
|
@ -310,16 +310,10 @@ describe('Table.rowSelection', () => {
|
|||
);
|
||||
expect(dropdownWrapper.findAll('.ant-dropdown-menu-item').length).toBe(4);
|
||||
|
||||
dropdownWrapper
|
||||
.findAll('.ant-dropdown-menu-item > div')
|
||||
.at(2)
|
||||
.trigger('click');
|
||||
dropdownWrapper.findAll('.ant-dropdown-menu-item > div').at(2).trigger('click');
|
||||
expect(handleSelectOdd).toBeCalledWith([0, 1, 2, 3]);
|
||||
|
||||
dropdownWrapper
|
||||
.findAll('.ant-dropdown-menu-item > div')
|
||||
.at(3)
|
||||
.trigger('click');
|
||||
dropdownWrapper.findAll('.ant-dropdown-menu-item > div').at(3).trigger('click');
|
||||
expect(handleSelectEven).toBeCalledWith([0, 1, 2, 3]);
|
||||
});
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ const Table = defineComponent({
|
|||
},
|
||||
});
|
||||
/* istanbul ignore next */
|
||||
Table.install = function(app: App) {
|
||||
Table.install = function (app: App) {
|
||||
app.component(Table.name, Table);
|
||||
app.component(Table.Column.name, Table.Column);
|
||||
app.component(Table.ColumnGroup.name, Table.ColumnGroup);
|
||||
|
|
|
@ -7,7 +7,7 @@ Tabs.TabPane = { ...TabPane, name: 'ATabPane', __ANT_TAB_PANE: true };
|
|||
Tabs.TabContent = { ...TabContent, name: 'ATabContent' };
|
||||
|
||||
/* istanbul ignore next */
|
||||
Tabs.install = function(app: App) {
|
||||
Tabs.install = function (app: App) {
|
||||
app.component(Tabs.name, Tabs);
|
||||
app.component(Tabs.TabPane.name, Tabs.TabPane);
|
||||
app.component(Tabs.TabContent.name, Tabs.TabContent);
|
||||
|
|
|
@ -140,7 +140,7 @@ const Tag = defineComponent({
|
|||
|
||||
Tag.CheckableTag = CheckableTag;
|
||||
|
||||
Tag.install = function(app: App) {
|
||||
Tag.install = function (app: App) {
|
||||
app.component(Tag.name, Tag);
|
||||
app.component(CheckableTag.name, CheckableTag);
|
||||
return app;
|
||||
|
|
|
@ -8,12 +8,12 @@ export type { TimelineItemProps } from './TimelineItem';
|
|||
Timeline.Item = TimelineItem;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Timeline.install = function(app: App) {
|
||||
Timeline.install = function (app: App) {
|
||||
app.component(Timeline.name, Timeline);
|
||||
app.component(TimelineItem.name, TimelineItem);
|
||||
return app;
|
||||
};
|
||||
export {TimelineItem}
|
||||
export { TimelineItem };
|
||||
export default Timeline as typeof Timeline &
|
||||
Plugin & {
|
||||
readonly Item: typeof TimelineItem;
|
||||
|
|
|
@ -197,7 +197,7 @@ const TreeSelect = defineComponent({
|
|||
});
|
||||
|
||||
/* istanbul ignore next */
|
||||
TreeSelect.install = function(app: App) {
|
||||
TreeSelect.install = function (app: App) {
|
||||
app.component(TreeSelect.name, TreeSelect);
|
||||
app.component(TreeSelect.TreeNode.displayName, TreeSelect.TreeNode);
|
||||
return app;
|
||||
|
|
|
@ -5,7 +5,7 @@ import DirectoryTree from './DirectoryTree';
|
|||
Tree.TreeNode.name = 'ATreeNode';
|
||||
Tree.DirectoryTree = DirectoryTree;
|
||||
/* istanbul ignore next */
|
||||
Tree.install = function(app: App) {
|
||||
Tree.install = function (app: App) {
|
||||
app.component(Tree.name, Tree);
|
||||
app.component(Tree.TreeNode.name, Tree.TreeNode);
|
||||
app.component(DirectoryTree.name, DirectoryTree);
|
||||
|
|
|
@ -123,18 +123,16 @@ const Base = defineComponent<InternalBlockProps>({
|
|||
|
||||
const contentRef = ref();
|
||||
const editIcon = ref();
|
||||
const ellipsis = computed(
|
||||
(): EllipsisConfig => {
|
||||
const ellipsis = props.ellipsis;
|
||||
if (!ellipsis) return {};
|
||||
const ellipsis = computed((): EllipsisConfig => {
|
||||
const ellipsis = props.ellipsis;
|
||||
if (!ellipsis) return {};
|
||||
|
||||
return {
|
||||
rows: 1,
|
||||
expandable: false,
|
||||
...(typeof ellipsis === 'object' ? ellipsis : null),
|
||||
};
|
||||
},
|
||||
);
|
||||
return {
|
||||
rows: 1,
|
||||
expandable: false,
|
||||
...(typeof ellipsis === 'object' ? ellipsis : null),
|
||||
};
|
||||
});
|
||||
onMounted(() => {
|
||||
state.clientRendered = true;
|
||||
});
|
||||
|
@ -294,7 +292,11 @@ const Base = defineComponent<InternalBlockProps>({
|
|||
// Do not measure if css already support ellipsis
|
||||
if (canUseCSSEllipsis.value) return;
|
||||
|
||||
const { content, text, ellipsis: ell } = measure(
|
||||
const {
|
||||
content,
|
||||
text,
|
||||
ellipsis: ell,
|
||||
} = measure(
|
||||
contentRef.value?.$el,
|
||||
{ rows, suffix },
|
||||
props.content,
|
||||
|
@ -451,7 +453,14 @@ const Base = defineComponent<InternalBlockProps>({
|
|||
<LocaleReceiver
|
||||
componentName="Text"
|
||||
children={(locale: Locale) => {
|
||||
const { type, disabled, content, class: className, style, ...restProps } = {
|
||||
const {
|
||||
type,
|
||||
disabled,
|
||||
content,
|
||||
class: className,
|
||||
style,
|
||||
...restProps
|
||||
} = {
|
||||
...props,
|
||||
...attrs,
|
||||
};
|
||||
|
|
|
@ -20,8 +20,10 @@ describe('Typography', () => {
|
|||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
// Mock offsetHeight
|
||||
const originOffsetHeight = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'offsetHeight')
|
||||
.get;
|
||||
const originOffsetHeight = Object.getOwnPropertyDescriptor(
|
||||
HTMLElement.prototype,
|
||||
'offsetHeight',
|
||||
).get;
|
||||
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', {
|
||||
get() {
|
||||
let html = this.innerHTML;
|
||||
|
|
|
@ -6,16 +6,15 @@ import Text from './Text';
|
|||
import Title from './Title';
|
||||
import Typography from './Typography';
|
||||
|
||||
export type {TypographyProps} from './Typography'
|
||||
export type { TypographyProps } from './Typography';
|
||||
|
||||
Typography.Text = Text;
|
||||
Typography.Title = Title;
|
||||
Typography.Paragraph = Paragraph;
|
||||
Typography.Link = Link;
|
||||
Typography.Base = Base;
|
||||
|
||||
Typography.Text = Text
|
||||
Typography.Title = Title
|
||||
Typography.Paragraph = Paragraph
|
||||
Typography.Link = Link
|
||||
Typography.Base = Base
|
||||
|
||||
Typography.install = function(app: App) {
|
||||
Typography.install = function (app: App) {
|
||||
app.component(Typography.name, Typography);
|
||||
app.component(Typography.Text.displayName, Text);
|
||||
app.component(Typography.Title.displayName, Title);
|
||||
|
@ -29,7 +28,7 @@ export {
|
|||
Title as TypographyTitle,
|
||||
Paragraph as TypographyParagraph,
|
||||
Link as TypographyLink,
|
||||
}
|
||||
};
|
||||
|
||||
export default Typography as typeof Typography &
|
||||
Plugin & {
|
||||
|
|
|
@ -93,10 +93,7 @@ describe('Upload List', () => {
|
|||
const wrapper = mount(Upload, props);
|
||||
setTimeout(async () => {
|
||||
expect(wrapper.findAll('.ant-upload-list-item').length).toBe(2);
|
||||
wrapper
|
||||
.findAll('.ant-upload-list-item')[0]
|
||||
.find('.anticon-delete')
|
||||
.trigger('click');
|
||||
wrapper.findAll('.ant-upload-list-item')[0].find('.anticon-delete').trigger('click');
|
||||
await delay(400);
|
||||
// wrapper.update();
|
||||
expect(wrapper.findAll('.ant-upload-list-item').length).toBe(1);
|
||||
|
|
|
@ -7,7 +7,7 @@ export { UploadProps, UploadListProps, UploadChangeParam } from './interface';
|
|||
Upload.Dragger = Dragger;
|
||||
|
||||
/* istanbul ignore next */
|
||||
Upload.install = function(app: App) {
|
||||
Upload.install = function (app: App) {
|
||||
app.component(Upload.name, Upload);
|
||||
app.component(Dragger.name, Dragger);
|
||||
return app;
|
||||
|
|
|
@ -26,7 +26,7 @@ export function genPercentAdd() {
|
|||
let k = 0.1;
|
||||
const i = 0.01;
|
||||
const end = 0.98;
|
||||
return function(s) {
|
||||
return function (s) {
|
||||
let start = s;
|
||||
if (start >= end) {
|
||||
return start;
|
||||
|
|
|
@ -178,12 +178,7 @@ const DateTBody = {
|
|||
cls += ` ${nextMonthDayClass}`;
|
||||
}
|
||||
|
||||
if (
|
||||
current
|
||||
.clone()
|
||||
.endOf('month')
|
||||
.date() === current.date()
|
||||
) {
|
||||
if (current.clone().endOf('month').date() === current.date()) {
|
||||
cls += ` ${lastDayOfMonthClass}`;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,15 +59,8 @@ const MonthPanel = {
|
|||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
sValue,
|
||||
cellRender,
|
||||
contentRender,
|
||||
locale,
|
||||
rootPrefixCls,
|
||||
disabledDate,
|
||||
renderFooter,
|
||||
} = this;
|
||||
const { sValue, cellRender, contentRender, locale, rootPrefixCls, disabledDate, renderFooter } =
|
||||
this;
|
||||
const year = sValue.year();
|
||||
const prefixCls = `${rootPrefixCls}-month-panel`;
|
||||
|
||||
|
|
|
@ -100,18 +100,8 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
render() {
|
||||
const {
|
||||
prefixCls,
|
||||
name,
|
||||
id,
|
||||
type,
|
||||
disabled,
|
||||
readonly,
|
||||
tabindex,
|
||||
autofocus,
|
||||
value,
|
||||
...others
|
||||
} = getOptionProps(this);
|
||||
const { prefixCls, name, id, type, disabled, readonly, tabindex, autofocus, value, ...others } =
|
||||
getOptionProps(this);
|
||||
const { class: className, onFocus, onBlur } = this.$attrs;
|
||||
const globalProps = Object.keys({ ...others, ...this.$attrs }).reduce((prev, key) => {
|
||||
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
|
||||
|
|
|
@ -190,15 +190,8 @@ const ImageInternal = defineComponent({
|
|||
return l;
|
||||
};
|
||||
return () => {
|
||||
const {
|
||||
prefixCls,
|
||||
wrapperClassName,
|
||||
fallback,
|
||||
src,
|
||||
preview,
|
||||
placeholder,
|
||||
wrapperStyle,
|
||||
} = props;
|
||||
const { prefixCls, wrapperClassName, fallback, src, preview, placeholder, wrapperStyle } =
|
||||
props;
|
||||
const {
|
||||
width,
|
||||
height,
|
||||
|
|
|
@ -26,9 +26,9 @@ export interface OverflowContextProviderValueType {
|
|||
className?: string;
|
||||
}
|
||||
|
||||
const OverflowContextProviderKey: InjectionKey<ComputedRef<OverflowContextProviderValueType | null>> = Symbol(
|
||||
'OverflowContextProviderKey',
|
||||
);
|
||||
const OverflowContextProviderKey: InjectionKey<
|
||||
ComputedRef<OverflowContextProviderValueType | null>
|
||||
> = Symbol('OverflowContextProviderKey');
|
||||
|
||||
export const OverflowContextProvider = defineComponent({
|
||||
name: 'OverflowContextProvider',
|
||||
|
@ -45,9 +45,10 @@ export const OverflowContextProvider = defineComponent({
|
|||
},
|
||||
});
|
||||
|
||||
export const useInjectOverflowContext = (): ComputedRef<OverflowContextProviderValueType | null> => {
|
||||
return inject(
|
||||
OverflowContextProviderKey,
|
||||
computed(() => null),
|
||||
);
|
||||
};
|
||||
export const useInjectOverflowContext =
|
||||
(): ComputedRef<OverflowContextProviderValueType | null> => {
|
||||
return inject(
|
||||
OverflowContextProviderKey,
|
||||
computed(() => null),
|
||||
);
|
||||
};
|
||||
|
|
|
@ -63,9 +63,8 @@ const RefSelect = generateSelector<SelectOptionsType>({
|
|||
fillOptionsWithMissingValue,
|
||||
});
|
||||
|
||||
export type ExportedSelectProps<
|
||||
ValueType extends DefaultValueType = DefaultValueType
|
||||
> = SelectProps<SelectOptionsType, ValueType>;
|
||||
export type ExportedSelectProps<ValueType extends DefaultValueType = DefaultValueType> =
|
||||
SelectProps<SelectOptionsType, ValueType>;
|
||||
|
||||
const Select = defineComponent<Omit<ExportedSelectProps, 'children'>>({
|
||||
setup(props, { attrs, expose, slots }) {
|
||||
|
|
|
@ -56,8 +56,8 @@ const props = {
|
|||
|
||||
maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||
maxTagTextLength: PropTypes.number,
|
||||
maxTagPlaceholder: PropTypes.any.def(() => (omittedValues: LabelValueType[]) =>
|
||||
`+ ${omittedValues.length} ...`,
|
||||
maxTagPlaceholder: PropTypes.any.def(
|
||||
() => (omittedValues: LabelValueType[]) => `+ ${omittedValues.length} ...`,
|
||||
),
|
||||
tagRender: PropTypes.func,
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ export default function generateSelector<
|
|||
label?: VNodeChild;
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
}[]
|
||||
}[],
|
||||
>(config: GenerateConfig<OptionsType>) {
|
||||
const {
|
||||
prefixCls: defaultPrefixCls,
|
||||
|
@ -442,29 +442,27 @@ export default function generateSelector<
|
|||
return mergedSearchValue;
|
||||
});
|
||||
|
||||
const mergedOptions = computed(
|
||||
(): OptionsType => {
|
||||
let newOptions = props.options;
|
||||
if (newOptions === undefined) {
|
||||
newOptions = convertChildrenToData(props.children);
|
||||
}
|
||||
const mergedOptions = computed((): OptionsType => {
|
||||
let newOptions = props.options;
|
||||
if (newOptions === undefined) {
|
||||
newOptions = convertChildrenToData(props.children);
|
||||
}
|
||||
|
||||
/**
|
||||
* `tags` should fill un-list item.
|
||||
* This is not cool here since TreeSelect do not need this
|
||||
*/
|
||||
if (props.mode === 'tags' && fillOptionsWithMissingValue) {
|
||||
newOptions = fillOptionsWithMissingValue(
|
||||
newOptions,
|
||||
mergedValue.value,
|
||||
mergedOptionLabelProp.value,
|
||||
props.labelInValue,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* `tags` should fill un-list item.
|
||||
* This is not cool here since TreeSelect do not need this
|
||||
*/
|
||||
if (props.mode === 'tags' && fillOptionsWithMissingValue) {
|
||||
newOptions = fillOptionsWithMissingValue(
|
||||
newOptions,
|
||||
mergedValue.value,
|
||||
mergedOptionLabelProp.value,
|
||||
props.labelInValue,
|
||||
);
|
||||
}
|
||||
|
||||
return newOptions || ([] as OptionsType);
|
||||
},
|
||||
);
|
||||
return newOptions || ([] as OptionsType);
|
||||
});
|
||||
|
||||
const mergedFlattenOptions = computed(() => flattenOptions(mergedOptions.value, props));
|
||||
|
||||
|
@ -553,14 +551,16 @@ export default function generateSelector<
|
|||
const { internalProps = {} } = props;
|
||||
if (!internalProps.skipTriggerSelect) {
|
||||
// Skip trigger `onSelect` or `onDeselect` if configured
|
||||
const selectValue = (mergedLabelInValue.value
|
||||
? getLabeledValue(newValue, {
|
||||
options: newValueOption,
|
||||
prevValueMap: mergedValueMap.value,
|
||||
labelInValue: mergedLabelInValue.value,
|
||||
optionLabelProp: mergedOptionLabelProp.value,
|
||||
})
|
||||
: newValue) as SingleType<ValueType>;
|
||||
const selectValue = (
|
||||
mergedLabelInValue.value
|
||||
? getLabeledValue(newValue, {
|
||||
options: newValueOption,
|
||||
prevValueMap: mergedValueMap.value,
|
||||
labelInValue: mergedLabelInValue.value,
|
||||
optionLabelProp: mergedOptionLabelProp.value,
|
||||
})
|
||||
: newValue
|
||||
) as SingleType<ValueType>;
|
||||
|
||||
if (isSelect && props.onSelect) {
|
||||
props.onSelect(selectValue, outOption);
|
||||
|
|
|
@ -7,7 +7,7 @@ export default function useCacheOptions<
|
|||
label?: VNodeChild;
|
||||
key?: Key;
|
||||
disabled?: boolean;
|
||||
}[]
|
||||
}[],
|
||||
>(options: Ref) {
|
||||
const optionMap = computed(() => {
|
||||
const map: Map<RawValueType, FlattenOptionsType<OptionsType>[number]> = new Map();
|
||||
|
|
|
@ -80,7 +80,7 @@ export function toOuterValues<FOT extends FlattenOptionsType>(
|
|||
|
||||
export function removeLastEnabledValue<
|
||||
T extends { disabled?: boolean },
|
||||
P extends RawValueType | object
|
||||
P extends RawValueType | object,
|
||||
>(measureValues: T[], values: P[]): { values: P[]; removedValue: P } {
|
||||
const newValues = [...values];
|
||||
|
||||
|
|
|
@ -178,9 +178,7 @@ function getFilterFunction(optionFilterProp: string) {
|
|||
|
||||
// Group label search
|
||||
if ('options' in option) {
|
||||
return toRawString(option.label)
|
||||
.toLowerCase()
|
||||
.includes(lowerSearchText);
|
||||
return toRawString(option.label).toLowerCase().includes(lowerSearchText);
|
||||
}
|
||||
// Option value search
|
||||
const rawValue = option[optionFilterProp];
|
||||
|
@ -277,9 +275,7 @@ export function fillOptionsWithMissingValue(
|
|||
optionLabelProp: string,
|
||||
labelInValue: boolean,
|
||||
): SelectOptionsType {
|
||||
const values = toArray<RawValueType | LabelValueType>(value)
|
||||
.slice()
|
||||
.sort();
|
||||
const values = toArray<RawValueType | LabelValueType>(value).slice().sort();
|
||||
const cloneOptions = [...options];
|
||||
|
||||
// Convert options value to set
|
||||
|
|
|
@ -137,9 +137,9 @@ function warningProps(props: SelectProps) {
|
|||
if (invalidateChildType) {
|
||||
warning(
|
||||
false,
|
||||
`\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${invalidateChildType.displayName ||
|
||||
invalidateChildType.name ||
|
||||
invalidateChildType}\`.`,
|
||||
`\`children\` should be \`Select.Option\` or \`Select.OptGroup\` instead of \`${
|
||||
invalidateChildType.displayName || invalidateChildType.name || invalidateChildType
|
||||
}\`.`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function handler(options, handle, e) {
|
|||
const PrevArrow = (_, { attrs }) => {
|
||||
const { clickHandler, infinite, currentSlide, slideCount, slidesToShow } = attrs;
|
||||
const prevClasses = { 'slick-arrow': true, 'slick-prev': true };
|
||||
let prevHandler = function(e) {
|
||||
let prevHandler = function (e) {
|
||||
handler({ message: 'previous' }, clickHandler, e);
|
||||
};
|
||||
|
||||
|
@ -67,7 +67,7 @@ const NextArrow = (_, { attrs }) => {
|
|||
const { clickHandler, currentSlide, slideCount } = attrs;
|
||||
|
||||
const nextClasses = { 'slick-arrow': true, 'slick-next': true };
|
||||
let nextHandler = function(e) {
|
||||
let nextHandler = function (e) {
|
||||
handler({ message: 'next' }, clickHandler, e);
|
||||
};
|
||||
if (!canGoNext(attrs)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import classnames from '../../_util/classNames';
|
||||
import { cloneElement } from '../../_util/vnode';
|
||||
|
||||
const getDotCount = function(spec) {
|
||||
const getDotCount = function (spec) {
|
||||
let dots;
|
||||
|
||||
if (spec.infinite) {
|
||||
|
|
|
@ -56,7 +56,7 @@ export default defineComponent({
|
|||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
this._responsiveMediaHandlers.forEach(function(obj) {
|
||||
this._responsiveMediaHandlers.forEach(function (obj) {
|
||||
obj.mql.removeListener(obj.listener);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ const getSlideClasses = spec => {
|
|||
};
|
||||
};
|
||||
|
||||
const getSlideStyle = function(spec) {
|
||||
const getSlideStyle = function (spec) {
|
||||
const style = {};
|
||||
|
||||
if (spec.variableWidth === undefined || spec.variableWidth === false) {
|
||||
|
@ -76,7 +76,7 @@ const getSlideStyle = function(spec) {
|
|||
|
||||
const getKey = (child, fallbackKey) => child.key || (child.key === 0 && '0') || fallbackKey;
|
||||
|
||||
const renderSlides = function(spec, children) {
|
||||
const renderSlides = function (spec, children) {
|
||||
let key;
|
||||
const slides = [];
|
||||
const preCloneSlides = [];
|
||||
|
|
|
@ -73,17 +73,8 @@ export default defineComponent({
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const {
|
||||
prefixCls,
|
||||
vertical,
|
||||
reverse,
|
||||
offset,
|
||||
disabled,
|
||||
min,
|
||||
max,
|
||||
value,
|
||||
tabindex,
|
||||
} = getOptionProps(this);
|
||||
const { prefixCls, vertical, reverse, offset, disabled, min, max, value, tabindex } =
|
||||
getOptionProps(this);
|
||||
const className = classNames(this.$attrs.class, {
|
||||
[`${prefixCls}-handle-click-focused`]: this.clickFocused,
|
||||
});
|
||||
|
|
|
@ -40,9 +40,8 @@ export default defineComponent({
|
|||
this.__emit('stepClick', this.stepIndex);
|
||||
},
|
||||
renderIconNode() {
|
||||
const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } = getOptionProps(
|
||||
this,
|
||||
);
|
||||
const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } =
|
||||
getOptionProps(this);
|
||||
const icon = getComponent(this, 'icon');
|
||||
const title = getComponent(this, 'title');
|
||||
const description = getComponent(this, 'description');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue