mirror of
https://github.com/NetEase/tango.git
synced 2026-09-03 14:37:28 +08:00
Compare commits
4 Commits
@music163/
...
@music163/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ada3fecb3 | ||
|
|
07febb385f | ||
|
|
ddbda0e6fb | ||
|
|
9f7441c134 |
@@ -46,7 +46,7 @@ const sandboxQuery = new DndQuery({
|
||||
|
||||
// 4. 图标库初始化(物料面板和组件树使用了 iconfont 里的图标)
|
||||
createFromIconfontCN({
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_2891794_lzc7rtwuzf.js',
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_2891794_cou9i7556tl.js',
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
import React from 'react';
|
||||
import { FormModel, SettingForm, register } from '@music163/tango-setting-form';
|
||||
import { ComponentPrototypeType } from '@music163/tango-helpers';
|
||||
import { BorderSetter } from '@music163/tango-designer/src/setters/style-setter';
|
||||
import { BorderSetter, DisplaySetter } from '@music163/tango-designer/src/setters/style-setter';
|
||||
import { Box } from 'coral-system';
|
||||
import { JsonView } from '@music163/tango-ui';
|
||||
import { toJS } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { Card } from 'antd';
|
||||
import { createFromIconfontCN } from '@ant-design/icons';
|
||||
|
||||
// 这里按需注入,因为部分 setter 依赖 Designer 的上下文
|
||||
register({
|
||||
name: 'borderSetter',
|
||||
component: BorderSetter,
|
||||
});
|
||||
|
||||
register({
|
||||
name: 'displaySetter',
|
||||
component: DisplaySetter,
|
||||
});
|
||||
|
||||
createFromIconfontCN({
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_2891794_cou9i7556tl.js',
|
||||
});
|
||||
|
||||
export default {
|
||||
title: 'SettingForm',
|
||||
};
|
||||
@@ -31,6 +42,14 @@ const prototype: ComponentPrototypeType = {
|
||||
name: 'text',
|
||||
title: 'textSetter',
|
||||
setter: 'textSetter',
|
||||
tip: '这是一个文本属性',
|
||||
docs: 'https://music-one.fn.netease.com/docs/button',
|
||||
deprecated: '使用 text2 替代',
|
||||
},
|
||||
{
|
||||
name: 'display',
|
||||
title: 'displaySetter',
|
||||
setter: 'displaySetter',
|
||||
},
|
||||
{
|
||||
name: 'border',
|
||||
|
||||
@@ -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.
|
||||
|
||||
# [1.0.0-alpha.8](https://github.com/netease/tango/compare/@music163/tango-context@1.0.0-alpha.7...@music163/tango-context@1.0.0-alpha.8) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-context
|
||||
|
||||
# [1.0.0-alpha.7](https://github.com/netease/tango/compare/@music163/tango-context@1.0.0-alpha.6...@music163/tango-context@1.0.0-alpha.7) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-context",
|
||||
"version": "1.0.0-alpha.7",
|
||||
"version": "1.0.0-alpha.8",
|
||||
"description": "react context for tango-apps",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -31,8 +31,8 @@
|
||||
"react": ">= 16.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"@music163/tango-core": "^1.0.0-alpha.7",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-core": "^1.0.0-alpha.8",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"mobx-react-lite": "4.0.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@@ -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.
|
||||
|
||||
# [1.0.0-alpha.8](https://github.com/netease/tango/compare/@music163/tango-core@1.0.0-alpha.7...@music163/tango-core@1.0.0-alpha.8) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-core
|
||||
|
||||
# [1.0.0-alpha.7](https://github.com/netease/tango/compare/@music163/tango-core@1.0.0-alpha.6...@music163/tango-core@1.0.0-alpha.7) (2024-03-18)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-core",
|
||||
"version": "1.0.0-alpha.7",
|
||||
"version": "1.0.0-alpha.8",
|
||||
"description": "tango core",
|
||||
"author": "wwsun <ww.sun@outlook.com>",
|
||||
"homepage": "",
|
||||
@@ -28,7 +28,7 @@
|
||||
"@babel/parser": "^7.23.5",
|
||||
"@babel/traverse": "^7.23.5",
|
||||
"@babel/types": "^7.23.5",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"@types/babel__generator": "^7.6.7",
|
||||
"@types/babel__traverse": "^7.20.4",
|
||||
"mobx": "6.12.0",
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.0.0-alpha.14](https://github.com/netease/tango/compare/@music163/tango-designer@1.0.0-alpha.13...@music163/tango-designer@1.0.0-alpha.14) (2024-03-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- select outline node & render dependency list ([#118](https://github.com/netease/tango/issues/118)) ([07febb3](https://github.com/netease/tango/commit/07febb385f710f9a0bc43639ce22787bb05e97ed))
|
||||
|
||||
# [1.0.0-alpha.13](https://github.com/netease/tango/compare/@music163/tango-designer@1.0.0-alpha.12...@music163/tango-designer@1.0.0-alpha.13) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- add deprecated and data group to ComponentPropType ([#116](https://github.com/netease/tango/issues/116)) ([9f7441c](https://github.com/netease/tango/commit/9f7441c13400dba55c58b7dd6ce9429013edbc45))
|
||||
|
||||
# [1.0.0-alpha.12](https://github.com/netease/tango/compare/@music163/tango-designer@1.0.0-alpha.11...@music163/tango-designer@1.0.0-alpha.12) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-designer",
|
||||
"version": "1.0.0-alpha.12",
|
||||
"version": "1.0.0-alpha.14",
|
||||
"description": "lowcode designer",
|
||||
"keywords": [
|
||||
"react"
|
||||
@@ -33,12 +33,12 @@
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.8.0",
|
||||
"@music163/request": "^0.1.2",
|
||||
"@music163/tango-context": "^1.0.0-alpha.7",
|
||||
"@music163/tango-core": "^1.0.0-alpha.7",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-sandbox": "^1.0.0-alpha.7",
|
||||
"@music163/tango-setting-form": "^1.0.0-alpha.10",
|
||||
"@music163/tango-ui": "^1.0.0-alpha.8",
|
||||
"@music163/tango-context": "^1.0.0-alpha.8",
|
||||
"@music163/tango-core": "^1.0.0-alpha.8",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"@music163/tango-sandbox": "^1.0.0-alpha.8",
|
||||
"@music163/tango-setting-form": "^1.0.0-alpha.12",
|
||||
"@music163/tango-ui": "^1.0.0-alpha.10",
|
||||
"antd": "^4.24.2",
|
||||
"cash-dom": "^8.1.2",
|
||||
"classnames": "^2.3.2",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import React, { useCallback } from 'react';
|
||||
import { Radio, RadioProps, Tooltip } from 'antd';
|
||||
import type { OptionType } from '@music163/tango-helpers';
|
||||
import { FormItemComponentProps } from '@music163/tango-setting-form';
|
||||
import { IconFont } from '@music163/tango-ui';
|
||||
|
||||
interface ChoiceSetterProps {
|
||||
mode?: 'text' | 'icon';
|
||||
options?: OptionType[];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,18 @@ export function ChoiceSetter({
|
||||
onChange,
|
||||
...props
|
||||
}: FormItemComponentProps<string> & ChoiceSetterProps) {
|
||||
const renderIcon = useCallback((icon: string) => {
|
||||
if (!icon) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (icon.startsWith('icon-')) {
|
||||
return <IconFont type={icon} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Radio.Group
|
||||
optionType="button"
|
||||
@@ -24,6 +36,7 @@ export function ChoiceSetter({
|
||||
>
|
||||
{options.map((item) => (
|
||||
<RadioButton tip={item.tip} key={item.value} value={item.value}>
|
||||
{renderIcon(item.icon)}
|
||||
{item.label}
|
||||
</RadioButton>
|
||||
))}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
Popconfirm,
|
||||
Radio,
|
||||
message,
|
||||
Tag,
|
||||
Checkbox,
|
||||
ModalProps,
|
||||
} from 'antd';
|
||||
@@ -18,7 +17,7 @@ import { FormListProps } from 'antd/lib/form';
|
||||
import { Box, Text } from 'coral-system';
|
||||
import semverLt from 'semver/functions/lt';
|
||||
import semverValid from 'semver/functions/valid';
|
||||
import { ConfigGroup, ConfigItem } from '@music163/tango-ui';
|
||||
import { ColorTag, ConfigGroup, ConfigItem } from '@music163/tango-ui';
|
||||
import { MinusCircleOutlined, PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { useBoolean } from '@music163/tango-helpers';
|
||||
import { isUndefined } from 'lodash-es';
|
||||
@@ -101,8 +100,8 @@ export const DependencyPanel = observer(
|
||||
/>
|
||||
<ConfigGroup
|
||||
title={
|
||||
<>
|
||||
基础包
|
||||
<div>
|
||||
基础包
|
||||
<Tooltip
|
||||
title={
|
||||
<>
|
||||
@@ -115,7 +114,7 @@ export const DependencyPanel = observer(
|
||||
>
|
||||
<QuestionCircleOutlined />
|
||||
</Tooltip>
|
||||
</>
|
||||
</div>
|
||||
}
|
||||
key={DependencyItemType.基础包}
|
||||
>
|
||||
@@ -332,25 +331,19 @@ function RenderItem({
|
||||
const packageJsonIncluded = !!dependencies?.[name];
|
||||
const tangoConfigJsonIncluded = !!packageInfo;
|
||||
|
||||
return [
|
||||
hasUmd && (
|
||||
<Tooltip title="该依赖拥有 UMD 资源,可优化加载速度">
|
||||
<Tag key="hasUmd" color="green">
|
||||
return (
|
||||
<Box display="inline-block">
|
||||
{hasUmd && (
|
||||
<ColorTag key="hasUmd" color="green" tooltip="该依赖拥有 UMD 资源,可优化加载速度">
|
||||
UMD
|
||||
</Tag>
|
||||
</Tooltip>
|
||||
),
|
||||
packageJsonIncluded && (
|
||||
<Tooltip title="此依赖在 package.json 中存在">
|
||||
<Tag key="packageJson">package</Tag>
|
||||
</Tooltip>
|
||||
),
|
||||
tangoConfigJsonIncluded && (
|
||||
<Tooltip title="此依赖在 tango.config.json 中存在">
|
||||
<Tag key="tangoConfigJson">tango.config</Tag>
|
||||
</Tooltip>
|
||||
),
|
||||
].filter((e) => e);
|
||||
</ColorTag>
|
||||
)}
|
||||
{packageJsonIncluded && <ColorTag tooltip="此依赖在 package.json 中存在">package</ColorTag>}
|
||||
{tangoConfigJsonIncluded && (
|
||||
<ColorTag tooltip="此依赖在 tango.config.json 中存在">tango.config</ColorTag>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}, [showTags, workspace, record]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -172,12 +172,7 @@ export const ComponentsTree: React.FC<ComponentsTreeProps> = observer(
|
||||
const slotKey = keys?.[0] as string;
|
||||
const data = sandboxQuery.getDraggableParentsData(buildQueryBySlotId(slotKey), true);
|
||||
if (data && data.id) {
|
||||
workspace.selectSource.select({
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
bounding: data.bounding,
|
||||
parents: data.parents,
|
||||
});
|
||||
workspace.selectSource.select(data);
|
||||
}
|
||||
// export selected
|
||||
onSelect(slotKey);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import styled, { css, keyframes } from 'styled-components';
|
||||
import { Box, Button, Group, HTMLCoralProps } from 'coral-system';
|
||||
import { Dropdown, DropdownProps } from 'antd';
|
||||
import { Dropdown, DropdownProps, Tooltip } from 'antd';
|
||||
import { PlusSquareOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
||||
import { ISelectedItemData, isString, noop } from '@music163/tango-helpers';
|
||||
import { observer, useDesigner, useWorkspace } from '@music163/tango-context';
|
||||
import { Action, IconFont } from '@music163/tango-ui';
|
||||
import { IconFont } from '@music163/tango-ui';
|
||||
import { getDragGhostElement } from '../helpers';
|
||||
import { getWidget } from '../widgets';
|
||||
|
||||
@@ -179,13 +179,9 @@ function SelectionBox({ showActions, actions, data }: SelectionBoxProps) {
|
||||
}}
|
||||
/>
|
||||
{!isFromCurrentFile && (
|
||||
<Action
|
||||
as="span"
|
||||
color="white"
|
||||
tooltip={`该节点来自其他文件(${data.filename})`}
|
||||
icon={<InfoCircleOutlined />}
|
||||
size="small"
|
||||
/>
|
||||
<Tooltip title={`该节点来自其他文件(${data.filename})`}>
|
||||
<InfoCircleOutlined />
|
||||
</Tooltip>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
# [1.0.0-alpha.4](https://github.com/netease/tango/compare/@music163/tango-helpers@1.0.0-alpha.3...@music163/tango-helpers@1.0.0-alpha.4) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- add deprecated and data group to ComponentPropType ([#116](https://github.com/netease/tango/issues/116)) ([9f7441c](https://github.com/netease/tango/commit/9f7441c13400dba55c58b7dd6ce9429013edbc45))
|
||||
|
||||
# [1.0.0-alpha.3](https://github.com/netease/tango/compare/@music163/tango-helpers@1.0.0-alpha.2...@music163/tango-helpers@1.0.0-alpha.3) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-helpers",
|
||||
"version": "1.0.0-alpha.3",
|
||||
"version": "1.0.0-alpha.4",
|
||||
"description": "Shared types, helpers, and hooks of tango-apps",
|
||||
"keywords": [
|
||||
"shared",
|
||||
|
||||
@@ -24,10 +24,11 @@ export type ComponentPropType<T = any> = {
|
||||
* 属性的分组
|
||||
* - basic 常用属性
|
||||
* - event 事件属性
|
||||
* - data 数据属性
|
||||
* - style 样式属性
|
||||
* - advanced 高级属性
|
||||
*/
|
||||
group?: 'basic' | 'event' | 'style' | 'advanced';
|
||||
group?: 'basic' | 'event' | 'style' | 'data' | 'advanced';
|
||||
/**
|
||||
* 帮助文档链接地址
|
||||
* @example https://foo.bar/help
|
||||
@@ -91,6 +92,10 @@ export type ComponentPropType<T = any> = {
|
||||
* 动态设置表单项是否展示
|
||||
*/
|
||||
getVisible?: (form: any) => boolean;
|
||||
/**
|
||||
* 标记属性是否已废弃
|
||||
*/
|
||||
deprecated?: boolean | string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
# [1.0.0-alpha.8](https://github.com/netease/tango/compare/@music163/tango-sandbox@1.0.0-alpha.7...@music163/tango-sandbox@1.0.0-alpha.8) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-sandbox
|
||||
|
||||
# [1.0.0-alpha.7](https://github.com/netease/tango/compare/@music163/tango-sandbox@1.0.0-alpha.6...@music163/tango-sandbox@1.0.0-alpha.7) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-sandbox
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-sandbox",
|
||||
"version": "1.0.0-alpha.7",
|
||||
"version": "1.0.0-alpha.8",
|
||||
"description": "sandbox of tango apps",
|
||||
"author": "wwsun <ww.sun@outlook.com>",
|
||||
"homepage": "",
|
||||
@@ -29,8 +29,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.8.0",
|
||||
"@music163/tango-core": "^1.0.0-alpha.7",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-core": "^1.0.0-alpha.8",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"crypto-js": "^4.1.1",
|
||||
"lodash.isequal": "4.5.0",
|
||||
"react-frame-component": "^5.2.4"
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.0.0-alpha.12](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.0.0-alpha.11...@music163/tango-setting-form@1.0.0-alpha.12) (2024-03-19)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-setting-form
|
||||
|
||||
# [1.0.0-alpha.11](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.0.0-alpha.10...@music163/tango-setting-form@1.0.0-alpha.11) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- add deprecated and data group to ComponentPropType ([#116](https://github.com/netease/tango/issues/116)) ([9f7441c](https://github.com/netease/tango/commit/9f7441c13400dba55c58b7dd6ce9429013edbc45))
|
||||
|
||||
# [1.0.0-alpha.10](https://github.com/netease/tango/compare/@music163/tango-setting-form@1.0.0-alpha.9...@music163/tango-setting-form@1.0.0-alpha.10) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-setting-form",
|
||||
"version": "1.0.0-alpha.10",
|
||||
"version": "1.0.0-alpha.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": "^1.0.0-alpha.7",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-ui": "^1.0.0-alpha.8",
|
||||
"@music163/tango-core": "^1.0.0-alpha.8",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"@music163/tango-ui": "^1.0.0-alpha.10",
|
||||
"antd": "^4.24.2",
|
||||
"coral-system": "^1.0.5",
|
||||
"mobx": "6.12.0",
|
||||
|
||||
@@ -86,6 +86,7 @@ export function createFormItem(options: IFormItemCreateOptions) {
|
||||
disableVariableSetter: disableVariableSetterProp = options.disableVariableSetter,
|
||||
getVisible: getVisibleProp,
|
||||
getSetterProps: getSetterPropsProp,
|
||||
deprecated,
|
||||
extra,
|
||||
footer,
|
||||
noStyle,
|
||||
@@ -160,6 +161,7 @@ export function createFormItem(options: IFormItemCreateOptions) {
|
||||
note={showItemSubtitle ? name : null}
|
||||
tip={tip}
|
||||
docs={docs}
|
||||
deprecated={deprecated}
|
||||
error={field.error}
|
||||
extra={
|
||||
<Box>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { useState } from 'react';
|
||||
import { css, Box, HTMLCoralProps, Text } from 'coral-system';
|
||||
import { css, Box, HTMLCoralProps, Link } from 'coral-system';
|
||||
import { Checkbox, Tooltip } from 'antd';
|
||||
import { CollapsePanel } from '@music163/tango-ui';
|
||||
import { isNil, isString } from '@music163/tango-helpers';
|
||||
import { WarningOutlined } from '@ant-design/icons';
|
||||
|
||||
export interface FormControlProps extends Omit<FormLabelProps, 'type'> {
|
||||
visible: boolean;
|
||||
@@ -19,6 +20,7 @@ export function FormControl({
|
||||
tip,
|
||||
docs,
|
||||
extra,
|
||||
deprecated,
|
||||
footer,
|
||||
error,
|
||||
children,
|
||||
@@ -27,7 +29,7 @@ export function FormControl({
|
||||
return (
|
||||
<Box className="FormControl" display={visible ? 'block' : 'none'} {...rest}>
|
||||
<Box display="flex" justifyContent="space-between" alignItems="center" mb="s">
|
||||
<FormLabel label={label} note={note} tip={tip} docs={docs} />
|
||||
<FormLabel label={label} note={note} tip={tip} docs={docs} deprecated={deprecated} />
|
||||
{extra}
|
||||
</Box>
|
||||
<Box>{children}</Box>
|
||||
@@ -138,12 +140,12 @@ const labelStyle = css`
|
||||
`;
|
||||
|
||||
const tipStyle = css`
|
||||
a:link {
|
||||
color: #fff;
|
||||
a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--tango-colors-brand);
|
||||
a:link {
|
||||
color: #fff;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -169,19 +171,45 @@ interface FormLabelProps extends HTMLCoralProps<'div'> {
|
||||
* 文档地址
|
||||
*/
|
||||
docs?: string;
|
||||
/**
|
||||
* 是否显示废弃标记
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
deprecated?: boolean | string;
|
||||
}
|
||||
|
||||
function FormLabel({ type = 'normal', label, note, tip, docs, ...rest }: FormLabelProps) {
|
||||
const help = docs ? (
|
||||
<Box css={tipStyle}>
|
||||
<Text mr="m">{tip}</Text>
|
||||
<a href={docs} target="_blank" rel="noreferrer">
|
||||
帮助文档
|
||||
</a>
|
||||
</Box>
|
||||
) : (
|
||||
tip
|
||||
);
|
||||
function FormLabel({
|
||||
type = 'normal',
|
||||
label,
|
||||
note,
|
||||
tip,
|
||||
docs,
|
||||
deprecated,
|
||||
...rest
|
||||
}: FormLabelProps) {
|
||||
let help: React.ReactNode;
|
||||
if (deprecated || docs) {
|
||||
help = (
|
||||
<Box>
|
||||
<Box css={tipStyle}>
|
||||
{tip}
|
||||
{docs ? (
|
||||
<Link href={docs} isExternal ml="m">
|
||||
查看属性文档
|
||||
</Link>
|
||||
) : null}
|
||||
</Box>
|
||||
{deprecated ? (
|
||||
<Box color="#faad14">
|
||||
<WarningOutlined /> 废弃提示:
|
||||
{isString(deprecated) ? deprecated : '该属性已废弃,请谨慎使用。'}
|
||||
</Box>
|
||||
) : null}
|
||||
</Box>
|
||||
);
|
||||
} else {
|
||||
help = tip;
|
||||
}
|
||||
|
||||
const labelColor = {
|
||||
normal: 'text.body',
|
||||
@@ -197,6 +225,7 @@ function FormLabel({ type = 'normal', label, note, tip, docs, ...rest }: FormLab
|
||||
css={labelStyle}
|
||||
title={isString(label) ? label : undefined}
|
||||
>
|
||||
{deprecated ? <WarningOutlined style={{ color: '#faad14', marginRight: 4 }} /> : null}
|
||||
{label}
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.0.0-alpha.10](https://github.com/netease/tango/compare/@music163/tango-ui@1.0.0-alpha.9...@music163/tango-ui@1.0.0-alpha.10) (2024-03-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- select outline node & render dependency list ([#118](https://github.com/netease/tango/issues/118)) ([07febb3](https://github.com/netease/tango/commit/07febb385f710f9a0bc43639ce22787bb05e97ed))
|
||||
|
||||
# [1.0.0-alpha.9](https://github.com/netease/tango/compare/@music163/tango-ui@1.0.0-alpha.8...@music163/tango-ui@1.0.0-alpha.9) (2024-03-18)
|
||||
|
||||
**Note:** Version bump only for package @music163/tango-ui
|
||||
|
||||
# [1.0.0-alpha.8](https://github.com/netease/tango/compare/@music163/tango-ui@1.0.0-alpha.7...@music163/tango-ui@1.0.0-alpha.8) (2024-03-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@music163/tango-ui",
|
||||
"version": "1.0.0-alpha.8",
|
||||
"version": "1.0.0-alpha.10",
|
||||
"description": "ui widgets of tango",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -38,7 +38,7 @@
|
||||
"@codemirror/lang-javascript": "^6.2.1",
|
||||
"@codemirror/lint": "^6.4.2",
|
||||
"@codemirror/search": "^6.5.5",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.3",
|
||||
"@music163/tango-helpers": "^1.0.0-alpha.4",
|
||||
"@uiw/react-codemirror": "^4.21.21",
|
||||
"antd": "^4.24.2",
|
||||
"classnames": "^2.5.1",
|
||||
|
||||
14
packages/ui/src/color-tag.tsx
Normal file
14
packages/ui/src/color-tag.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Tag, TagProps, Tooltip } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
interface ColorTagProps extends TagProps {
|
||||
tooltip?: string;
|
||||
}
|
||||
|
||||
export function ColorTag({ tooltip, children, ...rest }: ColorTagProps) {
|
||||
const tag = <Tag {...rest}>{children}</Tag>;
|
||||
if (tooltip) {
|
||||
return <Tooltip title={tooltip}>{tag}</Tooltip>;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ export * from './chat-input';
|
||||
export * from './error-boundary';
|
||||
export * from './file-explorer';
|
||||
export * from './collapse-panel';
|
||||
export * from './color-tag';
|
||||
export * from './iconfont';
|
||||
export * from './menu';
|
||||
export * from './panel';
|
||||
|
||||
Reference in New Issue
Block a user