Skip to content

Commit

Permalink
service for attached properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Sep 6, 2023
1 parent 9311769 commit 95e7846
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 23 deletions.
40 changes: 23 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"customElements": "custom-elements.json",
"webComponentDesigner": "web-component-designer.json",
"devDependencies": {
"@node-projects/web-component-designer": "^0.0.258",
"@web/dev-server": "^0.3.0",
"@node-projects/web-component-designer": "^0.0.282",
"@web/dev-server": "^0.3.1",
"es-module-shims": "^1.8.0",
"release-it": "^16.1.5",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},
"dependencies": {
"@node-projects/base-custom-webcomponent": "^0.13.0"
"@node-projects/base-custom-webcomponent": "^0.17.2"
}
}
18 changes: 18 additions & 0 deletions src/designer/AttachedPropertiesService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { BaseCustomWebComponentPropertiesService, IDesignItem, IProperty, PropertyType } from "@node-projects/web-component-designer";
import { TabWebcomponent } from "../tab/TabWebcomponent.js";

export default class AttachedPropertiesService extends BaseCustomWebComponentPropertiesService {
override isHandledElement(designItem: IDesignItem): boolean {
return designItem.parent?.element instanceof TabWebcomponent;
}

public override getProperties(designItem: IDesignItem): IProperty[] {
return [{
name: 'header',
description: 'header shown in tab control',
type: "string",
service: this,
propertyType: PropertyType.propertyAndAttribute
}];
}
}
3 changes: 1 addition & 2 deletions src/tab/TabWebcomponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export class TabWebcomponent extends BaseCustomWebComponentConstructorAppend {
.tab-container {
height: calc(100% - 30px);
overflow: none;
}
`;
}`;

public static override readonly template = html`
<div style="display: flex; flex-direction: column; height: 100%; width: 100%;">
Expand Down
3 changes: 3 additions & 0 deletions web-component-designer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
],
"containerService": [
"./dist/designer/TabPlacementService.js"
],
"attachedPropertyService": [
"./dist/designer/AttachedPropertiesService.js"
]
}
}

0 comments on commit 95e7846

Please sign in to comment.