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: some spell error #2523

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions packages/designer/src/builtin-simulator/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,15 +1069,15 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return null;
}

const nodeIntance = this.getClosestNodeInstance(target);
if (!nodeIntance) {
const nodeInstance = this.getClosestNodeInstance(target);
if (!nodeInstance) {
return null;
}
const { docId } = nodeIntance;
const { docId } = nodeInstance;
const doc = this.project.getDocument(docId)!;
const node = doc.getNode(nodeIntance.nodeId);
const node = doc.getNode(nodeInstance.nodeId);
return {
...nodeIntance,
...nodeInstance,
node,
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/designer/src/designer/designer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
IPublicEnumTransformStage,
IPublicModelLocateEvent,
} from '@alilc/lowcode-types';
import { megreAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils';
import { mergeAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils';
import { IProject, Project } from '../project';
import { Node, DocumentModel, insertChildren, INode } from '../document';
import { ComponentMeta, IComponentMeta } from '../component-meta';
Expand Down Expand Up @@ -458,7 +458,7 @@ export class Designer implements IDesigner {
if (components) {
// 合并 assets
let assets = this.editor.get('assets') || {};
let newAssets = megreAssets(assets, incrementalAssets);
let newAssets = mergeAssets(assets, incrementalAssets);
// 对于 assets 存在需要二次网络下载的过程,必须 await 等待结束之后,再进行事件触发
await this.editor.set('assets', newAssets);
}
Expand Down
18 changes: 9 additions & 9 deletions packages/designer/src/designer/scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function easing(n: number) {
return Math.sin((n * Math.PI) / 2);
}

const SCROLL_ACCURCY = 30;
const SCROLL_ACCURACY = 30;

export interface IScroller extends IPublicModelScroller {

Expand Down Expand Up @@ -142,15 +142,15 @@ export class Scroller implements IScroller {
let sy = scrollTarget.top;
let ax = 0;
let ay = 0;
if (y < bounds.top + SCROLL_ACCURCY) {
ay = -Math.min(Math.max(bounds.top + SCROLL_ACCURCY - y, 10), 50) / scale;
} else if (y > bounds.bottom - SCROLL_ACCURCY) {
ay = Math.min(Math.max(y + SCROLL_ACCURCY - bounds.bottom, 10), 50) / scale;
if (y < bounds.top + SCROLL_ACCURACY) {
ay = -Math.min(Math.max(bounds.top + SCROLL_ACCURACY - y, 10), 50) / scale;
} else if (y > bounds.bottom - SCROLL_ACCURACY) {
ay = Math.min(Math.max(y + SCROLL_ACCURACY - bounds.bottom, 10), 50) / scale;
}
if (x < bounds.left + SCROLL_ACCURCY) {
ax = -Math.min(Math.max(bounds.top + SCROLL_ACCURCY - y, 10), 50) / scale;
} else if (x > bounds.right - SCROLL_ACCURCY) {
ax = Math.min(Math.max(x + SCROLL_ACCURCY - bounds.right, 10), 50) / scale;
if (x < bounds.left + SCROLL_ACCURACY) {
ax = -Math.min(Math.max(bounds.top + SCROLL_ACCURACY - y, 10), 50) / scale;
} else if (x > bounds.right - SCROLL_ACCURACY) {
ax = Math.min(Math.max(x + SCROLL_ACCURACY - bounds.right, 10), 50) / scale;
}

if (!ax && !ay) {
Expand Down
12 changes: 6 additions & 6 deletions packages/utils/src/app-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ export class AppHelper extends EventEmitter {
}
}

batchOn(events: Array<string | symbol>, lisenter: (...args: any[]) => void) {
batchOn(events: Array<string | symbol>, listener: (...args: any[]) => void) {
if (!Array.isArray(events)) return;
events.forEach((event) => this.on(event, lisenter));
events.forEach((event) => this.on(event, listener));
}

batchOnce(events: Array<string | symbol>, lisenter: (...args: any[]) => void) {
batchOnce(events: Array<string | symbol>, listener: (...args: any[]) => void) {
if (!Array.isArray(events)) return;
events.forEach((event) => this.once(event, lisenter));
events.forEach((event) => this.once(event, listener));
}

batchOff(events: Array<string | symbol>, lisenter: (...args: any[]) => void) {
batchOff(events: Array<string | symbol>, listener: (...args: any[]) => void) {
if (!Array.isArray(events)) return;
events.forEach((event) => this.off(event, lisenter));
events.forEach((event) => this.off(event, listener));
}
}
8 changes: 4 additions & 4 deletions packages/utils/src/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function assetItem(type: AssetType, content?: string | null, level?: Asse
};
}

export function megreAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson): IPublicTypeAssetsJson {
export function mergeAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson): IPublicTypeAssetsJson {
if (incrementalAssets.packages) {
assets.packages = [...(assets.packages || []), ...incrementalAssets.packages];
}
Expand All @@ -59,13 +59,13 @@ export function megreAssets(assets: IPublicTypeAssetsJson, incrementalAssets: IP
assets.components = [...(assets.components || []), ...incrementalAssets.components];
}

megreAssetsComponentList(assets, incrementalAssets, 'componentList');
megreAssetsComponentList(assets, incrementalAssets, 'bizComponentList');
mergeAssetsComponentList(assets, incrementalAssets, 'componentList');
mergeAssetsComponentList(assets, incrementalAssets, 'bizComponentList');

return assets;
}

function megreAssetsComponentList(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson, listName: keyof IPublicTypeAssetsJson): void {
function mergeAssetsComponentList(assets: IPublicTypeAssetsJson, incrementalAssets: IPublicTypeAssetsJson, listName: keyof IPublicTypeAssetsJson): void {
if (incrementalAssets[listName]) {
if (assets[listName]) {
// 根据title进行合并
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const levelMarks: Record<string, string> = {
warn: 'warn',
error: 'error',
};
const outputFuntion: Record<string, any> = {
const outputFunction: Record<string, any> = {
debug: console.log,
log: console.log,
info: console.log,
Expand All @@ -88,7 +88,7 @@ const shouldOutput = (

const output = (logLevel: string, bizName: string) => {
return (...args: any[]) => {
return outputFuntion[logLevel].apply(console, getLogArgs(args, bizName, logLevel));
return outputFunction[logLevel].apply(console, getLogArgs(args, bizName, logLevel));
};
};

Expand Down