Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade antd to v5.17.0 #4275

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"nwsapi": "2.2.7",
"antd": "5.12.8"
"antd": "5.17.0"
},
"config": {
"ghooks": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@nocobase/sdk": "1.0.0-alpha.11",
"@nocobase/utils": "1.0.0-alpha.11",
"ahooks": "^3.7.2",
"antd": "^5.12.8",
"antd": "^5.17.0",
"antd-style": "3.4.5",
"axios": "^0.26.1",
"bignumber.js": "^9.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('CollectionSelect', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
Expand All @@ -54,7 +54,7 @@ describe('CollectionSelect', () => {
role="button"
>
<div
class="css-1nrq807 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-wwtqkl"
class="css-1nrq807 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-2z7f8a"
>
<div
class="ant-formily-item-label"
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('CollectionSelect', () => {
class="ant-formily-item-control-content-component"
>
<div
class="ant-select css-dev-only-do-not-override-wwtqkl ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search"
class="ant-select ant-select-outlined css-dev-only-do-not-override-2z7f8a ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search"
data-testid="select-collection"
role="button"
>
Expand Down Expand Up @@ -182,7 +182,7 @@ describe('CollectionSelect', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
Expand All @@ -191,7 +191,7 @@ describe('CollectionSelect', () => {
role="button"
>
<div
class="css-1nrq807 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-wwtqkl"
class="css-1nrq807 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-2z7f8a"
>
<div
class="ant-formily-item-label"
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('CollectionSelect', () => {
>
<div>
<span
class="ant-tag css-dev-only-do-not-override-wwtqkl"
class="ant-tag css-dev-only-do-not-override-2z7f8a"
>
Users
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('ColorPicker', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
Expand All @@ -35,7 +35,7 @@ describe('ColorPicker', () => {
style="display: inline-block;"
>
<div
class="ant-color-picker-trigger css-dev-only-do-not-override-wwtqkl"
class="ant-color-picker-trigger css-dev-only-do-not-override-2z7f8a"
>
<div
class="ant-color-picker-color-block"
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('ColorPicker', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
Expand All @@ -99,7 +99,7 @@ describe('ColorPicker', () => {
role="button"
>
<div
class="ant-color-picker-trigger ant-color-picker-sm css-dev-only-do-not-override-wwtqkl ant-color-picker-trigger-disabled"
class="ant-color-picker-trigger ant-color-picker-sm css-dev-only-do-not-override-2z7f8a ant-color-picker-trigger-disabled"
>
<div
class="ant-color-picker-color-block"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

import { connect, mapProps, mapReadPretty } from '@formily/react';
import { DatePicker as AntdDatePicker, DatePickerProps as AntdDatePickerProps } from 'antd';
import React, { FC } from 'react';
import { RangePickerProps } from 'antd/es/date-picker';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ReadPretty, ReadPrettyComposed } from './ReadPretty';
import { getDateRanges, mapDatePicker, mapRangePicker } from './util';
import { RangePickerProps } from 'antd/es/date-picker';

interface IDatePickerProps {
utc?: boolean;
Expand All @@ -33,11 +33,7 @@ const DatePickerContext = React.createContext<IDatePickerProps>({ utc: true });
export const useDatePickerContext = () => React.useContext(DatePickerContext);
export const DatePickerProvider = DatePickerContext.Provider;

const InternalDatePicker: ComposedDatePicker = connect(
AntdDatePicker,
mapProps(mapDatePicker()),
mapReadPretty(ReadPretty.DatePicker),
);
const InternalDatePicker = connect(AntdDatePicker, mapProps(mapDatePicker()), mapReadPretty(ReadPretty.DatePicker));

const InternalRangePicker = connect(
AntdDatePicker.RangePicker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ describe('Pagination', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div>
<ul
class="ant-pagination css-dev-only-do-not-override-wwtqkl"
class="ant-pagination css-dev-only-do-not-override-2z7f8a"
>
<li
aria-disabled="true"
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('Pagination', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import { dayjsable, formatDayjsValue } from '@formily/antd-v5/esm/__builtins__';
import { connect, mapProps, mapReadPretty } from '@formily/react';
import dayjs from 'dayjs';
import { TimePicker as AntdTimePicker } from 'antd';
import { TimePickerProps as AntdTimePickerProps, TimeRangePickerProps } from 'antd/es/time-picker';
import dayjs from 'dayjs';
import { ReadPretty } from './ReadPretty';

type ComposedTimePicker = React.FC<AntdTimePickerProps> & {
Expand Down Expand Up @@ -39,7 +39,7 @@ export const TimePicker: ComposedTimePicker = connect(
AntdTimePicker,
mapProps(mapTimeFormat()),
mapReadPretty(ReadPretty),
);
) as ComposedTimePicker;

TimePicker.RangePicker = connect(AntdTimePicker.RangePicker, mapProps(mapTimeFormat()), mapReadPretty(ReadPretty));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ describe('UnixTimestamp', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
class="ant-picker css-dev-only-do-not-override-wwtqkl"
class="ant-picker ant-picker-outlined css-dev-only-do-not-override-2z7f8a"
>
<div
class="ant-picker-input"
>
<input
aria-invalid="false"
autocomplete="off"
placeholder="Select date"
readonly=""
size="12"
title=""
value=""
/>
<span
Expand Down Expand Up @@ -132,7 +131,7 @@ describe('UnixTimestamp', () => {
expect(container).toMatchInlineSnapshot(`
<div>
<div
class="css-dev-only-do-not-override-wwtqkl ant-app"
class="css-dev-only-do-not-override-2z7f8a ant-app"
style="height: 100%;"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export function Input(props: VariableInputProps) {
});

setOptions(options);
}, [scope, variable]);
}, [scope, variable]); // 这里补全依赖会导致死循环

const loadData = async (selectedOptions: DefaultOptionType[]) => {
const option = selectedOptions[selectedOptions.length - 1];
Expand Down Expand Up @@ -276,7 +276,7 @@ export function Input(props: VariableInputProps) {
error(err);
}
}
setOptions([...options]);

setVariableText([...labels]);
};

Expand Down Expand Up @@ -368,7 +368,7 @@ export function Input(props: VariableInputProps) {
)}
<Cascader
options={options}
value={variable ?? ['', ...(children || !constantOption.children?.length ? [] : [type])]}
value={variable ?? [null, ...(children || !constantOption.children?.length ? [] : [type])]}
onChange={onSwitch}
loadData={loadData as any}
changeOnSelect={changeOnSelect}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Demo = () => {
setTargetKeys(nextTargetKeys);
}}
onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
setSelectedKeys([...sourceSelectedKeys.map(String), ...targetSelectedKeys.map(String)]);
}}
onScroll={onScroll}
render={(item) => item.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Demo = () => {
setTargetKeys(nextTargetKeys);
}}
onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
setSelectedKeys([...sourceSelectedKeys.map(String), ...targetSelectedKeys.map(String)]);
}}
onScroll={onScroll}
render={(item) => item.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Demo = () => {
setTargetKeys(nextTargetKeys);
}}
onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
setSelectedKeys([...sourceSelectedKeys.map(String), ...targetSelectedKeys.map(String)]);
}}
onScroll={onScroll}
render={(item) => item.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Demo = () => {
setTargetKeys(nextTargetKeys);
}}
onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
setSelectedKeys([...sourceSelectedKeys.map(String), ...targetSelectedKeys.map(String)]);
}}
onScroll={onScroll}
render={(item) => item.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

import { faker } from '@faker-js/faker';
import {
CalculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
QueryRecordNode,
apiCreateWorkflow,
Expand Down