mirror of
https://github.com/NetEase/tango.git
synced 2026-09-01 04:19:05 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f46137c56 | |||
| 1db52948db | |||
| 2550411c1c | |||
| 640859d36e | |||
| d91763379c | |||
| 588861f649 | |||
| 91b53da38e | |||
| 9b0ada94a0 | |||
| f604996e56 |
@@ -187,6 +187,13 @@ import { defineServices } from '@music163/tango-boot';
|
||||
import './sub';
|
||||
|
||||
export default defineServices({
|
||||
longLongLongLongLongLongLongLongGet: {
|
||||
url: 'https://nei.hz.netease.com/api/apimock-v2/cc974ffbaa7a85c77f30e4ce67deb67f/api/getUserProfile',
|
||||
formatter: res => res.data,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
},
|
||||
get: {
|
||||
url: 'https://nei.hz.netease.com/api/apimock-v2/cc974ffbaa7a85c77f30e4ce67deb67f/api/getUserProfile',
|
||||
formatter: res => res.data,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
CodeEditor,
|
||||
Sandbox,
|
||||
DndQuery,
|
||||
themeLight,
|
||||
} from '@music163/tango-designer';
|
||||
import { createEngine, Workspace } from '@music163/tango-core';
|
||||
import { Logo, ProjectDetail, bootHelperVariables } from './share';
|
||||
@@ -52,6 +53,7 @@ export default function App() {
|
||||
const [menuData, setMenuData] = useState(false);
|
||||
return (
|
||||
<Designer
|
||||
theme={themeLight}
|
||||
engine={engine}
|
||||
config={{
|
||||
customActionVariables: bootHelperVariables,
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.2.8](https://github.com/netease/tango/compare/@music163/tango-context@0.2.7...@music163/tango-context@0.2.8) (2023-11-27)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-context
|
||||
|
||||
## [0.2.7](https://github.com/netease/tango/compare/@music163/tango-context@0.2.6...@music163/tango-context@0.2.7) (2023-11-23)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-context",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"description": "react context for tango-apps",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -31,7 +31,7 @@
|
||||
"react": ">= 16.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"@music163/tango-core": "^0.2.6",
|
||||
"@music163/tango-core": "^0.2.7",
|
||||
"@music163/tango-helpers": "^0.1.8",
|
||||
"mobx-react-lite": "4.0.2"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.2.7](https://github.com/netease/tango/compare/@music163/tango-core@0.2.6...@music163/tango-core@0.2.7) (2023-11-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- list service functions ([91b53da](https://github.com/netease/tango/commit/91b53da38e362ae320457429037dc347adf90bd3))
|
||||
- parse tango variables in view file ([d917633](https://github.com/netease/tango/commit/d91763379c4ccf9d826b717aa80a07abdaf2e3a2))
|
||||
|
||||
## [0.2.6](https://github.com/netease/tango/compare/@music163/tango-core@0.2.5...@music163/tango-core@0.2.6) (2023-11-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-core",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"description": "tango core",
|
||||
"author": "wwsun <ww.sun@outlook.com>",
|
||||
"homepage": "",
|
||||
|
||||
@@ -1262,7 +1262,12 @@ export function traverseViewFile(ast: t.File, idGenerator: IdGenerator) {
|
||||
|
||||
MemberExpression(path) {
|
||||
const variable = node2value(path.node, false);
|
||||
if (isTangoVariable(variable) && !variables.includes(variable)) {
|
||||
const parentNode = path.parentPath.node;
|
||||
if (
|
||||
!t.isMemberExpression(parentNode) &&
|
||||
isTangoVariable(variable) &&
|
||||
!variables.includes(variable)
|
||||
) {
|
||||
variables.push(variable);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -696,12 +696,10 @@ export class Workspace extends EventTarget implements IWorkspace {
|
||||
*/
|
||||
listServiceFunctions() {
|
||||
const ret: Record<string, object> = {};
|
||||
Object.values(this.serviceModules).forEach((module) => {
|
||||
Object.keys(this.serviceModules).forEach((moduleName) => {
|
||||
const module = this.serviceModules[moduleName];
|
||||
Object.keys(module.serviceFunctions).forEach((name) => {
|
||||
const serviceKey =
|
||||
module.baseConfig.namespace !== 'index'
|
||||
? name
|
||||
: [module.baseConfig.namespace, name].join('.');
|
||||
const serviceKey = moduleName === 'index' ? name : [moduleName, name].join('.');
|
||||
ret[serviceKey] = module.serviceFunctions[name];
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,24 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.5.9](https://github.com/netease/tango/compare/@music163/tango-designer@0.5.8...@music163/tango-designer@0.5.9) (2023-11-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update theme ([2550411](https://github.com/netease/tango/commit/2550411c1c93037931d44aa9f7822ffe8caa900b))
|
||||
|
||||
## [0.5.8](https://github.com/netease/tango/compare/@music163/tango-designer@0.5.7...@music163/tango-designer@0.5.8) (2023-11-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- event setter ([588861f](https://github.com/netease/tango/commit/588861f6492b45954e29ceed950567781b822492))
|
||||
|
||||
## [0.5.7](https://github.com/netease/tango/compare/@music163/tango-designer@0.5.6...@music163/tango-designer@0.5.7) (2023-11-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update varTreeNode style ([#69](https://github.com/netease/tango/issues/69)) ([f604996](https://github.com/netease/tango/commit/f604996e56c9e4d58ff7f80cd98c3753986f081f))
|
||||
|
||||
## [0.5.6](https://github.com/netease/tango/compare/@music163/tango-designer@0.5.5...@music163/tango-designer@0.5.6) (2023-11-23)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-designer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-designer",
|
||||
"version": "0.5.6",
|
||||
"version": "0.5.9",
|
||||
"description": "lowcode designer",
|
||||
"keywords": [
|
||||
"react"
|
||||
@@ -33,12 +33,12 @@
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.8.0",
|
||||
"@music163/request": "^0.1.2",
|
||||
"@music163/tango-context": "^0.2.7",
|
||||
"@music163/tango-core": "^0.2.6",
|
||||
"@music163/tango-context": "^0.2.8",
|
||||
"@music163/tango-core": "^0.2.7",
|
||||
"@music163/tango-helpers": "^0.1.8",
|
||||
"@music163/tango-sandbox": "^0.1.11",
|
||||
"@music163/tango-setting-form": "^0.2.10",
|
||||
"@music163/tango-ui": "^0.1.11",
|
||||
"@music163/tango-sandbox": "^0.1.12",
|
||||
"@music163/tango-setting-form": "^0.2.12",
|
||||
"@music163/tango-ui": "^0.1.12",
|
||||
"antd": "^4.24.2",
|
||||
"cash-dom": "^8.1.2",
|
||||
"classnames": "^2.3.2",
|
||||
|
||||
@@ -317,6 +317,10 @@ const varTreeStyle = css`
|
||||
font-family: Consolas, Menlo, Courier, monospace;
|
||||
}
|
||||
|
||||
.ant-tree-node-content-wrapper.ant-tree-node-content-wrapper-normal {
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
|
||||
.ant-tree .ant-tree-treenode {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ export function DesignerPanel(props: DesignerPanelProps) {
|
||||
height="48px"
|
||||
bg="colors.custom.topNavBg"
|
||||
color="colors.custom.topNavColor"
|
||||
borderBottom="solid"
|
||||
borderColor="colors.custom.topNavBorderColor"
|
||||
className="DesignerPanelHeader"
|
||||
>
|
||||
<Box display="flex" alignItems="center">
|
||||
|
||||
@@ -3,9 +3,9 @@ import { SystemProvider, extendTheme } from 'coral-system';
|
||||
import { ConfigProvider } from 'antd';
|
||||
import { TangoEngineProvider, ITangoEngineContext } from '@music163/tango-context';
|
||||
import { createFromIconfontCN } from '@ant-design/icons';
|
||||
import { DesignerProvider, IDesignerContext } from './context';
|
||||
import { theme as baseTheme } from './theme';
|
||||
import zhCN from 'antd/lib/locale/zh_CN';
|
||||
import { DesignerProvider, IDesignerContext } from './context';
|
||||
import defaultTheme from './themes/default';
|
||||
|
||||
export interface DesignerProps extends IDesignerContext, ITangoEngineContext {
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ export function Designer(props: DesignerProps) {
|
||||
iconfontScriptUrl = '//at.alicdn.com/t/c/font_2891794_lzc7rtwuzf.js',
|
||||
children,
|
||||
} = props;
|
||||
const theme = useMemo(() => extendTheme(themeProp, baseTheme), [themeProp]);
|
||||
const theme = useMemo(() => extendTheme(themeProp, defaultTheme), [themeProp]);
|
||||
useEffect(() => {
|
||||
createFromIconfontCN({
|
||||
scriptUrl: iconfontScriptUrl,
|
||||
|
||||
@@ -12,6 +12,7 @@ export * from './sidebar';
|
||||
export * from './toolbar';
|
||||
export * from './selection-menu';
|
||||
export * from './widgets';
|
||||
export * from './themes';
|
||||
|
||||
export { register as registerSetter } from '@music163/tango-setting-form';
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@ const navigatorStyle = css`
|
||||
|
||||
.navigatorInput {
|
||||
flex: 1;
|
||||
border-color: transparent;
|
||||
background-color: var(--tango-colors-fill2);
|
||||
|
||||
&:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -68,7 +74,7 @@ export class Navigator extends React.Component<NavigatorProps, NavigatorState> {
|
||||
className="navigator"
|
||||
bg="white"
|
||||
px="l"
|
||||
py="4px"
|
||||
py="m"
|
||||
borderBottom="solid"
|
||||
borderBottomColor="line.normal"
|
||||
css={navigatorStyle}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AutoComplete } from 'antd';
|
||||
import { ActionSelect } from '@music163/tango-ui';
|
||||
import { FormItemComponentProps } from '@music163/tango-setting-form';
|
||||
import { useWorkspace, useWorkspaceData } from '@music163/tango-context';
|
||||
import { ExpressionModal } from './expression-setter';
|
||||
import { ExpressionModal, getWrappedExpressionCode } from './expression-setter';
|
||||
|
||||
enum EventAction {
|
||||
NoAction = 'noAction',
|
||||
@@ -47,8 +47,9 @@ export function EventSetter(props: EventSetterProps) {
|
||||
|
||||
const handleChange = useCallback<FormItemComponentProps['onChange']>(
|
||||
(nextValue: any, ...args) => {
|
||||
if (nextValue !== value) {
|
||||
onChange(nextValue, ...args);
|
||||
const ret = getWrappedExpressionCode(nextValue);
|
||||
if (ret !== value) {
|
||||
onChange(ret, ...args);
|
||||
}
|
||||
},
|
||||
[onChange, value],
|
||||
@@ -83,7 +84,7 @@ export function EventSetter(props: EventSetterProps) {
|
||||
onCancel={() => setExpModalVisible(false)}
|
||||
onOk={(nextValue) => {
|
||||
setExpModalVisible(false);
|
||||
handleChange(`{${nextValue}}`);
|
||||
handleChange(nextValue);
|
||||
}}
|
||||
dataSource={actionVariables}
|
||||
/>
|
||||
|
||||
@@ -34,6 +34,23 @@ export const jsonValueValidate = (value: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 返回 `{}` 包裹后的表达式代码
|
||||
* @param code 原始代码
|
||||
* @returns
|
||||
*/
|
||||
export function getWrappedExpressionCode(code: string) {
|
||||
let ret;
|
||||
if (!code) {
|
||||
// do nothing
|
||||
} else if (isWrappedByExpressionContainer(code)) {
|
||||
ret = code;
|
||||
} else {
|
||||
ret = `{${code}}`;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const suffixStyle = css`
|
||||
.anticon-close-circle {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
@@ -79,15 +96,7 @@ export function ExpressionSetter(props: ExpressionSetterProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
let ret;
|
||||
|
||||
if (!code) {
|
||||
// do nothing
|
||||
} else if (isWrappedByExpressionContainer(code)) {
|
||||
ret = code;
|
||||
} else {
|
||||
ret = `{${code}}`;
|
||||
}
|
||||
const ret = getWrappedExpressionCode(code);
|
||||
|
||||
if (ret === valueProp) {
|
||||
return;
|
||||
@@ -138,7 +147,7 @@ export function ExpressionSetter(props: ExpressionSetterProps) {
|
||||
value={inputValue}
|
||||
onCancel={() => off()}
|
||||
onOk={(value) => {
|
||||
onChange(value);
|
||||
change(value);
|
||||
off();
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -30,7 +30,6 @@ export const VariablePanel = observer(
|
||||
|
||||
return (
|
||||
<Panel
|
||||
shape="solid"
|
||||
className="ModelView"
|
||||
height={wrapperHeight}
|
||||
title="视图模型与变量管理"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { extendTheme } from 'coral-system';
|
||||
|
||||
export const theme = extendTheme({
|
||||
export default extendTheme({
|
||||
colors: {
|
||||
primary: {
|
||||
10: '#e8f3ff',
|
||||
@@ -27,11 +27,16 @@ export const theme = extendTheme({
|
||||
custom: {
|
||||
topNavBg: '#222',
|
||||
topNavColor: '#fff',
|
||||
topNavBorderColor: '#222',
|
||||
toolbarDividerColor: 'gray.60',
|
||||
toolbarButtonBg: 'rgba(223, 223, 223, 0.08)',
|
||||
toolbarButtonBgHover: '#4080ff',
|
||||
toolbarButtonBgDisabled: 'rgb(223,223,223)',
|
||||
toolbarButtonBgActive: '#4080ff',
|
||||
toolbarButtonTextColor: '#f5f5f5',
|
||||
toolbarButtonTextColorHover: '#FFF',
|
||||
toolbarButtonTextColorDisabled: '#bfbfbf',
|
||||
toolbarButtonTextColorDisabled: 'rgb(201,205,212)',
|
||||
toolbarButtonTextColorActive: '#fff',
|
||||
sidebarBg: '#fff',
|
||||
sidebarExpandBg: '#fff',
|
||||
sidebarItemActiveBg: '#f2f3f5',
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as themeDefault } from './default';
|
||||
export { default as themeLight } from './light';
|
||||
@@ -0,0 +1,25 @@
|
||||
import { extendTheme } from 'coral-system';
|
||||
|
||||
export default extendTheme({
|
||||
colors: {
|
||||
custom: {
|
||||
topNavBg: '#FFF',
|
||||
topNavColor: '#333',
|
||||
topNavBorderColor: 'rgb(229,230,235)',
|
||||
toolbarDividerColor: 'rgb(229,230,235)',
|
||||
toolbarButtonBg: 'rgb(242,243,245)',
|
||||
toolbarButtonBgHover: 'rgb(229,230,235)',
|
||||
toolbarButtonBgDisabled: 'rgb(247,248,250)',
|
||||
toolbarButtonBgActive: 'colors.brand',
|
||||
toolbarButtonTextColor: 'colors.text2',
|
||||
toolbarButtonTextColorHover: 'colors.text2',
|
||||
toolbarButtonTextColorDisabled: 'colors.text4',
|
||||
toolbarButtonTextColorActive: '#FFF',
|
||||
sidebarBg: '#fff',
|
||||
sidebarExpandBg: '#fff',
|
||||
sidebarItemActiveBg: '#f2f3f5',
|
||||
sidebarItemHoverBg: '#f2f3f5',
|
||||
viewportBg: '#f0f2f5',
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -10,7 +10,7 @@ export const HistoryTool = observer(() => {
|
||||
<ToggleButton
|
||||
shape="ghost"
|
||||
disabled={!workspace.history.couldBack || workspace.history.index === 0}
|
||||
tip="撤销"
|
||||
tooltip="撤销"
|
||||
onClick={() => {
|
||||
workspace.history.back();
|
||||
workspace.selectSource.clear();
|
||||
@@ -21,7 +21,7 @@ export const HistoryTool = observer(() => {
|
||||
<ToggleButton
|
||||
shape="ghost"
|
||||
disabled={!workspace.history.couldForward}
|
||||
tip="重做"
|
||||
tooltip="重做"
|
||||
onClick={() => {
|
||||
workspace.history.forward();
|
||||
workspace.selectSource.clear();
|
||||
|
||||
@@ -17,7 +17,7 @@ export const PreviewTool = observer(() => {
|
||||
designer.setActiveView('design');
|
||||
}
|
||||
}}
|
||||
tip="预览"
|
||||
tooltip="预览"
|
||||
>
|
||||
<EyeOutlined />
|
||||
</ToggleButton>
|
||||
|
||||
@@ -71,6 +71,7 @@ function PageSelect({ value, onSelect, onRemove, onUpdate, onCopy, options }: Pa
|
||||
}}
|
||||
/>
|
||||
}
|
||||
icon={<FileOutlined />}
|
||||
>
|
||||
{current?.name || current?.label || value}
|
||||
</ToggleButton>
|
||||
|
||||
@@ -81,7 +81,7 @@ function ToolbarItem({ placement, widgetProps, children }: ToolbarItemProps) {
|
||||
}
|
||||
|
||||
function Separator() {
|
||||
return <Box className="Separator" width={1} height={16} bg="gray.60" />;
|
||||
return <Box className="Separator" width={1} height={16} bg="colors.custom.toolbarDividerColor" />;
|
||||
}
|
||||
|
||||
Toolbar.Item = ToolbarItem;
|
||||
|
||||
@@ -17,7 +17,7 @@ export const ViewportSwitchTool = observer(() => {
|
||||
onClick={() => {
|
||||
designer.setSimulator('desktop');
|
||||
}}
|
||||
tip="桌面视图"
|
||||
tooltip="桌面视图"
|
||||
>
|
||||
<DesktopOutlined />
|
||||
</ToggleButton>
|
||||
@@ -27,7 +27,7 @@ export const ViewportSwitchTool = observer(() => {
|
||||
onClick={() => {
|
||||
designer.setSimulator('phone');
|
||||
}}
|
||||
tip="手机视图"
|
||||
tooltip="手机视图"
|
||||
>
|
||||
<MobileOutlined />
|
||||
</ToggleButton>
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.1.12](https://github.com/netease/tango/compare/@music163/tango-sandbox@0.1.11...@music163/tango-sandbox@0.1.12) (2023-11-27)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-sandbox
|
||||
|
||||
## [0.1.11](https://github.com/netease/tango/compare/@music163/tango-sandbox@0.1.10...@music163/tango-sandbox@0.1.11) (2023-11-23)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-sandbox
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-sandbox",
|
||||
"version": "0.1.11",
|
||||
"version": "0.1.12",
|
||||
"description": "sandbox of tango apps",
|
||||
"author": "wwsun <ww.sun@outlook.com>",
|
||||
"homepage": "",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.8.0",
|
||||
"@music163/tango-core": "^0.2.6",
|
||||
"@music163/tango-core": "^0.2.7",
|
||||
"@music163/tango-helpers": "^0.1.8",
|
||||
"crypto-js": "^4.1.1",
|
||||
"lodash.isequal": "4.5.0",
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.2.12](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.11...@music163/tango-setting-form@0.2.12) (2023-11-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update theme ([2550411](https://github.com/netease/tango/commit/2550411c1c93037931d44aa9f7822ffe8caa900b))
|
||||
- update type ([1db5294](https://github.com/netease/tango/commit/1db52948dbdc28f4533eb968f7da1bf6d16173d4))
|
||||
|
||||
## [0.2.11](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.10...@music163/tango-setting-form@0.2.11) (2023-11-27)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-setting-form
|
||||
|
||||
## [0.2.10](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.9...@music163/tango-setting-form@0.2.10) (2023-11-23)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-setting-form
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-setting-form",
|
||||
"version": "0.2.10",
|
||||
"version": "0.2.12",
|
||||
"description": "setting form of tango-apps",
|
||||
"author": "wwsun <ww.sun@outlook.com>",
|
||||
"homepage": "",
|
||||
@@ -28,9 +28,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.8.0",
|
||||
"@music163/tango-core": "^0.2.6",
|
||||
"@music163/tango-core": "^0.2.7",
|
||||
"@music163/tango-helpers": "^0.1.8",
|
||||
"@music163/tango-ui": "^0.1.11",
|
||||
"@music163/tango-ui": "^0.1.12",
|
||||
"antd": "^4.24.2",
|
||||
"coral-system": "^1.0.5",
|
||||
"mobx": "6.9.0",
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.1.12](https://github.com/netease/tango/compare/@music163/tango-ui@0.1.11...@music163/tango-ui@0.1.12) (2023-11-28)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update theme ([2550411](https://github.com/netease/tango/commit/2550411c1c93037931d44aa9f7822ffe8caa900b))
|
||||
|
||||
## [0.1.11](https://github.com/netease/tango/compare/@music163/tango-ui@0.1.10...@music163/tango-ui@0.1.11) (2023-11-23)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-ui
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-ui",
|
||||
"version": "0.1.11",
|
||||
"version": "0.1.12",
|
||||
"description": "ui widgets of tango",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import cx from 'classnames';
|
||||
import { css, Button, HTMLCoralProps } from 'coral-system';
|
||||
import { css, Button, HTMLCoralProps, Box } from 'coral-system';
|
||||
import { DropDownProps, Dropdown, MenuProps, Tooltip, TooltipProps } from 'antd';
|
||||
import { DownOutlined } from '@ant-design/icons';
|
||||
|
||||
@@ -26,19 +26,11 @@ const buttonStyle = css`
|
||||
&.size-m {
|
||||
height: 32px;
|
||||
font-size: 14px;
|
||||
|
||||
.anticon {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
&.size-l {
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
|
||||
.anticon {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&.size-xl {
|
||||
@@ -106,10 +98,12 @@ const buttonStyle = css`
|
||||
|
||||
&.disabled {
|
||||
color: var(--tango-colors-custom-toolbarButtonTextColorDisabled, rgb(201, 205, 212));
|
||||
background-color: var(--tango-colors-custom-toolbarButtonBgDisabled, rgb(247, 248, 250));
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background-color: var(--tango-colors-brand);
|
||||
color: var(--tango-colors-custom-toolbarButtonTextColorActive);
|
||||
background-color: var(--tango-colors-custom-toolbarButtonBgActive);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +118,7 @@ export interface ToggleButtonProps extends Omit<HTMLCoralProps<'button'>, 'type'
|
||||
type?: 'normal' | 'primary';
|
||||
selected?: boolean;
|
||||
disabled?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
/**
|
||||
* 提示文案
|
||||
* @deprecated 使用 tooltip 代替
|
||||
@@ -167,6 +162,7 @@ export function ToggleButton(props: ToggleButtonProps) {
|
||||
disabled,
|
||||
selected,
|
||||
children,
|
||||
icon,
|
||||
tip,
|
||||
tooltip = tip,
|
||||
tooltipPlacement = 'bottom',
|
||||
@@ -189,7 +185,14 @@ export function ToggleButton(props: ToggleButtonProps) {
|
||||
|
||||
let btn = (
|
||||
<Button css={buttonStyle} className={clazz} type="button" {...rest}>
|
||||
{children}
|
||||
<Box as="span">
|
||||
{icon && (
|
||||
<Box as="span" className="buttonIcon" mr="s">
|
||||
{icon}
|
||||
</Box>
|
||||
)}
|
||||
{children}
|
||||
</Box>
|
||||
{showDropdown ? <DownOutlined /> : null}
|
||||
</Button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user