Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ts interface error #1772

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: ts interface error
  • Loading branch information
Justin-lu committed Mar 24, 2023
commit 41eebcdd6fe3ca41bc62d881e3d34a7feab8f573
6 changes: 3 additions & 3 deletions packages/designer/src/designer/detecting.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { makeObservable, obx, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
import { IPublicModelDetecting } from '@alilc/lowcode-types';
import { IDocumentModel } from '../document/document-model';
import { INode } from '../document/node/node';
import type { IDocumentModel } from '../document/document-model';
import type { INode } from '../document/node/node';

const DETECTING_CHANGE_EVENT = 'detectingChange';
export interface IDetecting extends Omit< IPublicModelDetecting<INode>,
export interface IDetecting extends Omit<IPublicModelDetecting<INode>,
'capture' |
'release' |
'leave'
4 changes: 2 additions & 2 deletions packages/designer/src/designer/location.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDocumentModel, INode } from '../document';
import type { IDocumentModel, INode } from '../document';
import { ILocateEvent } from './dragon';
import {
IPublicModelDropLocation,
@@ -98,7 +98,7 @@ function isDocument(elem: any): elem is Document {
export function getWindow(elem: Element | Document): Window {
return (isDocument(elem) ? elem : elem.ownerDocument!).defaultView!;
}
export interface IDropLocation extends Omit< IPublicModelDropLocation, 'target' | 'clone' > {
export interface IDropLocation extends Omit<IPublicModelDropLocation, 'target' | 'clone'> {

readonly source: string;

12 changes: 7 additions & 5 deletions packages/designer/src/designer/setting/setting-field.ts
Original file line number Diff line number Diff line change
@@ -6,11 +6,13 @@ import {
IPublicTypeFieldExtraProps,
IPublicTypeFieldConfig,
IPublicTypeCustomView,
IPublicTypeSetValueOptions,
IPublicTypeDisposable,
IPublicModelSettingField,
IBaseModelSettingField,
} from '@alilc/lowcode-types';
import type {
IPublicTypeSetValueOptions,
} from '@alilc/lowcode-types';
import { Transducer } from './utils';
import { ISettingPropEntry, SettingPropEntry } from './setting-prop-entry';
import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
@@ -31,10 +33,10 @@ function getSettingFieldCollectorKey(parent: ISettingTopEntry | ISettingField, c
}

export interface ISettingField extends ISettingPropEntry, Omit<IBaseModelSettingField<
ISettingTopEntry,
ISettingField,
IComponentMeta,
INode
ISettingTopEntry,
ISettingField,
IComponentMeta,
INode
>, 'setValue' | 'key' | 'node'> {
get items(): Array<ISettingField | IPublicTypeCustomView>;

Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { GlobalEvent, IPublicApiSetters, IPublicModelEditor, IPublicModelSetting
import { uniqueId, isJSExpression } from '@alilc/lowcode-utils';
import { ISettingEntry } from './setting-entry-type';
import { INode } from '../../document';
import { IComponentMeta } from '../../component-meta';
import type { IComponentMeta } from '../../component-meta';
import { IDesigner } from '../designer';
import { ISettingTopEntry } from './setting-top-entry';
import { ISettingField, isSettingField } from './setting-field';
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { computed, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor
import { ISettingEntry } from './setting-entry-type';
import { ISettingField, SettingField } from './setting-field';
import { INode } from '../../document';
import { IComponentMeta } from '../../component-meta';
import type { IComponentMeta } from '../../component-meta';
import { IDesigner } from '../designer';
import { Setters } from '@alilc/lowcode-shell';

23 changes: 13 additions & 10 deletions packages/designer/src/document/document-model.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ import {
import {
IPublicTypeNodeData,
IPublicTypeNodeSchema,
IPublicTypeRootSchema,
IPublicTypePageSchema,
IPublicTypeComponentsMap,
IPublicTypeDragNodeObject,
@@ -21,7 +20,10 @@ import {
IPublicTypeOnChangeOptions,
IPublicTypeDisposable,
} from '@alilc/lowcode-types';
import {
import type {
IPublicTypeRootSchema,
} from '@alilc/lowcode-types';
import type {
IDropLocation,
} from '@alilc/lowcode-designer';
import {
@@ -37,9 +39,10 @@ import {
} from '@alilc/lowcode-utils';
import { IProject } from '../project';
import { ISimulatorHost } from '../simulator';
import { IComponentMeta } from '../component-meta';
import type { IComponentMeta } from '../component-meta';
import { IDesigner, IHistory } from '../designer';
import { insertChildren, insertChild, IRootNode, INode } from './node/node';
import { insertChildren, insertChild, IRootNode } from './node/node';
import type { INode } from './node/node';
import { Selection, ISelection } from './selection';
import { History } from './history';
import { IModalNodesManager, ModalNodesManager, Node } from './node';
@@ -49,11 +52,11 @@ export type GetDataType<T, NodeType> = T extends undefined
? NodeType extends {
schema: infer R;
}
? R
: any
? R
: any
: T;

export interface IDocumentModel extends Omit< IPublicModelDocumentModel<
export interface IDocumentModel extends Omit<IPublicModelDocumentModel<
ISelection,
IHistory,
INode,
@@ -656,9 +659,9 @@ export class DocumentModel implements IDocumentModel {
}

checkNesting(
dropTarget: INode,
dragObject: IPublicTypeDragNodeObject | IPublicTypeNodeSchema | INode | IPublicTypeDragNodeDataObject,
): boolean {
dropTarget: INode,
dragObject: IPublicTypeDragNodeObject | IPublicTypeNodeSchema | INode | IPublicTypeDragNodeDataObject,
): boolean {
let items: Array<INode | IPublicTypeNodeSchema>;
if (isDragNodeDataObject(dragObject)) {
items = Array.isArray(dragObject.data) ? dragObject.data : [dragObject.data];
2 changes: 1 addition & 1 deletion packages/designer/src/document/node/exclusive-group.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
import { uniqueId } from '@alilc/lowcode-utils';
import { IPublicTypeTitleContent, IPublicModelExclusiveGroup } from '@alilc/lowcode-types';
import { INode } from './node';
import type { INode } from './node';
import { intl } from '../../locale';

export interface IExclusiveGroup extends IPublicModelExclusiveGroup<INode> {
9 changes: 5 additions & 4 deletions packages/designer/src/document/node/node.ts
Original file line number Diff line number Diff line change
@@ -21,11 +21,12 @@ import {
import { compatStage, isDOMText, isJSExpression, isNode, isNodeSchema } from '@alilc/lowcode-utils';
import { ISettingTopEntry } from '@alilc/lowcode-designer';
import { Props, getConvertedExtraKey, IProps } from './props/props';
import { IDocumentModel } from '../document-model';
import type { IDocumentModel } from '../document-model';
import { NodeChildren, INodeChildren } from './node-children';
import { IProp, Prop } from './props/prop';
import { IComponentMeta } from '../../component-meta';
import { ExclusiveGroup, IExclusiveGroup, isExclusiveGroup } from './exclusive-group';
import type { IComponentMeta } from '../../component-meta';
import { ExclusiveGroup, isExclusiveGroup } from './exclusive-group';
import type { IExclusiveGroup } from './exclusive-group';
import { includeSlot, removeSlot } from '../../utils/slot';
import { foreachReverse } from '../../utils/tree';
import { NodeRemoveOptions, EDITOR_EVENT } from '../../types';
@@ -1095,7 +1096,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
condition(this) !== false :
condition !== false;
})
.map((action: IPublicTypeComponentAction) => action.name) || [];
.map((action: IPublicTypeComponentAction) => action.name) || [];

return availableActions.indexOf(actionName) >= 0;
}
5 changes: 3 additions & 2 deletions packages/designer/src/document/node/props/prop.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { untracked, computed, obx, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core';
import { IPublicTypeCompositeValue, GlobalEvent, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicEnumTransformStage, IPublicModelProp } from '@alilc/lowcode-types';
import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types';
import type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp } from '@alilc/lowcode-types';
import { uniqueId, isPlainObject, hasOwnProperty, compatStage, isJSExpression, isJSSlot, isNodeSchema } from '@alilc/lowcode-utils';
import { valueToSource } from './value-to-source';
import { IProps, IPropParent } from './props';
@@ -13,7 +14,7 @@ export type UNSET = typeof UNSET;

export interface IProp extends Omit<IPublicModelProp<
INode
>, 'exportSchema' | 'node' > {
>, 'exportSchema' | 'node'> {

readonly props: IProps;

3 changes: 2 additions & 1 deletion packages/designer/src/document/node/props/props.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { computed, makeObservable, obx, action } from '@alilc/lowcode-editor-core';
import { IPublicTypePropsMap, IPublicTypePropsList, IPublicTypeCompositeValue, IPublicEnumTransformStage, IBaseModelProps } from '@alilc/lowcode-types';
import { IPublicTypePropsList, IPublicTypeCompositeValue, IPublicEnumTransformStage, IBaseModelProps } from '@alilc/lowcode-types';
import type { IPublicTypePropsMap } from '@alilc/lowcode-types';
import { uniqueId, compatStage } from '@alilc/lowcode-utils';
import { Prop, IProp, UNSET } from './prop';
import { INode } from '../node';
17 changes: 10 additions & 7 deletions packages/designer/src/project/project.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { obx, computed, makeObservable, action, IEventBus, createModuleEventBus } from '@alilc/lowcode-editor-core';
import { IDesigner } from '../designer';
import { DocumentModel, IDocumentModel, isDocumentModel } from '../document';
import { DocumentModel, isDocumentModel } from '../document';
import type { IDocumentModel } from "../document";
import {
IPublicTypeProjectSchema,
IPublicTypeRootSchema,
IPublicTypeComponentsMap,
IPublicEnumTransformStage,
IBaseApiProject,
} from '@alilc/lowcode-types';
import type {
IPublicTypeProjectSchema,
IPublicTypeRootSchema,
} from '@alilc/lowcode-types';
import { isLowCodeComponentType, isProCodeComponentType } from '@alilc/lowcode-utils';
import { ISimulatorHost } from '../simulator';

export interface IProject extends Omit< IBaseApiProject<
export interface IProject extends Omit<IBaseApiProject<
IDocumentModel
>,
'simulatorHost' |
@@ -146,7 +149,7 @@ export class Project implements IProject {
return this.documents.reduce<IPublicTypeComponentsMap>((
componentsMap: IPublicTypeComponentsMap,
curDoc: IDocumentModel,
): IPublicTypeComponentsMap => {
): IPublicTypeComponentsMap => {
const curComponentsMap = curDoc.getComponentsMap();
if (Array.isArray(curComponentsMap)) {
curComponentsMap.forEach((item) => {
@@ -178,8 +181,8 @@ export class Project implements IProject {
* 获取项目整体 schema
*/
getSchema(
stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save,
): IPublicTypeProjectSchema {
stage: IPublicEnumTransformStage = IPublicEnumTransformStage.Save,
): IPublicTypeProjectSchema {
return {
...this.data,
componentsMap: this.getComponentsMap(),
4 changes: 2 additions & 2 deletions packages/shell/src/model/condition-group.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IExclusiveGroup } from '@alilc/lowcode-designer';
import type { IExclusiveGroup } from '@alilc/lowcode-designer';
import { IPublicModelExclusiveGroup, IPublicModelNode } from '@alilc/lowcode-types';
import { conditionGroupSymbol, nodeSymbol } from '../symbols';
import { Node } from './node';
@@ -39,4 +39,4 @@ export class ConditionGroup implements IPublicModelExclusiveGroup {
shellConditionGroup[conditionGroupSymbol] = shellConditionGroup;
return shellConditionGroup;
}
}
}
2 changes: 1 addition & 1 deletion packages/shell/src/model/history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDocumentModel as InnerDocumentModel, IHistory as InnerHistory } from '@alilc/lowcode-designer';
import type { IDocumentModel as InnerDocumentModel, IHistory as InnerHistory } from '@alilc/lowcode-designer';
import { historySymbol, documentSymbol } from '../symbols';
import { IPublicModelHistory, IPublicTypeDisposable } from '@alilc/lowcode-types';

6 changes: 4 additions & 2 deletions packages/workspace/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export { Workspace, IWorkspace } from './workspace';
export { Workspace } from './workspace';
export type { IWorkspace } from './workspace';
export * from './window';
export * from './layouts/workbench';
export { Resource, IResource } from './resource';
export { Resource } from './resource';
export type { IResource } from './resource';
3 changes: 2 additions & 1 deletion packages/workspace/src/workspace.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import { IDesigner, ILowCodePluginManager, LowCodePluginManager } from '@alilc/l
import { createModuleEventBus, Editor, IEventBus, makeObservable, obx } from '@alilc/lowcode-editor-core';
import { IPublicApiPlugins, IPublicApiWorkspace, IPublicResourceList, IPublicTypeResourceType, IShellModelFactory } from '@alilc/lowcode-types';
import { BasicContext } from './context/base-context';
import { EditorWindow, IEditorWindow } from './window';
import { EditorWindow } from './window';
import type { IEditorWindow } from './window';
import { IResource, Resource } from './resource';
import { IResourceType, ResourceType } from './resource-type';