From a5df92aeb9fcd4c25d22a1d830b0d718f45c48ee Mon Sep 17 00:00:00 2001 From: ONLY-yours <1349021570@qq.com> Date: Thu, 31 Aug 2023 16:20:51 +0800 Subject: [PATCH 01/55] :sparkles: feat: TipGuide add controlled api --- src/TipGuide/demos/controlled.tsx | 37 ++++++++++++++ src/TipGuide/demos/footer.tsx | 42 ++++++++++++++++ src/TipGuide/demos/normal.tsx | 9 +--- src/TipGuide/index.md | 28 ++++++++--- src/TipGuide/index.tsx | 82 +++++++++++++++++++++---------- src/TipGuide/style.ts | 10 ++++ src/TipGuide/useTipGuide.ts | 27 ---------- 7 files changed, 166 insertions(+), 69 deletions(-) create mode 100644 src/TipGuide/demos/controlled.tsx create mode 100644 src/TipGuide/demos/footer.tsx delete mode 100644 src/TipGuide/useTipGuide.ts diff --git a/src/TipGuide/demos/controlled.tsx b/src/TipGuide/demos/controlled.tsx new file mode 100644 index 00000000..bacfc0cf --- /dev/null +++ b/src/TipGuide/demos/controlled.tsx @@ -0,0 +1,37 @@ +import { TipGuide } from '@ant-design/pro-editor'; + +import { Button, List, Space } from 'antd'; +import { useState } from 'react'; + +export default () => { + const guideKey = 'DEMO_KEY123'; + + const [open, setOpen] = useState(true); + + return ( + + + + + + + + ); +}; diff --git a/src/TipGuide/demos/footer.tsx b/src/TipGuide/demos/footer.tsx new file mode 100644 index 00000000..c29e72bd --- /dev/null +++ b/src/TipGuide/demos/footer.tsx @@ -0,0 +1,42 @@ +import { TipGuide } from '@ant-design/pro-editor'; + +import { Button, Space } from 'antd'; +import { useState } from 'react'; + +export default () => { + const guideKey = 'DEMO_KEY'; + const [open, setOpen] = useState(true); + + return ( + { + return ( + + + + + ); + }} + title={'This Is Footer Render Demo !'} + > + + + ); +}; diff --git a/src/TipGuide/demos/normal.tsx b/src/TipGuide/demos/normal.tsx index c9066b6b..6c6376fc 100644 --- a/src/TipGuide/demos/normal.tsx +++ b/src/TipGuide/demos/normal.tsx @@ -12,14 +12,7 @@ export default () => { '道可道,非常道;名可名,非常名。无名天地之始,有名万物之母。故常无欲,以观其妙;常有欲,以观其徼(jiào)。此两者同出而异名,同谓之玄,玄之又玄,众妙之门。' } > - + ); }; diff --git a/src/TipGuide/index.md b/src/TipGuide/index.md index f4239cf6..40272d1f 100644 --- a/src/TipGuide/index.md +++ b/src/TipGuide/index.md @@ -18,6 +18,16 @@ group: 基础组件 +### 受控 + +使用 open 进行受控 + + + +### 自定义 footer + + + ### 偏移 可以通过 `offsetY` 将引导点进行垂直方向偏移。 @@ -26,10 +36,14 @@ group: 基础组件 ## API -| 参数 | 说明 | 类型 | 默认值 | -| :-------- | :----------------------------- | :-------------------------- | :------- | -| title | 引导标题 | `string` | - | -| placement | ToolTip 位置 | `TooltipProps['placement']` | 'bottom' | -| offsetY | 纵向偏移值 | number | - | -| maxWidth | 最大宽度 | number | 300 | -| guideKey | 最用于持久化该引导值状态, 必填 | string | - | +| 参数 | 说明 | 类型 | 默认值 | +| :----------- | :---------------------------------- | :---------------------------------------- | :------- | +| title | 引导标题 | `string` | - | +| placement | ToolTip 位置 | `TooltipProps['placement']` | 'bottom' | +| offsetY | 纵向偏移值 | number | - | +| maxWidth | 最大宽度 | number | 300 | +| guideKey | 最用于持久化该引导值状态, 必填 | string | - | +| open | 受控的 open 属性 | boolean | - | +| onOpenChange | 当 open 属性变化时候的触发 | (open: boolean) => void | - | +| defaultOpen | 默认时候的打开状态 | boolean | - | +| footerRender | 用于自定义 footer 部分的 render api | (dom: React.ReactNode) => React.ReactNode | - | diff --git a/src/TipGuide/index.tsx b/src/TipGuide/index.tsx index 641de19b..bb6da0e9 100644 --- a/src/TipGuide/index.tsx +++ b/src/TipGuide/index.tsx @@ -1,12 +1,11 @@ import type { TooltipProps } from 'antd'; -import { Badge, Button, Checkbox, Popover } from 'antd'; -import type { FC, ReactNode } from 'react'; +import { Badge, Button, Popover } from 'antd'; +import useMergedState from 'rc-util/lib/hooks/useMergedState'; +import { type FC, type ReactNode } from 'react'; import { Flexbox } from 'react-layout-kit'; - import { ConfigProvider } from '../ConfigProvider'; import { getPrefixCls, useToken } from '../theme'; import { useStyle } from './style'; -import { useTipGuide } from './useTipGuide'; export interface TipGuideProps { /** @@ -45,6 +44,22 @@ export interface TipGuideProps { * 类名 */ className?: string; + /** + * 受控的 open 属性 + */ + open?: boolean; + /** + * 当 open 属性变化时候的触发 + */ + onOpenChange?: (open: boolean) => void; + /** + * 默认时候的打开状态 + */ + defaultOpen?: boolean; + /** + * 用于自定义 footer 部分的 render api + */ + footerRender?: (dom: React.ReactNode) => React.ReactNode; } const TipGuide: FC = ({ @@ -57,13 +72,39 @@ const TipGuide: FC = ({ className, style, guideKey, + defaultOpen = true, + open: outOpen, + onOpenChange = () => {}, + footerRender, }) => { const prefixCls = getPrefixCls('tip-guide', customPrefixCls); - - const { noLongerShow, toggleChecked, closeGuide, visible, checked } = - useTipGuide(guideKey); const token = useToken(); const { styles, cx } = useStyle(prefixCls); + const [open, setOpen] = useMergedState(defaultOpen, { + value: outOpen, + onChange: onOpenChange, + }); + + const FooterDom = () => { + const defalutFooter = ( +
+ +
+ ); + if (footerRender) { + return footerRender(defalutFooter); + } + + return defalutFooter; + }; return ( = ({ Button: { colorPrimary: token['blue-7'] }, }} > - {noLongerShow || !visible ? ( - <>{children} - ) : ( -
+ {open ? ( +
{children}
= ({ }} >
{title}
- - - 不再显示 - - + + } @@ -121,6 +147,8 @@ const TipGuide: FC = ({
+ ) : ( + <>{children} )} ); diff --git a/src/TipGuide/style.ts b/src/TipGuide/style.ts index 984d7948..170fca72 100644 --- a/src/TipGuide/style.ts +++ b/src/TipGuide/style.ts @@ -1,6 +1,8 @@ import { createStyles } from '../theme'; export const useStyle = createStyles(({ css, cx }, prefixCls: string) => { + console.log('prefixCls', prefixCls); + return { container: cx( prefixCls, @@ -9,6 +11,14 @@ export const useStyle = createStyles(({ css, cx }, prefixCls: string) => { width: fit-content; `, ), + footer: cx( + `${prefixCls}-footer`, + css` + width: 100%; + display: flex; + justify-content: end; + `, + ), tip: cx( `${prefixCls}-tip`, css` diff --git a/src/TipGuide/useTipGuide.ts b/src/TipGuide/useTipGuide.ts deleted file mode 100644 index 93984384..00000000 --- a/src/TipGuide/useTipGuide.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { useLocalStorageState } from 'ahooks'; -import type { CheckboxChangeEvent } from 'antd/es/checkbox'; -import { useCallback, useState } from 'react'; - -export const useTipGuide = (guideKey: string) => { - const [visible, setVisible] = useState(true); - const [checked, setChecked] = useState(true); - - const [noLongerShow, setNoLongerShow] = useLocalStorageState(guideKey, { - defaultValue: false, - }); - - const closeGuide = useCallback(() => { - setVisible(false); - - if (checked) { - setNoLongerShow(true); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [checked]); - - const toggleChecked = useCallback((e: CheckboxChangeEvent) => { - setChecked(e.target.checked); - }, []); - - return { visible, noLongerShow, closeGuide, toggleChecked, checked }; -}; From 1a0685900bb45b713459544baf93007ce10bbc18 Mon Sep 17 00:00:00 2001 From: ONLY-yours <1349021570@qq.com> Date: Thu, 31 Aug 2023 16:45:48 +0800 Subject: [PATCH 02/55] :camera_flash: feat: update snapshot --- tests/__snapshots__/demo.test.tsx.snap | 177 ++++++++++++++++++++++++- 1 file changed, 176 insertions(+), 1 deletion(-) diff --git a/tests/__snapshots__/demo.test.tsx.snap b/tests/__snapshots__/demo.test.tsx.snap index 1d9876c3..62fecf89 100644 --- a/tests/__snapshots__/demo.test.tsx.snap +++ b/tests/__snapshots__/demo.test.tsx.snap @@ -32553,6 +32553,181 @@ exports[` > renders sortableRule.tsx correctly 1`] = `
`; +exports[` > renders controlled.tsx correctly 1`] = ` +.emotion-0 { + position: relative; + width: -webkit-fit-content; + width: -moz-fit-content; + width: fit-content; +} + +.emotion-1 { + position: absolute; + left: 50%; + -webkit-transform: translate(-50%); + -moz-transform: translate(-50%); + -ms-transform: translate(-50%); + transform: translate(-50%); +} + +
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+ + + + + + + + + +
+
+ No data +
+
+
+
+
+
+
+ + + +
+
+
+
+
+`; + +exports[` > renders footer.tsx correctly 1`] = ` +.emotion-0 { + position: relative; + width: -webkit-fit-content; + width: -moz-fit-content; + width: fit-content; +} + +.emotion-1 { + position: absolute; + left: 50%; + -webkit-transform: translate(-50%); + -moz-transform: translate(-50%); + -ms-transform: translate(-50%); + transform: translate(-50%); +} + +
+
+ +
+ + + +
+
+
+`; + exports[` > renders normal.tsx correctly 1`] = ` .emotion-0 { position: relative; @@ -32579,7 +32754,7 @@ exports[` > renders normal.tsx correctly 1`] = ` type="button" > - 清理引导缓存 + Button
Date: Thu, 31 Aug 2023 16:56:29 +0800 Subject: [PATCH 03/55] :package: feat: add rc-utils --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index f4a9cc27..11432f73 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "mockjs": "^1.1.0", "polished": "^4.2.2", "prettier": "^2.8.8", + "rc-util": "^5.37.0", "re-resizable": "^6.9.11", "react-colorful": "^5.6.1", "react-copy-to-clipboard": "^5.1.0", From f69815b8a3a537301d51bd89b6052b19f7f40492 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 31 Aug 2023 09:19:20 +0000 Subject: [PATCH 04/55] :bookmark: chore(release): v0.17.0 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [Version 0.17.0](https://github.com/ant-design/pro-editor/compare/v0.16.0...v0.17.0) Released on **2023-08-31** #### ✨ 新特性 - Add rc-utils, TipGuide add controlled api, update snapshot. #### 🐛 修复 - Merge main.
Improvements and Fixes #### What's improved * Add rc-utils ([d89f716](https://github.com/ant-design/pro-editor/commit/d89f716)) * TipGuide add controlled api ([a5df92a](https://github.com/ant-design/pro-editor/commit/a5df92a)) * Update snapshot ([1a06859](https://github.com/ant-design/pro-editor/commit/1a06859)) #### What's fixed * Merge main ([808ff09](https://github.com/ant-design/pro-editor/commit/808ff09))
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
--- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fcbf83b..85fa8130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,40 @@ # Changelog +## [Version 0.17.0](https://github.com/ant-design/pro-editor/compare/v0.16.0...v0.17.0) + +Released on **2023-08-31** + +#### ✨ 新特性 + +- Add rc-utils, TipGuide add controlled api, update snapshot. + +#### 🐛 修复 + +- Merge main. + +
+ +
+Improvements and Fixes + +#### What's improved + +- Add rc-utils ([d89f716](https://github.com/ant-design/pro-editor/commit/d89f716)) +- TipGuide add controlled api ([a5df92a](https://github.com/ant-design/pro-editor/commit/a5df92a)) +- Update snapshot ([1a06859](https://github.com/ant-design/pro-editor/commit/1a06859)) + +#### What's fixed + +- Merge main ([808ff09](https://github.com/ant-design/pro-editor/commit/808ff09)) + +
+ +
+ +[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) + +
+ ## [Version 0.16.0](https://github.com/ant-design/pro-editor/compare/v0.15.0...v0.16.0) Released on **2023-08-31** diff --git a/package.json b/package.json index 11432f73..6124a329 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ant-design/pro-editor", - "version": "0.16.0", + "version": "0.17.0", "description": "🌟 Lightweight Editor UI Framework", "homepage": "https://github.com/ant-design/pro-editor", "bugs": { From 1c2f206b26cbd115c69ef40e2aac8a7c438a840a Mon Sep 17 00:00:00 2001 From: ONLY-yours <1349021570@qq.com> Date: Thu, 31 Aug 2023 20:46:33 +0800 Subject: [PATCH 05/55] :sparkles: feat: delete tipGuide key & add some demo --- src/TipGuide/demos/controlled.tsx | 9 +--- src/TipGuide/demos/footer.tsx | 2 - src/TipGuide/demos/localStorage.tsx | 65 +++++++++++++++++++++++++++++ src/TipGuide/demos/normal.tsx | 3 -- src/TipGuide/demos/offset.tsx | 13 +----- src/TipGuide/index.md | 5 ++- src/TipGuide/index.tsx | 7 +--- 7 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 src/TipGuide/demos/localStorage.tsx diff --git a/src/TipGuide/demos/controlled.tsx b/src/TipGuide/demos/controlled.tsx index bacfc0cf..8291d0fe 100644 --- a/src/TipGuide/demos/controlled.tsx +++ b/src/TipGuide/demos/controlled.tsx @@ -4,8 +4,6 @@ import { Button, List, Space } from 'antd'; import { useState } from 'react'; export default () => { - const guideKey = 'DEMO_KEY123'; - const [open, setOpen] = useState(true); return ( @@ -24,12 +22,7 @@ export default () => { > Close - + diff --git a/src/TipGuide/demos/footer.tsx b/src/TipGuide/demos/footer.tsx index c29e72bd..80cd8a75 100644 --- a/src/TipGuide/demos/footer.tsx +++ b/src/TipGuide/demos/footer.tsx @@ -4,12 +4,10 @@ import { Button, Space } from 'antd'; import { useState } from 'react'; export default () => { - const guideKey = 'DEMO_KEY'; const [open, setOpen] = useState(true); return ( { diff --git a/src/TipGuide/demos/localStorage.tsx b/src/TipGuide/demos/localStorage.tsx new file mode 100644 index 00000000..cfe156c2 --- /dev/null +++ b/src/TipGuide/demos/localStorage.tsx @@ -0,0 +1,65 @@ +import { TipGuide } from '@ant-design/pro-editor'; + +import { Button, Checkbox, List, Space, message } from 'antd'; +import { useState } from 'react'; + +export default () => { + const [messageApi, contextHolder] = message.useMessage(); + const [open, setOpen] = useState(localStorage.getItem('tip-guide-key') ? false : true); + const [checked, setChecked] = useState(true); + + return ( + + {contextHolder} + + { + if (checked) { + localStorage.setItem('tip-guide-key', `${checked}`); + } + setOpen(e); + }} + footerRender={(dom) => { + return ( + + { + setChecked(e.target.value); + }} + checked={checked} + > + 不再显示 + + {dom} + + ); + }} + > + + + + ); +}; diff --git a/src/TipGuide/demos/normal.tsx b/src/TipGuide/demos/normal.tsx index 6c6376fc..4f8a51f9 100644 --- a/src/TipGuide/demos/normal.tsx +++ b/src/TipGuide/demos/normal.tsx @@ -3,11 +3,8 @@ import { TipGuide } from '@ant-design/pro-editor'; import { Button } from 'antd'; export default () => { - const guideKey = 'DEMO_KEY'; - return ( { - const guideKey = 'DEMO_KEY_2'; - return ( - - + + ); }; diff --git a/src/TipGuide/index.md b/src/TipGuide/index.md index 40272d1f..6053548c 100644 --- a/src/TipGuide/index.md +++ b/src/TipGuide/index.md @@ -28,6 +28,10 @@ group: 基础组件 +你还可以通过自定义和受控的方式使用 localStorage 来在业务中使用。 + + + ### 偏移 可以通过 `offsetY` 将引导点进行垂直方向偏移。 @@ -42,7 +46,6 @@ group: 基础组件 | placement | ToolTip 位置 | `TooltipProps['placement']` | 'bottom' | | offsetY | 纵向偏移值 | number | - | | maxWidth | 最大宽度 | number | 300 | -| guideKey | 最用于持久化该引导值状态, 必填 | string | - | | open | 受控的 open 属性 | boolean | - | | onOpenChange | 当 open 属性变化时候的触发 | (open: boolean) => void | - | | defaultOpen | 默认时候的打开状态 | boolean | - | diff --git a/src/TipGuide/index.tsx b/src/TipGuide/index.tsx index bb6da0e9..dde188dd 100644 --- a/src/TipGuide/index.tsx +++ b/src/TipGuide/index.tsx @@ -24,10 +24,6 @@ export interface TipGuideProps { * 最大宽度 */ maxWidth?: number; - /** - * 用于持久化该引导值状态 - */ - guideKey: string; /** * 引导内容 */ @@ -71,7 +67,6 @@ const TipGuide: FC = ({ prefixCls: customPrefixCls, className, style, - guideKey, defaultOpen = true, open: outOpen, onOpenChange = () => {}, @@ -118,7 +113,7 @@ const TipGuide: FC = ({ }} > {open ? ( -
+
{children}
Date: Thu, 31 Aug 2023 20:21:47 +0800 Subject: [PATCH 06/55] :bug: fix: defautl getId --- package.json | 1 + src/SortableList/components/Item/index.tsx | 10 +++------ src/SortableList/demos/getId.tsx | 22 +++++++++++++----- src/SortableList/index.md | 26 +++++++++++----------- src/SortableList/store/initialState.ts | 5 +++-- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 6124a329..14095df8 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "lodash.unionby": "^4.8.0", "lodash.uniq": "^4.5.0", "mockjs": "^1.1.0", + "object-hash": "^3.0.0", "polished": "^4.2.2", "prettier": "^2.8.8", "rc-util": "^5.37.0", diff --git a/src/SortableList/components/Item/index.tsx b/src/SortableList/components/Item/index.tsx index 09c7c504..6a41d8e5 100644 --- a/src/SortableList/components/Item/index.tsx +++ b/src/SortableList/components/Item/index.tsx @@ -117,13 +117,9 @@ const Item = memo( {...listeners} /> ) : null} - {renderContent ? ( - renderContent(item, index) - ) : ( - - {id} - - )} + + {renderContent ? renderContent(item, index) : id} + { const token = useTheme(); return ( item.dataIndex} onChange={(value) => { console.log('value', value); }} /> + 当值相同且未指定 id 时无法正常排序 + item.text} + onChange={(value) => { + console.log('value', value); + }} + /> ); }; diff --git a/src/SortableList/index.md b/src/SortableList/index.md index 2fdcf7a7..4f0beff2 100644 --- a/src/SortableList/index.md +++ b/src/SortableList/index.md @@ -31,19 +31,19 @@ demo: ### Basic 组件属性 -| 属性名 | 类型 | 描述 | -| ------------------ | ---------------------------------------------------------------- | ----------------------------------------------------------------------- | -| value | `SortableItem[]` | 值 | -| initialValues | `T[]` | 初始值 | -| onChange | `(value: T[], event: ListDataDispatchPayload) => void` | 值变化 | -| renderContent | `(item: T, index: number) => ReactNode` | 自定义可排序列表项内容 | -| getId | `(item: T, index: number) => string\|number` | 自定义获取 `id` 规则,默认获取数据中的 `id`值,如果没有传则使用 `index` | -| renderItem | `(item: T, options) => ReactNode` | 自定义可排序列表项 | -| getItemStyle | `(status: GetItemStylesArgs) => ReactNode` | 自定义容器样式 | -| ref | `ForwardedRef>` | 对外部暴露方法 | -| hideRemove | `boolean` | 是否隐藏删除按钮,默认为 false | -| creatorButtonProps | `CreatorButtonProps\|false` | 新建对象相关属性 | -| actions | `(item: T, index: number) => ReactNode[]` \| `React.ReactNode[]` | 除列表自带操作之外的其他操作自渲染 | +| 属性名 | 类型 | 描述 | +| ------------------ | ---------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| value | `SortableItem[]` | 值 | +| initialValues | `T[]` | 初始值 | +| onChange | `(value: T[], event: ListDataDispatchPayload) => void` | 值变化 | +| renderContent | `(item: T, index: number) => ReactNode` | 自定义可排序列表项内容 | +| getId | `(item: T, index: number) => string\|number` | 自定义获取 `id` 规则,默认获取数据中的 `id` 值或计算 item `sha1` 但无法保证唯一性 | +| renderItem | `(item: T, options) => ReactNode` | 自定义可排序列表项 | +| getItemStyle | `(status: GetItemStylesArgs) => ReactNode` | 自定义容器样式 | +| ref | `ForwardedRef>` | 对外部暴露方法 | +| hideRemove | `boolean` | 是否隐藏删除按钮,默认为 false | +| creatorButtonProps | `CreatorButtonProps\|false` | 新建对象相关属性 | +| actions | `(item: T, index: number) => ReactNode[]` \| `React.ReactNode[]` | 除列表自带操作之外的其他操作自渲染 | ### CreatorButtonProps 创建按钮属性 diff --git a/src/SortableList/store/initialState.ts b/src/SortableList/store/initialState.ts index 575ee7ba..7f8b516e 100644 --- a/src/SortableList/store/initialState.ts +++ b/src/SortableList/store/initialState.ts @@ -1,3 +1,4 @@ +import hash from 'object-hash'; import { SortableItem, SortableListState } from '../type'; export const initialState: SortableListState = { @@ -7,9 +8,9 @@ export const initialState: SortableListState = { onChange: undefined, renderItem: undefined, actions: [], - // 默认从 id 中取,如果没有 id 则取 index + // 默认从 id 中取,如果没有 id 则使用 hash 生成,无法保证唯一性 getId: (item: SortableItem, index: number) => { - return item?.id || index; + return item?.id || `${hash(item)}-${index}`; }, getItemStyles: () => ({}), }; From 8e0b23784516b357188ec0285d7d06dcd8119075 Mon Sep 17 00:00:00 2001 From: rdmclin2 Date: Fri, 1 Sep 2023 11:21:22 +0800 Subject: [PATCH 07/55] :bug: chore: merge creatorButtonProps --- src/ColumnList/ColumnList.tsx | 86 +++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/src/ColumnList/ColumnList.tsx b/src/ColumnList/ColumnList.tsx index 80d997db..7889daac 100644 --- a/src/ColumnList/ColumnList.tsx +++ b/src/ColumnList/ColumnList.tsx @@ -20,41 +20,59 @@ export interface ColumnListProps const ColumnList: (props: ColumnListProps) => ReactNode = forwardRef< SortableListRef, ColumnListProps ->(({ prefixCls: customPrefixCls, className, columns, actions, hideRemove, ...props }, ref) => { - const prefixCls = getPrefixCls('column-list', customPrefixCls); - const { cx } = useStyle(prefixCls); +>( + ( + { + prefixCls: customPrefixCls, + className, + columns, + actions, + hideRemove, + creatorButtonProps, + ...props + }, + ref, + ) => { + const prefixCls = getPrefixCls('column-list', customPrefixCls); + const { cx } = useStyle(prefixCls); - const renderItem = useCallback( - (item, { index, listeners }) => ( - - ), - [prefixCls, columns], - ); + const renderItem = useCallback( + (item, { index, listeners }) => ( + + ), + [prefixCls, columns], + ); - return ( - <> -
- ({ - id: genUniqueId('column-list'), - }), - }} - {...props} - /> - - ); -}); + return ( + <> +
+ ({ + id: genUniqueId('column-list'), + }), + ...creatorButtonProps, + } + } + {...props} + /> + + ); + }, +); export default ColumnList; From 2cb1d0e5c3dc9f0a9b504b043103131c3683f4a9 Mon Sep 17 00:00:00 2001 From: rdmclin2 Date: Fri, 1 Sep 2023 11:28:06 +0800 Subject: [PATCH 08/55] :camera_flash: chore: update snapshot --- tests/__snapshots__/demo.test.tsx.snap | 2046 ++++++++++++++---------- 1 file changed, 1180 insertions(+), 866 deletions(-) diff --git a/tests/__snapshots__/demo.test.tsx.snap b/tests/__snapshots__/demo.test.tsx.snap index 62fecf89..cb02547d 100644 --- a/tests/__snapshots__/demo.test.tsx.snap +++ b/tests/__snapshots__/demo.test.tsx.snap @@ -21788,7 +21788,7 @@ exports[` > renders Basic.tsx correctly 1`] = ` style="--index: 0;" >
> renders Basic.tsx correctly 1`] = ` style="--index: 1;" >
> renders Basic.tsx correctly 1`] = `
- -
-
+ +
+
- - - - - 文本 - -
-
- +
- -
-
-
- - - - - 下拉框 - -
-
+
+
- - + + + 下拉框 + +
+ - +
- -
-
+ +
+
- - - - - 圆形序号 - -
-
- +
- -
-
+ +
+
- - - - - 文本 - -
-
- +
- -
-
+ +
+
- - - - - 下拉框 - -
-
- +