umbraco-package-view by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-package-view包视图为 Umbraco 中已安装的包提供自定义 UI 面板。它们出现在“包”部分,允许包开发者为他们的包创建专用的配置或信息页面。当用户点击已安装的包时,包视图会以模态框或面板的形式显示。
在实现之前,请始终获取最新文档:
Umbraco 元素 : 用于创建 UI 组件的基类
umbraco-umbraco-element模态框 : 包视图在模态框上下文中显示
umbraco-modals广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import type { ManifestPackageView } from '@umbraco-cms/backoffice/packages';
export const manifests: Array<ManifestPackageView> = [
{
type: 'packageView',
alias: 'My.PackageView',
name: 'My Package View',
element: () => import('./my-package-view.element.js'),
meta: {
packageName: 'My Package',
},
},
];
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
@customElement('my-package-view')
export class MyPackageViewElement extends UmbModalBaseElement {
override render() {
return html`
<umb-body-layout headline="My Package">
<uui-box>
<h2>Package Configuration</h2>
<p>Configure your package settings here.</p>
<uui-form>
<uui-form-layout-item>
<uui-label slot="label">Setting 1</uui-label>
<uui-input></uui-input>
</uui-form-layout-item>
</uui-form>
</uui-box>
<div slot="actions">
<uui-button @click=${this.#onClose} label="Close"></uui-button>
<uui-button look="primary" @click=${this.#onSave} label="Save"></uui-button>
</div>
</umb-body-layout>
`;
}
#onClose() {
this.modalContext?.reject();
}
#onSave() {
// 保存逻辑写在这里
this.modalContext?.submit();
}
}
export default MyPackageViewElement;
const template = document.createElement('template');
template.innerHTML = `
<umb-body-layout>
<h1 slot="header">My Package</h1>
<uui-box>
<p>Package information and settings</p>
</uui-box>
<uui-action-bar slot="footer-info">
<uui-button look="primary" type="button">Close</uui-button>
</uui-action-bar>
</umb-body-layout>
`;
export default class MyPackageViewElement extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.appendChild(template.content.cloneNode(true));
this.shadowRoot.querySelector('uui-button').addEventListener('click', this.onClick.bind(this));
}
onClick() {
this.modalContext.close();
}
}
customElements.define('my-package-view', MyPackageViewElement);
interface ManifestPackageView extends ManifestElement {
type: 'packageView';
meta: MetaPackageView;
}
interface MetaPackageView {
packageName: string; // 必须与 umbraco-package.json 中的包名匹配
}
包视图通过将 meta.packageName 与您的包在 umbraco-package.json 中的名称匹配来链接:
{
"$schema": "../../umbraco-package-schema.json",
"name": "My Package",
"version": "1.0.0",
"extensions": [
{
"type": "packageView",
"alias": "My.PackageView",
"name": "My Package View",
"element": "/App_Plugins/MyPackage/my-package-view.js",
"meta": {
"packageName": "My Package"
}
}
]
}
就是这样!请始终获取最新的文档,保持示例简洁,生成完整可用的代码。
每周安装量
75
代码仓库
GitHub 星标数
17
首次出现
2026年2月4日
安全审计
安装于
github-copilot55
cursor25
opencode23
codex23
gemini-cli21
amp21
Package Views provide custom UI panels for installed packages in Umbraco. They appear in the Packages section and allow package developers to create dedicated configuration or information pages for their packages. When a user clicks on an installed package, the package view is displayed as a modal or panel.
Always fetch the latest docs before implementing:
Umbraco Element : Base class for creating UI components
umbraco-umbraco-elementModals : Package views are displayed in modal context
umbraco-modalsimport type { ManifestPackageView } from '@umbraco-cms/backoffice/packages';
export const manifests: Array<ManifestPackageView> = [
{
type: 'packageView',
alias: 'My.PackageView',
name: 'My Package View',
element: () => import('./my-package-view.element.js'),
meta: {
packageName: 'My Package',
},
},
];
import { html, customElement } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
@customElement('my-package-view')
export class MyPackageViewElement extends UmbModalBaseElement {
override render() {
return html`
<umb-body-layout headline="My Package">
<uui-box>
<h2>Package Configuration</h2>
<p>Configure your package settings here.</p>
<uui-form>
<uui-form-layout-item>
<uui-label slot="label">Setting 1</uui-label>
<uui-input></uui-input>
</uui-form-layout-item>
</uui-form>
</uui-box>
<div slot="actions">
<uui-button @click=${this.#onClose} label="Close"></uui-button>
<uui-button look="primary" @click=${this.#onSave} label="Save"></uui-button>
</div>
</umb-body-layout>
`;
}
#onClose() {
this.modalContext?.reject();
}
#onSave() {
// Save logic here
this.modalContext?.submit();
}
}
export default MyPackageViewElement;
const template = document.createElement('template');
template.innerHTML = `
<umb-body-layout>
<h1 slot="header">My Package</h1>
<uui-box>
<p>Package information and settings</p>
</uui-box>
<uui-action-bar slot="footer-info">
<uui-button look="primary" type="button">Close</uui-button>
</uui-action-bar>
</umb-body-layout>
`;
export default class MyPackageViewElement extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.appendChild(template.content.cloneNode(true));
this.shadowRoot.querySelector('uui-button').addEventListener('click', this.onClick.bind(this));
}
onClick() {
this.modalContext.close();
}
}
customElements.define('my-package-view', MyPackageViewElement);
interface ManifestPackageView extends ManifestElement {
type: 'packageView';
meta: MetaPackageView;
}
interface MetaPackageView {
packageName: string; // Must match the package name in umbraco-package.json
}
The package view is linked by matching meta.packageName with your package's name in umbraco-package.json:
{
"$schema": "../../umbraco-package-schema.json",
"name": "My Package",
"version": "1.0.0",
"extensions": [
{
"type": "packageView",
"alias": "My.PackageView",
"name": "My Package View",
"element": "/App_Plugins/MyPackage/my-package-view.js",
"meta": {
"packageName": "My Package"
}
}
]
}
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
75
Repository
GitHub Stars
17
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot55
cursor25
opencode23
codex23
gemini-cli21
amp21
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
SpecStory 历史文件整理工具 - 按时间戳自动归档会话文件,保持项目目录整洁
120 周安装
AI播客制作工具 - 文本转播客脚本,自动生成音乐音效,专业播客工作室
75 周安装
Microsoft 365 管理员技能:Exchange、Teams、SharePoint 自动化与 Graph API 管理
120 周安装
Claude子代理创建指南:创建自动化子代理提升AI开发效率
125 周安装
AI肖像照片美化 - 专业级皮肤平滑、牙齿美白、眼部增强修图技能
75 周安装
16位像素角色精灵表生成器 - 复古游戏动画制作与ImageMagick自动化
122 周安装