Skip to content
Draft
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"@dtinsight/dt-utils": "^1.3.1",
"@dtinsight/react-icons": "^1.0.0",
"@handsontable/react": "2.1.0",
"antd": "4.22.5",
"antd": "4.24.16",
"classnames": "^2.2.6",
"handsontable": "6.2.2",
"highlight.js": "^10.5.0",
Expand Down
3,281 changes: 1,742 additions & 1,539 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/catalogue/components/catalogue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface NormalCatalogueProps<U extends Record<string, any> = {}>
placeholder?: string;
loading?: boolean;
onCancelSave?: (item: ITreeNode<U>) => void;
overlay?: (item: ITreeNode<U>) => DropdownProps['overlay'];
overlay?: (item: ITreeNode<U>) => DropdownProps['dropdownRender'];
onSearch?: (value: string) => void;
onSave?: (data: ITreeNode<U>, value: string) => Promise<string | void>;
}
Expand Down Expand Up @@ -150,11 +150,11 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
}
activeKey={activeTabKey}
onChange={onTabChange}
>
{tabList?.map((tab: { key: string; title: React.ReactNode }) => (
<Tabs.TabPane tab={tab.title} key={tab.key} />
))}
</Tabs>
items={tabList?.map((tab: { key: string; title: React.ReactNode }) => ({
key: tab.key,
label: tab.title,
}))}
/>
);
};

Expand All @@ -177,7 +177,7 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
>
{overlay && (
<Dropdown
overlay={overlay(item)}
dropdownRender={overlay(item)}
placement="bottomRight"
arrow
destroyPopupOnHide
Expand Down
1 change: 1 addition & 0 deletions src/chat/__tests__/__snapshots__/input.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`Test Chat Input Match snapshot 1`] = `
>
<textarea
class="ant-input dtc__chat__textarea"
style="height: -28px; resize: none; min-height: -8px; max-height: -28px;"
/>
<span
class="dtc__icon dtc__chat__textarea__send"
Expand Down
8 changes: 2 additions & 6 deletions src/chat/demos/global-state/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export default function () {
});
}
};

return (
<>
<Tabs
Expand All @@ -112,11 +111,8 @@ export default function () {
remove(targetKey as string);
}
}}
>
{tabs.map((i) => (
<Tabs.TabPane tab={i.label} key={i.key} closable={tabs.length !== 1} />
))}
</Tabs>
items={tabs}
/>
<AI data={data} onSubmit={handleSubmit} />
</>
);
Expand Down
14 changes: 8 additions & 6 deletions src/collapsibleActionItems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ const CollapsibleActionItems: React.FC<ICollapsibleActionItems> = (props) => {
.map((item) => getActionItemNode(item, false));

// 折叠展示的下拉菜单
const dropdownMenu = isOverMaxCount ? (
<Menu data-testid="action-dropdown-menu" onClick={(info) => onItemClick?.(info.key)}>
{actionItems.slice(maxCount - 1).map((item) => getActionItemNode(item, true))}
</Menu>
) : null;
const dropdownMenu = isOverMaxCount
? () => (
<Menu data-testid="action-dropdown-menu" onClick={(info) => onItemClick?.(info.key)}>
{actionItems.slice(maxCount - 1).map((item) => getActionItemNode(item, true))}
</Menu>
)
: null;

return (
<div className={classNames('dtc-collapsibleActionItems', className)} style={style}>
Expand All @@ -86,7 +88,7 @@ const CollapsibleActionItems: React.FC<ICollapsibleActionItems> = (props) => {
})}
{dropdownMenu && (
<Dropdown
overlay={dropdownMenu}
dropdownRender={dropdownMenu}
getPopupContainer={(triggerNode) => triggerNode.parentElement ?? document.body}
{...dropdownProps}
>
Expand Down
4 changes: 2 additions & 2 deletions src/contextMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ContextMenu({
wrapperClassName,
...restProps
}: PropsWithChildren<IContextMenu>) {
const menu = (
const menu = () => (
<Menu
className="dtc-contextMenu-menu"
onClick={(item) => {
Expand All @@ -72,7 +72,7 @@ export default function ContextMenu({
if (!data.length) return <span className={wrapperClassName}>{children}</span>;

return (
<Dropdown overlay={menu} trigger={['contextMenu']} {...restProps}>
<Dropdown dropdownRender={menu} trigger={['contextMenu']} {...restProps}>
<span className={wrapperClassName}>{children}</span>
</Dropdown>
);
Expand Down
7 changes: 2 additions & 5 deletions src/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,8 @@ const Drawer = <T extends readOnlyTab>(props: DrawerProps<T>) => {
activeKey={currentKey}
onChange={handleChangeKey}
className={`${drawerPrefixCls}-tabs`}
>
{props.tabs?.map((tab: { key: string; title: React.ReactNode }) => (
<Tabs.TabPane tab={tab.title} key={tab.key} />
))}
</Tabs>
items={props.tabs?.map((tab) => ({ key: tab.key, label: tab.title }))}
/>
)}
<div
className={classNames(`${drawerPrefixCls}-body`, bodyClassName)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ exports[`Test Dropdown.Select Component Should match snapshot 1`] = `
aria-checked="mixed"
class="ant-checkbox-input"
type="checkbox"
value=""
/>
<span
class="ant-checkbox-inner"
Expand Down
8 changes: 4 additions & 4 deletions src/dropdown/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function Select({
!isEqual(options.map((i) => i.value).sort(), [...selected].sort()) &&
options.some((o) => selected.includes(o.value));

const overlay = (
const overlay = () => (
<>
<Row>
<Col span={24} className={`${prefix}__col`}>
Expand Down Expand Up @@ -183,12 +183,12 @@ export default function Select({

return (
<Dropdown
visible={visible}
open={visible}
overlayClassName={classNames(`${prefix}__container`, className)}
trigger={['click']}
overlay={overlay}
dropdownRender={overlay}
getPopupContainer={getPopupContainer}
onVisibleChange={(visible) => {
onOpenChange={(visible) => {
if (visible) {
setVisible(true);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/empty/__tests__/__snapshots__/empty.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports[`Empty match snapshots 1`] = `
<div
class="ant-empty-description"
>
No Data
No data
</div>
</div>
</DocumentFragment>
Expand All @@ -36,7 +36,7 @@ exports[`Empty match snapshots 2`] = `
<div
class="ant-empty-description"
>
No Data
No data
</div>
</div>
</DocumentFragment>
Expand Down
1 change: 1 addition & 0 deletions src/form/__tests__/__snapshots__/table.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ exports[`Test Form.Table Component Should match snapshot 1`] = `
class="ant-form-item-control-input-content"
>
<input
aria-required="true"
class="ant-input"
id="data_0_name"
placeholder="Name"
Expand Down
6 changes: 0 additions & 6 deletions src/modal/__tests__/__snapshots__/modal.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`Test Modal Component Should Match snapshot 1`] = `
style="height: auto; width: 520px;"
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down Expand Up @@ -101,7 +100,6 @@ exports[`Test Modal Component Should Match snapshot 1`] = `
</div>
</div>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down Expand Up @@ -131,7 +129,6 @@ exports[`Test Modal Component Should support banner Should match snapshot for dr
style="height: auto; width: 520px;"
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down Expand Up @@ -215,7 +212,6 @@ exports[`Test Modal Component Should support banner Should match snapshot for dr
</div>
</div>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down Expand Up @@ -245,7 +241,6 @@ exports[`Test Modal Component Should support banner Should match snapshot for re
style="height: 600px; width: 620px;"
>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down Expand Up @@ -348,7 +343,6 @@ exports[`Test Modal Component Should support banner Should match snapshot for re
class="dt-modal-resize-handle handle-se"
/>
<div
aria-hidden="true"
style="width: 0px; height: 0px; overflow: hidden; outline: none;"
tabindex="0"
/>
Expand Down
32 changes: 13 additions & 19 deletions src/modal/__tests__/modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Test Modal Component', () => {

it('Should Match snapshot', () => {
const { asFragment } = render(
<Modal visible title="title" getContainer={false}>
<Modal open title="title" getContainer={false}>
<div>test</div>
</Modal>
);
Expand All @@ -35,31 +35,31 @@ describe('Test Modal Component', () => {
it('Should get different size', () => {
// default size
const { container, rerender } = render(
<Modal visible title="title" getContainer={false}>
<Modal open title="title" getContainer={false}>
test
</Modal>
);
expect(modal.query(container)?.style.width).toBe('520px');

// small size
rerender(
<Modal visible title="title" getContainer={false} size="small">
<Modal open title="title" getContainer={false} size="small">
test
</Modal>
);
expect(modal.query(container)?.style.width).toBe('400px');

// middle size
rerender(
<Modal visible title="title" getContainer={false} size="middle">
<Modal open title="title" getContainer={false} size="middle">
test
</Modal>
);
expect(modal.query(container)?.style.width).toBe('640px');

// large size
rerender(
<Modal visible title="title" getContainer={false} size="large">
<Modal open title="title" getContainer={false} size="large">
test
</Modal>
);
Expand All @@ -69,7 +69,7 @@ describe('Test Modal Component', () => {
describe('Should support banner', () => {
it('Should support string banner', async () => {
const { getByText } = render(
<Modal visible title="title" getContainer={false} banner="banner">
<Modal open title="title" getContainer={false} banner="banner">
test
</Modal>
);
Expand All @@ -80,7 +80,7 @@ describe('Test Modal Component', () => {
it('Should support ReactNode', async () => {
const { getByTestId } = render(
<Modal
visible
open
title="title"
getContainer={false}
banner={<div data-testid="banner">xxxx</div>}
Expand All @@ -95,7 +95,7 @@ describe('Test Modal Component', () => {
it('Should support AlertProps', async () => {
const { container, getByText } = render(
<Modal
visible
open
title="title"
getContainer={false}
banner={{ message: 'banner', type: 'error' }}
Expand All @@ -110,13 +110,7 @@ describe('Test Modal Component', () => {

it('Should match snapshot for draggable modal', () => {
const { asFragment } = render(
<Modal
visible
title="title"
getContainer={false}
draggable
position={{ x: 0, y: 0 }}
>
<Modal open title="title" getContainer={false} draggable position={{ x: 0, y: 0 }}>
test
</Modal>
);
Expand All @@ -127,7 +121,7 @@ describe('Test Modal Component', () => {
const fn = jest.fn();
const { container } = render(
<Modal
visible
open
title="title"
getContainer={false}
draggable
Expand All @@ -150,7 +144,7 @@ describe('Test Modal Component', () => {
it('Should match snapshot for resizable modal', () => {
const { asFragment } = render(
<Modal
visible
open
title="title"
getContainer={false}
resizable
Expand All @@ -166,7 +160,7 @@ describe('Test Modal Component', () => {
const onRectChange = jest.fn();
const { container } = render(
<Modal
visible
open
title="title"
getContainer={false}
resizable
Expand All @@ -186,7 +180,7 @@ describe('Test Modal Component', () => {
const onPositionChange = jest.fn();
const { container } = render(
<Modal
visible
open
title="title"
getContainer={false}
resizable
Expand Down
2 changes: 1 addition & 1 deletion src/modal/demos/bannerProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function BannerProps() {
<>
<Modal
title="支持传 banner 的 Props 属性"
visible={visible}
open={visible}
banner={{
message: '模态框可以支持 banner 属性',
type: 'error',
Expand Down
2 changes: 1 addition & 1 deletion src/modal/demos/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function Basic() {
<>
<Modal
title="最大高度限制"
visible={visible}
open={visible}
onCancel={() => setVisible(false)}
onOk={() => setVisible(false)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/modal/demos/draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function Basic() {
}}
position={position}
onPositionChange={({ x, y }) => setPosition({ x, y })}
visible={visible}
open={visible}
onCancel={() => setVisible(false)}
onOk={() => setVisible(false)}
>
Expand Down
2 changes: 1 addition & 1 deletion src/modal/demos/resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Basic() {
<Resize onResize={() => setSize({ width: window.innerWidth, height: window.innerHeight })}>
<Modal
title="Resizable Modal"
visible={modal.visible}
open={modal.visible}
resizable={{
maxConstraints: [size.width - 40, size.height - 150],
}}
Expand Down
Loading
Loading