diff --git a/cc-inspector/src/views/devtools/comp/index.ts b/cc-inspector/src/views/devtools/comp/index.ts index 3b93bf1..57e7f48 100644 --- a/cc-inspector/src/views/devtools/comp/index.ts +++ b/cc-inspector/src/views/devtools/comp/index.ts @@ -13,5 +13,9 @@ export function getSimpleProperties(typeName: string): string[] { config[CompType.Node2] = ["position", "rotation", "scale", "anchor", "size", "color", "opacity", "skew", "group"]; config[CompType.Label2] = ["string", "horizontalAlign", "verticalAlign", "fontSize", "lineHeight", "overflow", "font", "fontFamily", "ebableBold", "enableItalic", "enableUnderline", "underlineHeight", "cacheMode", "useSystemFont"]; config[CompType.Spirte2] = ["atlas", "spriteFrame", "type", "sizeMode"]; - return config[typeName]; + return config[typeName] || []; } +export const VisibleProp = { + Active: "active", + Enabled: "enabled", +}; diff --git a/cc-inspector/src/views/devtools/data.ts b/cc-inspector/src/views/devtools/data.ts index 4e4811a..9310505 100644 --- a/cc-inspector/src/views/devtools/data.ts +++ b/cc-inspector/src/views/devtools/data.ts @@ -1,6 +1,6 @@ import { ITreeData } from "@xuyanfeng/cc-ui/types/cc-tree/const"; import { v4 } from "uuid"; -import { getSimpleProperties } from "./comp"; +import { getSimpleProperties, VisibleProp } from "./comp"; export enum DataType { Number = "Number", String = "String", @@ -565,9 +565,18 @@ export class Group { this.id = id || ""; } isSimple(name: string): boolean { + if (name === VisibleProp.Active || name === VisibleProp.Enabled) { + return true; + } + const arr = getSimpleProperties(this.name); - const b = arr.find((el) => el === name); - return !!b; + if (arr.length) { + const b = arr.find((el) => el === name); + return !!b; + } else { + // 这个类型,没有追加精简属性的配置,默认都是精简属性 + return true; + } } parse(data: Group, simple: boolean = false) { this.id = data.id; diff --git a/cc-inspector/src/views/devtools/test/server.ts b/cc-inspector/src/views/devtools/test/server.ts index ebd8031..5c3032d 100644 --- a/cc-inspector/src/views/devtools/test/server.ts +++ b/cc-inspector/src/views/devtools/test/server.ts @@ -1,5 +1,6 @@ import { v4 } from "uuid"; import { Msg, Page, PluginEvent, RequestNodeInfoData, ResponseNodeInfoData, ResponseSupportData, ResponseTreeInfoData } from "../../../core/types"; +import { VisibleProp } from "../comp"; import { ArrayData, BoolData, ColorData, EngineData, EnumData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectData, Property, StringData, TextData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../data"; export class TestClient { recv(event: PluginEvent) {} @@ -125,11 +126,19 @@ export class TestServer { this.testData.buildChild("str2").buildComponent("group6").buildProperty("str2", new StringData("str2")); - this.testData.buildChild("Invalid").buildComponent("group7").buildProperty("NaN", new InvalidData(NaN)).buildProperty("null", new InvalidData(null)).buildProperty("Infinity", new InvalidData(Infinity)).buildProperty("undefined", new InvalidData(undefined)); + this.testData + .buildChild("Invalid") + .buildComponent("group7") + .buildProperty("NaN", new InvalidData(NaN)) // + .buildProperty("null", new InvalidData(null)) + .buildProperty("Infinity", new InvalidData(Infinity)) + .buildProperty(VisibleProp.Active, new BoolData(true)) + .buildProperty("undefined", new InvalidData(undefined)); this.testData .buildChild("comp") .buildComponent("node-2") // .buildProperty("rotation", new NumberData(0)) + .buildProperty(VisibleProp.Enabled, new BoolData(true)) .buildProperty("max", new NumberData(100)); } add(client: TestClient) { diff --git a/cc-inspector/src/views/devtools/ui/property-group.vue b/cc-inspector/src/views/devtools/ui/property-group.vue index 642c438..007efd5 100644 --- a/cc-inspector/src/views/devtools/ui/property-group.vue +++ b/cc-inspector/src/views/devtools/ui/property-group.vue @@ -1,6 +1,11 @@