fix: remove some deprecated apis

This commit is contained in:
1ncounter 2024-04-14 21:10:12 +08:00
parent 0831277dc0
commit 35db123cbf
23 changed files with 97 additions and 140 deletions

View File

@ -7,7 +7,6 @@ import {
IPublicTypeNpmInfo, IPublicTypeNpmInfo,
IPublicModelEditor, IPublicModelEditor,
IPublicTypePropsList, IPublicTypePropsList,
IPublicTypeNodeSchema,
IPublicTypePropsTransducer, IPublicTypePropsTransducer,
IShellModelFactory, IShellModelFactory,
IPublicModelDragObject, IPublicModelDragObject,

View File

@ -1,5 +1,5 @@
import { Component, ReactElement } from 'react'; import { Component, ReactElement } from 'react';
import { observer, observable, Title, makeObservable } from '@alilc/lowcode-editor-core'; import { observer, observable, Title, makeObservable, action } from '@alilc/lowcode-editor-core';
import { Designer } from '../designer'; import { Designer } from '../designer';
import { isSimulatorHost } from '../../simulator'; import { isSimulatorHost } from '../../simulator';
import './ghost.less'; import './ghost.less';
@ -30,15 +30,15 @@ export default class DragGhost extends Component<{ designer: Designer }> {
super(props); super(props);
makeObservable(this); makeObservable(this);
this.dispose = [ this.dispose = [
this.dragon.onDragstart((e) => { this.dragon.onDragstart(action((e) => {
if (e.originalEvent.type.slice(0, 4) === 'drag') { if (e.originalEvent.type.slice(0, 4) === 'drag') {
return; return;
} }
this.titles = this.getTitles(e.dragObject!) as any; this.titles = this.getTitles(e.dragObject!) as any;
this.x = e.globalX; this.x = e.globalX;
this.y = e.globalY; this.y = e.globalY;
}), })),
this.dragon.onDrag((e) => { this.dragon.onDrag(action((e) => {
this.x = e.globalX; this.x = e.globalX;
this.y = e.globalY; this.y = e.globalY;
if (isSimulatorHost(e.sensor)) { if (isSimulatorHost(e.sensor)) {
@ -49,12 +49,12 @@ export default class DragGhost extends Component<{ designer: Designer }> {
} }
} }
this.isAbsoluteLayoutContainer = false; this.isAbsoluteLayoutContainer = false;
}), })),
this.dragon.onDragend(() => { this.dragon.onDragend(action(() => {
this.titles = null; this.titles = null;
this.x = 0; this.x = 0;
this.y = 0; this.y = 0;
}), })),
]; ];
} }

View File

@ -71,8 +71,6 @@ export interface ISettingField
clearValue(): void; clearValue(): void;
valueChange(options: IPublicTypeSetValueOptions): void;
createField(config: IPublicTypeFieldConfig): ISettingField; createField(config: IPublicTypeFieldConfig): ISettingField;
onEffect(action: () => void): IPublicTypeDisposable; onEffect(action: () => void): IPublicTypeDisposable;
@ -258,8 +256,6 @@ export class SettingField extends SettingPropEntry implements ISettingField {
if (Array.isArray(data) && data[0] && data[0].__sid__) { if (Array.isArray(data) && data[0] && data[0].__sid__) {
return; return;
} }
this.valueChange();
} }
@action @action
@ -304,8 +300,6 @@ export class SettingField extends SettingPropEntry implements ISettingField {
if (Array.isArray(data) && data[0] && data[0].__sid__) { if (Array.isArray(data) && data[0] && data[0].__sid__) {
return; return;
} }
this.valueChange(options);
} }
onEffect(action: () => void): IPublicTypeDisposable { onEffect(action: () => void): IPublicTypeDisposable {

View File

@ -14,7 +14,7 @@ import {
IPublicTypeFieldExtraProps, IPublicTypeFieldExtraProps,
IPublicTypeSetValueOptions, IPublicTypeSetValueOptions,
} from '@alilc/lowcode-types'; } from '@alilc/lowcode-types';
import { uniqueId, isJSExpression, isSettingField } from '@alilc/lowcode-utils'; import { uniqueId, isJSExpression } from '@alilc/lowcode-utils';
import { ISettingEntry } from './setting-entry-type'; import { ISettingEntry } from './setting-entry-type';
import { INode } from '../../document'; import { INode } from '../../document';
import type { IComponentMeta } from '../../component-meta'; import type { IComponentMeta } from '../../component-meta';
@ -29,8 +29,6 @@ export interface ISettingPropEntry extends ISettingEntry {
get name(): string | number | undefined; get name(): string | number | undefined;
valueChange(options: IPublicTypeSetValueOptions): void;
getKey(): string | number | undefined; getKey(): string | number | undefined;
setKey(key: string | number): void; setKey(key: string | number): void;
@ -49,8 +47,6 @@ export interface ISettingPropEntry extends ISettingEntry {
setValue( setValue(
val: any, val: any,
isHotValue?: boolean,
force?: boolean,
extraOptions?: IPublicTypeSetValueOptions, extraOptions?: IPublicTypeSetValueOptions,
): void; ): void;
@ -231,8 +227,6 @@ export class SettingPropEntry implements ISettingPropEntry {
*/ */
setValue( setValue(
val: any, val: any,
isHotValue?: boolean,
force?: boolean,
extraOptions?: IPublicTypeSetValueOptions, extraOptions?: IPublicTypeSetValueOptions,
) { ) {
const oldValue = this.getValue(); const oldValue = this.getValue();
@ -250,10 +244,6 @@ export class SettingPropEntry implements ISettingPropEntry {
} }
} }
this.notifyValueChange(oldValue, val); this.notifyValueChange(oldValue, val);
// 如果 fromSetHotValue那么在 setHotValue 中已经调用过 valueChange 了
if (!extraOptions?.fromSetHotValue) {
this.valueChange(extraOptions);
}
} }
/** /**

View File

@ -2,7 +2,6 @@ import { ReactElement } from 'react';
import { import {
observable, observable,
computed, computed,
autorun,
makeObservable, makeObservable,
runInAction, runInAction,
wrapWithEventSwitch, wrapWithEventSwitch,
@ -295,7 +294,6 @@ implements
this._children = new NodeChildren(this as INode, this.initialChildren(children)); this._children = new NodeChildren(this as INode, this.initialChildren(children));
this._children.internalInitParent(); this._children.internalInitParent();
this.props.merge(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras)); this.props.merge(this.upgradeProps(this.initProps(props || {})), this.upgradeProps(extras));
this.setupAutoruns();
} }
this.initBuiltinProps(); this.initBuiltinProps();
@ -343,18 +341,6 @@ implements
return this.document.designer.transformProps(props, this, IPublicEnumTransformStage.Upgrade); return this.document.designer.transformProps(props, this, IPublicEnumTransformStage.Upgrade);
} }
private setupAutoruns() {
const { autoruns } = this.componentMeta.advanced;
if (!autoruns || autoruns.length < 1) {
return;
}
this.autoruns = autoruns.map((item) => {
return autorun(() => {
item.autorun(this.props.getNode().settingEntry.get(item.name)?.internalToShellField());
});
});
}
private initialChildren( private initialChildren(
children: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined, children: IPublicTypeNodeData | IPublicTypeNodeData[] | undefined,
): IPublicTypeNodeData[] { ): IPublicTypeNodeData[] {
@ -840,7 +826,7 @@ implements
} }
import(data: Schema, checkId = false) { import(data: Schema, checkId = false) {
const { componentName, id, children, props, ...extras } = data; const { children, props, ...extras } = data;
if (this.isSlot()) { if (this.isSlot()) {
foreachReverse( foreachReverse(
this.children!, this.children!,
@ -894,17 +880,6 @@ implements
const _extras_: { [key: string]: any } = { const _extras_: { [key: string]: any } = {
...extras, ...extras,
}; };
/* istanbul ignore next */
Object.keys(this._addons).forEach((key) => {
const addon = this._addons[key];
if (addon) {
if (addon.isProp) {
(props as any)[getConvertedExtraKey(key)] = addon.exportData();
} else {
_extras_[key] = addon.exportData();
}
}
});
const schema: any = { const schema: any = {
...baseSchema, ...baseSchema,
@ -1146,6 +1121,13 @@ implements
this.emitter.removeListener('propChange', wrappedFunc); this.emitter.removeListener('propChange', wrappedFunc);
}; };
} }
/**
* todo: fixed types
*/
getDOMNode(): HTMLElement {
return document.body;
}
} }
function ensureNode(node: any, document: IDocumentModel): INode { function ensureNode(node: any, document: IDocumentModel): INode {

View File

@ -75,7 +75,11 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
private purged = false; private purged = false;
constructor(owner: INode, value?: IPublicTypePropsMap | IPublicTypePropsList | null, extras?: ExtrasObject) { constructor(
owner: INode,
value?: IPublicTypePropsMap | IPublicTypePropsList | null,
extras?: ExtrasObject
) {
makeObservable(this); makeObservable(this);
this.owner = owner; this.owner = owner;
if (Array.isArray(value)) { if (Array.isArray(value)) {
@ -166,10 +170,9 @@ export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'g
allProps[name] = value; allProps[name] = value;
} }
}); });
// compatible vision
const transformedProps = this.transformToStatic(allProps); Object.keys(allProps).forEach((name) => {
Object.keys(transformedProps).forEach((name) => { const value = allProps[name];
const value = transformedProps[name];
if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) { if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
name = getOriginalExtraKey(name); name = getOriginalExtraKey(name);
extras[name] = value; extras[name] = value;

View File

@ -1,6 +1,5 @@
import { ReactNode } from 'react';
import { IPublicApiSetters, IPublicModelSettingField, IPublicTypeCustomView, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types'; import { IPublicApiSetters, IPublicModelSettingField, IPublicTypeCustomView, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types';
import { createContent, isCustomView } from '@alilc/lowcode-utils'; import { isCustomView } from '@alilc/lowcode-utils';
const settersMap = new Map<string, IPublicTypeRegisteredSetter & { const settersMap = new Map<string, IPublicTypeRegisteredSetter & {
type: string; type: string;
@ -44,9 +43,7 @@ function getInitialFromSetter(setter: any) {
) || null; // eslint-disable-line ) || null; // eslint-disable-line
} }
export interface ISetters extends IPublicApiSetters {} export class Setters implements IPublicApiSetters {
export class Setters implements ISetters {
settersMap = new Map<string, IPublicTypeRegisteredSetter & { settersMap = new Map<string, IPublicTypeRegisteredSetter & {
type: string; type: string;
}>(); }>();
@ -91,27 +88,4 @@ export class Setters implements ISetters {
getSettersMap = () => { getSettersMap = () => {
return this.settersMap; return this.settersMap;
}; };
createSetterContent = (setter: any, props: Record<string, any>): ReactNode => {
if (typeof setter === 'string') {
setter = this.getSetter(setter);
if (!setter) {
return null;
}
if (setter.defaultProps) {
props = {
...setter.defaultProps,
...props,
};
}
setter = setter.component;
}
// Fusion 的表单组件都是通过 'value' in props 来判断是否使用 defaultValue
if ('value' in props && typeof props.value === 'undefined') {
delete props.value;
}
return createContent(setter, props);
};
} }

View File

@ -1,7 +1,7 @@
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { configure } from 'mobx'; import * as mobx from 'mobx';
configure({ enforceActions: 'never' }); mobx.configure({ enforceActions: 'never' });
export { export {
observable, observable,
@ -18,4 +18,4 @@ export {
} from 'mobx'; } from 'mobx';
export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx'; export type { IReactionDisposer, IReactionPublic, IReactionOptions } from 'mobx';
export { observer }; export { observer, mobx };

View File

@ -65,7 +65,7 @@ export class Title extends Component<IPublicTypeTitleProps> {
return null; return null;
} }
const intlLabel = intl(String(label)); const intlLabel = intl(label as IPublicTypeI18nData);
if (typeof intlLabel !== 'string') { if (typeof intlLabel !== 'string') {
return <span className="lc-title-txt">{intlLabel}</span>; return <span className="lc-title-txt">{intlLabel}</span>;

View File

@ -14,7 +14,11 @@ export interface FieldProps {
[extra: string]: any; [extra: string]: any;
} }
export function createField(props: FieldProps, children: ReactNode, type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry'): ReactNode { export function createField(
props: FieldProps,
children:ReactNode,
type?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry'
): ReactNode {
if (type === 'popup') { if (type === 'popup') {
return createElement(PopupField, props, children); return createElement(PopupField, props, children);
} }

View File

@ -1,10 +1,11 @@
import { Component, MouseEvent, Fragment, ReactNode } from 'react'; import { Component, MouseEvent, Fragment, ReactNode } from 'react';
import { shallowIntl, observer, observable, engineConfig, runInAction } from '@alilc/lowcode-editor-core'; import { observer, observable, engineConfig, runInAction, shallowIntl } from '@alilc/lowcode-editor-core';
import { import {
createContent, createContent,
isJSSlot, isJSSlot,
isSetterConfig, isSetterConfig,
shouldUseVariableSetter, shouldUseVariableSetter,
isSettingField
} from '@alilc/lowcode-utils'; } from '@alilc/lowcode-utils';
import { Skeleton } from '../../skeleton'; import { Skeleton } from '../../skeleton';
import { Stage } from '../../widget/stage'; import { Stage } from '../../widget/stage';
@ -17,7 +18,6 @@ import {
ISettingEntry, ISettingEntry,
IComponentMeta, IComponentMeta,
ISettingField, ISettingField,
isSettingField,
ISettingTopEntry, ISettingTopEntry,
} from '@alilc/lowcode-designer'; } from '@alilc/lowcode-designer';
import { createField } from '../field'; import { createField } from '../field';
@ -41,7 +41,7 @@ function isStandardComponent(componentMeta: IComponentMeta | null) {
function isInitialValueNotEmpty(initialValue: any) { function isInitialValueNotEmpty(initialValue: any) {
if (isJSSlot(initialValue)) { if (isJSSlot(initialValue)) {
return ( return (
// @ts-ignore visible 为 false 代表默认不展示 // @ts-expect-error visible 为 false 代表默认不展示
initialValue.visible !== false && initialValue.visible !== false &&
Array.isArray(initialValue.value) && Array.isArray(initialValue.value) &&
initialValue.value.length > 0 initialValue.value.length > 0
@ -247,13 +247,38 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
return null; return null;
} }
const { setterProps = {}, setterType, initialValue = null } = this.setterInfo;
const value = this.value;
const onChangeAPI = extraProps?.onChange;
const stageName = this.stageName; const stageName = this.stageName;
const {
setterProps = {},
setterType,
initialValue = null,
} = this.setterInfo;
const onChangeAPI = extraProps?.onChange;
const createSetterContent = (setter: any, props: Record<string, any>): ReactNode => {
if (typeof setter === 'string') {
setter = this.setters?.getSetter(setter);
if (!setter) {
return null;
}
if (setter.defaultProps) {
props = {
...setter.defaultProps,
...props,
};
}
setter = setter.component;
}
// Fusion 的表单组件都是通过 'value' in props 来判断是否使用 defaultValue
if ('value' in props && typeof props.value === 'undefined') {
delete props.value;
}
return createContent(setter, props);
};
return createField( return createField(
{ {
meta: field?.componentMeta?.npm || field?.componentMeta?.componentName || '', meta: field?.componentMeta?.npm || field?.componentMeta?.componentName || '',
@ -268,8 +293,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
stageName, stageName,
...extraProps, ...extraProps,
}, },
!stageName && !stageName && createSetterContent(setterType, {
this.setters?.createSetterContent(setterType, {
...shallowIntl(setterProps), ...shallowIntl(setterProps),
forceInline: extraProps.forceInline, forceInline: extraProps.forceInline,
key: field.id, key: field.id,
@ -278,12 +302,11 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
selected: field.top?.getNode()?.internalToShellNode(), selected: field.top?.getNode()?.internalToShellNode(),
field: field.internalToShellField(), field: field.internalToShellField(),
// === IO // === IO
value, // reaction point value: this.value, // reaction point
initialValue, initialValue,
onChange: (value: any) => { onChange: (value: any) => {
this.setState({ this.setState({
fromOnChange: true, fromOnChange: true,
// eslint-disable-next-line react/no-unused-state
value, value,
}); });
field.setValue(value, true); field.setValue(value, true);
@ -298,7 +321,6 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
? initialValue(field.internalToShellField()) ? initialValue(field.internalToShellField())
: initialValue; : initialValue;
this.setState({ this.setState({
// eslint-disable-next-line react/no-unused-state
value, value,
}); });
field.setValue(value, true); field.setValue(value, true);

View File

@ -18,6 +18,8 @@ import { SkeletonContext } from '../../context';
import { intl } from '../../locale'; import { intl } from '../../locale';
import { createIcon, isSettingField } from '@alilc/lowcode-utils'; import { createIcon, isSettingField } from '@alilc/lowcode-utils';
import './style.less';
interface ISettingsPrimaryPaneProps { interface ISettingsPrimaryPaneProps {
engineEditor: Editor; engineEditor: Editor;
config?: any; config?: any;
@ -200,7 +202,6 @@ export class SettingsPrimaryPane extends Component<
{(skeleton) => { {(skeleton) => {
if (skeleton) { if (skeleton) {
return ( return (
// @ts-ignore
<StageBox skeleton={skeleton} target={settings} key={settings.id}> <StageBox skeleton={skeleton} target={settings} key={settings.id}>
<SettingsPane target={settings} usePopup={false} /> <SettingsPane target={settings} usePopup={false} />
</StageBox> </StageBox>

View File

@ -123,26 +123,27 @@ const designer = new Designer({ editor, shellModelFactory });
editor.set('designer', designer); editor.set('designer', designer);
const { project: innerProject } = designer; const { project: innerProject } = designer;
const project = new Project(innerProject);
editor.set('project', project);
const innerHotkey = new InnerHotkey(); const innerHotkey = new InnerHotkey();
const hotkey = new Hotkey(innerHotkey); const hotkey = new Hotkey(innerHotkey);
const project = new Project(innerProject); editor.set('innerHotkey', innerHotkey);
const skeleton = new Skeleton(innerSkeleton, 'any', false); const skeleton = new Skeleton(innerSkeleton, 'any', false);
const innerSetters = new InnerSetters(); const innerSetters = new InnerSetters();
const setters = new Setters(innerSetters); const setters = new Setters(innerSetters);
editor.set('setters', setters);
const material = new Material(editor);
editor.set('material', material);
const innerCommand = new InnerCommand(); const innerCommand = new InnerCommand();
const command = new Command( const command = new Command(
innerCommand, innerCommand,
engineContext as IPublicModelPluginContext engineContext as IPublicModelPluginContext
); );
const material = new Material(editor);
const commonUI = new CommonUI(editor); const commonUI = new CommonUI(editor);
editor.set('project', project);
editor.set('setters', setters);
editor.set('material', material);
editor.set('innerHotkey', innerHotkey);
const config = new Config(engineConfig); const config = new Config(engineConfig);
const event = new Event(commonEvent, { prefix: 'common' }); const event = new Event(commonEvent, { prefix: 'common' });
const logger = new Logger({ level: 'warn', bizName: 'common' }); const logger = new Logger({ level: 'warn', bizName: 'common' });

View File

@ -1,4 +1,4 @@
import { ISettingField, isSettingField } from '@alilc/lowcode-designer'; import { ISettingField } from '@alilc/lowcode-designer';
import { import {
IPublicTypeCompositeValue, IPublicTypeCompositeValue,
IPublicTypeFieldConfig, IPublicTypeFieldConfig,
@ -16,7 +16,7 @@ import { settingFieldSymbol } from '../symbols';
import { Node as ShellNode } from './node'; import { Node as ShellNode } from './node';
import { SettingTopEntry, SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry'; import { SettingTopEntry, SettingTopEntry as ShellSettingTopEntry } from './setting-top-entry';
import { ComponentMeta as ShellComponentMeta } from './component-meta'; import { ComponentMeta as ShellComponentMeta } from './component-meta';
import { isCustomView } from '@alilc/lowcode-utils'; import { isCustomView, isSettingField } from '@alilc/lowcode-utils';
export class SettingField implements IPublicModelSettingField { export class SettingField implements IPublicModelSettingField {
private readonly [settingFieldSymbol]: ISettingField; private readonly [settingFieldSymbol]: ISettingField;

View File

@ -30,6 +30,7 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.27.8", "@alifd/next": "^1.27.8",
"@alilc/lowcode-editor-core": "workspace:*",
"@alilc/lowcode-types": "workspace:*", "@alilc/lowcode-types": "workspace:*",
"@alilc/lowcode-utils": "workspace:*", "@alilc/lowcode-utils": "workspace:*",
"classnames": "^2.5.1", "classnames": "^2.5.1",
@ -44,6 +45,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@alifd/next": "^1.27.8", "@alifd/next": "^1.27.8",
"@alilc/lowcode-editor-core": "workspace:*",
"@alilc/lowcode-types": "workspace:*", "@alilc/lowcode-types": "workspace:*",
"@alilc/lowcode-utils": "workspace:*", "@alilc/lowcode-utils": "workspace:*",
"react": "^18.2.0", "react": "^18.2.0",

View File

@ -1,5 +1,6 @@
import { PureComponent } from 'react'; import { PureComponent } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { Title } from '@alilc/lowcode-editor-core';
import TreeNode from '../controllers/tree-node'; import TreeNode from '../controllers/tree-node';
import TreeNodeView from './tree-node'; import TreeNodeView from './tree-node';
import { IPublicModelExclusiveGroup, IPublicTypeDisposable, IPublicTypeLocationChildrenDetail } from '@alilc/lowcode-types'; import { IPublicModelExclusiveGroup, IPublicTypeDisposable, IPublicTypeLocationChildrenDetail } from '@alilc/lowcode-types';
@ -119,7 +120,6 @@ class TreeNodeChildren extends PureComponent<{
let groupContents: any[] = []; let groupContents: any[] = [];
let currentGrp: IPublicModelExclusiveGroup; let currentGrp: IPublicModelExclusiveGroup;
const { filterWorking, matchSelf, keywords } = this.state; const { filterWorking, matchSelf, keywords } = this.state;
const Title = this.props.treeNode.pluginContext.common.editorCabin.Title;
const endGroup = () => { const endGroup = () => {
if (groupContents.length > 0) { if (groupContents.length > 0) {
@ -194,7 +194,6 @@ class TreeNodeSlots extends PureComponent<{
if (!treeNode.hasSlots()) { if (!treeNode.hasSlots()) {
return null; return null;
} }
const Title = this.props.treeNode.pluginContext.common.editorCabin.Title;
return ( return (
<div <div
className={classNames('tree-node-slots', { className={classNames('tree-node-slots', {

View File

@ -1,5 +1,6 @@
import { KeyboardEvent, FocusEvent, Fragment, PureComponent } from 'react'; import { KeyboardEvent, FocusEvent, Fragment, PureComponent } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { Title, Tip } from '@alilc/lowcode-editor-core';
import { createIcon } from '@alilc/lowcode-utils'; import { createIcon } from '@alilc/lowcode-utils';
import { IPublicApiEvent } from '@alilc/lowcode-types'; import { IPublicApiEvent } from '@alilc/lowcode-types';
import TreeNode from '../controllers/tree-node'; import TreeNode from '../controllers/tree-node';
@ -165,8 +166,7 @@ export default class TreeTitle extends PureComponent<{
}; };
} }
const Extra = pluginContext.extraTitle as any; const Extra = pluginContext.extraTitle as any;
const { intlNode, common, config } = pluginContext; const { intlNode, config } = pluginContext;
const { Tip, Title } = common.editorCabin;
const couldHide = availableActions.includes('hide'); const couldHide = availableActions.includes('hide');
const couldLock = availableActions.includes('lock'); const couldLock = availableActions.includes('lock');
const couldUnlock = availableActions.includes('unlock'); const couldUnlock = availableActions.includes('unlock');
@ -235,7 +235,6 @@ export default class TreeTitle extends PureComponent<{
/> />
) : ( ) : (
<Fragment> <Fragment>
{/* @ts-ignore */}
<Title <Title
title={this.state.title} title={this.state.title}
match={filterWorking && matchSelf} match={filterWorking && matchSelf}
@ -245,7 +244,6 @@ export default class TreeTitle extends PureComponent<{
{node.slotFor && ( {node.slotFor && (
<a className="tree-node-tag slot"> <a className="tree-node-tag slot">
{/* todo: click redirect to prop */} {/* todo: click redirect to prop */}
{/* @ts-ignore */}
<Tip>{intlNode('Slot for {prop}', { prop: node.slotFor.key })}</Tip> <Tip>{intlNode('Slot for {prop}', { prop: node.slotFor.key })}</Tip>
</a> </a>
)} )}
@ -253,7 +251,6 @@ export default class TreeTitle extends PureComponent<{
<a className="tree-node-tag loop"> <a className="tree-node-tag loop">
{/* todo: click todo something */} {/* todo: click todo something */}
<IconLoop /> <IconLoop />
{/* @ts-ignore */}
<Tip>{intlNode('Loop')}</Tip> <Tip>{intlNode('Loop')}</Tip>
</a> </a>
)} )}
@ -261,7 +258,6 @@ export default class TreeTitle extends PureComponent<{
<a className="tree-node-tag cond"> <a className="tree-node-tag cond">
{/* todo: click todo something */} {/* todo: click todo something */}
<IconCond /> <IconCond />
{/* @ts-ignore */}
<Tip>{intlNode('Conditional')}</Tip> <Tip>{intlNode('Conditional')}</Tip>
</a> </a>
)} )}
@ -282,12 +278,10 @@ class DeleteBtn extends PureComponent<{
onClick: () => void; onClick: () => void;
}> { }> {
render() { render() {
const { intl, common } = this.props.treeNode.pluginContext; const { intl } = this.props.treeNode.pluginContext;
const { Tip } = common.editorCabin;
return ( return (
<div className="tree-node-delete-btn" onClick={this.props.onClick}> <div className="tree-node-delete-btn" onClick={this.props.onClick}>
<IconDelete /> <IconDelete />
{/* @ts-ignore */}
<Tip>{intl('Delete')}</Tip> <Tip>{intl('Delete')}</Tip>
</div> </div>
); );
@ -299,12 +293,10 @@ class RenameBtn extends PureComponent<{
onClick: (e: any) => void; onClick: (e: any) => void;
}> { }> {
render() { render() {
const { intl, common } = this.props.treeNode.pluginContext; const { intl } = this.props.treeNode.pluginContext;
const { Tip } = common.editorCabin;
return ( return (
<div className="tree-node-rename-btn" onClick={this.props.onClick}> <div className="tree-node-rename-btn" onClick={this.props.onClick}>
<IconSetting /> <IconSetting />
{/* @ts-ignore */}
<Tip>{intl('Rename')}</Tip> <Tip>{intl('Rename')}</Tip>
</div> </div>
); );
@ -317,8 +309,7 @@ class LockBtn extends PureComponent<{
}> { }> {
render() { render() {
const { treeNode, locked } = this.props; const { treeNode, locked } = this.props;
const { intl, common } = this.props.treeNode.pluginContext; const { intl } = this.props.treeNode.pluginContext;
const { Tip } = common.editorCabin;
return ( return (
<div <div
className="tree-node-lock-btn" className="tree-node-lock-btn"
@ -346,8 +337,7 @@ class HideBtn extends PureComponent<
> { > {
render() { render() {
const { treeNode, hidden } = this.props; const { treeNode, hidden } = this.props;
const { intl, common } = treeNode.pluginContext; const { intl } = treeNode.pluginContext;
const { Tip } = common.editorCabin;
return ( return (
<div <div
className="tree-node-hide-btn" className="tree-node-hide-btn"

View File

@ -5,6 +5,6 @@ export default defineConfig(async () => {
return baseConfigFn({ return baseConfigFn({
name: 'LowCodePluginOutlinePane', name: 'LowCodePluginOutlinePane',
defaultFormats: ['es', 'cjs'], defaultFormats: ['es', 'cjs'],
entry: 'src/index.tsx' entry: 'src/index.tsx',
}) })
}); });

View File

@ -1,5 +1,3 @@
import { ReactNode } from 'react';
import { IPublicTypeRegisteredSetter, IPublicTypeCustomView } from '../type'; import { IPublicTypeRegisteredSetter, IPublicTypeCustomView } from '../type';
export interface IPublicApiSetters { export interface IPublicApiSetters {

View File

@ -447,4 +447,5 @@ export interface IBaseModelNode<
}; };
} }
export interface IPublicModelNode extends IBaseModelNode<IPublicModelDocumentModel, IPublicModelNode> {} export interface IPublicModelNode extends
IBaseModelNode<IPublicModelDocumentModel, IPublicModelNode> {}

View File

@ -1,6 +1,6 @@
import { isValidElement } from 'react'; import { isValidElement } from 'react';
import { isReactComponent } from '../is-react';
import { IPublicTypeCustomView } from '@alilc/lowcode-types'; import { IPublicTypeCustomView } from '@alilc/lowcode-types';
import { isReactComponent } from '../is-react';
export function isCustomView(obj: any): obj is IPublicTypeCustomView { export function isCustomView(obj: any): obj is IPublicTypeCustomView {
if (!obj) { if (!obj) {

View File

@ -2,9 +2,6 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "dist", "outDir": "dist",
"paths": {
"@alilc/lowcode-*": ["packages/*"]
}
}, },
"include": ["src"] "include": ["src"]
} }

View File

@ -37,7 +37,7 @@
"paths": { "paths": {
"@alilc/lowcode-*": ["packages/*/src"] "@alilc/lowcode-*": ["packages/*/src"]
}, },
"types": ["vitest/globals", "node"] "types": ["vite/client", "vitest/globals", "node"]
}, },
"exclude": ["**/dist", "node_modules"] "exclude": ["**/dist", "node_modules"]
} }