MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / Props

Class Props

packages/shell/src/model/props.ts:7–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import { Prop as ShellProp } from './prop';
6
7export class Props implements IPublicModelProps {
8 private readonly [propsSymbol]: InnerProps;
9
10 constructor(props: InnerProps) {
11 this[propsSymbol] = props;
12 }
13
14 static create(props: InnerProps | undefined | null): IPublicModelProps | null {
15 if (!props) {
16 return null;
17 }
18 return new Props(props);
19 }
20
21 /**
22 * id
23 */
24 get id(): string {
25 return this[propsSymbol].id;
26 }
27
28 /**
29 * 返回当前 props 的路径
30 */
31 get path(): string[] {
32 return this[propsSymbol].path;
33 }
34
35 /**
36 * 返回所属的 node 实例
37 */
38 get node(): IPublicModelNode | null {
39 return ShellNode.create(this[propsSymbol].getNode());
40 }
41
42 /**
43 * 获取指定 path 的属性模型实例
44 * @param path 属性路径,支持 a / a.b / a.0 等格式
45 * @returns
46 */
47 getProp(path: string): IPublicModelProp | null {
48 return ShellProp.create(this[propsSymbol].getProp(path));
49 }
50
51 /**
52 * 获取指定 path 的属性模型实例值
53 * @param path 属性路径,支持 a / a.b / a.0 等格式
54 * @returns
55 */
56 getPropValue(path: string): any {
57 return this.getProp(path)?.getValue();
58 }
59
60 /**
61 * 获取指定 path 的属性模型实例,
62 * 注:导出时,不同于普通属性,该属性并不挂载在 props 之下,而是与 props 同级
63 * @param path 属性路径,支持 a / a.b / a.0 等格式
64 * @returns

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…