Compare commits

..

11 Commits

Author SHA1 Message Date
wwsun 89bcd45728 chore(release): publish
- @music163/tango-designer@0.4.1
 - @music163/tango-setting-form@0.2.4
 - @music163/tango-ui@0.1.5
2023-10-09 18:44:15 +08:00
wwsun e86a6d7cd9 docs: update 2023-10-09 18:41:21 +08:00
wwsun 46b54459ce fix: update tabs style 2023-09-25 19:38:04 +08:00
wwsun 85898dee19 fix: always switch to design mode after preview is on 2023-09-25 16:31:47 +08:00
wwsun e429610606 fix: update export entry 2023-09-25 16:01:04 +08:00
wwsun b6814d6484 chore: update script 2023-09-22 17:55:30 +08:00
wwsun 3d7b58f19a chore(release): publish
- @music163/tango-context@0.2.1
 - @music163/tango-core@0.2.1
 - @music163/tango-designer@0.4.0
 - @music163/tango-sandbox@0.1.6
 - @music163/tango-setting-form@0.2.3
2023-09-22 17:52:12 +08:00
wwsun b6a47acdde chore: add husky 2023-09-22 17:48:54 +08:00
wwsun 226d71c704 fix: remove useless api 2023-09-22 17:48:15 +08:00
wwsun 1c72ee6ac2 feat: add global widget map 2023-09-22 17:37:26 +08:00
wwsun 09a1e2135a fix: add listServiceFunctions 2023-09-22 16:42:38 +08:00
37 changed files with 261 additions and 145 deletions
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn commitlint --edit "$1"
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged --allow-empty
+1 -1
View File
@@ -14,7 +14,7 @@ export default {
],
devServer: {
host: 'local.netease.com',
port: 7007,
port: 8008,
https: {
key: path.resolve(__dirname, 'local.netease.com-key.pem'),
cert: path.resolve(__dirname, 'local.netease.com.pem'),
+1 -1
View File
@@ -10,7 +10,7 @@
],
"scripts": {
"build": "COMPRESS=none umi build",
"start": "HTTPS=1 umi dev"
"start": "umi dev"
},
"dependencies": {
"@ant-design/icons": "^4.8.0",
@@ -1,6 +1,6 @@
import React from 'react';
import { Row, Switch } from 'antd';
import { observer } from '@music163/tango-designer';
import { observer } from '@music163/tango-context';
const OtherPanel = observer(({ autoRemove, setAutoRemove }: any) => {
const onChange = (checked: boolean) => {
+1 -1
View File
@@ -44,7 +44,7 @@ const tangoConfigJson = {
resources: ['https://unpkg.com/moment@{{version}}/moment.js'],
},
'@music163/tango-boot': {
version: '0.2.0',
version: '0.2.1',
library: 'TangoBoot',
type: 'baseDependency',
resources: ['https://unpkg.com/@music163/tango-boot@{{version}}/dist/boot.js'],
+1 -1
View File
@@ -2,4 +2,4 @@
@import '~antd/dist/antd.less'; // 引入官方提供的 less 样式入口文件
@primary-color: #2f54eb;
@border-radius-base: 2px;
@border-radius-base: 2px;
+34 -9
View File
@@ -9,7 +9,6 @@ import {
Toolbar,
WorkspacePanel,
WorkspaceView,
ComponentsPanel,
CodeEditor,
Sandbox,
DndQuery,
@@ -18,6 +17,13 @@ import { createEngine, Workspace } from '@music163/tango-core';
import { Logo, ProjectDetail } from './share';
import { sampleFiles } from '../mock/project';
import './index.less';
import {
ApiOutlined,
AppstoreAddOutlined,
BuildOutlined,
ClusterOutlined,
FunctionOutlined,
} from '@ant-design/icons';
// 1. 实例化工作区
const workspace = new Workspace({
@@ -52,10 +58,11 @@ export default function App() {
<Box px="l">
<Toolbar>
<Toolbar.Item key="routeSwitch" placement="left" />
<Toolbar.Item key="preview" placement="left" />
<Toolbar.Item key="modeSwitch" placement="right" />
<Toolbar.Item key="togglePanel" placement="right" />
<Toolbar.Separator />
<Toolbar.Item key="extra" placement="right">
<Toolbar.Item placement="right">
<Space>
<Button type="primary"></Button>
</Space>
@@ -65,13 +72,31 @@ export default function App() {
}
>
<Sidebar>
<Sidebar.Item key="outline" />
<Sidebar.Item key="components">
<ComponentsPanel menuData={menuData as any} loading={menuLoading} />
</Sidebar.Item>
<Sidebar.Item key="variables" isFloat width={800} />
<Sidebar.Item key="dataSource" isFloat width={800} />
<Sidebar.Item key="dependency" isFloat width={800} />
<Sidebar.Item key="outline" label="结构" icon={<BuildOutlined />} />
<Sidebar.Item
key="components"
label="组件"
icon={<AppstoreAddOutlined />}
widgetProps={{
menuData: menuData as any,
loading: menuLoading,
}}
/>
<Sidebar.Item
key="variables"
label="变量"
icon={<FunctionOutlined />}
isFloat
width={800}
/>
<Sidebar.Item key="dataSource" label="接口" icon={<ApiOutlined />} isFloat width={800} />
<Sidebar.Item
key="dependency"
label="依赖"
icon={<ClusterOutlined />}
isFloat
width={800}
/>
</Sidebar>
<WorkspacePanel>
<WorkspaceView mode="design">
+1 -1
View File
@@ -133,7 +133,7 @@ export function ProjectDetail() {
return (
<Box display="flex" alignItems="center" columnGap="l">
<Box className="ProjectName" fontSize="18px" fontWeight="bold">
lc-online-test
community-test
</Box>
<Box className="BranchName" as="code" fontSize="14px">
<BranchesOutlined /> feature/list
+10 -1
View File
@@ -10,11 +10,20 @@
项目使用的 npm 包依赖信息,用于定义依赖的类型以及外置依赖资源。该配置项为一个 map,key 为对应的 npm 包名,value 为该依赖的配置信息。
- version 包的版本号,必选
- library UMD 包中的全局变量名,必选
- type 依赖的类型
- baseDependency 基础依赖包
- bizDependency 业务组件依赖包
- dependency 其他依赖包
- resources 外置依赖资源列表
- designerResources 在设计器视图载入的外置资源列表,用来需要区别加载时使用
- description 描述信息
依赖的类型 `type` 可以是 `baseDependency` 即项目的基础依赖,用于获取项目基础物料列表的信息;也可以是 `bizDependency` 即业务组件依赖,用于获取合并到物料面板业务组件菜单中的业务组件列表;也可以是 `depenency` 即项目的其他依赖,只用于提供 external 信息与版本信息等,不会和物料面板产生关系。
当配置了外置依赖资源 `resources` 与其对应的全局变量 `library` 时,当这些依赖被 import 时,相关资源不会被打包到 bundle 中,而是在运行时再去外部获取这些扩展依赖,其等效于之前的 `sandbox.externalResources` 与 `sandbox.externals` 配置项。此外,可以将 `resource` 中的版本号替换为 `{{version}}`,其会在平台上构建时替换为版本号。特殊的,可以定义 `designerResources` 用于适配平台的设计器视图。
```json
{
"react": {
+7
View File
@@ -0,0 +1,7 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-case': [0],
'subject-case': [0],
},
};
+10 -3
View File
@@ -21,7 +21,8 @@
"ver": "lerna version --no-private --conventional-commits",
"release": "yarn eslint && yarn build && yarn run ver && lerna publish from-git",
"release:beta": "yarn eslint && yarn build && yarn run ver && lerna publish from-package --dist-tag beta",
"up": "yarn upgrade-interactive --latest"
"up": "yarn upgrade-interactive --latest",
"prepare": "husky install"
},
"devDependencies": {
"@babel/preset-env": "^7.19.3",
@@ -49,11 +50,11 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"http-server": "^14.1.0",
"husky": "^8.0.1",
"husky": "^8.0.3",
"jest": "^29.1.1",
"jest-environment-jsdom": "^29.1.1",
"lerna": "^6.6.1",
"lint-staged": "^13.1.0",
"lint-staged": "^14.0.1",
"prettier": "^2.8.7",
"react": "^17.0.0",
"react-dom": "^17.0.0",
@@ -63,5 +64,11 @@
},
"resolutions": {
"@yarnpkg/parsers": "3.0.0-rc.48.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
}
+4
View File
@@ -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.1](https://github.com/netease/tango/compare/@music163/tango-context@0.2.0...@music163/tango-context@0.2.1) (2023-09-22)
**Note:** Version bump only for package @music163/tango-context
# [0.2.0](https://github.com/netease/tango/compare/@music163/tango-context@0.1.4...@music163/tango-context@0.2.0) (2023-09-21)
### Features
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-context",
"version": "0.2.0",
"version": "0.2.1",
"description": "react context for tango-apps",
"keywords": [
"react",
@@ -31,7 +31,7 @@
"react": ">= 16.8"
},
"dependencies": {
"@music163/tango-core": "^0.2.0",
"@music163/tango-core": "^0.2.1",
"@music163/tango-helpers": "^0.1.3",
"mobx-react-lite": "4.0.2"
},
+6
View File
@@ -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.2.1](https://github.com/netease/tango/compare/@music163/tango-core@0.2.0...@music163/tango-core@0.2.1) (2023-09-22)
### Bug Fixes
- add listServiceFunctions ([09a1e21](https://github.com/netease/tango/commit/09a1e2135a1f51b0a5f6c0a507ba42d2e6355c24))
# [0.2.0](https://github.com/netease/tango/compare/@music163/tango-core@0.1.4...@music163/tango-core@0.2.0) (2023-09-21)
### Features
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-core",
"version": "0.2.0",
"version": "0.2.1",
"description": "tango core",
"author": "wwsun <ww.sun@outlook.com>",
"homepage": "",
+1
View File
@@ -192,6 +192,7 @@ export interface IWorkspace {
) => void;
getServiceFunction?: (serviceKey: string) => object;
listServiceFunctions?: () => Record<string, object>;
removeServiceFunction?: (serviceName: string, modName?: string) => void;
addServiceFunction?: (
payload: IServiceFunctionPayload | IServiceFunctionPayload[],
+8 -1
View File
@@ -16,12 +16,19 @@ import { TangoModule } from './module';
*/
export class TangoServiceModule extends TangoModule {
/**
* 模块名
* 服务函数的模块名,默认为 index
*/
name: string;
/**
* 原始注册的服务函数
* @example { get: {}, list: {} }
*/
_serviceFunctions: Dict;
/**
* 原始的基础配置
*/
_baseConfig: Dict;
get serviceFunctions() {
+18
View File
@@ -647,6 +647,7 @@ export class Workspace extends EventTarget implements IWorkspace {
/**
* 获取服务函数的详情
* TODO: 不要 services 前缀
* @param serviceKey `services.list` 或 `services.sub.list`
* @returns
*/
@@ -663,6 +664,23 @@ export class Workspace extends EventTarget implements IWorkspace {
};
}
/**
* 获取服务函数的列表
*/
listServiceFunctions() {
const ret: Record<string, object> = {};
Object.values(this.serviceModules).forEach((module) => {
Object.keys(module.serviceFunctions).forEach((name) => {
const serviceKey =
module.baseConfig.namespace !== 'index'
? name
: [module.baseConfig.namespace, name].join('.');
ret[serviceKey] = module.serviceFunctions[name];
});
});
return ret;
}
/**
* 更新服务函数
*/
+17
View File
@@ -3,6 +3,23 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.4.1](https://github.com/netease/tango/compare/@music163/tango-designer@0.4.0...@music163/tango-designer@0.4.1) (2023-10-09)
### Bug Fixes
- always switch to design mode after preview is on ([85898de](https://github.com/netease/tango/commit/85898dee19b6031016679e33a4ce9edbd1089713))
- update export entry ([e429610](https://github.com/netease/tango/commit/e4296106066ad290ac838135fe6a57bc50ad2680))
# [0.4.0](https://github.com/netease/tango/compare/@music163/tango-designer@0.3.0...@music163/tango-designer@0.4.0) (2023-09-22)
### Bug Fixes
- remove useless api ([226d71c](https://github.com/netease/tango/commit/226d71c704f41a756ee777d6de4627a7eb7b4259))
### Features
- add global widget map ([1c72ee6](https://github.com/netease/tango/commit/1c72ee6ac287c1b6fb5eb3806a68b877f3749405))
# [0.3.0](https://github.com/netease/tango/compare/@music163/tango-designer@0.2.1...@music163/tango-designer@0.3.0) (2023-09-21)
### Features
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-designer",
"version": "0.3.0",
"version": "0.4.1",
"description": "lowcode designer",
"keywords": [
"react"
@@ -33,12 +33,12 @@
"dependencies": {
"@ant-design/icons": "^4.8.0",
"@music163/request": "^0.1.0",
"@music163/tango-context": "^0.2.0",
"@music163/tango-core": "^0.2.0",
"@music163/tango-context": "^0.2.1",
"@music163/tango-core": "^0.2.1",
"@music163/tango-helpers": "^0.1.3",
"@music163/tango-sandbox": "^0.1.5",
"@music163/tango-setting-form": "^0.2.2",
"@music163/tango-ui": "^0.1.4",
"@music163/tango-sandbox": "^0.1.6",
"@music163/tango-setting-form": "^0.2.4",
"@music163/tango-ui": "^0.1.5",
"antd": "^4.24.2",
"cash-dom": "^8.1.2",
"classnames": "^2.3.2",
+1
View File
@@ -11,6 +11,7 @@ export * from './sandbox';
export * from './sidebar';
export * from './toolbar';
export * from './selection-menu';
export * from './widgets';
export { register as registerSetter } from '@music163/tango-setting-form';
+3 -5
View File
@@ -19,7 +19,6 @@ interface ISandboxEventHandlerConfig {
export type SandboxProps = Omit<CodeSandboxProps, 'files' | 'eventHandlers' | 'onMessage'> & {
isPreview?: boolean;
selectionTools?: SelectionToolsProps['actions'];
builtinSelectionMenuMap?: SelectionToolsProps['builtinActionMap'];
/**
* tangoConfigJson 处理器
*/
@@ -32,10 +31,10 @@ export type SandboxProps = Omit<CodeSandboxProps, 'files' | 'eventHandlers' | 'o
onLoad?: (config?: ISandboxEventHandlerConfig) => void;
};
export type CombinedSandboxRef = {
export interface CombinedSandboxRef {
designSandbox: CodeSandbox;
previewSandbox: CodeSandbox;
};
}
const LANDING_PAGE_PATH = '/__background_landing_page__';
@@ -281,7 +280,6 @@ export const Sandbox = observer(
({
isPreview: isPreviewProp,
selectionTools,
builtinSelectionMenuMap,
bundlerURL,
mode = 'combined',
...props
@@ -352,7 +350,7 @@ export const Sandbox = observer(
}}
/>
<Simulator>
<Viewport selectionTools={selectionTools} builtinActionMap={builtinSelectionMenuMap}>
<Viewport selectionTools={selectionTools}>
{mode === 'single' && (
<DesignSandbox
ref={sandboxRef}
+17 -54
View File
@@ -1,21 +1,11 @@
import React, { useMemo } from 'react';
import cx from 'classnames';
import { Box, Text, css, HTMLCoralProps } from 'coral-system';
import {
ClusterOutlined,
FunctionOutlined,
ApiOutlined,
AppstoreOutlined,
BuildOutlined,
} from '@ant-design/icons';
import { Badge } from 'antd';
import { ReactComponentProps } from '@music163/tango-helpers';
import { observer, useDesigner } from '@music163/tango-context';
import { ResizableBox } from './resizable-box';
import { OutlinePanel } from './outline-panel';
import { DependencyPanel } from './dependency-panel';
import { VariablePanel } from './variable-panel';
import { DataSourcePanel } from './datasource-panel';
import { getWidget } from '../widgets';
const sidebarStyle = css`
position: relative;
@@ -51,7 +41,6 @@ export interface SidebarProps extends ReactComponentProps {
* 底部附加内容
*/
footer?: React.ReactNode;
builtinPanelMap?: Record<string, SidebarPanelItemProps>;
}
export interface SidebarPanelItemProps
@@ -79,54 +68,21 @@ export interface SidebarPanelItemProps
* 面板宽度
*/
width?: number;
/**
* 如果 key 匹配到内置组件的话,传递给子节点的属性
*/
widgetProps?: object;
}
const INTERNAL_SIDEBAR_PANEL_MAP: Record<string, SidebarPanelItemProps> = {
components: {
label: '组件',
title: '组件列表',
icon: <AppstoreOutlined />,
},
outline: {
label: '结构',
title: '结构',
icon: <BuildOutlined />,
children: <OutlinePanel />,
},
dependency: {
label: '依赖',
title: '项目依赖',
icon: <ClusterOutlined />,
children: <DependencyPanel />,
},
variables: {
label: '变量',
title: '变量管理',
icon: <FunctionOutlined />,
children: <VariablePanel />,
width: 440,
},
dataSource: {
label: '接口',
title: '数据源与接口',
icon: <ApiOutlined />,
children: <DataSourcePanel />,
width: 600,
},
};
function BaseSidebarPanel({
panelWidth: defaultPanelWidth = 280,
builtinPanelMap = INTERNAL_SIDEBAR_PANEL_MAP,
footer,
children,
}: SidebarProps) {
function BaseSidebarPanel({ panelWidth: defaultPanelWidth = 280, footer, children }: SidebarProps) {
const items = useMemo(() => {
const ret: Record<React.Key, SidebarPanelItemProps> = {};
React.Children.forEach(children, (child) => {
if (child && React.isValidElement(child)) {
const widget = getWidget(['sidebar', child.key].join('.'));
const fallbackNode = widget ? React.createElement(widget, child.props.widgetProps) : null;
ret[child.key] = {
...builtinPanelMap[child.key],
children: fallbackNode,
...child.props,
};
}
@@ -203,7 +159,14 @@ function BaseSidebarPanel({
);
}
BaseSidebarPanel.Item = function ({ key, title, doc, isFloat, width }: SidebarPanelItemProps) {
BaseSidebarPanel.Item = function ({
key,
title,
doc,
isFloat,
width,
widgetProps,
}: SidebarPanelItemProps) {
return <></>;
};
+4 -17
View File
@@ -6,7 +6,7 @@ import { ISelectedItemData, isString, noop } from '@music163/tango-helpers';
import { observer, useDesigner, useWorkspace } from '@music163/tango-context';
import { IconButton } from '@music163/tango-ui';
import { getDragGhostElement } from '../helpers';
import { CopyNodeAction, DeleteNodeAction, ViewSourceAction } from '../selection-menu';
import { getWidget } from '../widgets';
/**
* 选择辅助工具的对齐方式
@@ -15,34 +15,21 @@ type SelectionHelperAlignType = 'top-right' | 'top-left' | 'inner-top-right';
const boundingOffset = 100; // 检测选中模块的工具栏是否溢出的偏移值
const internalSelectionToolsMap = {
source: <ViewSourceAction />,
copy: <CopyNodeAction />,
delete: <DeleteNodeAction />,
};
export const INTERNAL_SELECTION_TOOLS = ['source', 'create', 'copy', 'delete'];
export interface SelectionToolsProps {
/**
* 动作列表,内置的动作列表有 source-定位到源码, block-创建区块, copy-复制节点, delete-删除节点
*/
actions?: Array<string | React.ReactElement>;
builtinActionMap?: Record<string, React.ReactElement>;
}
export const SelectionTools = observer(
({
actions: actionsProp = INTERNAL_SELECTION_TOOLS,
builtinActionMap = internalSelectionToolsMap,
}: SelectionToolsProps) => {
({ actions: actionsProp = ['viewSource', 'copyNode', 'deleteNode'] }: SelectionToolsProps) => {
const workspace = useWorkspace();
const selectSource = workspace.selectSource;
const actions = actionsProp.map((item) => {
if (isString(item)) {
return builtinActionMap[item]
? React.cloneElement(builtinActionMap[item], { key: item })
: null;
const widget = getWidget(['selectionMenu', item].join('.'));
return widget ? React.createElement(widget, { key: item }) : null;
}
return item;
});
+2 -9
View File
@@ -10,21 +10,14 @@ import { DraggingMask } from './mask';
export interface ViewportProps extends HTMLCoralProps<'div'> {
selectionTools?: SelectionToolsProps['actions'];
builtinActionMap?: SelectionToolsProps['builtinActionMap'];
}
export function Viewport({
selectionTools,
builtinActionMap,
children,
className,
...rest
}: ViewportProps) {
export function Viewport({ selectionTools, children, className, ...rest }: ViewportProps) {
return (
<Box position="relative" height="100%" className={cx('Viewport', className)} {...rest}>
<ViewportBody>{children}</ViewportBody>
<div className="AuxTools">
<SelectionTools actions={selectionTools} builtinActionMap={builtinActionMap} />
<SelectionTools actions={selectionTools} />
<InsertionPrompt />
<DraggingMask />
</div>
+5 -1
View File
@@ -11,7 +11,11 @@ export const PreviewTool = observer(() => {
shape="ghost"
selected={designer.isPreview}
onClick={() => {
designer.toggleIsPreview(!designer.isPreview);
const nextIsPreview = !designer.isPreview;
designer.toggleIsPreview(nextIsPreview);
if (nextIsPreview) {
designer.setActiveView('design');
}
}}
tip="预览"
>
+16 -17
View File
@@ -1,26 +1,13 @@
import React, { useMemo } from 'react';
import { Box, Group } from 'coral-system';
import { ReactComponentProps } from '@music163/tango-helpers';
import { HistoryTool } from './history';
import { ModeSwitchTool } from './mode-switch';
import { PreviewTool } from './preview';
import { RouteSwitchTool } from './route-switch';
import { TogglePanelTool } from './toggle-panel';
import { getWidget } from '../widgets';
export interface ToolbarProps {
children?: React.ReactElement | React.ReactElement[];
builtinToolMap?: Record<string, React.ReactNode>;
}
const builtinToolsMap = {
history: <HistoryTool />,
modeSwitch: <ModeSwitchTool />,
preview: <PreviewTool />,
routeSwitch: <RouteSwitchTool />,
togglePanel: <TogglePanelTool />,
};
export function Toolbar({ children, builtinToolMap = builtinToolsMap }: ToolbarProps) {
export function Toolbar({ children }: ToolbarProps) {
const [leftTools, centerTools, rightTools] = useMemo(() => {
const left: React.ReactNode[] = [];
const center: React.ReactNode[] = [];
@@ -28,7 +15,15 @@ export function Toolbar({ children, builtinToolMap = builtinToolsMap }: ToolbarP
let prevPlacement: string;
React.Children.forEach(children, (child: React.ReactElement, index) => {
let node = child.props.children || builtinToolMap[child.key];
let fallbackNode;
if (child.key) {
const Widget = getWidget(['toolbar', child.key].join('.'));
if (Widget) {
fallbackNode = React.createElement(Widget, child.props.widgetProps);
}
}
let node = child.props.children ?? fallbackNode ?? null;
if (!node) {
node = child; // separator
}
@@ -75,9 +70,13 @@ export function Toolbar({ children, builtinToolMap = builtinToolsMap }: ToolbarP
export interface ToolbarItemProps extends ReactComponentProps {
placement?: 'left' | 'center' | 'right';
children?: React.ReactElement;
/**
* 如果 key 匹配到内置组件的话,传递给子节点的属性
*/
widgetProps?: object;
}
function ToolbarItem({ placement, children }: ToolbarItemProps) {
function ToolbarItem({ placement, widgetProps, children }: ToolbarItemProps) {
return <div>{children}</div>;
}
+44
View File
@@ -0,0 +1,44 @@
import { getValue, setValue } from '@music163/tango-helpers';
import { ModeSwitchTool, PreviewTool, RouteSwitchTool, TogglePanelTool } from './toolbar';
import {
ComponentsPanel,
DataSourcePanel,
DependencyPanel,
OutlinePanel,
VariablePanel,
} from './sidebar';
import { CopyNodeAction, DeleteNodeAction, ViewSourceAction } from './selection-menu';
const widgets = {};
export function registerWidget(key: string, component: React.ComponentType<any>) {
if (!/^(toolbar|sidebar|selectionMenu)\.[a-zA-z]+$/.test(key)) {
throw new Error(
`Invalid widget key(${key}), should start with toolbar, sidebar, or selection-menu`,
);
}
setValue(widgets, key, component);
}
export function getWidget(key: string) {
if (!key) {
return;
}
return getValue(widgets, key);
}
registerWidget('toolbar.modeSwitch', ModeSwitchTool);
registerWidget('toolbar.preview', PreviewTool);
registerWidget('toolbar.routeSwitch', RouteSwitchTool);
registerWidget('toolbar.togglePanel', TogglePanelTool);
registerWidget('sidebar.components', ComponentsPanel);
registerWidget('sidebar.outline', OutlinePanel);
registerWidget('sidebar.dependency', DependencyPanel);
registerWidget('sidebar.variables', VariablePanel);
registerWidget('sidebar.dataSource', DataSourcePanel);
registerWidget('selectionMenu.copyNode', CopyNodeAction);
registerWidget('selectionMenu.deleteNode', DeleteNodeAction);
registerWidget('selectionMenu.viewSource', ViewSourceAction);
+4
View File
@@ -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.6](https://github.com/netease/tango/compare/@music163/tango-sandbox@0.1.5...@music163/tango-sandbox@0.1.6) (2023-09-22)
**Note:** Version bump only for package @music163/tango-sandbox
## [0.1.5](https://github.com/netease/tango/compare/@music163/tango-sandbox@0.1.4...@music163/tango-sandbox@0.1.5) (2023-09-21)
**Note:** Version bump only for package @music163/tango-sandbox
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-sandbox",
"version": "0.1.5",
"version": "0.1.6",
"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.0",
"@music163/tango-core": "^0.2.1",
"@music163/tango-helpers": "^0.1.3",
"crypto-js": "^4.1.1",
"lodash.isequal": "4.5.0",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.2.4](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.3...@music163/tango-setting-form@0.2.4) (2023-10-09)
**Note:** Version bump only for package @music163/tango-setting-form
## [0.2.3](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.2...@music163/tango-setting-form@0.2.3) (2023-09-22)
**Note:** Version bump only for package @music163/tango-setting-form
## [0.2.2](https://github.com/netease/tango/compare/@music163/tango-setting-form@0.2.1...@music163/tango-setting-form@0.2.2) (2023-09-21)
**Note:** Version bump only for package @music163/tango-setting-form
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-setting-form",
"version": "0.2.2",
"version": "0.2.4",
"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.0",
"@music163/tango-core": "^0.2.1",
"@music163/tango-helpers": "^0.1.3",
"@music163/tango-ui": "^0.1.4",
"@music163/tango-ui": "^0.1.5",
"antd": "^4.24.2",
"coral-system": "^1.0.5",
"mobx": "6.9.0",
+6
View File
@@ -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.5](https://github.com/netease/tango/compare/@music163/tango-ui@0.1.4...@music163/tango-ui@0.1.5) (2023-10-09)
### Bug Fixes
- update tabs style ([46b5445](https://github.com/netease/tango/commit/46b54459ceb23f9df52b9eb40dc935bc872ba1b4))
## [0.1.4](https://github.com/netease/tango/compare/@music163/tango-ui@0.1.3...@music163/tango-ui@0.1.4) (2023-09-18)
**Note:** Version bump only for package @music163/tango-ui
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@music163/tango-ui",
"version": "0.1.4",
"version": "0.1.5",
"description": "ui widgets of tango",
"keywords": [
"react",
+1 -1
View File
@@ -18,7 +18,7 @@ export function Tabs({
const tabBarStyle = useMemo(() => {
let ret = centered ? centerTabBarStyle : defaultTabBarStyle;
if (isTabBarSticky) {
ret = { ...ret, position: 'sticky', top: tabBarStickyOffset, zIndex: 1, background: '#fff' };
ret = { ...ret, position: 'sticky', top: tabBarStickyOffset, zIndex: 2, background: '#fff' };
}
return ret;
}, [centered, isTabBarSticky, tabBarStickyOffset]);
+6 -6
View File
@@ -11185,9 +11185,9 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
husky@^8.0.1:
husky@^8.0.3:
version "8.0.3"
resolved "https://registry.npmmirror.com/husky/-/husky-8.0.3.tgz"
resolved "https://registry.npmmirror.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==
iconv-lite@0.4.24, iconv-lite@^0.4.24:
@@ -13043,10 +13043,10 @@ lines-and-columns@~2.0.3:
resolved "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-2.0.3.tgz"
integrity sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w==
lint-staged@^13.1.0:
version "13.3.0"
resolved "https://registry.npmmirror.com/lint-staged/-/lint-staged-13.3.0.tgz"
integrity sha512-mPRtrYnipYYv1FEE134ufbWpeggNTo+O/UPzngoaKzbzHAthvR55am+8GfHTnqNRQVRRrYQLGW9ZyUoD7DsBHQ==
lint-staged@^14.0.1:
version "14.0.1"
resolved "https://registry.npmmirror.com/lint-staged/-/lint-staged-14.0.1.tgz#57dfa3013a3d60762d9af5d9c83bdb51291a6232"
integrity sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw==
dependencies:
chalk "5.3.0"
commander "11.0.0"