From 71d9be4d9702b087529f811401c7f5583ff4c6fb Mon Sep 17 00:00:00 2001 From: xiange Date: Wed, 23 Oct 2024 00:19:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20removed=20default=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/chili-core/src/foundation/observer.ts | 2 +- packages/chili-ui/src/property/propertyView.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/chili-core/src/foundation/observer.ts b/packages/chili-core/src/foundation/observer.ts index 0586d500..b1b1d2e6 100644 --- a/packages/chili-core/src/foundation/observer.ts +++ b/packages/chili-core/src/foundation/observer.ts @@ -57,11 +57,11 @@ export class Observable implements IPropertyChanged { while (proto !== null) { if (proto.hasOwnProperty(pubKey)) { Object.defineProperty(proto, privateKey, { - value: newValue, writable: true, enumerable: false, configurable: true, }); + proto[privateKey] = newValue; break; } proto = Object.getPrototypeOf(proto); diff --git a/packages/chili-ui/src/property/propertyView.ts b/packages/chili-ui/src/property/propertyView.ts index 53aa681c..7a23f5da 100644 --- a/packages/chili-ui/src/property/propertyView.ts +++ b/packages/chili-ui/src/property/propertyView.ts @@ -8,6 +8,7 @@ import { INode, IView, Node, + NodeLinkedList, ParameterShapeNode, Property, PubSub, @@ -56,10 +57,17 @@ export class PropertyView extends HTMLElement { private addModel(document: IDocument, nodes: INode[]) { if (nodes.length === 0) return; + let properties = div({ className: style.rootProperties }); - Property.getOwnProperties(Node.prototype).forEach((x) => { - appendProperty(properties, document, nodes, x); - }); + if (nodes[0] instanceof NodeLinkedList) { + Property.getProperties(Object.getPrototypeOf(nodes[0])).forEach((x) => { + appendProperty(properties, document, nodes, x); + }); + } else if (nodes[0] instanceof Node) { + Property.getOwnProperties(Node.prototype).forEach((x) => { + appendProperty(properties, document, nodes, x); + }); + } this.panel.append(properties); }