Skip to content

Commit

Permalink
Merge branch 'main' into alpha
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	package.json
  • Loading branch information
arvinxx committed Sep 14, 2023
2 parents d32b12c + c7973e0 commit 99cc3c5
Show file tree
Hide file tree
Showing 40 changed files with 2,040 additions and 4,324 deletions.
126 changes: 122 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,126 @@
# Changelog

## [Version 0.19.0-alpha.1](https://github.com/ant-design/pro-editor/compare/v0.18.1...v0.19.0-alpha.1)
### [Version 0.20.2](https://github.com/ant-design/pro-editor/compare/v0.20.1...v0.20.2)

<sup>Released on **2023-09-05**</sup>
<sup>Released on **2023-09-13**</sup>

#### 🐛 修复

- 修复 crypto.randomUUID 在 http 中无法使用的问题.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- 修复 crypto.randomUUID 在 http 中无法使用的问题 ([a2ec772](https://github.com/ant-design/pro-editor/commit/a2ec772))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version&nbsp;0.20.1](https://github.com/ant-design/pro-editor/compare/v0.20.0...v0.20.1)

<sup>Released on **2023-09-12**</sup>

#### 🐛 修复

- Lock version.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- Lock version ([b503ce6](https://github.com/ant-design/pro-editor/commit/b503ce6))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

## [Version&nbsp;0.20.0](https://github.com/ant-design/pro-editor/compare/v0.19.1...v0.20.0)

<sup>Released on **2023-09-08**</sup>

#### ✨ 新特性

- Add keyManager list, 默认渲染 string list.

#### 🐛 修复

- Columnlist blur not change.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's improved

- Add keyManager list ([1337802](https://github.com/ant-design/pro-editor/commit/1337802))
- 默认渲染 string list ([1f87b03](https://github.com/ant-design/pro-editor/commit/1f87b03))

#### What's fixed

- Columnlist blur not change ([353134f](https://github.com/ant-design/pro-editor/commit/353134f))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version&nbsp;0.19.1](https://github.com/ant-design/pro-editor/compare/v0.19.0...v0.19.1)

<sup>Released on **2023-09-07**</sup>

#### 🐛 修复

- ColumnList id lost, 修复文档样式显示异常.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- ColumnList id lost ([955e838](https://github.com/ant-design/pro-editor/commit/955e838))
- 修复文档样式显示异常 ([bfa84fc](https://github.com/ant-design/pro-editor/commit/bfa84fc))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

## [Version&nbsp;0.19.0](https://github.com/ant-design/pro-editor/compare/v0.18.1...v0.19.0)

<sup>Released on **2023-09-06**</sup>

#### ✨ 新特性

- Undo/redo Middleware.
- Support renderEmpty and add sotrablelist custom create demo.

#### 🐛 修复

- 默认不提供 creatorButtonProps.

<br/>

Expand All @@ -15,7 +129,11 @@

#### What's improved

- Undo/redo Middleware, closes [#74](https://github.com/ant-design/pro-editor/issues/74) ([7699738](https://github.com/ant-design/pro-editor/commit/7699738))
- Support renderEmpty and add sotrablelist custom create demo ([d0629c6](https://github.com/ant-design/pro-editor/commit/d0629c6))

#### What's fixed

- 默认不提供 creatorButtonProps ([bfc2f6d](https://github.com/ant-design/pro-editor/commit/bfc2f6d))

</details>

Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ant-design/pro-editor",
"version": "0.19.0-alpha.1",
"version": "0.20.2",
"description": "🌟 Lightweight Editor UI Framework",
"homepage": "https://github.com/ant-design/pro-editor",
"bugs": {
Expand Down Expand Up @@ -34,6 +34,7 @@
"prepublishOnly": "father doctor && npm run build",
"release": "semantic-release",
"start": "npm run dev",
"sync": "tnpm sync @ant-design/pro-editor",
"test": "vitest",
"test:coverage": "vitest run --coverage",
"test:update": "vitest -u",
Expand All @@ -58,7 +59,7 @@
},
"dependencies": {
"@ant-design/icons": "^5.2.5",
"@ant-design/pro-components": "^2.6.16",
"@ant-design/pro-components": "^2.6.15",
"@antv/dw-random": "^1.1.7",
"@babel/runtime": "^7.22.11",
"@dnd-kit/core": "^6.0.8",
Expand All @@ -69,7 +70,7 @@
"@emotion/styled": "^11.11.0",
"@faker-js/faker": "^7.6.0",
"@floating-ui/react": "^0.24.8",
"@mui/material": "^5.14.7",
"@mui/material": "^5.14.6",
"@textea/json-viewer": "^3.1.1",
"ahooks": "^3.7.8",
"classnames": "^2.3.2",
Expand All @@ -93,7 +94,7 @@
"lodash.unionby": "^4.8.0",
"lodash.uniq": "^4.5.0",
"mockjs": "^1.1.0",
"object-hash": "^3.0.0",
"nanoid": "^5.0.1",
"polished": "^4.2.2",
"prettier": "^2.8.8",
"rc-util": "^5.37.0",
Expand All @@ -116,14 +117,14 @@
},
"devDependencies": {
"@emotion/jest": "^11.11.0",
"@testing-library/jest-dom": "^6.1.2",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/color": "^3.0.3",
"@types/json-schema": "^7.0.12",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@umijs/lint": "^4.0.79",
"@umijs/lint": "^4.0.78",
"@vitest/coverage-v8": "latest",
"antd": "^5.8.5",
"antd-style": "^3.4.4",
Expand All @@ -134,9 +135,9 @@
"dumi": "^2.2.7",
"dumi-theme-antd-style": "latest",
"eslint": "^8.48.0",
"father": "^4.3.1",
"father": "4.3.1",
"gh-pages": "^5.0.0",
"glob": "^10.3.4",
"glob": "^10.3.3",
"husky": "^8.0.3",
"jsdom": "^22.1.0",
"lint-staged": "^13.3.0",
Expand All @@ -150,7 +151,7 @@
"semantic-release": "^21.1.1",
"semantic-release-config-gitmoji": "^1.5.3",
"stylelint": "^15.10.3",
"typescript": "^5.2.2",
"typescript": "~5.1.6",
"vitest": "latest",
"wait-on": "^6.0.1",
"y-protocols": "^1.0.5",
Expand Down
7 changes: 4 additions & 3 deletions src/ColumnList/ColumnItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
ColumnItemList,
DeleteAction,
HandleAction,
SortableItem,
useSortableList,
} from '@ant-design/pro-editor';
import { createStyles } from 'antd-style';
Expand Down Expand Up @@ -69,9 +68,10 @@ const useStyle = createStyles(({ css, cx }, prefixCls) => {
};
});

interface ItemRenderProps<T extends SortableItem = SortableItem> {
interface ItemRenderProps<T = any> {
columns: ColumnItemList<T>;
item: T;
dragging: boolean;
index: number;
prefixCls: string;
listeners: any;
Expand All @@ -80,7 +80,7 @@ interface ItemRenderProps<T extends SortableItem = SortableItem> {
}

const ColumnItem = memo<ItemRenderProps>(
({ item, index, prefixCls, columns, listeners, actions, hideRemove }) => {
({ item, index, prefixCls, columns, listeners, actions, hideRemove, dragging }) => {
const { styles } = useStyle(prefixCls);
const instance = useSortableList();
return (
Expand All @@ -101,6 +101,7 @@ const ColumnItem = memo<ItemRenderProps>(
value: item[col.dataIndex],
id: item.id,
index,
dragging,
prefixCls,
style,
placeholder: col.placeholder,
Expand Down
89 changes: 32 additions & 57 deletions src/ColumnList/ColumnList.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
SortableItem,
SortableList,
SortableListProps,
SortableListRef,
genUniqueId,
getPrefixCls,
} from '@ant-design/pro-editor';
import { ReactNode, forwardRef, useCallback } from 'react';
Expand All @@ -12,67 +10,44 @@ import { Header } from './Header';
import { useStyle } from './style';
import { ColumnItemList } from './types';

export interface ColumnListProps<T extends SortableItem = SortableItem>
extends SortableListProps<T> {
export interface ColumnListProps<T = any> extends SortableListProps<T> {
columns: ColumnItemList<T>;
}

const ColumnList: <T extends SortableItem>(props: ColumnListProps<T>) => ReactNode = forwardRef<
const ColumnList: <T>(props: ColumnListProps<T>) => ReactNode = forwardRef<
SortableListRef,
ColumnListProps
>(
(
{
prefixCls: customPrefixCls,
className,
columns,
actions,
hideRemove,
creatorButtonProps,
...props
},
ref,
) => {
const prefixCls = getPrefixCls('column-list', customPrefixCls);
const { cx } = useStyle(prefixCls);
>(({ prefixCls: customPrefixCls, className, columns, actions, hideRemove, ...props }, ref) => {
const prefixCls = getPrefixCls('column-list', customPrefixCls);
const { cx } = useStyle(prefixCls);

const renderItem = useCallback(
(item, { index, listeners }) => (
<ColumnItem
columns={columns}
item={item}
listeners={listeners}
index={index}
prefixCls={prefixCls}
actions={typeof actions === 'function' ? actions(item, index) : actions}
hideRemove={hideRemove}
/>
),
[prefixCls, columns],
);
const renderItem = useCallback(
(item, { index, listeners, dragging }) => (
<ColumnItem
columns={columns}
item={item}
dragging={dragging}
listeners={listeners}
index={index}
prefixCls={prefixCls}
actions={typeof actions === 'function' ? actions(item, index) : actions}
hideRemove={hideRemove}
/>
),
[prefixCls, columns],
);

return (
<>
<Header prefixCls={prefixCls} columns={columns} />
<SortableList
ref={ref}
renderItem={renderItem}
className={cx(prefixCls, className)}
creatorButtonProps={
creatorButtonProps === false
? false
: {
record: () => ({
id: genUniqueId('column-list'),
}),
...creatorButtonProps,
}
}
{...props}
/>
</>
);
},
);
return (
<>
<Header prefixCls={prefixCls} columns={columns} />
<SortableList
ref={ref}
renderItem={renderItem}
className={cx(prefixCls, className)}
{...props}
/>
</>
);
});

export default ColumnList;
Loading

0 comments on commit 99cc3c5

Please sign in to comment.