Skip to content

Commit 47ea1fb

Browse files
committed
svg child props
1 parent f1d7adc commit 47ea1fb

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

packages/web-component-designer/src/elements/services/propertiesService/PropertyGroupsService.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ export class PropertyGroupsService implements IPropertyGroupsService {
3939
{ name: 'svg', propertiesService: new CssPropertiesService("svg") },
4040
];
4141

42+
protected _svgChildPgList: { name: string; propertiesService: IPropertiesService; }[] = [
43+
{ name: 'properties', propertiesService: null },
44+
{ name: 'attached', propertiesService: this._attachedPropertiesService },
45+
{ name: 'attributes', propertiesService: new AttributesPropertiesService() },
46+
{ name: 'common', propertiesService: new CommonPropertiesService() },
47+
{ name: 'styles', propertiesService: new CssCurrentPropertiesService() },
48+
{ name: 'css vars', propertiesService: new CssCustomPropertiesService() },
49+
{ name: 'layout', propertiesService: new CssPropertiesService("layoutSvgChild") },
50+
];
51+
4252
protected _gridChild: { name: string; propertiesService: IPropertiesService; }[] = [
4353
{ name: 'gridChild', propertiesService: new CssPropertiesService("gridChild") },
4454
];
@@ -74,8 +84,13 @@ export class PropertyGroupsService implements IPropertyGroupsService {
7484
this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
7585

7686
let lst = this._pgList;
77-
if (designItems[0].element instanceof designItems[0].window.SVGElement)
78-
lst = this._svgPgList;
87+
if (designItems[0].element instanceof designItems[0].window.SVGElement) {
88+
if (designItems[0].element instanceof designItems[0].window.SVGSVGElement) {
89+
lst = this._svgPgList;
90+
} else {
91+
lst = this._svgChildPgList;
92+
}
93+
}
7994

8095
const style = designItems[0].getComputedStyle();
8196
if (style.display.includes('grid'))

packages/web-component-designer/src/elements/services/propertiesService/services/CssPropertiesService.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,21 @@ export class CssPropertiesService extends AbstractCssPropertiesService {
9494
"stroke-opacity"
9595
];
9696

97+
public layoutSvgChild = {
98+
"common": [
99+
"display",
100+
"fill",
101+
"fill-rule",
102+
"fill-opacity",
103+
"stroke",
104+
"stroke-width",
105+
"stroke-dasharray",
106+
"stroke-dashoffset",
107+
"stroke-opacity"
108+
],
109+
}
97110

98-
constructor(name: 'layout' | 'grid' | 'gridChild' | 'flex' | 'flexChild' | 'svg') {
111+
constructor(name: 'layout' | 'layoutSvgChild' | 'grid' | 'gridChild' | 'flex' | 'flexChild' | 'svg') {
99112
super();
100113
this.name = name;
101114
}

0 commit comments

Comments
 (0)