Compare commits

...

4 Commits

Author SHA1 Message Date
wwsun 82bc5db4d8 chore(release): publish
- @music163/tango-context@1.1.5
 - @music163/tango-core@1.3.3
 - @music163/tango-designer@1.3.3
 - @music163/tango-sandbox@1.0.8
 - @music163/tango-setting-form@1.2.8
 - @music163/tango-ui@1.3.3
2024-07-12 13:51:34 +08:00
Wells 85c053b3db fix: update designer config (#186)
* docs: add section to generate local https ca

* fix: support disable format code

* fix: disable autoRemoveUnusedImports in CodeEditor

* fix: update toggle view setting
2024-07-12 10:52:12 +08:00
wwsun 32f5667cae docs: update readme 2024-07-03 15:44:25 +08:00
Wells 1d0fb4f274 fix: selection bug without prototype & update ToggleButton style (#180)
* fix: update toggleButton arrow style

* fix: check if prototype exists in selection tool

* fix: update state tree data
2024-06-26 16:54:38 +08:00
26 changed files with 210 additions and 190 deletions
+1
View File
@@ -9,3 +9,4 @@ coverage/
.umi-production/ .umi-production/
.log .log
.eslintcache .eslintcache
*.pem
+22 -5
View File
@@ -35,13 +35,13 @@ You can view the detailed usage guide through the following links:
You can use tango to build lowcode builders, for example: You can use tango to build lowcode builders, for example:
| Preview | Description | | Preview | Description |
|---------|-------------------------| | ---------------------------------------------------------------------------------------------- | ----------------------- |
| ![image](https://github.com/NetEase/tango/assets/6984035/56a71741-4536-4336-803a-d81d51128a76) | Internal App Builder | | ![image](https://github.com/NetEase/tango/assets/6984035/56a71741-4536-4336-803a-d81d51128a76) | Internal App Builder |
| ![image](https://github.com/NetEase/tango/assets/6984035/7f817e59-f7aa-4476-bc29-ac3e33fadbf7) | Dashboard App Builder | | ![dashboard app](public/dashboard-builder.png) | Dashboard App Builder |
| ![image](https://github.com/NetEase/tango/assets/6984035/790d88e1-d716-4f99-868a-31dda25e9fb1) | Mobile App Builder | | ![image](https://github.com/NetEase/tango/assets/6984035/790d88e1-d716-4f99-868a-31dda25e9fb1) | Mobile App Builder |
| ![rn app](public/rn-builder.png) | ReactNative App Builder | | ![rn app](public/rn-builder.png) | ReactNative App Builder |
| ![mail app](public/mail-builder.png) | Email Builder | | ![mail app](public/mail-builder.png) | Email Builder |
## 🌐 Compatibility ## 🌐 Compatibility
@@ -70,6 +70,23 @@ yarn
yarn start yarn start
``` ```
### Local Https certificate
If you need to use https in the local development environment, you can use the following command to generate a certificate:
```bash
brew install mkcert
# install the local certificate
mkcert -install
# enter the playground app directory
cd apps/playground
# generate a certificate
mkcert local.netease.com # or change to your own domain name
```
## 💬 Community ## 💬 Community
Join NetEase Tango Community to share your ideas, suggestions, or questions and connect with other users and contributors. Join NetEase Tango Community to share your ideas, suggestions, or questions and connect with other users and contributors.
+24 -8
View File
@@ -35,14 +35,13 @@
你可以使用 Tango 快速构建多种类型的基于源码的低代码搭建工具,例如: 你可以使用 Tango 快速构建多种类型的基于源码的低代码搭建工具,例如:
| 预览图 | 说明 | | 预览图 | 说明 |
|---------|-------------------------| | ---------------------------------------------------------------------------------------------- | -------------------- |
| ![image](https://github.com/NetEase/tango/assets/6984035/56a71741-4536-4336-803a-d81d51128a76) | 中后台系统搭建 | | ![image](https://github.com/NetEase/tango/assets/6984035/56a71741-4536-4336-803a-d81d51128a76) | 中后台系统搭建 |
| ![image](https://github.com/NetEase/tango/assets/6984035/7f817e59-f7aa-4476-bc29-ac3e33fadbf7) | 仪表盘应用搭建 | | ![dashboard app](public/dashboard-builder.png) | 仪表盘应用搭建 |
| ![image](https://github.com/NetEase/tango/assets/6984035/790d88e1-d716-4f99-868a-31dda25e9fb1) | H5活动页面搭建 | | ![image](https://github.com/NetEase/tango/assets/6984035/790d88e1-d716-4f99-868a-31dda25e9fb1) | H5活动页面搭建 |
| ![rn app](public/rn-builder.png) | ReactNative 应用搭建 | | ![rn app](public/rn-builder.png) | ReactNative 应用搭建 |
| ![mail app](public/mail-builder.png) | 营销类邮件搭建 | | ![mail app](public/mail-builder.png) | 营销类邮件搭建 |
## 🌐 兼容环境 ## 🌐 兼容环境
@@ -71,6 +70,23 @@ yarn
yarn start yarn start
``` ```
### 本地 https 证书
如果需要在本地开发环境中使用 https,可以使用以下命令生成证书:
```bash
brew install mkcert
# 将 mkcert 添加到本地根 CA,仅在本地生效
mkcert -install
# 进入 playground 应用目录
cd apps/playground
# 为网站生成一个由 mkcert 签名的证书
mkcert local.netease.com
```
## 💬 社区讨论 ## 💬 社区讨论
参与 NetEase Tango 的社区,以分享您的想法、建议或问题,并与其他用户和贡献者建立联系。 参与 NetEase Tango 的社区,以分享您的想法、建议或问题,并与其他用户和贡献者建立联系。
-28
View File
@@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4sAqDE3nhtSWD
YqV4mlglnzIs2AioZr2uxfj/OKrpE1ZML/dflJyc5NGUpOZWV+W1vRc70wWVNFxB
Si8nrYrrseoID7Ehxxe6+J1m/JsEbhZWHwV3M1iGW7JD7VhujaDpSLg67wMTMpSW
3BUS+0NT+MNfCisp+u/ls4fXPCTgXiWcjMULm95oLlTeYwurPHfxwn9f9hh85I5I
K3dI7w8MsQN7EFNrJz3UfrNLpmARMtSUBMwBYqrCitoUxRT0q7KYCru7kHxGPB6A
SQrFpSpOWT79vp8GBSp9g3axhRsK+aEgzQ0QGrFPHBwBP/kWgmdB1URc/K7STSC9
xyMNZOM7AgMBAAECggEATbyDYDKVbaRymr+tyHqmuYctdmSkGEXOdz8LFFoEzj/+
ZekWpVuHJB7H/FoAPb2XiYyCuAKVafz1C+IuwPOx8o0bZbM9KmuDmIZGsm+GzDGO
I0fBZC/vhfYYrbC8NSRV43thWCT8VVtH4cvW7vtllnWxvlIoYu4lhbiwZ68AEpO1
8PlJsOhnagfkFpG8LehSDs9if5L+Ig0geQEcUY3pGUM9LKYsRoxFv6Vh8wQku1XD
YOxLvLWDPqJ75m816t50RARe3e6eDJ+ukzDCoDjmLP8uhf1sk1FcL5aOgUNU3VOi
P6sIH5uzuD0MA3FXx2mItYLOc44r4uaFJZiRUMEXGQKBgQDCjUYblE4rh0nKFkqx
Ah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2OR0a+CfelDXZNLR3C4z
cBKr53ajAbHstnpxKJh9IfeKph44PrbDo6HMe1XPprl7idoEesX3Ma3SBgm4lmId
cfEOUWNIYOgtOT5bflXNNyzXOgYVjpLnjwg4EOASO/XIjhvqdjIyCu7HJMIcZ9oo
Aob2exeluv5LVwic1UJQDl2McDBIgJ8R32oEN4skCKIBSbWlxWyjnxL5I5WkJF4y
vlSx8bKAjVr8map0C3rWISuZdgheJkF96qjwhVSxOv++p6srq6M=
-----END CERTIFICATE-----
+2 -2
View File
@@ -3,7 +3,7 @@ const packageJson = {
private: true, private: true,
dependencies: { dependencies: {
'@music163/antd': '0.2.5', '@music163/antd': '0.2.5',
'@music163/tango-boot': '0.2.5', '@music163/tango-boot': '0.3.5',
react: '17.0.2', react: '17.0.2',
'react-dom': '17.0.2', 'react-dom': '17.0.2',
'prop-types': '15.7.2', 'prop-types': '15.7.2',
@@ -48,7 +48,7 @@ const tangoConfigJson = {
}, },
'@music163/tango-boot': { '@music163/tango-boot': {
description: '云音乐低代码运行时框架', description: '云音乐低代码运行时框架',
version: '0.2.5', version: '0.3.5',
library: 'TangoBoot', library: 'TangoBoot',
type: 'baseDependency', type: 'baseDependency',
resources: ['https://unpkg.com/@music163/tango-boot@{{version}}/dist/boot.js'], resources: ['https://unpkg.com/@music163/tango-boot@{{version}}/dist/boot.js'],
+3 -3
View File
@@ -187,6 +187,9 @@ export default function App() {
/> />
</Sidebar> </Sidebar>
<WorkspacePanel> <WorkspacePanel>
<WorkspaceView mode="code">
<CodeEditor />
</WorkspaceView>
<WorkspaceView mode="design"> <WorkspaceView mode="design">
<Sandbox <Sandbox
onMessage={(e) => { onMessage={(e) => {
@@ -208,9 +211,6 @@ export default function App() {
navigatorExtra={<Button size="small">hello world</Button>} navigatorExtra={<Button size="small">hello world</Button>}
/> />
</WorkspaceView> </WorkspaceView>
<WorkspaceView mode="code">
<CodeEditor />
</WorkspaceView>
</WorkspacePanel> </WorkspacePanel>
<SettingPanel /> <SettingPanel />
</DesignerPanel> </DesignerPanel>
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.5](https://github.com/netease/tango/compare/@music163/tango-context@1.1.4...@music163/tango-context@1.1.5) (2024-07-12)
**Note:** Version bump only for package @music163/tango-context
## [1.1.4](https://github.com/netease/tango/compare/@music163/tango-context@1.1.3...@music163/tango-context@1.1.4) (2024-06-20) ## [1.1.4](https://github.com/netease/tango/compare/@music163/tango-context@1.1.3...@music163/tango-context@1.1.4) (2024-06-20)
**Note:** Version bump only for package @music163/tango-context **Note:** Version bump only for package @music163/tango-context
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-context", "name": "@music163/tango-context",
"version": "1.1.4", "version": "1.1.5",
"description": "react context for tango-apps", "description": "react context for tango-apps",
"keywords": [ "keywords": [
"react", "react",
@@ -31,7 +31,7 @@
"react": ">= 16.8" "react": ">= 16.8"
}, },
"dependencies": { "dependencies": {
"@music163/tango-core": "^1.3.2", "@music163/tango-core": "^1.3.3",
"@music163/tango-helpers": "^1.2.0", "@music163/tango-helpers": "^1.2.0",
"mobx-react-lite": "4.0.7" "mobx-react-lite": "4.0.7"
}, },
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.3](https://github.com/netease/tango/compare/@music163/tango-core@1.3.2...@music163/tango-core@1.3.3) (2024-07-12)
### Bug Fixes
- update designer config ([#186](https://github.com/netease/tango/issues/186)) ([85c053b](https://github.com/netease/tango/commit/85c053b3db6d652b41c9873dba1366315174833f))
## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-core@1.3.1...@music163/tango-core@1.3.2) (2024-06-20) ## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-core@1.3.1...@music163/tango-core@1.3.2) (2024-06-20)
### Bug Fixes ### Bug Fixes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-core", "name": "@music163/tango-core",
"version": "1.3.2", "version": "1.3.3",
"description": "tango core", "description": "tango core",
"author": "wwsun <ww.sun@outlook.com>", "author": "wwsun <ww.sun@outlook.com>",
"homepage": "", "homepage": "",
+7
View File
@@ -239,6 +239,13 @@ export class Designer {
setActiveView(view: DesignerViewType) { setActiveView(view: DesignerViewType) {
this._activeView = view; this._activeView = view;
if (view === 'dual') {
this.setActiveSidebarPanel('');
this.toggleRightPanel(false);
this.toggleIsPreview(true);
} else if (view === 'design') {
this.toggleIsPreview(false);
}
} }
setActiveSidebarPanel(panel: string) { setActiveSidebarPanel(panel: string) {
+3 -1
View File
@@ -442,7 +442,9 @@ export class Workspace extends EventTarget implements IWorkspace {
updateFile(filename: string, code: string, shouldFormatCode = false) { updateFile(filename: string, code: string, shouldFormatCode = false) {
const file = this.getFile(filename); const file = this.getFile(filename);
file.update(code); file.update(code);
if (shouldFormatCode && file instanceof TangoViewModule) {
const shouldFormat = shouldFormatCode ?? this.projectConfig?.designerConfig?.autoFormatCode;
if (shouldFormat && file instanceof TangoViewModule) {
file.removeUnusedImportSpecifiers().update(); file.removeUnusedImportSpecifiers().update();
} }
this.history.push({ this.history.push({
+7
View File
@@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.3](https://github.com/netease/tango/compare/@music163/tango-designer@1.3.2...@music163/tango-designer@1.3.3) (2024-07-12)
### Bug Fixes
- selection bug without prototype & update ToggleButton style ([#180](https://github.com/netease/tango/issues/180)) ([1d0fb4f](https://github.com/netease/tango/commit/1d0fb4f274a5b767962c54583ab5863329d5bcc5))
- update designer config ([#186](https://github.com/netease/tango/issues/186)) ([85c053b](https://github.com/netease/tango/commit/85c053b3db6d652b41c9873dba1366315174833f))
## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-designer@1.3.1...@music163/tango-designer@1.3.2) (2024-06-20) ## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-designer@1.3.1...@music163/tango-designer@1.3.2) (2024-06-20)
### Bug Fixes ### Bug Fixes
+6 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-designer", "name": "@music163/tango-designer",
"version": "1.3.2", "version": "1.3.3",
"description": "lowcode designer", "description": "lowcode designer",
"keywords": [ "keywords": [
"react" "react"
@@ -33,12 +33,12 @@
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.8.0", "@ant-design/icons": "^4.8.0",
"@music163/request": "^0.2.0", "@music163/request": "^0.2.0",
"@music163/tango-context": "^1.1.4", "@music163/tango-context": "^1.1.5",
"@music163/tango-core": "^1.3.2", "@music163/tango-core": "^1.3.3",
"@music163/tango-helpers": "^1.2.0", "@music163/tango-helpers": "^1.2.0",
"@music163/tango-sandbox": "^1.0.7", "@music163/tango-sandbox": "^1.0.8",
"@music163/tango-setting-form": "^1.2.7", "@music163/tango-setting-form": "^1.2.8",
"@music163/tango-ui": "^1.3.2", "@music163/tango-ui": "^1.3.3",
"antd": "^4.24.2", "antd": "^4.24.2",
"cash-dom": "^8.1.2", "cash-dom": "^8.1.2",
"classnames": "^2.5.1", "classnames": "^2.5.1",
+96 -98
View File
@@ -23,113 +23,111 @@ const ideConfig = {
export interface CodeEditorProps extends Partial<MultiEditorProps> { export interface CodeEditorProps extends Partial<MultiEditorProps> {
/** /**
* 是否自动清未使用的导入 * 是否自动清未使用的导入
*/ */
autoRemoveUnusedImports?: boolean; autoRemoveUnusedImports?: boolean;
} }
export const CodeEditor = observer( export const CodeEditor = observer(({ autoRemoveUnusedImports, ...rest }: CodeEditorProps) => {
({ autoRemoveUnusedImports = true, ...rest }: CodeEditorProps) => { const editorRef = useRef(null);
const editorRef = useRef(null); const workspace = useWorkspace();
const workspace = useWorkspace(); const designer = useDesigner();
const designer = useDesigner(); const files = workspace.listFiles();
const files = workspace.listFiles(); const activeFile = workspace.activeFile;
const activeFile = workspace.activeFile;
let loc: any; // 记录视图代码的选中位置 let loc: any; // 记录视图代码的选中位置
const selectNode = workspace.selectSource.firstNode; const selectNode = workspace.selectSource.firstNode;
if (selectNode && activeFile === workspace.activeViewFile) { if (selectNode && activeFile === workspace.activeViewFile) {
loc = selectNode.loc; loc = selectNode.loc;
} }
useEffect(() => { useEffect(() => {
editorRef.current?.refresh(files, activeFile, loc); editorRef.current?.refresh(files, activeFile, loc);
}, [files, activeFile, loc]); }, [files, activeFile, loc]);
const fileSave = useCallback( const fileSave = useCallback(
(path: string, value: string) => { (path: string, value: string) => {
if (!isJsFile(path)) { if (!isJsFile(path)) {
// 非 js 文件直接保存 // 非 js 文件直接保存
workspace.updateFile(path, value, autoRemoveUnusedImports); workspace.updateFile(path, value, autoRemoveUnusedImports);
return; return;
}
// js 文件需要先检查语法,只有语法正确才会保存
if (isValidCode(value)) {
workspace.updateFile(path, value, autoRemoveUnusedImports);
} else {
Modal.confirm({
title: '检测到代码中存在语法错误,暂时无法将代码同步给设计器,是否回退到安全代码?',
onOk: () => {
editorRef.current?.refresh(files, activeFile);
},
onCancel: () => {},
});
}
},
[workspace, autoRemoveUnusedImports, activeFile, files],
);
const handleFileChange = useCallback(
(type: string, info: any) => {
switch (type) {
case 'addFile':
workspace.addFile(info.path, info.value);
break;
case 'deleteFile':
case 'deleteFolder':
workspace.removeFile(info.path);
break;
case 'renameFile':
workspace.renameFile(info.path, info.newpath);
workspace.setActiveFile(info.newpath);
break;
case 'renameFolder':
workspace.renameFolder(info.path, info.newpath);
break;
case 'addFolder':
default:
break;
}
},
[workspace],
);
const handlePathChange = useCallback(
(path: string) => {
workspace.setActiveFile(path);
},
[workspace],
);
const borderStyle =
designer.activeView === 'dual'
? {
borderLeft: 'solid 1px var(--tango-colors-line2)',
} }
: {};
// js 文件需要先检查语法,只有语法正确才会保存 return (
if (isValidCode(value)) { <Box display="flex" flexDirection="row" height="100%" bg="white" {...borderStyle}>
workspace.updateFile(path, value, autoRemoveUnusedImports); <MultiEditor
} else { ref={editorRef}
Modal.confirm({ options={{
title: '检测到代码中存在语法错误,暂时无法将代码同步给设计器,是否回退到安全代码?', fontSize: 14,
onOk: () => { automaticLayout: true,
editorRef.current?.refresh(files, activeFile); }}
}, ideConfig={ideConfig}
onCancel: () => {}, onFileSave={fileSave}
}); onPathChange={handlePathChange}
} onFileChange={handleFileChange}
}, defaultPath={activeFile}
[workspace, autoRemoveUnusedImports, activeFile, files], defaultTheme="GithubLightDefault"
); defaultFiles={files}
{...rest}
const handleFileChange = useCallback( />
(type: string, info: any) => { </Box>
switch (type) { );
case 'addFile': });
workspace.addFile(info.path, info.value);
break;
case 'deleteFile':
case 'deleteFolder':
workspace.removeFile(info.path);
break;
case 'renameFile':
workspace.renameFile(info.path, info.newpath);
workspace.setActiveFile(info.newpath);
break;
case 'renameFolder':
workspace.renameFolder(info.path, info.newpath);
break;
case 'addFolder':
default:
break;
}
},
[workspace],
);
const handlePathChange = useCallback(
(path: string) => {
workspace.setActiveFile(path);
},
[workspace],
);
const borderStyle =
designer.activeView === 'dual'
? {
borderLeft: 'solid 1px var(--tango-colors-line2)',
}
: {};
return (
<Box display="flex" flexDirection="row" height="100%" bg="white" {...borderStyle}>
<MultiEditor
ref={editorRef}
options={{
fontSize: 14,
automaticLayout: true,
}}
ideConfig={ideConfig}
onFileSave={fileSave}
onPathChange={handlePathChange}
onFileChange={handleFileChange}
defaultPath={activeFile}
defaultTheme="GithubLightDefault"
defaultFiles={files}
{...rest}
/>
</Box>
);
},
);
function isJsFile(path: string) { function isJsFile(path: string) {
return /.jsx?$/.test(path); return /.jsx?$/.test(path);
@@ -30,6 +30,7 @@ export const StateTree = observer(() => {
'pageStore', 'pageStore',
'services', 'services',
'config', 'config',
'routeData',
]); ]);
const callback = () => { const callback = () => {
forceUpdate(); forceUpdate();
@@ -206,7 +206,7 @@ function SelectionBox({ showActions, actions, data }: SelectionBoxProps) {
} }
/> />
<SelectionToolSet>{!isPage && actions}</SelectionToolSet> <SelectionToolSet>{!isPage && actions}</SelectionToolSet>
{isFromCurrentFile && prototype.hasChildren && ( {isFromCurrentFile && prototype?.hasChildren && (
<ComponentsPopover> <ComponentsPopover>
<Tooltip title="快捷添加子元素"> <Tooltip title="快捷添加子元素">
<SelectionHelper icon={<PlusOutlined />} /> <SelectionHelper icon={<PlusOutlined />} />
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.8](https://github.com/netease/tango/compare/@music163/tango-sandbox@1.0.7...@music163/tango-sandbox@1.0.8) (2024-07-12)
**Note:** Version bump only for package @music163/tango-sandbox
## [1.0.7](https://github.com/netease/tango/compare/@music163/tango-sandbox@1.0.6...@music163/tango-sandbox@1.0.7) (2024-06-20) ## [1.0.7](https://github.com/netease/tango/compare/@music163/tango-sandbox@1.0.6...@music163/tango-sandbox@1.0.7) (2024-06-20)
**Note:** Version bump only for package @music163/tango-sandbox **Note:** Version bump only for package @music163/tango-sandbox
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-sandbox", "name": "@music163/tango-sandbox",
"version": "1.0.7", "version": "1.0.8",
"description": "sandbox of tango apps", "description": "sandbox of tango apps",
"author": "wwsun <ww.sun@outlook.com>", "author": "wwsun <ww.sun@outlook.com>",
"homepage": "", "homepage": "",
@@ -29,7 +29,7 @@
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.8.0", "@ant-design/icons": "^4.8.0",
"@music163/tango-core": "^1.3.2", "@music163/tango-core": "^1.3.3",
"@music163/tango-helpers": "^1.2.0", "@music163/tango-helpers": "^1.2.0",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"lodash.isequal": "4.5.0", "lodash.isequal": "4.5.0",
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.8](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.2.7...@music163/tango-setting-form@1.2.8) (2024-07-12)
**Note:** Version bump only for package @music163/tango-setting-form
## [1.2.7](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.2.6...@music163/tango-setting-form@1.2.7) (2024-06-20) ## [1.2.7](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.2.6...@music163/tango-setting-form@1.2.7) (2024-06-20)
### Bug Fixes ### Bug Fixes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-setting-form", "name": "@music163/tango-setting-form",
"version": "1.2.7", "version": "1.2.8",
"description": "setting form of tango-apps", "description": "setting form of tango-apps",
"author": "wwsun <ww.sun@outlook.com>", "author": "wwsun <ww.sun@outlook.com>",
"homepage": "", "homepage": "",
@@ -28,9 +28,9 @@
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.8.0", "@ant-design/icons": "^4.8.0",
"@music163/tango-core": "^1.3.2", "@music163/tango-core": "^1.3.3",
"@music163/tango-helpers": "^1.2.0", "@music163/tango-helpers": "^1.2.0",
"@music163/tango-ui": "^1.3.2", "@music163/tango-ui": "^1.3.3",
"antd": "^4.24.2", "antd": "^4.24.2",
"coral-system": "^1.0.5", "coral-system": "^1.0.5",
"mobx": "6.12.3", "mobx": "6.12.3",
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.3.3](https://github.com/netease/tango/compare/@music163/tango-ui@1.3.2...@music163/tango-ui@1.3.3) (2024-07-12)
### Bug Fixes
- selection bug without prototype & update ToggleButton style ([#180](https://github.com/netease/tango/issues/180)) ([1d0fb4f](https://github.com/netease/tango/commit/1d0fb4f274a5b767962c54583ab5863329d5bcc5))
## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-ui@1.3.1...@music163/tango-ui@1.3.2) (2024-06-20) ## [1.3.2](https://github.com/netease/tango/compare/@music163/tango-ui@1.3.1...@music163/tango-ui@1.3.2) (2024-06-20)
### Bug Fixes ### Bug Fixes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@music163/tango-ui", "name": "@music163/tango-ui",
"version": "1.3.2", "version": "1.3.3",
"description": "ui widgets of tango", "description": "ui widgets of tango",
"keywords": [ "keywords": [
"react", "react",
+4 -4
View File
@@ -20,6 +20,10 @@ const buttonStyle = css`
transition: transform 0.1s ease-in; transition: transform 0.1s ease-in;
} }
&:hover .anticon-down {
transform: translateY(2px);
}
&.size-s { &.size-s {
height: 24px; height: 24px;
font-size: 14px; font-size: 14px;
@@ -59,10 +63,6 @@ const buttonStyle = css`
&:hover { &:hover {
background-color: rgba(197, 197, 197, 0.16); background-color: rgba(197, 197, 197, 0.16);
.anticon-down {
transform: translateY(2px);
}
} }
&.disabled { &.disabled {
Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB