mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 03:08:21 +08:00
chore: upgrade & improve eslint rule (#3105)
* chore: remove unused ts-node * chore: upgrade lodash * chore: upgrade eslint * perf: remove side effects in computed * refactor: follow eslint rules * chore: remove vue-template-compiler * style: enhance eslint format rule * style: format code
This commit is contained in:
parent
f274bc97db
commit
e9e56d5938
28
.eslintrc.js
28
.eslintrc.js
@ -20,18 +20,33 @@ module.exports = {
|
||||
'plugin:vue/vue3-recommended',
|
||||
],
|
||||
rules: {
|
||||
// js/ts
|
||||
// style
|
||||
'block-spacing': 'error',
|
||||
'eol-last': 'error',
|
||||
'no-trailing-spaces': 'error',
|
||||
'comma-style': ['error', 'last'],
|
||||
'comma-dangle': ['error', 'always-multiline'],
|
||||
'no-multi-spaces': 'error',
|
||||
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
||||
camelcase: ['error', { properties: 'never' }],
|
||||
semi: ['error', 'never'],
|
||||
indent: ['error', 2, { SwitchCase: 1 }],
|
||||
'object-curly-spacing': ['error', 'always'],
|
||||
'arrow-parens': ['error', 'as-needed'],
|
||||
'arrow-parens':['error', 'as-needed'],
|
||||
'array-bracket-spacing': ['error', 'never'],
|
||||
|
||||
'indent': 'off',
|
||||
'@typescript-eslint/indent':['error', 2, { SwitchCase: 1 }],
|
||||
|
||||
'object-curly-spacing': 'off',
|
||||
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
|
||||
|
||||
quotes: 'off',
|
||||
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
||||
|
||||
'space-infix-ops': 'off',
|
||||
'@typescript-eslint/space-infix-ops': ['error', { 'int32Hint': false }],
|
||||
|
||||
'@typescript-eslint/type-annotation-spacing': ['error', {}],
|
||||
|
||||
// js/ts
|
||||
camelcase: ['error', { properties: 'never' }],
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/member-delimiter-style': [
|
||||
@ -47,6 +62,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
// vue
|
||||
'vue/no-v-html': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
|
@ -54,8 +54,8 @@
|
||||
"@types/jest": "^26.0.10",
|
||||
"@types/klaw-sync": "^6.0.1",
|
||||
"@types/lodash": "^4.14.161",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.1",
|
||||
"@typescript-eslint/parser": "^3.10.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"@vue/babel-plugin-jsx": "^1.0.0",
|
||||
"@vue/compiler-sfc": "^3.2.0",
|
||||
"@vue/component-compiler-utils": "^3.2.0",
|
||||
@ -112,14 +112,12 @@
|
||||
"transliteration": "^2.1.11",
|
||||
"ts-loader": "^8.0.3",
|
||||
"ts-morph": "^11.0.3",
|
||||
"ts-node": "^10.2.0",
|
||||
"typescript": "^4.3.5",
|
||||
"url-loader": "^4.1.0",
|
||||
"vue": "^3.2.0",
|
||||
"vue-jest": "5.0.0-alpha.5",
|
||||
"vue-loader": "^16.1.2",
|
||||
"vue-router": "^4.0.2",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"webpack": "^4.44.1",
|
||||
"webpack-bundle-analyzer": "^3.9.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
|
@ -297,7 +297,7 @@ export default defineComponent({
|
||||
}))
|
||||
|
||||
watch(
|
||||
[ config, () => props.options ],
|
||||
[config, () => props.options],
|
||||
initStore,
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
|
@ -112,6 +112,8 @@ const useCheckboxStatus = (props: IUseCheckboxProps, { model }: PartialReturnTyp
|
||||
return value.includes(props.label)
|
||||
} else if (value !== null && value !== undefined) {
|
||||
return value === props.trueLabel
|
||||
} else {
|
||||
return !!value
|
||||
}
|
||||
})
|
||||
const checkboxSize = computed(() => {
|
||||
|
@ -27,7 +27,7 @@ export default defineComponent({
|
||||
accordion: Boolean,
|
||||
modelValue: {
|
||||
type: [Array, String, Number] as PropType<
|
||||
string | number | Array<string | number>
|
||||
string | number | Array<string | number>
|
||||
>,
|
||||
default: () => [],
|
||||
},
|
||||
|
@ -179,7 +179,7 @@ export default class Color {
|
||||
this.doOnChange()
|
||||
}
|
||||
|
||||
set(prop: {[key: string]: any;} | any, value?: number) {
|
||||
set(prop: { [key: string]: any; } | any, value?: number) {
|
||||
if (arguments.length === 1 && typeof prop === 'object') {
|
||||
for (const p in prop) {
|
||||
if (hasOwn(prop, p)) {
|
||||
|
@ -93,7 +93,7 @@ export default defineComponent({
|
||||
// data
|
||||
const lastRow = ref(null)
|
||||
const lastColumn = ref(null)
|
||||
const tableRows = ref([ [], [], [], [], [], [] ])
|
||||
const tableRows = ref([[], [], [], [], [], []])
|
||||
|
||||
// todo better way to get Day.js locale object
|
||||
const firstDayOfWeek = (props.date as any).$locale().weekStart || 7
|
||||
|
@ -68,7 +68,7 @@ export default defineComponent({
|
||||
setup(props, ctx) {
|
||||
const { t, lang } = useLocaleInject()
|
||||
const months = ref(props.date.locale('en').localeData().monthsShort().map(_=>_.toLowerCase()))
|
||||
const tableRows = ref([ [], [], [] ])
|
||||
const tableRows = ref([[], [], []])
|
||||
const lastRow = ref(null)
|
||||
const lastColumn = ref(null)
|
||||
const rows = computed(() => {
|
||||
|
@ -28,7 +28,7 @@ export default defineComponent({
|
||||
return {}
|
||||
}
|
||||
return {
|
||||
...(props.size ? { '--font-size': `${props.size}px` }: {}),
|
||||
...(props.size ? { '--font-size': `${props.size}px` } : {}),
|
||||
...(props.color ? { '--color': props.color } : {}),
|
||||
} as CSSProperties
|
||||
}),
|
||||
|
@ -94,7 +94,7 @@ export default defineComponent({
|
||||
props: {
|
||||
urlList: {
|
||||
type: Array as PropType<string[]>,
|
||||
default: [],
|
||||
default: () => [],
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
|
@ -1,49 +1,49 @@
|
||||
import type { Ref, VNode } from 'vue'
|
||||
|
||||
export type ILoadingOptions = {
|
||||
parent?: ILoadingParentElement
|
||||
background?: string
|
||||
svg?: string
|
||||
svgViewBox?: string
|
||||
spinner?: boolean | string
|
||||
text?: string
|
||||
fullscreen?: boolean
|
||||
body?: boolean
|
||||
lock?: boolean
|
||||
customClass?: string
|
||||
visible?: boolean
|
||||
target?: string | HTMLElement
|
||||
parent?: ILoadingParentElement
|
||||
background?: string
|
||||
svg?: string
|
||||
svgViewBox?: string
|
||||
spinner?: boolean | string
|
||||
text?: string
|
||||
fullscreen?: boolean
|
||||
body?: boolean
|
||||
lock?: boolean
|
||||
customClass?: string
|
||||
visible?: boolean
|
||||
target?: string | HTMLElement
|
||||
}
|
||||
|
||||
export type ILoadingInstance = {
|
||||
parent?: Ref<ILoadingParentElement>
|
||||
background?: Ref<string>
|
||||
spinner?: Ref<boolean | string>
|
||||
text?: Ref<string>
|
||||
fullscreen?: Ref<boolean>
|
||||
body?: Ref<boolean>
|
||||
lock?: Ref<boolean>
|
||||
customClass?: Ref<string>
|
||||
visible?: Ref<boolean>
|
||||
target?: Ref<string | HTMLElement>
|
||||
originalPosition?: Ref<string>
|
||||
originalOverflow?: Ref<string>
|
||||
setText: (text: string) => void
|
||||
close: () => void
|
||||
handleAfterLeave: () => void
|
||||
vm: VNode
|
||||
$el: HTMLElement
|
||||
parent?: Ref<ILoadingParentElement>
|
||||
background?: Ref<string>
|
||||
spinner?: Ref<boolean | string>
|
||||
text?: Ref<string>
|
||||
fullscreen?: Ref<boolean>
|
||||
body?: Ref<boolean>
|
||||
lock?: Ref<boolean>
|
||||
customClass?: Ref<string>
|
||||
visible?: Ref<boolean>
|
||||
target?: Ref<string | HTMLElement>
|
||||
originalPosition?: Ref<string>
|
||||
originalOverflow?: Ref<string>
|
||||
setText: (text: string) => void
|
||||
close: () => void
|
||||
handleAfterLeave: () => void
|
||||
vm: VNode
|
||||
$el: HTMLElement
|
||||
}
|
||||
|
||||
export type ILoadingGlobalConfig = {
|
||||
fullscreenLoading: ILoadingInstance
|
||||
fullscreenLoading: ILoadingInstance
|
||||
}
|
||||
|
||||
export type ILoadingCreateComponentParams = {
|
||||
options: ILoadingOptions
|
||||
globalLoadingOption: ILoadingGlobalConfig
|
||||
options: ILoadingOptions
|
||||
globalLoadingOption: ILoadingGlobalConfig
|
||||
}
|
||||
|
||||
export interface ILoadingParentElement extends HTMLElement {
|
||||
vLoadingAddClassList?: () => void
|
||||
vLoadingAddClassList?: () => void
|
||||
}
|
||||
|
@ -157,14 +157,14 @@ export interface ElMessageBoxOptions {
|
||||
|
||||
export type ElMessageBoxShortcutMethod =
|
||||
((
|
||||
message: ElMessageBoxOptions['message'],
|
||||
title: ElMessageBoxOptions['title'],
|
||||
options?: ElMessageBoxOptions,
|
||||
) => Promise<MessageBoxData>)
|
||||
message: ElMessageBoxOptions['message'],
|
||||
title: ElMessageBoxOptions['title'],
|
||||
options?: ElMessageBoxOptions,
|
||||
) => Promise<MessageBoxData>)
|
||||
& ((
|
||||
message: ElMessageBoxOptions['message'],
|
||||
options?: ElMessageBoxOptions,
|
||||
) => Promise<MessageBoxData>)
|
||||
message: ElMessageBoxOptions['message'],
|
||||
options?: ElMessageBoxOptions,
|
||||
) => Promise<MessageBoxData>)
|
||||
|
||||
export interface IElMessageBox {
|
||||
/** Show a message box */
|
||||
|
@ -17,13 +17,13 @@ import type {
|
||||
// component default merge props & data
|
||||
|
||||
const messageInstance = new Map<
|
||||
ComponentPublicInstance<{ doClose: () => void; }>, // marking doClose as function
|
||||
{
|
||||
options: any
|
||||
callback: Callback
|
||||
resolve: (res: any) => void
|
||||
reject: (reason?: any) => void
|
||||
}
|
||||
ComponentPublicInstance<{ doClose: () => void; }>, // marking doClose as function
|
||||
{
|
||||
options: any
|
||||
callback: Callback
|
||||
resolve: (res: any) => void
|
||||
reject: (reason?: any) => void
|
||||
}
|
||||
>()
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ const showMessage = (options: any) => {
|
||||
async function MessageBox(options: ElMessageBoxOptions): Promise<MessageBoxData>
|
||||
function MessageBox(
|
||||
options: ElMessageBoxOptions | string | VNode,
|
||||
): Promise<{value: string; action: Action;} | Action> {
|
||||
): Promise<{ value: string; action: Action; } | Action> {
|
||||
if (isServer) return
|
||||
let callback
|
||||
if (isString(options) || isVNode(options)) {
|
||||
|
@ -78,7 +78,7 @@ const Message: IMessage = function(
|
||||
return {
|
||||
// instead of calling the onClose function directly, setting this value so that we can have the full lifecycle
|
||||
// for out component, so that all closing steps will not be skipped.
|
||||
close: () => (vm.component.proxy as ComponentPublicInstance<{visible: boolean;}>).visible = false,
|
||||
close: () => (vm.component.proxy as ComponentPublicInstance<{ visible: boolean; }>).visible = false,
|
||||
}
|
||||
} as any
|
||||
|
||||
|
@ -26,7 +26,7 @@ export type MessageParams = IMessageOptions | string
|
||||
export type TypedMessageParams<T extends MessageType> = { type: T; } & Omit<IMessageOptions, 'type'> | string
|
||||
|
||||
export interface IMessage {
|
||||
(options?: MessageParams) : IMessageHandle
|
||||
(options?: MessageParams): IMessageHandle
|
||||
success: (options?: TypedMessageParams<'success'>) => IMessageHandle
|
||||
warning: (options?: TypedMessageParams<'warning'>) => IMessageHandle
|
||||
info: (options?: TypedMessageParams<'info'>) => IMessageHandle
|
||||
|
@ -9,7 +9,7 @@ export interface INotificationHandle {
|
||||
}
|
||||
|
||||
export interface INotification {
|
||||
(options?: INotificationOptions) : INotificationHandle
|
||||
(options?: INotificationOptions): INotificationHandle
|
||||
success?: (options: TypedNotificationOptions) => INotificationHandle
|
||||
warning?: (options: TypedNotificationOptions) => INotificationHandle
|
||||
error?: (options: TypedNotificationOptions) => INotificationHandle
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
computed,
|
||||
defineComponent,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import { warn } from '@element-plus/utils/error'
|
||||
import { useLocaleInject } from '@element-plus/hooks'
|
||||
@ -185,10 +186,6 @@ export default defineComponent({
|
||||
} else if (!isAbsent(props.total)) {
|
||||
pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value))
|
||||
}
|
||||
// side effect
|
||||
if (currentPageBridge.value > pageCount) {
|
||||
currentPageBridge.value = pageCount
|
||||
}
|
||||
return pageCount
|
||||
})
|
||||
|
||||
@ -213,6 +210,11 @@ export default defineComponent({
|
||||
},
|
||||
})
|
||||
|
||||
watch(pageCountBridge, val => {
|
||||
if (currentPageBridge.value > val)
|
||||
currentPageBridge.value = val
|
||||
})
|
||||
|
||||
function handleCurrentChange(val: number) {
|
||||
currentPageBridge.value = val
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export interface ISliderProvider {
|
||||
export type Mark = {
|
||||
point: number
|
||||
position: number
|
||||
mark: {[s: string]: any;}
|
||||
mark: { [s: string]: any; }
|
||||
}
|
||||
|
||||
export type Marks = ComputedRef<Mark[]>
|
||||
|
@ -25,7 +25,7 @@ export default defineComponent({
|
||||
|
||||
render(
|
||||
ctx: ReturnType<typeof useSpace> &
|
||||
ExtractPropTypes<typeof defaultProps> & { $slots: Slots; },
|
||||
ExtractPropTypes<typeof defaultProps> & { $slots: Slots; },
|
||||
) {
|
||||
const {
|
||||
classes,
|
||||
|
@ -25,7 +25,7 @@ export const defaultProps = {
|
||||
|
||||
style: {
|
||||
type: [String, Array, Object] as PropType<
|
||||
string | Array<any> | CSSProperties
|
||||
string | Array<any> | CSSProperties
|
||||
>,
|
||||
},
|
||||
|
||||
@ -63,7 +63,7 @@ export const defaultProps = {
|
||||
|
||||
size: {
|
||||
type: [String, Array, Number] as PropType<
|
||||
ComponentSize | [number, number] | number
|
||||
ComponentSize | [number, number] | number
|
||||
>,
|
||||
validator: (val: unknown) => {
|
||||
return (
|
||||
|
@ -70,7 +70,7 @@ interface ISwitchProps {
|
||||
name: string
|
||||
validateEvent: boolean
|
||||
id: string
|
||||
loading:boolean
|
||||
loading: boolean
|
||||
beforeChange?: () => (Promise<boolean> | boolean)
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const switchDisabled = computed((): boolean => {
|
||||
return props.disabled || props.loading ||(elForm || {}).disabled
|
||||
return props.disabled || props.loading || (elForm || {}).disabled
|
||||
})
|
||||
|
||||
const handleChange = (): void => {
|
||||
|
@ -25,10 +25,10 @@ const defaultProps = {
|
||||
type: Object as PropType<TableBodyProps<DefaultRow>['context']>,
|
||||
},
|
||||
rowClassName: [String, Function] as PropType<
|
||||
TableBodyProps<DefaultRow>['rowClassName']
|
||||
TableBodyProps<DefaultRow>['rowClassName']
|
||||
>,
|
||||
rowStyle: [Object, Function] as PropType<
|
||||
TableBodyProps<DefaultRow>['rowStyle']
|
||||
TableBodyProps<DefaultRow>['rowStyle']
|
||||
>,
|
||||
fixed: {
|
||||
type: String,
|
||||
|
@ -95,7 +95,7 @@ export default {
|
||||
default: '',
|
||||
},
|
||||
renderHeader: Function as PropType<
|
||||
TableColumnCtx<DefaultRow>['renderHeader']
|
||||
TableColumnCtx<DefaultRow>['renderHeader']
|
||||
>,
|
||||
sortable: {
|
||||
type: [Boolean, String],
|
||||
@ -103,7 +103,7 @@ export default {
|
||||
},
|
||||
sortMethod: Function as PropType<TableColumnCtx<DefaultRow>['sortMethod']>,
|
||||
sortBy: [String, Function, Array] as PropType<
|
||||
TableColumnCtx<DefaultRow>['sortBy']
|
||||
TableColumnCtx<DefaultRow>['sortBy']
|
||||
>,
|
||||
resizable: {
|
||||
type: Boolean,
|
||||
@ -119,7 +119,7 @@ export default {
|
||||
selectable: Function as PropType<TableColumnCtx<DefaultRow>['selectable']>,
|
||||
reserveSelection: Boolean,
|
||||
filterMethod: Function as PropType<
|
||||
TableColumnCtx<DefaultRow>['filterMethod']
|
||||
TableColumnCtx<DefaultRow>['filterMethod']
|
||||
>,
|
||||
filteredValue: Array as PropType<TableColumnCtx<DefaultRow>['filteredValue']>,
|
||||
filters: Array as PropType<TableColumnCtx<DefaultRow>['filters']>,
|
||||
|
@ -27,7 +27,7 @@ export default defineComponent({
|
||||
type: Object as PropType<TableFooter<DefaultRow>['store']>,
|
||||
},
|
||||
summaryMethod: Function as PropType<
|
||||
TableFooter<DefaultRow>['summaryMethod']
|
||||
TableFooter<DefaultRow>['summaryMethod']
|
||||
>,
|
||||
sumText: String,
|
||||
border: Boolean,
|
||||
|
@ -58,19 +58,19 @@ type ColumnStyle<T> =
|
||||
type CellCls<T> =
|
||||
| string
|
||||
| ((data: {
|
||||
row: T
|
||||
rowIndex: number
|
||||
column: TableColumnCtx<T>
|
||||
columnIndex: number
|
||||
}) => string)
|
||||
row: T
|
||||
rowIndex: number
|
||||
column: TableColumnCtx<T>
|
||||
columnIndex: number
|
||||
}) => string)
|
||||
type CellStyle<T> =
|
||||
| CSSProperties
|
||||
| ((data: {
|
||||
row: T
|
||||
rowIndex: number
|
||||
column: TableColumnCtx<T>
|
||||
columnIndex: number
|
||||
}) => CSSProperties)
|
||||
row: T
|
||||
rowIndex: number
|
||||
column: TableColumnCtx<T>
|
||||
columnIndex: number
|
||||
}) => CSSProperties)
|
||||
|
||||
interface TableProps<T> {
|
||||
data: T[]
|
||||
@ -108,11 +108,11 @@ interface TableProps<T> {
|
||||
column: TableColumnCtx<T>
|
||||
columnIndex: number
|
||||
}) =>
|
||||
| number[]
|
||||
| {
|
||||
rowspan: number
|
||||
colspan: number
|
||||
}
|
||||
| number[]
|
||||
| {
|
||||
rowspan: number
|
||||
colspan: number
|
||||
}
|
||||
selectOnIndeterminate?: boolean
|
||||
indent?: number
|
||||
treeProps?: {
|
||||
@ -182,26 +182,26 @@ export default {
|
||||
sumText: String,
|
||||
summaryMethod: Function as PropType<TableProps<DefaultRow>['summaryMethod']>,
|
||||
rowClassName: [String, Function] as PropType<
|
||||
TableProps<DefaultRow>['rowClassName']
|
||||
TableProps<DefaultRow>['rowClassName']
|
||||
>,
|
||||
rowStyle: [Object, Function] as PropType<TableProps<DefaultRow>['rowStyle']>,
|
||||
cellClassName: [String, Function] as PropType<
|
||||
TableProps<DefaultRow>['cellClassName']
|
||||
TableProps<DefaultRow>['cellClassName']
|
||||
>,
|
||||
cellStyle: [Object, Function] as PropType<
|
||||
TableProps<DefaultRow>['cellStyle']
|
||||
TableProps<DefaultRow>['cellStyle']
|
||||
>,
|
||||
headerRowClassName: [String, Function] as PropType<
|
||||
TableProps<DefaultRow>['headerRowClassName']
|
||||
TableProps<DefaultRow>['headerRowClassName']
|
||||
>,
|
||||
headerRowStyle: [Object, Function] as PropType<
|
||||
TableProps<DefaultRow>['headerRowStyle']
|
||||
TableProps<DefaultRow>['headerRowStyle']
|
||||
>,
|
||||
headerCellClassName: [String, Function] as PropType<
|
||||
TableProps<DefaultRow>['headerCellClassName']
|
||||
TableProps<DefaultRow>['headerCellClassName']
|
||||
>,
|
||||
headerCellStyle: [Object, Function] as PropType<
|
||||
TableProps<DefaultRow>['headerCellStyle']
|
||||
TableProps<DefaultRow>['headerCellStyle']
|
||||
>,
|
||||
highlightCurrentRow: Boolean,
|
||||
currentRowKey: [String, Number],
|
||||
|
@ -48,7 +48,7 @@ export default defineComponent({
|
||||
editable: Boolean,
|
||||
onTabClick: {
|
||||
type: Function as PropType<
|
||||
(tab: Pane, tabName: string, ev: Event) => void
|
||||
(tab: Pane, tabName: string, ev: Event) => void
|
||||
>,
|
||||
default: NOOP,
|
||||
},
|
||||
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, computed, inject, getCurrentInstance } from 'vue'
|
||||
import { defineComponent, ref, computed, inject, getCurrentInstance, watch } from 'vue'
|
||||
import type { RootTabs, UpdatePaneStateCallback } from './token'
|
||||
|
||||
export default defineComponent({
|
||||
@ -45,11 +45,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const active = computed(() => {
|
||||
const active = rootTabs.currentName.value === (props.name || index.value)
|
||||
if (active) {
|
||||
loaded.value = true
|
||||
}
|
||||
return active
|
||||
return rootTabs.currentName.value === (props.name || index.value)
|
||||
})
|
||||
|
||||
const paneName = computed((): string => {
|
||||
@ -60,6 +56,10 @@ export default defineComponent({
|
||||
return !props.lazy || loaded.value || active.value
|
||||
})
|
||||
|
||||
watch(active, val => {
|
||||
if (val) loaded.value = true
|
||||
})
|
||||
|
||||
const instance = getCurrentInstance()
|
||||
updatePaneState({
|
||||
uid: instance.uid,
|
||||
|
@ -48,16 +48,6 @@
|
||||
<script lang='ts'>
|
||||
import { inject, defineComponent } from 'vue'
|
||||
|
||||
interface ITimeLineItemProps {
|
||||
timestamp: string
|
||||
hideTimestamp: boolean
|
||||
placement: string
|
||||
type: string
|
||||
color: string
|
||||
size: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ElTimelineItem',
|
||||
props: {
|
||||
|
@ -130,7 +130,7 @@ export default class TreeStore {
|
||||
}
|
||||
}
|
||||
|
||||
append(data: TreeNodeData, parentData: TreeNodeData| TreeKey | Node ): void {
|
||||
append(data: TreeNodeData, parentData: TreeNodeData | TreeKey | Node ): void {
|
||||
const parentNode = parentData ? this.getNode(parentData) : this.root
|
||||
|
||||
if (parentNode) {
|
||||
|
@ -2,7 +2,7 @@ import { inject, provide } from 'vue'
|
||||
import Node from '../model/node'
|
||||
|
||||
interface NodeMap {
|
||||
treeNodeExpand(node: Node) : void
|
||||
treeNodeExpand(node: Node): void
|
||||
children: NodeMap[]
|
||||
}
|
||||
|
||||
|
@ -4,67 +4,67 @@ import TreeStore from './model/tree-store'
|
||||
|
||||
import type { ComponentInternalInstance, Ref, SetupContext, VNode } from 'vue'
|
||||
export interface RootTreeType {
|
||||
ctx: SetupContext<any>
|
||||
props: TreeComponentProps
|
||||
store: Ref<TreeStore>
|
||||
root: Ref<Node>
|
||||
currentNode: Ref<Node>
|
||||
instance: ComponentInternalInstance
|
||||
}
|
||||
ctx: SetupContext<any>
|
||||
props: TreeComponentProps
|
||||
store: Ref<TreeStore>
|
||||
root: Ref<Node>
|
||||
currentNode: Ref<Node>
|
||||
instance: ComponentInternalInstance
|
||||
}
|
||||
|
||||
export declare type hType = typeof h
|
||||
export declare type TreeData = TreeNodeData[]
|
||||
export declare type TreeKey = string | number
|
||||
export declare interface FakeNode {
|
||||
data: TreeNodeData
|
||||
data: TreeNodeData
|
||||
}
|
||||
export declare interface TreeNodeData {
|
||||
[key: string]: any
|
||||
[key: string]: any
|
||||
}
|
||||
export declare interface TreeNodeLoadedDefaultProps {
|
||||
checked?: boolean
|
||||
checked?: boolean
|
||||
}
|
||||
export declare interface TreeNodeChildState {
|
||||
all: boolean
|
||||
none: boolean
|
||||
allWithoutDisable: boolean
|
||||
half: boolean
|
||||
all: boolean
|
||||
none: boolean
|
||||
allWithoutDisable: boolean
|
||||
half: boolean
|
||||
}
|
||||
export declare interface TreeNodeOptions {
|
||||
data: TreeNodeData
|
||||
store: TreeStore
|
||||
parent?: Node
|
||||
data: TreeNodeData
|
||||
store: TreeStore
|
||||
parent?: Node
|
||||
}
|
||||
export declare interface TreeStoreNodesMap {
|
||||
[key: string]: Node
|
||||
[key: string]: Node
|
||||
}
|
||||
export declare interface TreeStoreOptions {
|
||||
key: TreeKey
|
||||
data: TreeData
|
||||
lazy: boolean
|
||||
props: TreeOptionProps
|
||||
load: LoadFunction
|
||||
currentNodeKey: TreeKey
|
||||
checkStrictly: boolean
|
||||
checkDescendants: boolean
|
||||
defaultCheckedKeys: TreeKey[]
|
||||
defaultExpandedKeys: TreeKey[]
|
||||
autoExpandParent: boolean
|
||||
defaultExpandAll: boolean
|
||||
filterNodeMethod: FilterNodeMethodFunction
|
||||
key: TreeKey
|
||||
data: TreeData
|
||||
lazy: boolean
|
||||
props: TreeOptionProps
|
||||
load: LoadFunction
|
||||
currentNodeKey: TreeKey
|
||||
checkStrictly: boolean
|
||||
checkDescendants: boolean
|
||||
defaultCheckedKeys: TreeKey[]
|
||||
defaultExpandedKeys: TreeKey[]
|
||||
autoExpandParent: boolean
|
||||
defaultExpandAll: boolean
|
||||
filterNodeMethod: FilterNodeMethodFunction
|
||||
}
|
||||
export declare interface TreeOptionProps {
|
||||
children: string
|
||||
label: string
|
||||
disabled: string
|
||||
isLeaf?: boolean
|
||||
children: string
|
||||
label: string
|
||||
disabled: string
|
||||
isLeaf?: boolean
|
||||
}
|
||||
export declare type RenderContentFunction = (h: hType, context: RenderContentContext) => (VNode | VNode[])
|
||||
export declare interface RenderContentContext {
|
||||
_self: ComponentInternalInstance
|
||||
node: Node
|
||||
data: TreeNodeData
|
||||
store: TreeStore
|
||||
_self: ComponentInternalInstance
|
||||
node: Node
|
||||
data: TreeNodeData
|
||||
store: TreeStore
|
||||
}
|
||||
export declare type AllowDragFunction = (node: Node) => boolean
|
||||
export declare type DropType = 'inner' | 'prev' | 'next'
|
||||
@ -73,30 +73,30 @@ export declare type LoadFunction = (rootNode: Node, loadedCallback: (data: TreeD
|
||||
export declare type FilterValue = any
|
||||
export declare type FilterNodeMethodFunction = (value: FilterValue, data: TreeNodeData, child: Node) => boolean
|
||||
export declare interface TreeComponentProps {
|
||||
data: TreeData
|
||||
emptyText: string
|
||||
renderAfterExpand: boolean
|
||||
nodeKey: string
|
||||
checkStrictly: boolean
|
||||
expandOnClickNode: boolean
|
||||
defaultExpandAll: boolean
|
||||
checkOnClickNode: boolean
|
||||
checkDescendants: boolean
|
||||
autoExpandParent: boolean
|
||||
defaultCheckedKeys: TreeKey[]
|
||||
defaultExpandedKeys: TreeKey[]
|
||||
currentNodeKey: TreeKey
|
||||
renderContent: RenderContentFunction
|
||||
showCheckbox: boolean
|
||||
draggable: boolean
|
||||
allowDrag: AllowDragFunction
|
||||
allowDrop: AllowDropFunction
|
||||
props: TreeOptionProps
|
||||
lazy: boolean
|
||||
highlightCurrent: boolean
|
||||
load: LoadFunction
|
||||
filterNodeMethod: FilterNodeMethodFunction
|
||||
accordion: boolean
|
||||
indent: number
|
||||
iconClass: string
|
||||
data: TreeData
|
||||
emptyText: string
|
||||
renderAfterExpand: boolean
|
||||
nodeKey: string
|
||||
checkStrictly: boolean
|
||||
expandOnClickNode: boolean
|
||||
defaultExpandAll: boolean
|
||||
checkOnClickNode: boolean
|
||||
checkDescendants: boolean
|
||||
autoExpandParent: boolean
|
||||
defaultCheckedKeys: TreeKey[]
|
||||
defaultExpandedKeys: TreeKey[]
|
||||
currentNodeKey: TreeKey
|
||||
renderContent: RenderContentFunction
|
||||
showCheckbox: boolean
|
||||
draggable: boolean
|
||||
allowDrag: AllowDragFunction
|
||||
allowDrop: AllowDropFunction
|
||||
props: TreeOptionProps
|
||||
lazy: boolean
|
||||
highlightCurrent: boolean
|
||||
load: LoadFunction
|
||||
filterNodeMethod: FilterNodeMethodFunction
|
||||
accordion: boolean
|
||||
indent: number
|
||||
iconClass: string
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ export default defineComponent({
|
||||
},
|
||||
beforeUpload: {
|
||||
type: Function as PropType<
|
||||
(file: File) => Promise<File | Blob> | boolean | unknown
|
||||
(file: File) => Promise<File | Blob> | boolean | unknown
|
||||
>,
|
||||
default: NOOP as (file: File) => void,
|
||||
},
|
||||
@ -113,7 +113,7 @@ export default defineComponent({
|
||||
},
|
||||
onRemove: {
|
||||
type: Function as PropType<
|
||||
(file: Nullable<FileList>, rawFile: ElFile) => void
|
||||
(file: Nullable<FileList>, rawFile: ElFile) => void
|
||||
>,
|
||||
default: NOOP as (file: Nullable<FileList>, rawFile: ElFile) => void,
|
||||
},
|
||||
@ -142,7 +142,7 @@ export default defineComponent({
|
||||
},
|
||||
onExceed: {
|
||||
type: Function as PropType<
|
||||
(files: FileList, fileList: UploadFile[]) => void
|
||||
(files: FileList, fileList: UploadFile[]) => void
|
||||
>,
|
||||
default: NOOP,
|
||||
},
|
||||
|
@ -10,11 +10,11 @@ import type { Nullable } from '@element-plus/utils/types'
|
||||
|
||||
type DocumentHandler = <T extends MouseEvent>(mouseup: T, mousedown: T) => void;
|
||||
type FlushList = Map<
|
||||
HTMLElement,
|
||||
{
|
||||
documentHandler: DocumentHandler
|
||||
bindingFn: (...args: unknown[]) => unknown
|
||||
}[]
|
||||
HTMLElement,
|
||||
{
|
||||
documentHandler: DocumentHandler
|
||||
bindingFn: (...args: unknown[]) => unknown
|
||||
}[]
|
||||
>;
|
||||
|
||||
const nodeList: FlushList = new Map()
|
||||
|
@ -25,7 +25,6 @@
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"gitHead": "c69724230befa8fede0e6b9c37fb0b7e39fd7cdd"
|
||||
|
@ -28,7 +28,6 @@
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"gitHead": "c69724230befa8fede0e6b9c37fb0b7e39fd7cdd"
|
||||
|
@ -59,8 +59,8 @@ export const useTargetEvents = (
|
||||
}
|
||||
|
||||
const triggerEventsMap: Partial<Record<
|
||||
TriggerType,
|
||||
(keyof PopperEvents)[]
|
||||
TriggerType,
|
||||
(keyof PopperEvents)[]
|
||||
>> = {
|
||||
click: ['onClick'],
|
||||
hover: ['onMouseenter', 'onMouseleave'],
|
||||
|
@ -23,7 +23,6 @@
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"gitHead": "c69724230befa8fede0e6b9c37fb0b7e39fd7cdd"
|
||||
|
@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'
|
||||
import { merge } from 'lodash'
|
||||
|
||||
const makeMount = <C,O, E>(element: C, defaultOptions: O) => {
|
||||
return (props: (E | O) | (E & O)= {} as E) => mount(element, merge({}, defaultOptions, props))
|
||||
return (props: (E | O) | (E & O) = {} as E) => mount(element, merge({}, defaultOptions, props))
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
@ -40,7 +40,6 @@
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-sass": "^5.0.0",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {},
|
||||
|
@ -27,7 +27,6 @@
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"gitHead": "c69724230befa8fede0e6b9c37fb0b7e39fd7cdd"
|
||||
|
@ -11,7 +11,7 @@ export const EVENT_CODE = {
|
||||
backspace: 'Backspace',
|
||||
}
|
||||
|
||||
const FOCUSABLE_ELEMENT_SELECTORS =`a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`
|
||||
const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`
|
||||
|
||||
/**
|
||||
* Determine if the testing element is visible on screen no matter if its on the viewport or not
|
||||
|
@ -20,7 +20,6 @@
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"sass": "^1.37.0",
|
||||
"ts-node": "^10.1.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"gitHead": "c69724230befa8fede0e6b9c37fb0b7e39fd7cdd"
|
||||
|
Loading…
Reference in New Issue
Block a user