Skip to content

Commit

Permalink
test(comp:*): resovle overlay warnings and stepper snapshots (#1402)
Browse files Browse the repository at this point in the history
* test(comp:*): resovle overlay warnings and stepper snapshots

* style: update with style lint
  • Loading branch information
danranVm committed Jan 12, 2023
1 parent aa90a7e commit 5d604f9
Show file tree
Hide file tree
Showing 80 changed files with 98 additions and 96 deletions.
6 changes: 3 additions & 3 deletions packages/cdk/drag-drop/src/composables/useDraggable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import type { DnDEventName, DnDEventType, DnDPosition, DraggableOptions } from '../types'
import type { DnDContext } from './useDragDropContext'
import type { DnDEventName, DnDEventType, DnDPosition, DraggableOptions } from '../types'

import { type ComputedRef, computed, ref, watch } from 'vue'

import { type MaybeElementRef, convertElement, tryOnScopeDispose, useEventListener } from '@idux/cdk/utils'

import { DnDState } from '../state'
import { extraMove, initContext, reMoveElement } from '../utils'
import { withBoundary } from './withBoundary'
import { withDragFree } from './withDragFree'
import { withDragHandle } from './withDragHandle'
import { DnDState } from '../state'
import { extraMove, initContext, reMoveElement } from '../utils'

/**
* make a element draggable
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/drag-drop/src/composables/useDroppable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { watch } from 'vue'

import { type MaybeElementRef, convertElement, tryOnScopeDispose } from '@idux/cdk/utils'

import { initContext } from '../utils'
import { type DnDContext } from './useDragDropContext'
import { initContext } from '../utils'

/**
* make a element droppable as a container and accept draggable element
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/drag-drop/src/composables/withBoundary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { LockAxisType } from '../types'
import { type DnDContext } from './useDragDropContext'
import { LockAxisType } from '../types'

export const withBoundary = (
sourceEl: HTMLElement,
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/drag-drop/src/composables/withDragFree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import type { DnDEventType } from '../types'

import { moveElement } from '../utils'
import { type DnDContext } from './useDragDropContext'
import { moveElement } from '../utils'

export const withDragFree = (sourceEl: HTMLElement, context: DnDContext): void => {
const registry = context.registry
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/drag-drop/src/draggable/Draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { computed, defineComponent, normalizeClass, reactive, ref } from 'vue'

import { callEmit } from '@idux/cdk/utils'

import { useDraggable } from '../composables/useDraggable'
import { draggableProps } from './types'
import { useDraggable } from '../composables/useDraggable'

const style = {
width: 'fit-content',
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/forms/src/models/formArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { type ComputedRef, computed, watch, watchEffect } from 'vue'

import { type AsyncValidatorFn, type ValidateStatus, type ValidatorFn, type ValidatorOptions } from '../types'
import { AbstractControl } from './abstractControl'
import { type AsyncValidatorFn, type ValidateStatus, type ValidatorFn, type ValidatorOptions } from '../types'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class FormArray<T = any> extends AbstractControl<T[]> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/forms/src/models/formControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { watch } from 'vue'

import { type AsyncValidatorFn, type ValidatorFn, type ValidatorOptions } from '../types'
import { AbstractControl } from './abstractControl'
import { type AsyncValidatorFn, type ValidatorFn, type ValidatorOptions } from '../types'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class FormControl<T = any> extends AbstractControl<T> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/forms/src/models/formGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { watch, watchEffect } from 'vue'

import { hasOwnProperty } from '@idux/cdk/utils'

import { type AsyncValidatorFn, type ValidateStatus, type ValidatorFn, type ValidatorOptions } from '../types'
import { AbstractControl, type GroupControls, type OptionalKeys } from './abstractControl'
import { type AsyncValidatorFn, type ValidateStatus, type ValidatorFn, type ValidatorOptions } from '../types'

export class FormGroup<T extends object = object> extends AbstractControl<T> {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/scroll/src/strategy/blockScrollStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { addClass, removeClass } from '@idux/cdk/utils'

import { getScrollBarSize } from '../utils'
import { ScrollStrategy } from './scrollStrategy'
import { getScrollBarSize } from '../utils'

export interface BlockScrollStrategyOptions {
target?: HTMLElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import type { VirtualScrollProps } from '../types'
import type { GetKey } from './useGetKey'
import type { VirtualScrollProps } from '../types'
import type { VKey } from '@idux/cdk/utils'
import type { ComputedRef, Ref } from 'vue'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type { ComputedRef, VNode } from 'vue'

import { computed, defineComponent, inject } from 'vue'

import { datePanelToken } from '../token'
import PanelRow from './PanelRow'
import { datePanelToken } from '../token'

export default defineComponent({
setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import { computed, defineComponent, inject } from 'vue'

import PanelCell from './PanelCell'
import { datePanelToken } from '../token'
import { panelRowProps } from '../types'
import PanelCell from './PanelCell'

interface TbodyCell {
key: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Overlay', () => {
const OverlayMount = (options?: MountingOptions<Partial<OverlayProps>>) => {
const { props, ...rest } = options || {}
return mount(Overlay, {
props: { container: () => '.ix-overlay-container', ...props },
props: { container: () => '.ix-overlay-container', containerFallback: '.ix-overlay-container', ...props },
...rest,
} as MountingOptions<OverlayProps>)
}
Expand All @@ -26,7 +26,10 @@ describe('Overlay', () => {
document.querySelector('.ix-overlay-container')!.innerHTML = ''
})

renderWork<OverlayProps>(Overlay, { props: { container: () => '.ix-overlay-container', visible: true }, slots })
renderWork<OverlayProps>(Overlay, {
props: { container: () => '.ix-overlay-container', containerFallback: '.ix-overlay-container', visible: true },
slots,
})

test('visible work', async () => {
const onUpdateVisible = vi.fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { type ComputedRef, type Ref, computed } from 'vue'

import { type VKey, useState } from '@idux/cdk/utils'

import { type CascaderProps } from '../types'
import { type MergedData } from './useDataSource'
import { type CascaderProps } from '../types'

export interface ActiveStateContext {
activeKey: Ref<VKey | undefined>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { isNil } from 'lodash-es'
import { type VKey, callEmit, useControlledProp } from '@idux/cdk/utils'
import { type GetKeyFn } from '@idux/components/utils'

import { type MergedData, convertMergedData, convertMergedDataMap } from './useDataSource'
import { type CascaderData, type CascaderProps } from '../types'
import { callChange, getParentKeys } from '../utils'
import { type MergedData, convertMergedData, convertMergedDataMap } from './useDataSource'

export interface ExpandableContext {
expandedKeys: ComputedRef<VKey[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { isFunction } from 'lodash-es'

import { NoopArray, type VKey } from '@idux/cdk/utils'

import { type CascaderData, type CascaderProps, type CascaderSearchFn } from '../types'
import { type MergedData } from './useDataSource'
import { type CascaderData, type CascaderProps, type CascaderSearchFn } from '../types'

export interface SearchableContext {
searchedData: ComputedRef<MergedData[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { type FormAccessor } from '@idux/cdk/forms'
import { NoopArray, type VKey, callEmit, convertArray } from '@idux/cdk/utils'
import { useGlobalConfig } from '@idux/components/config'

import { type MergedData } from './useDataSource'
import { type CascaderProps, type CascaderStrategy } from '../types'
import { getChildrenKeys, getParentKeys } from '../utils'
import { type MergedData } from './useDataSource'

export interface SelectedStateContext {
selectedKeys: ComputedRef<VKey[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { type VNode, computed, defineComponent, inject, watch } from 'vue'
import { type VKey, callEmit } from '@idux/cdk/utils'
import { ɵInput } from '@idux/components/_private/input'

import { cascaderToken } from '../token'
import OverlayOptionGroup from './OverlayOptionGroup'
import { cascaderToken } from '../token'

export default defineComponent({
setup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { type PropType, type VNode, computed, defineComponent, inject, normalize
import { CdkVirtualScroll, type VirtualItemRenderFn } from '@idux/cdk/scroll'
import { ɵEmpty } from '@idux/components/_private/empty'

import OverlayOption from './OverlayOption'
import { type MergedData } from '../composables/useDataSource'
import { cascaderToken } from '../token'
import OverlayOption from './OverlayOption'

export default defineComponent({
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { type ComputedRef, type Ref, watch } from 'vue'
import { useState } from '@idux/cdk/utils'
import { type DateConfig } from '@idux/components/config'

import { applyDateTime, convertToDate, isSameDateTime } from '../utils'
import { type FormatContext } from './useFormat'
import { type InputEnableStatus } from './useInputEnableStatus'
import { applyDateTime, convertToDate, isSameDateTime } from '../utils'

export interface PickerControlContext {
inputValue: ComputedRef<string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import type { DatePickerProps, DateRangePickerProps } from '../types'
import type { PickerControlContext } from './useControl'
import type { PickerRangeControlContext } from './useRangeControl'
import type { DatePickerProps, DateRangePickerProps } from '../types'
import type { ComputedRef } from 'vue'

import { onMounted, watch } from 'vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { type ComputedRef, type Ref, computed, watch } from 'vue'
import { convertArray, useState } from '@idux/cdk/utils'
import { type DateConfig } from '@idux/components/config'

import { compareDateTime, convertToDate, sortRangeValue } from '../utils'
import { type PickerControlContext, useControl } from './useControl'
import { type FormatContext } from './useFormat'
import { type InputEnableStatus } from './useInputEnableStatus'
import { compareDateTime, convertToDate, sortRangeValue } from '../utils'

export interface PickerRangeControlContext {
buffer: ComputedRef<(Date | undefined)[] | undefined>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/form/src/composables/useFormItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { type VKey, hasOwnProperty } from '@idux/cdk/utils'
import { useGlobalConfig } from '@idux/components/config'
import { type Locale } from '@idux/components/locales'

import { useFormStatus } from './public'
import { FORM_ITEM_TOKEN } from '../token'
import { type FormItemProps } from '../types'
import { useFormStatus } from './public'

export function useFormItem(props: FormItemProps): {
status: ComputedRef<ValidateStatus | undefined>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/menu/src/contents/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { isString } from 'lodash-es'

import { useKey } from '@idux/components/utils'

import { coverIcon } from './Utils'
import { usePaddingLeft } from '../composables/usePaddingLeft'
import { menuItemGroupToken, menuSubToken, menuToken } from '../token'
import { menuItemProps } from '../types'
import { coverIcon } from './Utils'

export default defineComponent({
name: 'MenuItem',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/menu/src/contents/MenuItemGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { isString } from 'lodash-es'

import { useKey } from '@idux/components/utils'

import { coverChildren, coverIcon } from './Utils'
import { usePaddingLeft } from '../composables/usePaddingLeft'
import { menuItemGroupToken, menuSubToken, menuToken } from '../token'
import { menuItemGroupProps } from '../types'
import { coverChildren, coverIcon } from './Utils'

export default defineComponent({
name: 'MenuItemGroup',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/menu/src/contents/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { Logger } from '@idux/cdk/utils'
import { IxIcon } from '@idux/components/icon'
import { type GetKeyFn } from '@idux/components/utils'

import { type MenuData } from '../types'
import MenuDivider from './MenuDivider'
import MenuItem from './MenuItem'
import MenuItemGroup from './MenuItemGroup'
import MenuSub from './menu-sub/MenuSub'
import { type MenuData } from '../types'

export function coverChildren(data: MenuData[] | undefined, getKetFn: GetKeyFn): VNode[] {
if (!data || data.length === 0) {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/menu/src/contents/menu-sub/MenuSub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import { ɵOverlay } from '@idux/components/_private/overlay'
import { useGlobalConfig } from '@idux/components/config'
import { useKey } from '@idux/components/utils'

import { usePaddingLeft } from '../../composables/usePaddingLeft'
import { type MenuSubContext, menuItemGroupToken, menuSubToken, menuToken } from '../../token'
import { type MenuData, type MenuProps, type MenuSubProps, menuSubProps } from '../../types'
import InlineContent from './InlineContent'
import Label from './Label'
import OverlayContent from './OverlayContent'
import { usePaddingLeft } from '../../composables/usePaddingLeft'
import { type MenuSubContext, menuItemGroupToken, menuSubToken, menuToken } from '../../token'
import { type MenuData, type MenuProps, type MenuSubProps, menuSubProps } from '../../types'

export default defineComponent({
name: 'MenuSub',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/select/src/composables/useOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { isFunction, isNil } from 'lodash-es'

import { type VKey, flattenNode } from '@idux/cdk/utils'

import { GetKeyFn } from './useGetOptionKey'
import { optionGroupKey, optionKey } from '../option'
import { generateOption } from '../utils/generateOption'
import { GetKeyFn } from './useGetOptionKey'

export interface FlattenedOption {
key: VKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { type ComputedRef, computed, toRaw } from 'vue'
import { type FormAccessor } from '@idux/cdk/forms'
import { type VKey, callEmit, convertArray } from '@idux/cdk/utils'

import { type FlattenedOption } from './useOptions'
import { type SelectProps } from '../types'
import { generateOption } from '../utils/generateOption'
import { type FlattenedOption } from './useOptions'

export interface SelectedStateContext {
selectedValue: ComputedRef<VKey[]>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/select/src/panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import { callEmit } from '@idux/cdk/utils'
import { ɵEmpty } from '@idux/components/_private/empty'
import { type SelectConfig, useGlobalConfig } from '@idux/components/config'

import ListBox from './ListBox'
import Option from './Option'
import OptionGroup from './OptionGroup'
import { usePanelGetOptionKey } from '../composables/useGetOptionKey'
import { useFlattenedOptions } from '../composables/useOptions'
import { usePanelActiveState } from '../composables/usePanelActiveState'
import { useSelectedState } from '../composables/usePanelSelectedState'
import { SELECT_PANEL_DATA_TOKEN, selectPanelContext } from '../token'
import { type SelectPanelProps, selectPanelProps } from '../types'
import ListBox from './ListBox'
import Option from './Option'
import OptionGroup from './OptionGroup'

export default defineComponent({
name: 'IxSelectPanel',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/stepper/demo/Dot.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<IxStepper :activeKey="2" :dot="true" labelPlacement="bottom">
<IxStepper :activeKey="2" :dot="true">
<IxStepperItem title="Finished" description="This is a description."></IxStepperItem>
<IxStepperItem title="In Progress" description="This is a description."></IxStepperItem>
<IxStepperItem title="Waiting" description="This is a description."></IxStepperItem>
Expand Down
3 changes: 1 addition & 2 deletions packages/components/stepper/src/StepperItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default defineComponent({
const classes = computed(() => {
const prefixCls = mergedPrefixCls.value
const { disabled, icon } = props
const { dot, labelPlacement } = parentProps
const { dot } = parentProps

return normalizeClass({
[prefixCls]: true,
Expand All @@ -56,7 +56,6 @@ export default defineComponent({
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-with-icon`]: icon || !!slots.icon,
[`${prefixCls}-dot`]: dot,
[`${prefixCls}-label-${labelPlacement}`]: true,
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/components/table/src/composables/useDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { type ComputedRef, type Ref, computed } from 'vue'
import { type VKey } from '@idux/cdk/utils'
import { type GetKeyFn } from '@idux/components/utils'

import { type TablePagination, type TableProps } from '../types'
import { type ActiveFilter } from './useFilterable'
import { type ActiveSorter } from './useSortable'
import { type TablePagination, type TableProps } from '../types'

export function useDataSource(
props: TableProps,
Expand Down
Loading

0 comments on commit 5d604f9

Please sign in to comment.