chore: 增加方法注释

This commit is contained in:
lihao.ylh 2022-01-05 15:11:25 +08:00
parent 9f8bb613b9
commit c59eee0cca
19 changed files with 461 additions and 12 deletions

View File

@ -15,6 +15,7 @@
"lint": "eslint --ext .ts,.tsx,.js,.jsx ./ --quiet", "lint": "eslint --ext .ts,.tsx,.js,.jsx ./ --quiet",
"lint:fix": "eslint --ext .ts,.tsx,.js,.jsx ./ --quiet --fix", "lint:fix": "eslint --ext .ts,.tsx,.js,.jsx ./ --quiet --fix",
"pub": "tnpm run watchdog:build && lerna publish patch --force-publish --exact --no-changelog", "pub": "tnpm run watchdog:build && lerna publish patch --force-publish --exact --no-changelog",
"pub:premajor": "tnpm run watchdog:build && lerna publish premajor --force-publish --exact --dist-tag beta --preid beta --no-changelog",
"pub:prepatch": "tnpm run watchdog:build && lerna publish prepatch --force-publish --exact --dist-tag beta --preid beta --no-changelog", "pub:prepatch": "tnpm run watchdog:build && lerna publish prepatch --force-publish --exact --dist-tag beta --preid beta --no-changelog",
"pub:prerelease": "tnpm run watchdog:build && lerna publish prerelease --force-publish --exact --dist-tag beta --preid beta --no-changelog", "pub:prerelease": "tnpm run watchdog:build && lerna publish prerelease --force-publish --exact --dist-tag beta --preid beta --no-changelog",
"setup": "./scripts/setup.sh", "setup": "./scripts/setup.sh",

View File

@ -29,46 +29,77 @@ export default class ComponentMeta {
return new ComponentMeta(componentMeta); return new ComponentMeta(componentMeta);
} }
/**
*
*/
get componentName(): string { get componentName(): string {
return this[componentMetaSymbol].componentName; return this[componentMetaSymbol].componentName;
} }
/**
*
*/
get isContainer(): boolean { get isContainer(): boolean {
return this[componentMetaSymbol].isContainer; return this[componentMetaSymbol].isContainer;
} }
/**
*
*
*
*
*/
get isMinimalRenderUnit(): boolean { get isMinimalRenderUnit(): boolean {
return this[componentMetaSymbol].isMinimalRenderUnit; return this[componentMetaSymbol].isMinimalRenderUnit;
} }
/**
*
*/
get isModal(): boolean { get isModal(): boolean {
return this[componentMetaSymbol].isModal; return this[componentMetaSymbol].isModal;
} }
/**
*
*/
get configure() { get configure() {
return this[componentMetaSymbol].configure; return this[componentMetaSymbol].configure;
} }
/**
*
*/
get title() { get title() {
return this[componentMetaSymbol].title; return this[componentMetaSymbol].title;
} }
/**
*
*/
get icon() { get icon() {
return this[componentMetaSymbol].icon; return this[componentMetaSymbol].icon;
} }
/**
* npm
*/
get npm() { get npm() {
return this[componentMetaSymbol].npm; return this[componentMetaSymbol].npm;
} }
get acceptable(): boolean { /**
return this[componentMetaSymbol].acceptable; * npm
} * @param npm
*/
setNpm(npm: any) { setNpm(npm: any) {
this[componentMetaSymbol].setNpm(npm); this[componentMetaSymbol].setNpm(npm);
} }
/**
*
* @returns
*/
getMetadata() { getMetadata() {
return this[componentMetaSymbol].getMetadata(); return this[componentMetaSymbol].getMetadata();
} }

View File

@ -13,14 +13,25 @@ export default class Detecting {
this[detectingSymbol] = document.designer.detecting; this[detectingSymbol] = document.designer.detecting;
} }
/**
* hover
* @param id id
*/
capture(id: string) { capture(id: string) {
this[detectingSymbol].capture(this[documentSymbol].getNode(id)); this[detectingSymbol].capture(this[documentSymbol].getNode(id));
} }
/**
* hover
* @param id id
*/
release(id: string) { release(id: string) {
this[detectingSymbol].release(this[documentSymbol].getNode(id)); this[detectingSymbol].release(this[documentSymbol].getNode(id));
} }
/**
* hover
*/
leave() { leave() {
this[detectingSymbol].leave(this[documentSymbol]); this[detectingSymbol].leave(this[documentSymbol]);
} }

View File

@ -101,7 +101,7 @@ export default class DocumentModel {
* @param stage * @param stage
* @returns * @returns
*/ */
exportSchema(stage?: TransformStage) { exportSchema(stage: TransformStage = TransformStage.Render) {
return this[documentSymbol].export(stage); return this[documentSymbol].export(stage);
} }

View File

@ -25,10 +25,30 @@ export default class Event {
} }
} }
/**
*
* @param event
* @param listener
*/
on(event: string, listener: (...args: unknown[]) => void) { on(event: string, listener: (...args: unknown[]) => void) {
this[editorSymbol].on(event, listener); this[editorSymbol].on(event, listener);
} }
/**
*
* @param event
* @param listener
*/
off(event: string, listener: (...args: unknown[]) => void) {
this[editorSymbol].off(event, listener);
}
/**
*
* @param event
* @param args
* @returns
*/
emit(event: string, ...args: unknown[]) { emit(event: string, ...args: unknown[]) {
if (!this.options.prefix) { if (!this.options.prefix) {
logger.warn('Event#emit has been forbidden while prefix is not specified'); logger.warn('Event#emit has been forbidden while prefix is not specified');

View File

@ -10,34 +10,65 @@ export default class History {
this[historySymbol] = this[documentSymbol].getHistory(); this[historySymbol] = this[documentSymbol].getHistory();
} }
/**
*
* @param cursor
*/
go(cursor: number) { go(cursor: number) {
this[historySymbol].go(cursor); this[historySymbol].go(cursor);
} }
/**
* 退
*/
back() { back() {
this[historySymbol].back(); this[historySymbol].back();
} }
/**
*
*/
forward() { forward() {
this[historySymbol].forward(); this[historySymbol].forward();
} }
/**
*
*/
savePoint() { savePoint() {
this[historySymbol].savePoint(); this[historySymbol].savePoint();
} }
/**
*
* @returns
*/
isSavePoint() { isSavePoint() {
return this[historySymbol].isSavePoint(); return this[historySymbol].isSavePoint();
} }
/**
* state退
* @returns
*/
getState() { getState() {
return this[historySymbol].getState(); return this[historySymbol].getState();
} }
/**
* state
* @param func
* @returns
*/
onChangeState(func: () => any) { onChangeState(func: () => any) {
return this[historySymbol].onStateChange(func); return this[historySymbol].onStateChange(func);
} }
/**
*
* @param func
* @returns
*/
onChangeCursor(func: () => any) { onChangeCursor(func: () => any) {
return this[historySymbol].onCursor(func); return this[historySymbol].onCursor(func);
} }

View File

@ -2,6 +2,13 @@ import { hotkey, HotkeyCallback } from '@ali/lowcode-editor-core';
import { Disposable } from '@ali/lowcode-types'; import { Disposable } from '@ali/lowcode-types';
export default class Hotkey { export default class Hotkey {
/**
*
* @param combos ['command + s'] ['ctrl + shift + s']
* @param callback
* @param action
* @returns
*/
bind(combos: string[] | string, callback: HotkeyCallback, action?: string): Disposable { bind(combos: string[] | string, callback: HotkeyCallback, action?: string): Disposable {
hotkey.bind(combos, callback, action); hotkey.bind(combos, callback, action);
return () => { return () => {

View File

@ -22,22 +22,45 @@ export default class Material {
this[designerSymbol] = editor.get('designer')!; this[designerSymbol] = editor.get('designer')!;
} }
/**
* map
*/
get componentsMap() { get componentsMap() {
return this[designerSymbol].componentsMap; return this[designerSymbol].componentsMap;
} }
/**
*
* @param assets
* @returns
*/
setAssets(assets: AssetsJson) { setAssets(assets: AssetsJson) {
return this[editorSymbol].setAssets(assets); return this[editorSymbol].setAssets(assets);
} }
/**
*
* @returns
*/
getAssets() { getAssets() {
return this[editorSymbol].get('assets'); return this[editorSymbol].get('assets');
} }
/**
*
* @param incrementalAssets
* @returns
*/
loadIncrementalAssets(incrementalAssets: AssetsJson) { loadIncrementalAssets(incrementalAssets: AssetsJson) {
return this[designerSymbol].loadIncrementalAssets(incrementalAssets); return this[designerSymbol].loadIncrementalAssets(incrementalAssets);
} }
/**
*
* @param transducer
* @param level
* @param id
*/
registerMetadataTransducer( registerMetadataTransducer(
transducer: MetadataTransducer, transducer: MetadataTransducer,
level?: number, level?: number,
@ -46,14 +69,27 @@ export default class Material {
registerMetadataTransducer(transducer, level, id); registerMetadataTransducer(transducer, level, id);
} }
/**
*
* @returns
*/
getRegisteredMetadataTransducers() { getRegisteredMetadataTransducers() {
return getRegisteredMetadataTransducers(); return getRegisteredMetadataTransducers();
} }
/**
*
* @param componentName
* @returns
*/
getComponentMeta(componentName: string) { getComponentMeta(componentName: string) {
return ComponentMeta.create(this[designerSymbol].getComponentMeta(componentName)); return ComponentMeta.create(this[designerSymbol].getComponentMeta(componentName));
} }
/**
*
* @returns
*/
getComponentMetasMap() { getComponentMetasMap() {
const map = new Map<string, ComponentMeta>(); const map = new Map<string, ComponentMeta>();
const originalMap = this[designerSymbol].getComponentMetasMap(); const originalMap = this[designerSymbol].getComponentMetasMap();
@ -63,14 +99,27 @@ export default class Material {
return map; return map;
} }
/**
* action
* @param action
*/
addBuiltinComponentAction(action: ComponentAction) { addBuiltinComponentAction(action: ComponentAction) {
addBuiltinComponentAction(action); addBuiltinComponentAction(action);
} }
/**
* action
* @param name
*/
removeBuiltinComponentAction(name: string) { removeBuiltinComponentAction(name: string) {
removeBuiltinComponentAction(name); removeBuiltinComponentAction(name);
} }
/**
* action
* @param actionName
* @param handle
*/
modifyBuiltinComponentAction(actionName: string, handle: (action: ComponentAction) => void) { modifyBuiltinComponentAction(actionName: string, handle: (action: ComponentAction) => void) {
modifyBuiltinComponentAction(actionName, handle); modifyBuiltinComponentAction(actionName, handle);
} }

View File

@ -15,66 +15,128 @@ export default class NodeChildren {
return new NodeChildren(nodeChldren); return new NodeChildren(nodeChldren);
} }
/**
* children
*/
get owner(): Node | null { get owner(): Node | null {
return Node.create(this[nodeChildrenSymbol].owner); return Node.create(this[nodeChildrenSymbol].owner);
} }
/**
* children
*/
get size() { get size() {
return this[nodeChildrenSymbol].size; return this[nodeChildrenSymbol].size;
} }
/**
*
* @returns
*/
isEmpty() { isEmpty() {
return this[nodeChildrenSymbol].isEmpty(); return this[nodeChildrenSymbol].isEmpty();
} }
/**
*
* @param node
* @returns
*/
delete(node: Node) { delete(node: Node) {
return this[nodeChildrenSymbol].delete(node[nodeSymbol]); return this[nodeChildrenSymbol].delete(node[nodeSymbol]);
} }
insert(node: Node, at?: number | null | undefined, useMutator?: boolean) { /**
return this[nodeChildrenSymbol].insert(node[nodeSymbol], at, useMutator); *
* @param node
* @param at
* @returns
*/
insert(node: Node, at?: number | null) {
return this[nodeChildrenSymbol].insert(node[nodeSymbol], at, true);
} }
/**
*
* @param node
* @returns
*/
indexOf(node: Node) { indexOf(node: Node) {
return this[nodeChildrenSymbol].indexOf(node[nodeSymbol]); return this[nodeChildrenSymbol].indexOf(node[nodeSymbol]);
} }
/**
* splice
* @param start
* @param deleteCount
* @param node
*/
splice(start: number, deleteCount: number, node?: Node) { splice(start: number, deleteCount: number, node?: Node) {
this[nodeChildrenSymbol].splice(start, deleteCount, node?.[nodeSymbol]); this[nodeChildrenSymbol].splice(start, deleteCount, node?.[nodeSymbol]);
} }
/**
*
* @param index
* @returns
*/
get(index: number) { get(index: number) {
return this[nodeChildrenSymbol].get(index); return this[nodeChildrenSymbol].get(index);
} }
/**
*
* @param node
* @returns
*/
has(node: Node) { has(node: Node) {
return this[nodeChildrenSymbol].has(node[nodeSymbol]); return this[nodeChildrenSymbol].has(node[nodeSymbol]);
} }
/**
* forEach
* @param fn
*/
forEach(fn: (node: Node, index: number) => void) { forEach(fn: (node: Node, index: number) => void) {
this[nodeChildrenSymbol].forEach((item: InnerNode<NodeSchema>, index: number) => { this[nodeChildrenSymbol].forEach((item: InnerNode<NodeSchema>, index: number) => {
fn(Node.create(item)!, index); fn(Node.create(item)!, index);
}); });
} }
/**
* map
* @param fn
*/
map<T>(fn: (node: Node, index: number) => T[]) { map<T>(fn: (node: Node, index: number) => T[]) {
return this[nodeChildrenSymbol].map((item: InnerNode<NodeSchema>, index: number) => { return this[nodeChildrenSymbol].map((item: InnerNode<NodeSchema>, index: number) => {
return fn(Node.create(item)!, index); return fn(Node.create(item)!, index);
}); });
} }
/**
* every
* @param fn
*/
every(fn: (node: Node, index: number) => boolean) { every(fn: (node: Node, index: number) => boolean) {
return this[nodeChildrenSymbol].every((item: InnerNode<NodeSchema>, index: number) => { return this[nodeChildrenSymbol].every((item: InnerNode<NodeSchema>, index: number) => {
return fn(Node.create(item)!, index); return fn(Node.create(item)!, index);
}); });
} }
/**
* some
* @param fn
*/
some(fn: (node: Node, index: number) => boolean) { some(fn: (node: Node, index: number) => boolean) {
return this[nodeChildrenSymbol].some((item: InnerNode<NodeSchema>, index: number) => { return this[nodeChildrenSymbol].some((item: InnerNode<NodeSchema>, index: number) => {
return fn(Node.create(item)!, index); return fn(Node.create(item)!, index);
}); });
} }
/**
* filter
* @param fn
*/
filter(fn: (node: Node, index: number) => boolean) { filter(fn: (node: Node, index: number) => boolean) {
return this[nodeChildrenSymbol] return this[nodeChildrenSymbol]
.filter((item: InnerNode<NodeSchema>, index: number) => { .filter((item: InnerNode<NodeSchema>, index: number) => {
@ -83,6 +145,10 @@ export default class NodeChildren {
.map((item: InnerNode<NodeSchema>) => Node.create(item)!); .map((item: InnerNode<NodeSchema>) => Node.create(item)!);
} }
/**
* find
* @param fn
*/
find(fn: (node: Node, index: number) => boolean) { find(fn: (node: Node, index: number) => boolean) {
return Node.create( return Node.create(
this[nodeChildrenSymbol].find((item: InnerNode<NodeSchema>, index: number) => { this[nodeChildrenSymbol].find((item: InnerNode<NodeSchema>, index: number) => {
@ -91,20 +157,39 @@ export default class NodeChildren {
); );
} }
/**
* reduce
* @param fn
*/
reduce(fn: (acc: any, cur: Node) => any, initialValue: any) { reduce(fn: (acc: any, cur: Node) => any, initialValue: any) {
return this[nodeChildrenSymbol].reduce((acc: any, cur: InnerNode) => { return this[nodeChildrenSymbol].reduce((acc: any, cur: InnerNode) => {
return fn(acc, Node.create(cur)!); return fn(acc, Node.create(cur)!);
}, initialValue); }, initialValue);
} }
/**
* schema
* @param data
*/
importSchema(data?: NodeData | NodeData[]) { importSchema(data?: NodeData | NodeData[]) {
this[nodeChildrenSymbol].import(data); this[nodeChildrenSymbol].import(data);
} }
exportSchema(stage?: TransformStage) { /**
* schema
* @param stage
* @returns
*/
exportSchema(stage: TransformStage = TransformStage.Render) {
return this[nodeChildrenSymbol].export(stage); return this[nodeChildrenSymbol].export(stage);
} }
/**
*
* @param remover
* @param adder
* @param sorter
*/
mergeChildren( mergeChildren(
remover: (node: Node, idx: number) => boolean, remover: (node: Node, idx: number) => boolean,
adder: (children: Node[]) => any, adder: (children: Node[]) => any,

View File

@ -26,63 +26,99 @@ export default class Node {
} }
/** /**
* id * id
*/ */
get id() { get id() {
return this[nodeSymbol].id; return this[nodeSymbol].id;
} }
/**
*
*/
get title() { get title() {
return this[nodeSymbol].title; return this[nodeSymbol].title;
} }
/**
*
*/
get isContainer() { get isContainer() {
return this[nodeSymbol].isContainer(); return this[nodeSymbol].isContainer();
} }
/**
*
*/
get isRoot() { get isRoot() {
return this[nodeSymbol].isRoot(); return this[nodeSymbol].isRoot();
} }
/**
* Page
*/
get isPage() { get isPage() {
return this[nodeSymbol].isPage(); return this[nodeSymbol].isPage();
} }
/**
* Component
*/
get isComponent() { get isComponent() {
return this[nodeSymbol].isComponent(); return this[nodeSymbol].isComponent();
} }
/**
*
*/
get isSlot() { get isSlot() {
return this[nodeSymbol].isSlot(); return this[nodeSymbol].isSlot();
} }
/**
* /
*/
get isParental() { get isParental() {
return this[nodeSymbol].isParental(); return this[nodeSymbol].isParental();
} }
/**
*
*/
get isLeaf() { get isLeaf() {
return this[nodeSymbol].isLeaf(); return this[nodeSymbol].isLeaf();
} }
/**
*
*/
get index() { get index() {
return this[nodeSymbol].index; return this[nodeSymbol].index;
} }
/**
*
*/
get icon() { get icon() {
return this[nodeSymbol].icon; return this[nodeSymbol].icon;
} }
/**
* 0
*/
get zLevel() { get zLevel() {
return this[nodeSymbol].zLevel; return this[nodeSymbol].zLevel;
} }
/** /**
* componentName * componentName
*/ */
get componentName() { get componentName() {
return this[nodeSymbol].componentName; return this[nodeSymbol].componentName;
} }
/**
*
*/
get componentMeta() { get componentMeta() {
return ComponentMeta.create(this[nodeSymbol].componentMeta); return ComponentMeta.create(this[nodeSymbol].componentMeta);
} }
@ -127,14 +163,23 @@ export default class Node {
return NodeChildren.create(this[nodeSymbol].children); return NodeChildren.create(this[nodeSymbol].children);
} }
/**
*
*/
get slots(): Node[] { get slots(): Node[] {
return this[nodeSymbol].slots.map((node: InnerNode) => Node.create(node)!); return this[nodeSymbol].slots.map((node: InnerNode) => Node.create(node)!);
} }
/**
*
*/
get slotFor() { get slotFor() {
return Prop.create(this[nodeSymbol].slotFor); return Prop.create(this[nodeSymbol].slotFor);
} }
/**
*
*/
get props() { get props() {
return Props.create(this[nodeSymbol].props); return Props.create(this[nodeSymbol].props);
} }
@ -153,18 +198,34 @@ export default class Node {
return this[nodeSymbol].getDOMNode(); return this[nodeSymbol].getDOMNode();
} }
/**
*
* @returns
*/
getRect() { getRect() {
return this[nodeSymbol].getRect(); return this[nodeSymbol].getRect();
} }
/**
*
* @returns
*/
hasSlots() { hasSlots() {
return this[nodeSymbol].hasSlots(); return this[nodeSymbol].hasSlots();
} }
/**
*
* @returns
*/
hasCondition() { hasCondition() {
return this[nodeSymbol].hasCondition(); return this[nodeSymbol].hasCondition();
} }
/**
*
* @returns
*/
hasLoop() { hasLoop() {
return this[nodeSymbol].hasLoop(); return this[nodeSymbol].hasLoop();
} }
@ -248,7 +309,7 @@ export default class Node {
* @param options * @param options
* @returns * @returns
*/ */
exportSchema(stage?: TransformStage, options?: any) { exportSchema(stage: TransformStage = TransformStage.Render, options?: any) {
return this[nodeSymbol].export(stage, options); return this[nodeSymbol].export(stage, options);
} }

View File

@ -30,6 +30,9 @@ export default class Project {
return this[projectSymbol].documents.map((doc) => DocumentModel.create(doc)!); return this[projectSymbol].documents.map((doc) => DocumentModel.create(doc)!);
} }
/**
* host
*/
get simulatorHost() { get simulatorHost() {
return SimulatorHost.create(this[projectSymbol].simulator as any || this[simulatorHostSymbol]); return SimulatorHost.create(this[projectSymbol].simulator as any || this[simulatorHostSymbol]);
} }

View File

@ -15,27 +15,56 @@ export default class Prop {
return new Prop(prop); return new Prop(prop);
} }
/**
* id
*/
get id() { get id() {
return this[propSymbol].id; return this[propSymbol].id;
} }
/**
* key
*/
get key() { get key() {
return this[propSymbol].key; return this[propSymbol].key;
} }
/**
* prop
*/
get path() {
return this[propSymbol].path;
}
/**
*
*/
get node(): Node | null { get node(): Node | null {
return Node.create(this[propSymbol].getNode()); return Node.create(this[propSymbol].getNode());
} }
/**
*
* @param val
*/
setValue(val: CompositeValue) { setValue(val: CompositeValue) {
this[propSymbol].setValue(val); this[propSymbol].setValue(val);
} }
/**
*
* @returns
*/
getValue() { getValue() {
return this[propSymbol].getValue(); return this[propSymbol].getValue();
} }
exportSchema(stage: TransformStage) { /**
*
* @param stage
* @returns
*/
exportSchema(stage: TransformStage = TransformStage.Render) {
return this[propSymbol].export(stage); return this[propSymbol].export(stage);
} }
} }

View File

@ -16,10 +16,16 @@ export default class Props {
return new Props(props); return new Props(props);
} }
/**
* id
*/
get id() { get id() {
return this[propsSymbol].id; return this[propsSymbol].id;
} }
/**
* props
*/
get path() { get path() {
return this[propsSymbol].path; return this[propsSymbol].path;
} }

View File

@ -15,34 +15,65 @@ export default class Selection {
this[selectionSymbol] = document.selection; this[selectionSymbol] = document.selection;
} }
/**
* id
*/
get selected() { get selected() {
return this[selectionSymbol].selected; return this[selectionSymbol].selected;
} }
/**
*
* @param id
*/
select(id: string) { select(id: string) {
this[selectionSymbol].select(id); this[selectionSymbol].select(id);
} }
/**
*
* @param ids
*/
selectAll(ids: string[]) { selectAll(ids: string[]) {
this[selectionSymbol].selectAll(ids); this[selectionSymbol].selectAll(ids);
} }
/**
*
* @param id
*/
remove(id: string) { remove(id: string) {
this[selectionSymbol].remove(id); this[selectionSymbol].remove(id);
} }
/**
*
*/
clear() { clear() {
this[selectionSymbol].clear(); this[selectionSymbol].clear();
} }
/**
*
* @param id
* @returns
*/
has(id: string) { has(id: string) {
return this[selectionSymbol].has(id); return this[selectionSymbol].has(id);
} }
/**
*
* @param id
*/
add(id: string) { add(id: string) {
this[selectionSymbol].add(id); this[selectionSymbol].add(id);
} }
/**
*
* @returns
*/
getNodes() { getNodes() {
return this[selectionSymbol].getNodes().map((node: InnerNode) => Node.create(node)); return this[selectionSymbol].getNodes().map((node: InnerNode) => Node.create(node));
} }

View File

@ -2,14 +2,29 @@ import { getSetter, registerSetter, getSettersMap, RegisteredSetter } from '@ali
import { CustomView } from '@ali/lowcode-types'; import { CustomView } from '@ali/lowcode-types';
export default class Setters { export default class Setters {
/**
* setter
* @param type
* @returns
*/
getSetter(type: string) { getSetter(type: string) {
return getSetter(type); return getSetter(type);
} }
/**
* settersMap
* @returns
*/
getSettersMap() { getSettersMap() {
return getSettersMap(); return getSettersMap();
} }
/**
* setter
* @param typeOrMaps
* @param setter
* @returns
*/
registerSetter( registerSetter(
typeOrMaps: string | { [key: string]: CustomView | RegisteredSetter }, typeOrMaps: string | { [key: string]: CustomView | RegisteredSetter },
setter?: CustomView | RegisteredSetter | undefined, setter?: CustomView | RegisteredSetter | undefined,

View File

@ -26,30 +26,59 @@ export default class SettingPropEntry {
return this.node; return this.node;
} }
/**
*
* @param val
*/
setValue(val: CompositeValue) { setValue(val: CompositeValue) {
this[settingPropEntrySymbol].setValue(val); this[settingPropEntrySymbol].setValue(val);
} }
/**
*
* @returns
*/
getValue() { getValue() {
return this[settingPropEntrySymbol].getValue(); return this[settingPropEntrySymbol].getValue();
} }
/**
*
* @returns
*/
getProps() { getProps() {
return SettingTopEntry.create(this[settingPropEntrySymbol].getProps() as SettingEntry) as any; return SettingTopEntry.create(this[settingPropEntrySymbol].getProps() as SettingEntry) as any;
} }
/**
*
* @returns
*/
isUseVariable() { isUseVariable() {
return this[settingPropEntrySymbol].isUseVariable(); return this[settingPropEntrySymbol].isUseVariable();
} }
/**
*
* @param flag
*/
setUseVariable(flag: boolean) { setUseVariable(flag: boolean) {
this[settingPropEntrySymbol].setUseVariable(flag); this[settingPropEntrySymbol].setUseVariable(flag);
} }
/**
* field
* @param config
* @returns
*/
createField(config: FieldConfig) { createField(config: FieldConfig) {
return SettingPropEntry.create(this[settingPropEntrySymbol].createField(config)); return SettingPropEntry.create(this[settingPropEntrySymbol].createField(config));
} }
/**
* mock
* @returns
*/
getMockOrValue() { getMockOrValue() {
return this[settingPropEntrySymbol].getMockOrValue(); return this[settingPropEntrySymbol].getMockOrValue();
} }

View File

@ -13,6 +13,9 @@ export default class SettingTopEntry {
return new SettingTopEntry(prop); return new SettingTopEntry(prop);
} }
/**
*
*/
get node(): Node | null { get node(): Node | null {
return Node.create(this[settingTopEntrySymbol].getNode()); return Node.create(this[settingTopEntrySymbol].getNode());
} }
@ -24,10 +27,20 @@ export default class SettingTopEntry {
return this.node; return this.node;
} }
/**
* propName
* @param propName
* @returns
*/
getPropValue(propName: string | number) { getPropValue(propName: string | number) {
return this[settingTopEntrySymbol].getPropValue(propName); return this[settingTopEntrySymbol].getPropValue(propName);
} }
/**
* propName
* @param propName
* @param value
*/
setPropValue(propName: string | number, value: any) { setPropValue(propName: string | number, value: any) {
this[settingTopEntrySymbol].setPropValue(propName, value); this[settingTopEntrySymbol].setPropValue(propName, value);
} }

View File

@ -15,18 +15,34 @@ export default class SimulatorHost {
return new SimulatorHost(host); return new SimulatorHost(host);
} }
/**
* contentWindow
*/
get contentWindow() { get contentWindow() {
return this[simulatorHostSymbol].contentWindow; return this[simulatorHostSymbol].contentWindow;
} }
/**
* contentDocument
*/
get contentDocument() { get contentDocument() {
return this[simulatorHostSymbol].contentDocument; return this[simulatorHostSymbol].contentDocument;
} }
/**
* host
* @param key
* @param value
*/
set(key: string, value: any) { set(key: string, value: any) {
this[simulatorHostSymbol].set(key, value); this[simulatorHostSymbol].set(key, value);
} }
/**
* host
* @param key
* @returns
*/
get(key: string) { get(key: string) {
return this[simulatorHostSymbol].get(key); return this[simulatorHostSymbol].get(key);
} }

View File

@ -12,10 +12,21 @@ export default class Skeleton {
this[skeletonSymbol] = skeleton; this[skeletonSymbol] = skeleton;
} }
/**
*
* @param config
* @param extraConfig
* @returns
*/
add(config: IWidgetBaseConfig, extraConfig?: Record<string, any>) { add(config: IWidgetBaseConfig, extraConfig?: Record<string, any>) {
return this[skeletonSymbol].add(config, extraConfig); return this[skeletonSymbol].add(config, extraConfig);
} }
/**
*
* @param config
* @returns
*/
remove(config: IWidgetBaseConfig) { remove(config: IWidgetBaseConfig) {
const { area, name } = config; const { area, name } = config;
const skeleton = this[skeletonSymbol]; const skeleton = this[skeletonSymbol];