@morya-ui/mcp 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,216 +1,220 @@
1
- <script setup lang="ts">
2
- /**
3
- * 黄金样例:列表页
4
- * @see DESIGN.md · morya-ui-pages references/page-layouts.md · visual-craft § Ops polish
5
- */
6
- import {
7
- MBreadcrumb,
8
- MButton,
9
- MConfigProvider,
10
- MEmpty,
11
- MInput,
12
- MLayout,
13
- MLayoutContent,
14
- MLayoutHeader,
15
- MLayoutSider,
16
- MMenu,
17
- MPageContent,
18
- MPageFilterChips,
19
- MPageFilters,
20
- MPageHeader,
21
- MSelect,
22
- MSpace,
23
- MStatus,
24
- MTable,
25
- MTag,
26
- zhCN,
27
- } from 'morya-ui'
28
- import { computed, ref } from 'vue'
29
-
30
- const keyword = ref('')
31
- const status = ref<string | undefined>()
32
- const department = ref<string | null>(null)
33
- const filtersExpanded = ref(false)
34
- const siderCollapsed = ref(false)
35
-
36
- const menuModel = [
37
- { key: 'users', label: '用户管理', icon: 'user', to: '/users' },
38
- { key: 'roles', label: '角色管理', icon: 'shield', to: '/roles' },
39
- { key: 'settings', label: '系统设置', icon: 'settings', to: '/settings' },
40
- ]
41
-
42
- const statusOptions = [
43
- { label: '全部', value: '' },
44
- { label: '启用', value: 'active' },
45
- { label: '停用', value: 'inactive' },
46
- ]
47
-
48
- const departmentOptions = [
49
- { label: '研发', value: '研发' },
50
- { label: '运营', value: '运营' },
51
- { label: '市场', value: '市场' },
52
- ]
53
-
54
- const activeFilters = computed(() => {
55
- const items: Array<{ key: string; label: string }> = []
56
- if (keyword.value.trim()) {
57
- items.push({ key: 'keyword', label: `关键词:${keyword.value.trim()}` })
58
- }
59
- if (status.value) {
60
- const label = statusOptions.find((o) => o.value === status.value)?.label ?? status.value
61
- items.push({ key: 'status', label: `状态:${label}` })
62
- }
63
- if (department.value) {
64
- items.push({ key: 'department', label: `部门:${department.value}` })
65
- }
66
- return items
67
- })
68
-
69
- function clearFilter(key: string) {
70
- if (key === 'keyword') keyword.value = ''
71
- if (key === 'status') status.value = undefined
72
- if (key === 'department') department.value = null
73
- }
74
-
75
- function resetFilters() {
76
- keyword.value = ''
77
- status.value = undefined
78
- department.value = null
79
- }
80
-
81
- const columns = [
82
- { key: 'name', label: '名称' },
83
- { key: 'status', label: '状态', width: 120 },
84
- { key: 'updatedAt', label: '更新时间', width: 140 },
85
- { key: 'actions', label: '操作', width: 148 },
86
- ]
87
-
88
- const rows = [
89
- { id: '1', name: '示例项目 A', status: 'active', updatedAt: '2026-09-01' },
90
- { id: '2', name: '示例项目 B', status: 'inactive', updatedAt: '2026-08-28' },
91
- { id: '3', name: '示例项目 C', status: 'active', updatedAt: '2026-08-25' },
92
- { id: '4', name: '示例项目 D', status: 'active', updatedAt: '2026-08-20' },
93
- { id: '5', name: '示例项目 E', status: 'inactive', updatedAt: '2026-08-15' },
94
- ]
95
- </script>
96
-
97
- <template>
98
- <MConfigProvider :locale="zhCN">
99
- <MLayout has-sider fill-viewport>
100
- <MLayoutSider v-model:collapsed="siderCollapsed" bordered :collapsed-width="72">
101
- <MMenu
102
- :model="menuModel"
103
- :collapsed="siderCollapsed"
104
- :collapsed-width="72"
105
- selected-key="users"
106
- />
107
- </MLayoutSider>
108
-
109
- <MLayout>
110
- <MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
111
- <MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理' }]" />
112
- </MLayoutHeader>
113
-
114
- <MLayoutContent>
115
- <MPageContent>
116
- <MPageHeader title="用户管理" description="维护账号、角色与权限。">
117
- <template #actions>
118
- <MButton severity="primary">
119
- 新建用户
120
- </MButton>
121
- </template>
122
- </MPageHeader>
123
-
124
- <MPageFilters
125
- v-model:expanded="filtersExpanded"
126
- aria-label="筛选"
127
- variant="filled"
128
- collapsible
129
- >
130
- <MSpace wrap>
131
- <MInput v-model="keyword" placeholder="搜索名称" clearable style="width: 14rem" />
132
- <MSelect
133
- v-model="status"
134
- :options="statusOptions"
135
- placeholder="状态"
136
- clearable
137
- style="width: 10rem"
138
- />
139
- <MButton severity="secondary">
140
- 查询
141
- </MButton>
142
- <MButton severity="secondary" text @click="resetFilters">
143
- 重置
144
- </MButton>
145
- </MSpace>
146
- <template #advanced>
147
- <MSpace wrap>
148
- <MSelect
149
- v-model="department"
150
- :options="departmentOptions"
151
- placeholder="部门"
152
- clearable
153
- style="width: 10rem"
154
- />
155
- </MSpace>
156
- </template>
157
- </MPageFilters>
158
-
159
- <MPageFilterChips v-if="activeFilters.length" label="已选" aria-label="已选筛选">
160
- <MTag
161
- v-for="item in activeFilters"
162
- :key="item.key"
163
- :value="item.label"
164
- size="small"
165
- bordered
166
- closable
167
- @close="clearFilter(item.key)"
168
- />
169
- </MPageFilterChips>
170
-
171
- <MTable
172
- :columns="columns"
173
- :rows="rows"
174
- :rows-per-page="5"
175
- paginator
176
- striped
177
- bordered
178
- row-key="id"
179
- aria-label="用户列表"
180
- >
181
- <template #cell-status="{ value }">
182
- <MStatus
183
- :label="value === 'active' ? '启用' : '停用'"
184
- :severity="value === 'active' ? 'success' : 'secondary'"
185
- />
186
- </template>
187
- <template #cell-actions>
188
- <MSpace>
189
- <MButton severity="secondary" size="small" text>
190
- 编辑
191
- </MButton>
192
- <MButton severity="danger" size="small" text>
193
- 删除
194
- </MButton>
195
- </MSpace>
196
- </template>
197
- <template #empty>
198
- <MEmpty
199
- title="还没有用户"
200
- description="创建第一个用户后,即可分配角色与权限。"
201
- icon="user"
202
- >
203
- <template #extra>
204
- <MButton severity="primary">
205
- 新建用户
206
- </MButton>
207
- </template>
208
- </MEmpty>
209
- </template>
210
- </MTable>
211
- </MPageContent>
212
- </MLayoutContent>
213
- </MLayout>
214
- </MLayout>
215
- </MConfigProvider>
216
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * 黄金样例:列表页(结构母版 · style: soft)
4
+ * structure: list · style: soft
5
+ * 全视口主列表使用 fill;气质变体见 list-page-dense / list-page-rail。
6
+ * 镜像区块顺序;视觉跟 styleDirection / 参考走,不要把 soft 当唯一正确答案。
7
+ * @see DESIGN.md · page-layouts.md · style-presets.md · visual-craft § Ops polish
8
+ */
9
+ import {
10
+ MBreadcrumb,
11
+ MButton,
12
+ MConfigProvider,
13
+ MEmpty,
14
+ MInput,
15
+ MLayout,
16
+ MLayoutContent,
17
+ MLayoutHeader,
18
+ MLayoutSider,
19
+ MMenu,
20
+ MPageContent,
21
+ MPageFilterChips,
22
+ MPageFilters,
23
+ MPageHeader,
24
+ MSelect,
25
+ MSpace,
26
+ MStatus,
27
+ MTable,
28
+ MTag,
29
+ zhCN,
30
+ } from 'morya-ui'
31
+ import { computed, ref } from 'vue'
32
+
33
+ const keyword = ref('')
34
+ const status = ref<string | undefined>()
35
+ const department = ref<string | null>(null)
36
+ const filtersExpanded = ref(false)
37
+ const siderCollapsed = ref(false)
38
+
39
+ const menuModel = [
40
+ { key: 'users', label: '用户管理', icon: 'user', to: '/users' },
41
+ { key: 'roles', label: '角色管理', icon: 'shield', to: '/roles' },
42
+ { key: 'settings', label: '系统设置', icon: 'settings', to: '/settings' },
43
+ ]
44
+
45
+ const statusOptions = [
46
+ { label: '全部', value: '' },
47
+ { label: '启用', value: 'active' },
48
+ { label: '停用', value: 'inactive' },
49
+ ]
50
+
51
+ const departmentOptions = [
52
+ { label: '研发', value: '研发' },
53
+ { label: '运营', value: '运营' },
54
+ { label: '市场', value: '市场' },
55
+ ]
56
+
57
+ const activeFilters = computed(() => {
58
+ const items: Array<{ key: string; label: string }> = []
59
+ if (keyword.value.trim()) {
60
+ items.push({ key: 'keyword', label: `关键词:${keyword.value.trim()}` })
61
+ }
62
+ if (status.value) {
63
+ const label = statusOptions.find((o) => o.value === status.value)?.label ?? status.value
64
+ items.push({ key: 'status', label: `状态:${label}` })
65
+ }
66
+ if (department.value) {
67
+ items.push({ key: 'department', label: `部门:${department.value}` })
68
+ }
69
+ return items
70
+ })
71
+
72
+ function clearFilter(key: string) {
73
+ if (key === 'keyword') keyword.value = ''
74
+ if (key === 'status') status.value = undefined
75
+ if (key === 'department') department.value = null
76
+ }
77
+
78
+ function resetFilters() {
79
+ keyword.value = ''
80
+ status.value = undefined
81
+ department.value = null
82
+ }
83
+
84
+ const columns = [
85
+ { key: 'name', label: '名称' },
86
+ { key: 'status', label: '状态', width: 120 },
87
+ { key: 'updatedAt', label: '更新时间', width: 140 },
88
+ { key: 'actions', label: '操作', width: 148 },
89
+ ]
90
+
91
+ const rows = [
92
+ { id: '1', name: '示例项目 A', status: 'active', updatedAt: '2026-09-01' },
93
+ { id: '2', name: '示例项目 B', status: 'inactive', updatedAt: '2026-08-28' },
94
+ { id: '3', name: '示例项目 C', status: 'active', updatedAt: '2026-08-25' },
95
+ { id: '4', name: '示例项目 D', status: 'active', updatedAt: '2026-08-20' },
96
+ { id: '5', name: '示例项目 E', status: 'inactive', updatedAt: '2026-08-15' },
97
+ ]
98
+ </script>
99
+
100
+ <template>
101
+ <MConfigProvider :locale="zhCN">
102
+ <MLayout has-sider fill-viewport>
103
+ <MLayoutSider v-model:collapsed="siderCollapsed" bordered :collapsed-width="72">
104
+ <MMenu
105
+ :model="menuModel"
106
+ :collapsed="siderCollapsed"
107
+ :collapsed-width="72"
108
+ selected-key="users"
109
+ />
110
+ </MLayoutSider>
111
+
112
+ <MLayout>
113
+ <MLayoutHeader padding="var(--m-space-4) var(--m-space-6)">
114
+ <MBreadcrumb :model="[{ label: '首页', to: '/' }, { label: '用户管理' }]" />
115
+ </MLayoutHeader>
116
+
117
+ <MLayoutContent>
118
+ <MPageContent fill>
119
+ <MPageHeader title="用户管理" description="维护账号、角色与权限。">
120
+ <template #actions>
121
+ <MButton severity="primary">
122
+ 新建用户
123
+ </MButton>
124
+ </template>
125
+ </MPageHeader>
126
+
127
+ <MPageFilters
128
+ v-model:expanded="filtersExpanded"
129
+ aria-label="筛选"
130
+ variant="filled"
131
+ collapsible
132
+ >
133
+ <MSpace wrap>
134
+ <MInput v-model="keyword" placeholder="搜索名称" clearable style="width: 14rem" />
135
+ <MSelect
136
+ v-model="status"
137
+ :options="statusOptions"
138
+ placeholder="状态"
139
+ clearable
140
+ style="width: 10rem"
141
+ />
142
+ <MButton severity="secondary">
143
+ 查询
144
+ </MButton>
145
+ <MButton severity="secondary" text @click="resetFilters">
146
+ 重置
147
+ </MButton>
148
+ </MSpace>
149
+ <template #advanced>
150
+ <MSpace wrap>
151
+ <MSelect
152
+ v-model="department"
153
+ :options="departmentOptions"
154
+ placeholder="部门"
155
+ clearable
156
+ style="width: 10rem"
157
+ />
158
+ </MSpace>
159
+ </template>
160
+ </MPageFilters>
161
+
162
+ <MPageFilterChips v-if="activeFilters.length" label="已选" aria-label="已选筛选">
163
+ <MTag
164
+ v-for="item in activeFilters"
165
+ :key="item.key"
166
+ :value="item.label"
167
+ size="small"
168
+ bordered
169
+ closable
170
+ @close="clearFilter(item.key)"
171
+ />
172
+ </MPageFilterChips>
173
+
174
+ <MTable
175
+ :columns="columns"
176
+ :rows="rows"
177
+ :rows-per-page="5"
178
+ fill
179
+ paginator
180
+ striped
181
+ bordered
182
+ row-key="id"
183
+ aria-label="用户列表"
184
+ >
185
+ <template #cell-status="{ value }">
186
+ <MStatus
187
+ :label="value === 'active' ? '启用' : '停用'"
188
+ :severity="value === 'active' ? 'success' : 'secondary'"
189
+ />
190
+ </template>
191
+ <template #cell-actions>
192
+ <MSpace>
193
+ <MButton severity="secondary" size="small" text>
194
+ 编辑
195
+ </MButton>
196
+ <MButton severity="danger" size="small" text>
197
+ 删除
198
+ </MButton>
199
+ </MSpace>
200
+ </template>
201
+ <template #empty>
202
+ <MEmpty
203
+ title="还没有用户"
204
+ description="创建第一个用户后,即可分配角色与权限。"
205
+ icon="user"
206
+ >
207
+ <template #extra>
208
+ <MButton severity="primary">
209
+ 新建用户
210
+ </MButton>
211
+ </template>
212
+ </MEmpty>
213
+ </template>
214
+ </MTable>
215
+ </MPageContent>
216
+ </MLayoutContent>
217
+ </MLayout>
218
+ </MLayout>
219
+ </MConfigProvider>
220
+ </template>