chore: update lit & format

pull/6917/head
tangjinzhou 1 year ago
parent deada0aeb8
commit 31d00bf7d1

@ -8,5 +8,6 @@ lib/
_site/
dist/
site/dist/
components/version/version.tsx
components/version/version.ts
site/src/router/demoRoutes.js
locale/

@ -185,7 +185,7 @@ All rights reserved.
};
if (process.env.RUN_ENV === 'PRODUCTION') {
let entry = ['./index'];
const entry = ['./index'];
config.externals = [
{
vue: {

@ -368,7 +368,7 @@ function pub(done) {
}
}
let startTime = new Date();
const startTime = new Date();
gulp.task('compile-with-es', done => {
console.log('start compile at ', startTime);
console.log('[Parallel] Compile to es...');
@ -452,7 +452,7 @@ gulp.task(
newVersion.trim() === version
) {
// eslint-disable-next-line no-unused-vars
runCmd('npm', ['run', 'pub'], code => {
runCmd('npm', ['run', 'pub'], _code => {
done();
});
} else {

@ -1,7 +1,7 @@
// Test via a getter in the options object to see if the passive property is accessed
let supportsPassive = false;
try {
let opts = Object.defineProperty({}, 'passive', {
const opts = Object.defineProperty({}, 'passive', {
get() {
supportsPassive = true;
},

@ -31,6 +31,8 @@ export interface PropOptions<T = any, D = T> {
}
declare type VNodeChildAtom = VNode | string | number | boolean | null | undefined | void;
// eslint-disable-next-line no-undef
export type VueNode = VNodeChildAtom | VNodeChildAtom[] | JSX.Element;
export const withInstall = <T>(comp: T) => {

@ -8,7 +8,7 @@ import DownOutlined from '@ant-design/icons-vue/DownOutlined';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { MouseEventHandler } from '../_util/EventInterface';
import { eventType, objectType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
import type { CustomSlotsType, VueNode } from '../_util/type';
export const breadcrumbItemProps = () => ({
prefixCls: String,
@ -38,7 +38,7 @@ export default defineComponent({
* if overlay is have
* Wrap a Dropdown
*/
const renderBreadcrumbNode = (breadcrumbItem: JSX.Element, prefixCls: string) => {
const renderBreadcrumbNode = (breadcrumbItem: VueNode, prefixCls: string) => {
const overlay = getPropsSlot(slots, props, 'overlay');
if (overlay) {
return (
@ -59,7 +59,7 @@ export default defineComponent({
const separator = getPropsSlot(slots, props, 'separator') ?? '/';
const children = getPropsSlot(slots, props);
const { class: cls, style, ...restAttrs } = attrs;
let link: JSX.Element;
let link: VueNode;
if (props.href !== undefined) {
link = (
<a class={`${prefixCls.value}-link`} onClick={handleClick} {...restAttrs}>

@ -206,7 +206,7 @@ describe('Locale Provider', () => {
return null;
},
};
for (let locale of locales) {
for (const locale of locales) {
document.body.innerHTML = '';
mount(
{

@ -107,7 +107,7 @@ describe('message', () => {
// https:// github.com/ant-design/ant-design/issues/8201
it('should hide message correctly', async () => {
let hide = message.loading('Action in progress..', 0);
const hide = message.loading('Action in progress..', 0);
await Promise.resolve();
expect(document.querySelectorAll('.ant-message-notice').length).toBe(1);
hide();

@ -12,15 +12,15 @@ import destroyFns from '../destroyFns';
let uuid = 0;
interface ElementsHolderRef {
addModal: (modal: () => JSX.Element) => () => void;
addModal: (modal: () => VueNode) => () => void;
}
const ElementsHolder = defineComponent({
name: 'ElementsHolder',
inheritAttrs: false,
setup(_, { expose }) {
const modals = shallowRef<(() => JSX.Element)[]>([]);
const addModal = (modal: () => JSX.Element) => {
const modals = shallowRef<(() => VueNode)[]>([]);
const addModal = (modal: () => VueNode) => {
modals.value.push(modal);
modals.value = modals.value.slice();
return () => {

@ -23,7 +23,7 @@ const getMinPercent = (width: number): number => (CIRCLE_MIN_STROKE_WIDTH / widt
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Circle',
name: 'ProgressCircle',
inheritAttrs: false,
props: initDefaultProps(circleProps(), {
trailColor: null as unknown as string,

@ -72,7 +72,7 @@ export const handleGradient = (
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Line',
name: 'ProgressLine',
inheritAttrs: false,
props: lineProps(),
setup(props, { slots, attrs }) {

@ -1,4 +1,4 @@
import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import { defineComponent } from 'vue';
import initDefaultProps from '../_util/props-util/initDefaultProps';
import StatisticNumber from './Number';
@ -9,7 +9,7 @@ import useConfigInject from '../config-provider/hooks/useConfigInject';
// CSSINJS
import useStyle from './style';
import { anyType, booleanType, functionType, someType, vNodeType } from '../_util/type';
import type { CustomSlotsType } from '../_util/type';
import type { CustomSlotsType, VueNode } from '../_util/type';
export const statisticProps = () => ({
prefixCls: String,
@ -18,7 +18,7 @@ export const statisticProps = () => ({
format: String,
value: someType<valueType>([Number, String, Object]),
valueStyle: { type: Object as PropType<CSSProperties>, default: undefined as CSSProperties },
valueRender: functionType<(node: VNode | JSX.Element) => VNode | JSX.Element>(),
valueRender: functionType<(node: VueNode) => VueNode>(),
formatter: anyType<Formatter>(),
precision: Number,
prefix: vNodeType(),
@ -60,7 +60,7 @@ export default defineComponent({
const formatter = props.formatter ?? (slots.formatter as unknown as Formatter);
// data-for-update just for update component
// https://github.com/vueComponent/ant-design-vue/pull/3170
let valueNode = (
let valueNode: VueNode = (
<StatisticNumber
data-for-update={Date.now()}
{...{ ...props, prefixCls: pre, value, formatter }}

@ -125,7 +125,7 @@ export const baseProps = () => ({
const Base = defineComponent({
compatConfig: { MODE: 3 },
name: 'Base',
name: 'TypographyBase',
inheritAttrs: false,
props: baseProps(),
// emits: ['update:content'],

@ -214,7 +214,7 @@ describe('Typography', () => {
});
describe('copyable', () => {
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
function copyTest(name, text, target, icon) {
it(name, async () => {
jest.useFakeTimers();

@ -12,7 +12,7 @@ export type ContentRef = {
};
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Content',
name: 'DialogContent',
inheritAttrs: false,
props: {
...dialogPropTypes(),

@ -16,7 +16,7 @@ import { getMotionName, getUUID } from './util';
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Dialog',
name: 'VcDialog',
inheritAttrs: false,
props: initDefaultProps(
{

@ -3,7 +3,7 @@ import Transition, { getTransitionProps } from '../_util/transition';
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Mask',
name: 'DialogMask',
props: {
prefixCls: String,
visible: Boolean,

@ -64,7 +64,7 @@ export const mergeDefaultValue = <T extends object>(obj: T, defaultValues: objec
let uuid = 0;
const ImageInternal = defineComponent({
compatConfig: { MODE: 3 },
name: 'Image',
name: 'VcImage',
inheritAttrs: false,
props: imageProps(),
emits: ['click', 'error'],

@ -616,5 +616,5 @@ function PickerPanel<DateType>() {
});
}
const InterPickerPanel = PickerPanel<any>();
export default <DateType,>(props: MergedPickerPanelProps<DateType>): JSX.Element =>
export default <DateType,>(props: MergedPickerPanelProps<DateType>) =>
createVNode(InterPickerPanel, props);

@ -6,7 +6,7 @@ import { propTypes } from './types';
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Line',
name: 'ProgressLine',
props: initDefaultProps(propTypes, defaultProps),
setup(props) {
const percentList = computed(() => {

@ -28,7 +28,7 @@ import {
watch,
watchEffect,
} from 'vue';
import type { CSSProperties, ExtractPropTypes, PropType, VNode } from 'vue';
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
import PropTypes from '../_util/vue-types';
import { initDefaultProps, isValidElement } from '../_util/props-util';
import isMobile from '../vc-util/isMobile';
@ -721,7 +721,7 @@ export default defineComponent({
// ============================= Arrow ==============================
const mergedShowArrow =
showArrow !== undefined ? showArrow : loading || (!multiple.value && mode !== 'combobox');
let arrowNode: VNode | JSX.Element;
let arrowNode: VueNode;
if (mergedShowArrow) {
arrowNode = (
@ -742,7 +742,7 @@ export default defineComponent({
}
// ============================= Clear ==============================
let clearNode: VNode | JSX.Element;
let clearNode: VueNode;
const onClearMouseDown: MouseEventHandler = () => {
onClear?.();
@ -851,7 +851,7 @@ export default defineComponent({
></SelectTrigger>
);
// >>> Render
let renderNode: VNode | JSX.Element;
let renderNode: VueNode;
// Render raw
if (customizeRawInputElement) {

@ -164,7 +164,7 @@ function isRawValue(value: DraftValueType): value is RawValueType {
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Select',
name: 'VcSelect',
inheritAttrs: false,
props: initDefaultProps(selectProps(), {
prefixCls: 'vc-select',

@ -42,7 +42,7 @@ export type InputProps = Partial<ExtractPropTypes<typeof inputProps>>;
const Input = defineComponent({
compatConfig: { MODE: 3 },
name: 'Input',
name: 'SelectInput',
inheritAttrs: false,
props: inputProps,
setup(props) {

@ -32,7 +32,7 @@ const getSlideClasses = spec => {
} else {
focusedSlide = spec.targetSlide;
}
let slickCurrent = index === focusedSlide;
const slickCurrent = index === focusedSlide;
return {
'slick-slide': true,
'slick-active': slickActive,

@ -461,7 +461,7 @@ export const swipeEnd = (e, spec) => {
onSwipe(swipeDirection);
}
let slideCount, newSlide;
let activeSlide = infinite ? currentSlide : targetSlide;
const activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) {
case 'left':
case 'up':

@ -22,7 +22,7 @@ export interface BodyProps<RecordType> {
}
export default defineComponent<BodyProps<any>>({
name: 'Body',
name: 'TableBody',
props: [
'data',
'getRowKey',

@ -7,7 +7,7 @@ export interface SummaryProps {
let indexGuid = 0;
const Summary = defineComponent<SummaryProps>({
name: 'Summary',
name: 'TableSummary',
props: ['fixed'] as any,
setup(props, { slots }) {
const tableContext = useInjectTable();

@ -13,7 +13,7 @@ export interface FooterProps<RecordType = DefaultRecordType> {
}
export default defineComponent<FooterProps>({
name: 'Footer',
name: 'TableFooter',
inheritAttrs: false,
props: ['stickyOffsets', 'flattenColumns'] as any,
setup(props, { slots }) {

@ -91,7 +91,7 @@ export interface HeaderProps<RecordType = DefaultRecordType> {
}
export default defineComponent<HeaderProps>({
name: 'Header',
name: 'TableHeader',
inheritAttrs: false,
props: ['columns', 'flattenColumns', 'stickyOffsets', 'customHeaderRow'] as any,
setup(props) {

@ -150,7 +150,7 @@ export interface TableProps<RecordType = DefaultRecordType> {
}
export default defineComponent<TableProps<DefaultRecordType>>({
name: 'Table',
name: 'VcTable',
inheritAttrs: false,
props: [
'prefixCls',

@ -12,7 +12,7 @@ export type TooltipContentProps = Partial<ExtractPropTypes<typeof tooltipContent
export default defineComponent({
compatConfig: { MODE: 3 },
name: 'Content',
name: 'TooltipContent',
props: tooltipContentProps,
setup(props: TooltipContentProps, { slots }) {
return () => (

@ -23,7 +23,7 @@ export interface MaskProps {
zIndex?: number;
}
const Mask = defineComponent({
name: 'Mask',
name: 'TourMask',
props: {
prefixCls: { type: String },
pos: objectType<PosInfo>(), //

@ -54,7 +54,7 @@
"lint:demo": "eslint --fix components/*/demo/*.vue",
"lint:md": "eslint --fix *.md",
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
"lint:site": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.ts,.tsx,vue ./site",
"lint:site": "eslint --fix -c ./.eslintrc.js --ext .jsx,.js,.ts,.tsx,vue ./site",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov",
"routes": "node site/scripts/genrateRoutes.js",

@ -182,7 +182,7 @@ export default defineComponent({
type.value = type.value === 'TS' ? 'JS' : 'TS';
};
const handleCodeSandbox = () => {
const code = codeRef.value!.innerText;
const code = codeRef.value.innerText;
const params = getCodeSandboxParams(code, {
title: `${title.value} - ant-design-vue@${packageInfo.version}`,
});

@ -10,6 +10,7 @@ const Demo = defineComponent({
setup() {
return () => {
const onClick: MenuProps['onClick'] = e => {
// eslint-disable-next-line no-console
console.log('click ', e);
};

@ -24,6 +24,7 @@ const items: MenuProps['items'] = [
const Demo = () => {
const onClick: MenuProps['onClick'] = e => {
// eslint-disable-next-line no-console
console.log('click ', e);
};

@ -15,6 +15,7 @@ const Demo = defineComponent({
</div>
),
onOk() {
// eslint-disable-next-line no-console
console.log('i am ok');
},
});

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data';
const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`);
};

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data';
const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`);
};

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data';
const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`);
};

@ -6,6 +6,7 @@ import type { ComponentDemo } from '../../interface';
import options from './data';
const handleChange = (value: any) => {
// eslint-disable-next-line no-console
console.log(`selected ${value}`);
};

@ -90,6 +90,7 @@ const data = [
];
const onChange: TableProps<TableData>['onChange'] = (pagination, filters, sorter, extra) => {
// eslint-disable-next-line no-console
console.log('params', pagination, filters, sorter, extra);
};

@ -19,7 +19,7 @@ export default {
},
watch: {
$route(e, t) {
let adId = '#carbonads';
const adId = '#carbonads';
// if(isGitee) {
// adId = '#cf';
// }

@ -63,7 +63,7 @@ class ClipboardAction {
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
// Move element to the same position vertically
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
const yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = `${yPosition}px`;
this.fakeElem.setAttribute('readonly', '');

@ -1,10 +1,10 @@
let DOCUMENT_NODE_TYPE = 9;
const DOCUMENT_NODE_TYPE = 9;
/**
* A polyfill for Element.matches()
*/
if (typeof Element !== 'undefined' && !Element.prototype.matches) {
let proto = Element.prototype;
const proto = Element.prototype;
proto.matches =
proto.matchesSelector ||

@ -1,3 +1,5 @@
/* eslint-disable prefer-spread */
/* eslint-disable prefer-rest-params */
import closest from './closest';
/**
@ -11,7 +13,7 @@ import closest from './closest';
* @return {Object}
*/
function _delegate(element, selector, type, callback, useCapture) {
let listenerFn = listener.apply(this, arguments);
const listenerFn = listener.apply(this, arguments);
element.addEventListener(type, listenerFn, useCapture);

@ -15,7 +15,7 @@ export const node = function (value) {
* @return {Boolean}
*/
export const nodeList = function (value) {
let type = Object.prototype.toString.call(value);
const type = Object.prototype.toString.call(value);
return (
value !== undefined &&
@ -42,7 +42,7 @@ export const string = function (value) {
* @return {Boolean}
*/
export const fn = function (value) {
let type = Object.prototype.toString.call(value);
const type = Object.prototype.toString.call(value);
return type === '[object Function]';
};

@ -6,7 +6,7 @@ function select(element) {
selectedText = element.value;
} else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
let isReadOnly = element.hasAttribute('readonly');
const isReadOnly = element.hasAttribute('readonly');
if (!isReadOnly) {
element.setAttribute('readonly', '');
@ -25,8 +25,8 @@ function select(element) {
element.focus();
}
let selection = window.getSelection();
let range = document.createRange();
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
function E() {
// Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
@ -5,7 +6,7 @@ function E() {
E.prototype = {
on(name, callback, ctx) {
let e = this.e || (this.e = {});
const e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({
fn: callback,
@ -16,7 +17,8 @@ E.prototype = {
},
once(name, callback, ctx) {
let self = this;
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
function listener() {
self.off(name, listener);
callback.apply(ctx, arguments);
@ -27,10 +29,10 @@ E.prototype = {
},
emit(name) {
let data = [].slice.call(arguments, 1);
let evtArr = ((this.e || (this.e = {}))[name] || []).slice();
const data = [].slice.call(arguments, 1);
const evtArr = ((this.e || (this.e = {}))[name] || []).slice();
let i = 0;
let len = evtArr.length;
const len = evtArr.length;
for (i; i < len; i++) {
evtArr[i].fn.apply(evtArr[i].ctx, data);
@ -40,9 +42,9 @@ E.prototype = {
},
off(name, callback) {
let e = this.e || (this.e = {});
let evts = e[name];
let liveEvents = [];
const e = this.e || (this.e = {});
const evts = e[name];
const liveEvents = [];
if (evts && callback) {
for (let i = 0, len = evts.length; i < len; i++) {

@ -13,7 +13,7 @@
<slot />
<!-- <GoogleAds v-if="showAd" :key="`goo-${route.path}`" /> -->
<section class="markdown api-container" v-html="api"></section>
<Contributor :isZn="isZhCN" />
<Contributor :is-zn="isZhCN" />
</article>
</template>
<script lang="ts">

@ -40,7 +40,7 @@ const IconDisplay = defineComponent({
return Object.keys(categories)
.map(key => {
let iconList = categories[key];
const iconList = categories[key];
return {
category: key,

2
site/typings.d.ts vendored

@ -1,7 +1,7 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-types
const component: DefineComponent<any, any, any> & { readonly pageDate?: PageData };
const component: DefineComponent<any, any, any>;
export default component;
}

@ -13,6 +13,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"jsx": "preserve",
"jsxImportSource": "vue",
"noUnusedParameters": true,
"noUnusedLocals": true,
"noImplicitAny": false,

Loading…
Cancel
Save