GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: update skeleton ts defined · EasterGit/lowcode-engine@21f74f0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • editor-core/src
      • editor.ts
    • editor-skeleton/src
      • area.ts
      • components
        • settings
          • settings-pane.tsx
        • stage-box
          • stage-box.tsx
      • context.ts
      • layouts
        • left-float-pane.tsx
        • workbench.tsx
      • skeleton.ts
      • transducers
        • parse-func.ts
      • types.ts
      • widget
        • dock.ts
        • panel-dock.ts
        • panel.ts
        • stage.ts
        • utils.ts
        • widget.ts
    • shell/src/api
      • event.ts
      • skeleton.ts
    • types/src/shell/type
      • widget-base-config.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/editor-core/src/editor.ts‎

Copy file name to clipboardExpand all lines: packages/editor-core/src/editor.ts
+34-25Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable max-len */
33
import { StrictEventEmitter } from 'strict-event-emitter-types';
44
import { EventEmitter } from 'events';
5-
import { EventBus } from './event-bus';
5+
import { EventBus, IEventBus } from './event-bus';
66
import {
77
IPublicModelEditor,
88
EditorConfig,
@@ -52,15 +52,18 @@ export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalE
5252
eventNames(): Array<string | symbol>;
5353
}
5454

55+
export interface IEditor extends IPublicModelEditor {
56+
config?: EditorConfig;
57+
58+
components?: PluginClassSet;
59+
60+
eventBus: IEventBus;
61+
62+
init(config?: EditorConfig, components?: PluginClassSet): Promise<any>;
63+
}
64+
5565
// eslint-disable-next-line no-redeclare
56-
export class Editor extends (EventEmitter as any) implements IPublicModelEditor {
57-
constructor(readonly viewName: string = 'global', readonly workspaceMode: boolean = false) {
58-
// eslint-disable-next-line constructor-super
59-
super();
60-
// set global emitter maxListeners
61-
this.setMaxListeners(200);
62-
this.eventBus = new EventBus(this);
63-
}
66+
export class Editor extends EventEmitter implements IEditor {
6467

6568
/**
6669
* Ioc Container
@@ -71,10 +74,32 @@ export class Editor extends (EventEmitter as any) implements IPublicModelEditor
7174
return globalLocale.getLocale();
7275
}
7376

77+
config?: EditorConfig;
78+
79+
eventBus: EventBus;
80+
81+
components?: PluginClassSet;
82+
7483
// readonly utils = utils;
7584

7685
private hooks: HookConfig[] = [];
7786

87+
private waits = new Map<
88+
IPublicTypeEditorValueKey,
89+
Array<{
90+
once?: boolean;
91+
resolve: (data: any) => void;
92+
}>
93+
>();
94+
95+
constructor(readonly viewName: string = 'global', readonly workspaceMode: boolean = false) {
96+
// eslint-disable-next-line constructor-super
97+
super();
98+
// set global emitter maxListeners
99+
this.setMaxListeners(200);
100+
this.eventBus = new EventBus(this);
101+
}
102+
78103
get<T = undefined, KeyOrType = any>(
79104
keyOrType: KeyOrType,
80105
): IPublicTypeEditorGetResult<T, KeyOrType> | undefined {
@@ -202,12 +227,6 @@ export class Editor extends (EventEmitter as any) implements IPublicModelEditor
202227
this.notifyGot(key || data);
203228
}
204229

205-
config?: EditorConfig;
206-
207-
eventBus: EventBus;
208-
209-
components?: PluginClassSet;
210-
211230
async init(config?: EditorConfig, components?: PluginClassSet): Promise<any> {
212231
this.config = config || {};
213232
this.components = components || {};
@@ -270,16 +289,6 @@ export class Editor extends (EventEmitter as any) implements IPublicModelEditor
270289
});
271290
};
272291

273-
/* eslint-disable */
274-
private waits = new Map<
275-
IPublicTypeEditorValueKey,
276-
Array<{
277-
once?: boolean;
278-
resolve: (data: any) => void;
279-
}>
280-
>();
281-
/* eslint-enable */
282-
283292
private notifyGot(key: IPublicTypeEditorValueKey) {
284293
let waits = this.waits.get(key);
285294
if (!waits) {
Collapse file

‎packages/editor-skeleton/src/area.ts‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/area.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
33
import { Logger } from '@alilc/lowcode-utils';
44
import { IPublicTypeWidgetBaseConfig } from '@alilc/lowcode-types';
55
import { WidgetContainer } from './widget/widget-container';
6-
import { Skeleton } from './skeleton';
6+
import { ISkeleton } from './skeleton';
77
import { IWidget } from './widget/widget';
88

99
const logger = new Logger({ level: 'warn', bizName: 'skeleton:area' });
@@ -35,7 +35,9 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget
3535

3636
readonly container: WidgetContainer<T, C>;
3737

38-
constructor(readonly skeleton: Skeleton, readonly name: string, handle: (item: T | C) => T, private exclusive?: boolean, defaultSetCurrent = false) {
38+
private lastCurrent: T | null = null;
39+
40+
constructor(readonly skeleton: ISkeleton, readonly name: string, handle: (item: T | C) => T, private exclusive?: boolean, defaultSetCurrent = false) {
3941
makeObservable(this);
4042
this.container = skeleton.createContainer(name, handle, exclusive, () => this.visible, defaultSetCurrent);
4143
}
@@ -57,8 +59,6 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget
5759
return this.container.remove(config);
5860
}
5961

60-
private lastCurrent: T | null = null;
61-
6262
setVisible(flag: boolean) {
6363
if (this.exclusive) {
6464
const { current } = this.container;
Collapse file

‎packages/editor-skeleton/src/components/settings/settings-pane.tsx‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/components/settings/settings-pane.tsx
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
9292
const { extraProps } = this.field;
9393
const { ignoreDefaultValue } = extraProps;
9494
try {
95-
return typeof ignoreDefaultValue === 'function' ? ignoreDefaultValue(this.field.internalToShell()) : false;
95+
if (typeof ignoreDefaultValue === 'function') {
96+
return ignoreDefaultValue(this.field.internalToShellField());
97+
}
98+
return false;
9699
} catch (error) {
97100
console.error('exception when ignoreDefaultValue is excuted', error);
98101
}
Collapse file

‎packages/editor-skeleton/src/components/stage-box/stage-box.tsx‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/components/stage-box/stage-box.tsx
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React, { Component } from 'react';
22
import classNames from 'classnames';
33
import { observer } from '@alilc/lowcode-editor-core';
4-
import { SettingTopEntry, SettingField } from '@alilc/lowcode-designer';
54
import StageChain from './stage-chain';
65
import Stage from './stage';
7-
import { Skeleton } from '../../skeleton';
6+
import { ISkeleton } from '../../skeleton';
87
import PopupService, { PopupPipe } from '../popup';
98
import { Stage as StageWidget } from '../../widget/stage';
109

@@ -14,9 +13,7 @@ export type StageBoxProps = typeof StageBoxDefaultProps & {
1413
stageChain?: StageChain;
1514
className?: string;
1615
children: React.ReactNode;
17-
skeleton: Skeleton;
18-
// @todo to remove
19-
target?: SettingTopEntry | SettingField;
16+
skeleton: ISkeleton;
2017
};
2118

2219
type WillDetachMember = () => void;
Collapse file

‎packages/editor-skeleton/src/context.ts‎

Copy file name to clipboard
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { createContext } from 'react';
2-
import { Skeleton } from './skeleton';
2+
import { ISkeleton } from './skeleton';
33

4-
export const SkeletonContext = createContext<Skeleton>({} as any);
4+
export const SkeletonContext = createContext<ISkeleton>({} as any);
Collapse file

‎packages/editor-skeleton/src/layouts/left-float-pane.tsx‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/layouts/left-float-pane.tsx
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import classNames from 'classnames';
33
import { observer, Focusable, focusTracker } from '@alilc/lowcode-editor-core';
44
import { Area } from '../area';
55
import { Panel } from '../widget/panel';
6+
import { PanelConfig } from '../types';
67

78
@observer
8-
export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }> {
9+
export default class LeftFloatPane extends Component<{ area: Area<PanelConfig, Panel> }> {
910
private dispose?: () => void;
1011

1112
private focusing?: Focusable;
Collapse file

‎packages/editor-skeleton/src/layouts/workbench.tsx‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/layouts/workbench.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component } from 'react';
22
import { TipContainer, observer } from '@alilc/lowcode-editor-core';
33
import classNames from 'classnames';
4-
import { Skeleton } from '../skeleton';
4+
import { ISkeleton } from '../skeleton';
55
import TopArea from './top-area';
66
import LeftArea from './left-area';
77
import LeftFixedPane from './left-fixed-pane';
@@ -16,7 +16,7 @@ import { EditorConfig, PluginClassSet } from '@alilc/lowcode-types';
1616

1717
@observer
1818
export class Workbench extends Component<{
19-
skeleton: Skeleton;
19+
skeleton: ISkeleton;
2020
config?: EditorConfig;
2121
components?: PluginClassSet;
2222
className?: string;
Collapse file

‎packages/editor-skeleton/src/skeleton.ts‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/skeleton.ts
+65-4Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Editor, action, makeObservable, obx, engineConfig } from '@alilc/lowcode-editor-core';
1+
import { action, makeObservable, obx, engineConfig, IEditor } from '@alilc/lowcode-editor-core';
22
import {
33
DockConfig,
44
PanelConfig,
@@ -27,6 +27,7 @@ import {
2727
IPublicTypeWidgetBaseConfig,
2828
IPublicTypeWidgetConfigArea,
2929
IPublicTypeSkeletonConfig,
30+
IPublicApiSkeleton,
3031
} from '@alilc/lowcode-types';
3132

3233
const logger = new Logger({ level: 'warn', bizName: 'skeleton' });
@@ -42,6 +43,66 @@ export enum SkeletonEvents {
4243
WIDGET_ENABLE = 'skeleton.widget.enable',
4344
}
4445

46+
export interface ISkeleton extends Omit<IPublicApiSkeleton,
47+
'showPanel' |
48+
'hidePanel' |
49+
'showWidget' |
50+
'enableWidget' |
51+
'hideWidget' |
52+
'disableWidget' |
53+
'showArea' |
54+
'onShowPanel' |
55+
'onHidePanel' |
56+
'onShowWidget' |
57+
'onHideWidget' |
58+
'remove' |
59+
'hideArea'
60+
> {
61+
editor: IEditor;
62+
63+
readonly leftArea: Area<DockConfig | PanelDockConfig | DialogDockConfig>;
64+
65+
readonly topArea: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
66+
67+
readonly subTopArea: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
68+
69+
readonly toolbar: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
70+
71+
readonly leftFixedArea: Area<PanelConfig, Panel>;
72+
73+
readonly leftFloatArea: Area<PanelConfig, Panel>;
74+
75+
readonly rightArea: Area<PanelConfig, Panel>;
76+
77+
readonly mainArea: Area<WidgetConfig | PanelConfig, Widget | Panel>;
78+
79+
readonly bottomArea: Area<PanelConfig, Panel>;
80+
81+
readonly stages: Area<StageConfig, Stage>;
82+
83+
readonly widgets: IWidget[];
84+
85+
getPanel(name: string): Panel | undefined;
86+
87+
getWidget(name: string): IWidget | undefined;
88+
89+
buildFromConfig(config?: EditorConfig, components?: PluginClassSet): void;
90+
91+
createStage(config: any): string | undefined;
92+
93+
getStage(name: string): Stage | null;
94+
95+
createContainer(
96+
name: string,
97+
handle: (item: any) => any,
98+
exclusive?: boolean,
99+
checkVisible?: () => boolean,
100+
defaultSetCurrent?: boolean,
101+
): WidgetContainer;
102+
103+
createPanel(config: PanelConfig): Panel;
104+
}
105+
45106
export class Skeleton {
46107
private panels = new Map<string, Panel>();
47108

@@ -69,7 +130,7 @@ export class Skeleton {
69130

70131
readonly widgets: IWidget[] = [];
71132

72-
constructor(readonly editor: Editor, readonly viewName: string = 'global') {
133+
constructor(readonly editor: IEditor, readonly viewName: string = 'global') {
73134
makeObservable(this);
74135
this.leftArea = new Area(
75136
this,
@@ -244,7 +305,7 @@ export class Skeleton {
244305
Object.keys(plugins).forEach((area) => {
245306
plugins[area].forEach((item) => {
246307
const { pluginKey, type, props = {}, pluginProps } = item;
247-
const config: Partial<IPublicTypeWidgetBaseConfig> = {
308+
const config: IPublicTypeWidgetBaseConfig = {
248309
area: area as IPublicTypeWidgetConfigArea,
249310
type: 'Widget',
250311
name: pluginKey,
@@ -272,7 +333,7 @@ export class Skeleton {
272333
if (pluginKey in components) {
273334
config.content = components[pluginKey];
274335
}
275-
this.add(config as IPublicTypeWidgetBaseConfig);
336+
this.add(config);
276337
});
277338
});
278339
}
Collapse file

‎packages/editor-skeleton/src/transducers/parse-func.ts‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/transducers/parse-func.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { isPlainObject, isJSFunction, getLogger } from '@alilc/lowcode-utils';
44
const leadingFnRe = /^function/;
55
const leadingFnNameRe = /^\w+\s*\(/;
66
const logger = getLogger({ level: 'warn', bizName: 'skeleton:transducers' });
7+
78
/**
89
* 将函数字符串转成函数,支持几种类型
910
* 类型一:() => {} / val => {}
Collapse file

‎packages/editor-skeleton/src/types.ts‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/types.ts
+2-9Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { ReactElement, ComponentType } from 'react';
22
import {
33
IPublicTypeTitleContent,
4-
IPublicTypeIconType,
54
IPublicTypeI18nData,
6-
TipContent,
75
IPublicTypeWidgetConfigArea,
86
IPublicTypeWidgetBaseConfig,
97
IPublicTypePanelDockPanelProps,
8+
IPublicTypePanelDockProps,
109
} from '@alilc/lowcode-types';
1110
import { IWidget } from './widget/widget';
1211

@@ -24,13 +23,7 @@ export function isWidgetConfig(obj: any): obj is WidgetConfig {
2423
return obj && obj.type === 'Widget';
2524
}
2625

27-
export interface DockProps {
28-
title?: IPublicTypeTitleContent;
29-
icon?: IPublicTypeIconType;
30-
size?: 'small' | 'medium' | 'large';
31-
className?: string;
32-
description?: TipContent;
33-
onClick?: () => void;
26+
export interface DockProps extends IPublicTypePanelDockProps {
3427
}
3528

3629
export interface DividerConfig extends IPublicTypeWidgetBaseConfig {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.