Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/utils/src/catalogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const catalogs = {
sortablejs: '^1.15.0',
tinycolor2: '^1.6.0',
validator: '^13.9.0',
vue: '^3.3.9',
vue: '^3.5.0',
'vue-router': '^4.2.4',
},
docs: {
Expand Down
2 changes: 1 addition & 1 deletion packages/common
4 changes: 4 additions & 0 deletions packages/components/affix/__tests__/affix.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ describe('Affix', () => {

it('Test get container', async () => {
await nextTick();

/* @ts-ignore */
expect(affixRef.scrollContainer).toBe(wrapper.vm.container());
});
// 模拟 affixWrap 的位置
Expand All @@ -110,6 +112,8 @@ describe('Affix', () => {

it('Test the scrolling state', async () => {
// 模拟容器滚动

/* @ts-ignore */
wrapper.vm.container().dispatchEvent(new CustomEvent('scroll'));
expect(wrapper.find('.t-affix').classes()).toContain('t-affix');
});
Expand Down
2 changes: 1 addition & 1 deletion packages/components/affix/affix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineComponent({
const COMPONENT_NAME = usePrefixClass('affix');
const renderTNodeJSX = useTNodeJSX();

const affixWrapRef = ref<HTMLElement>(null);
const affixWrapRef = ref(null);
const affixRef = ref<HTMLElement>(null);
const placeholderEL = ref(document?.createElement('div')); // 占位节点
const ticking = ref(false);
Expand Down
4 changes: 2 additions & 2 deletions packages/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export default defineComponent({

const renderIconTNode = useIcon();
// alert的dom引用
const alertRef = ref<HTMLElement | null>(null);
const alertRef = ref<HTMLElement>();
// description的dom引用
const descriptionRef = ref<HTMLElement | null>(null);
const descriptionRef = ref<HTMLElement>();
// desc高度
const descHeight = ref(0);
// 是否可见,关闭后置为false
Expand Down
1 change: 1 addition & 0 deletions packages/components/anchor/anchor-target.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default defineComponent({
const className = [`${COMPONENT_NAME.value}__target`];
const iconClassName = `${classPrefix.value}-copy`;
return (
// @ts-expect-error
<TAG id={id} class={className}>
{children && children(null)}
<Popup content={globalConfig.value.copyText} placement="top" showArrow class={iconClassName}>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/anchor/anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineComponent({
const anchorRef = ref<HTMLElement | null>(null);
const links = ref<string[]>([]);
const active = ref('');
const scrollContainer = ref<ANCHOR_CONTAINER>(null);
const scrollContainer = ref<ANCHOR_CONTAINER>();
const handleScrollLock = ref<boolean>(false);
const activeLineStyle = reactive({});
const COMPONENT_NAME = usePrefixClass('anchor');
Expand Down
1 change: 1 addition & 0 deletions packages/components/avatar/__tests__/avatar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('Avatar', () => {
describe('props', () => {
let wrapper: VueWrapper<InstanceType<typeof Avatar>> | null = null;
beforeEach(() => {
// @ts-ignore TODO
wrapper = mount(<Avatar>Avatar</Avatar>) as VueWrapper<InstanceType<typeof Avatar>>;
});

Expand Down
1 change: 1 addition & 0 deletions packages/components/breadcrumb/breadcrumb-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default defineComponent({
});

const handleClick = () => {
// @ts-ignore
const router = props.router || proxy.$router;

if (props.to && router) {
Expand Down
1 change: 0 additions & 1 deletion packages/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ export default defineComponent({
<div class={cls.controlSectionCell.value}>
<TCheckTag
class={cls.controlTag.value}
theme={state.isShowWeekend ? 'default' : 'primary'}
size="large"
{...weekendBtn.vBind.value}
disabled={weekendBtn.isDisabled.value}
Expand Down
4 changes: 1 addition & 3 deletions packages/components/cascader/cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ export default defineComponent({
return renderTNodeJSX('suffixIcon');
}

const { visible, disabled } = cascaderContext.value;
const { visible } = cascaderContext.value;
return (
<FakeArrow
overlayClassName={getFakeArrowIconClass(classPrefix.value, STATUS.value, cascaderContext.value)}
isActive={visible}
disabled={disabled}
/>
);
};
Expand Down Expand Up @@ -188,7 +187,6 @@ export default defineComponent({
<Panel
option={props.option}
empty={props.empty}
visible={visible}
trigger={props.trigger}
loading={props.loading}
loadingText={props.loadingText}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/color-picker/color-picker-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export default defineComponent({
setup(props, { attrs }) {
const newProps = computed(() => pickBy({ ...props, ...attrs }, (v) => v !== undefined));
const prefix = usePrefixClass();
return () => <ColorPanel {...newProps.value} popupProps={null} class={`${prefix.value}-is-inline`} />;
return () => <ColorPanel {...newProps.value} class={`${prefix.value}-is-inline`} />;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineComponent({
props: baseProps,
setup(props) {
const baseClassName = useBaseClassName();
const refPanel = ref<HTMLElement>(null);
const refPanel = ref<HTMLElement>();
const refThumb = ref<HTMLElement>(null);
const dragInstance = ref<Draggable>(null);
const panelRect = reactive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineComponent({
},
setup(props) {
const baseClassName = useBaseClassName();
const refPanel = ref<HTMLElement>(null);
const refPanel = ref<HTMLElement>();
const refThumb = ref<HTMLElement>(null);
const dragInstance = ref<Draggable>(null);
const panelRect = reactive({
Expand Down
1 change: 0 additions & 1 deletion packages/components/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ export default defineComponent({
}
popupVisible={!isReadOnly.value && popupVisible.value}
valueDisplay={() => renderTNodeJSX('valueDisplay', { params: valueDisplayParams.value })}
needConfirm={props.needConfirm}
{...(props.selectInputProps as TdDatePickerProps['selectInputProps'])}
panel={() => <TSinglePanel {...panelProps.value} />}
tagInputProps={{
Expand Down
4 changes: 2 additions & 2 deletions packages/components/empty/empty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useConfig, useTNodeJSX, usePrefixClass, useCommonClassName } from '@tde

import props from './props';
import type { TdEmptyProps } from './type';
import Image from '../image';
import Image, { ImageProps } from '../image';
import MaintenanceSvg from './components/MaintenanceSvg';
import NetworkErrorSvg from './components/NetworkErrorSvg';
import EmptySvg from './components/EmptySvg';
Expand Down Expand Up @@ -80,7 +80,7 @@ export default defineComponent({
} else if (data && Reflect.has(data, 'setup')) {
result = h(data as unknown);
} else if (isPlainObject(data)) {
result = <Image {...data} />;
result = <Image {...(data as ImageProps)} />;
}

return data ? result : null;
Expand Down
22 changes: 11 additions & 11 deletions packages/components/form/__tests__/form-item.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('FormItem', () => {
const wrapper = mount(
<Form>
<FormItem label="label" name="name" for="name">
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -22,7 +22,7 @@ describe('FormItem', () => {
const wrapper = mount(
<Form>
<FormItem label="label" name="name" help="help text">
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -33,7 +33,7 @@ describe('FormItem', () => {
const wrapperSlot = mount(
<Form>
<FormItem label="label" name="name" v-slots={{ help: () => 'help text' }}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -43,7 +43,7 @@ describe('FormItem', () => {
const wrapperFunction = mount(
<Form>
<FormItem label="label" name="name" help={renderHelp}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -54,7 +54,7 @@ describe('FormItem', () => {
const wrapper = mount(
<Form>
<FormItem label="label" name="name">
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -65,7 +65,7 @@ describe('FormItem', () => {
const wrapperSlot = mount(
<Form>
<FormItem name="name" v-slots={{ label: () => 'label' }}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -75,7 +75,7 @@ describe('FormItem', () => {
const wrapperFunction = mount(
<Form>
<FormItem name="name" label={renderHelp}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -85,7 +85,7 @@ describe('FormItem', () => {
it('labelAlign[string]', () => {
const formItemWrapper = mount(
<FormItem label="label" name="name">
<Input id="name" />
<Input />
</FormItem>,
);

Expand All @@ -99,7 +99,7 @@ describe('FormItem', () => {
mount(
<Form label-align="right">
<FormItem label="label" name="name" labelAlign={align}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -114,7 +114,7 @@ describe('FormItem', () => {
mount(
<Form label-width="100px">
<FormItem label="label" name="name" labelWidth={labelWidth}>
<Input id="name" />
<Input />
</FormItem>
</Form>,
);
Expand All @@ -134,7 +134,7 @@ describe('FormItem', () => {
return () => (
<Form rules={rules}>
<FormItem label="label" name="name">
<Input id="name" />
<Input />
</FormItem>
</Form>
);
Expand Down
4 changes: 4 additions & 0 deletions packages/components/form/__tests__/form.hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('Form hooks', () => {
const wrapper = mount(TestComponent, {
props: { disabled: true },
});
// @ts-ignore: TODO
expect(wrapper.vm.disabledState).toBe(true);
});

Expand All @@ -32,6 +33,7 @@ describe('Form hooks', () => {
},
},
});
// @ts-ignore: TODO
expect(wrapper.vm.disabledState).toBe(true);
});

Expand All @@ -49,6 +51,7 @@ describe('Form hooks', () => {
return { disabledState };
},
});
// @ts-ignore: TODO
expect(wrapper.vm.disabledState).toBe(true);
});

Expand All @@ -66,6 +69,7 @@ describe('Form hooks', () => {
return { disabledState };
},
});
// @ts-ignore: TODO
expect(wrapper.vm.disabledState).toBe(false);
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/components/form/__tests__/form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Form', () => {
describe('props', () => {
let wrapper: VueWrapper<InstanceType<typeof Form>> | null = null;
beforeEach(() => {
// @ts-ignore
wrapper = mount(
<Form>
<FormItem label="姓名" name="name">
Expand Down
2 changes: 1 addition & 1 deletion packages/components/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default defineComponent({
readonly,
});

const formRef = ref<HTMLFormElement>(null);
const formRef = ref<HTMLFormElement>();
const children = ref<FormItemContext[]>([]);

const {
Expand Down
14 changes: 9 additions & 5 deletions packages/components/grid/col.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, defineComponent, inject } from 'vue';
import { computed, defineComponent, inject, h } from 'vue';
import props from './col-props';
import { useRowSize } from './hooks';
import { RowProviderType, parseFlex, calcColPadding, getColClasses } from './utils';
Expand Down Expand Up @@ -31,10 +31,14 @@ export default defineComponent({

return () => {
const { tag: TAG } = props;
return (
<TAG class={colClasses.value} style={colStyle.value}>
{renderTNodeJSX('default')}
</TAG>

return h(
TAG,
{
class: colClasses.value,
style: colStyle.value,
},
[renderTNodeJSX('default')],
);
};
},
Expand Down
13 changes: 8 additions & 5 deletions packages/components/grid/row.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineComponent, provide, computed, toRefs, reactive } from 'vue';
import { defineComponent, provide, computed, toRefs, reactive, h } from 'vue';
import props from './row-props';
import { useRowSize } from './hooks';
import { getRowClasses, RowProviderType, calcRowStyle } from './utils';
Expand Down Expand Up @@ -27,10 +27,13 @@ export default defineComponent({

return () => {
const { tag: TAG } = props;
return (
<TAG class={rowClasses.value} style={rowStyle.value}>
{renderTNodeJSX('default')}
</TAG>
return h(
TAG,
{
class: rowClasses.value,
style: rowStyle.value,
},
[renderTNodeJSX('default')],
);
};
},
Expand Down
2 changes: 1 addition & 1 deletion packages/components/guide/guide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default defineComponent({
// dialog ref
const dialogTooltipRef = ref<HTMLElement>();
// ! popup ref 不确定这里的类型是否完全正确
const popupTooltipRef = ref<InstanceType<typeof Popup>>();
const popupTooltipRef = ref();
// 是否开始展示
const actived = ref<boolean>(false);
// 步骤总数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export default defineComponent({
<TImageViewerIcon icon={() => <ZoomOutIcon size="medium" />} onClick={props.onZoomOut} />
<TImageViewerIcon
class={`${classPrefix.value}-image-viewer__utils-scale`}
size="medium"
label={`${largeNumberToFixed(String(props.scale * 100))}%`}
/>

Expand Down
1 change: 0 additions & 1 deletion packages/components/image-viewer/image-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
setIndexValue(newIndex >= images.value.length ? indexValue.value : newIndex, { trigger: 'next' });
};

const onImgClick = (i: number) => {

Check warning on line 88 in packages/components/image-viewer/image-viewer.tsx

View workflow job for this annotation

GitHub Actions / lint

'onImgClick' is assigned a value but never used. Allowed unused vars must match /^_/u
setIndexValue(i, { trigger: 'current' });
};

Expand Down Expand Up @@ -188,7 +188,6 @@
src={image.thumbnail || image.mainImage}
error=""
class={`${COMPONENT_NAME.value}__header-img`}
onClick={() => onImgClick(index)}
/>
</div>
))}
Expand Down
4 changes: 2 additions & 2 deletions packages/components/image/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export default defineComponent({
name: 'TImage',
props,
setup(props) {
const divRef = ref<HTMLElement>(null);
const imgRef = ref<HTMLImageElement>(null);
const divRef = ref<HTMLElement>();
const imgRef = ref<HTMLImageElement>();
let io: IntersectionObserver = null;

const { src } = toRefs(props);
Expand Down
Loading
Loading