@morya-ui/mcp 0.4.1 → 0.4.3
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.
- package/data/catalog.json +498 -486
- package/data/example-coverage.json +15 -16
- package/data/golden-pages/dashboard-page.vue +10 -10
- package/data/golden-pages/detail-page.vue +6 -6
- package/data/golden-pages/empty-state.vue +3 -3
- package/data/golden-pages/form-in-dialog.vue +5 -5
- package/data/golden-pages/form-page.vue +2 -2
- package/data/golden-pages/landing-page.vue +4 -4
- package/data/golden-pages/list-page-dense.vue +7 -7
- package/data/golden-pages/list-page-rail.vue +7 -7
- package/data/golden-pages/list-page.vue +7 -7
- package/data/golden-pages/login-page.vue +2 -2
- package/data/golden-pages/result-page.vue +2 -2
- package/data/golden-pages/settings-page.vue +6 -6
- package/data/golden-pages/wizard-form.vue +3 -18
- package/dist/__tests__/tools.test.js +3 -3
- package/dist/decisions.js +17 -14
- package/dist/page-snippets.js +58 -58
- package/dist/patterns.d.ts +5 -5
- package/dist/patterns.js +8 -8
- package/dist/reference-brief.js +3 -3
- package/dist/tools.js +27 -28
- package/package.json +1 -1
package/dist/decisions.js
CHANGED
|
@@ -46,7 +46,7 @@ export const componentDecisions = [
|
|
|
46
46
|
['v-model / modelValue 控制开关(不要用 visible)', 'v-model / modelValue for open state (not visible)'],
|
|
47
47
|
['header 或 title 设弹窗标题', 'header or title for the dialog title'],
|
|
48
48
|
['width 约 32rem 适配短表单(见 form-in-dialog snippet)', 'width ~32rem for short forms (see form-in-dialog snippet)'],
|
|
49
|
-
['表单字段用 fluid;主按钮
|
|
49
|
+
['表单字段用 fluid;主按钮 type="primary"', 'Form fields use fluid; primary button type="primary"'],
|
|
50
50
|
], [
|
|
51
51
|
['#footer 放取消/保存', '#footer for cancel / save'],
|
|
52
52
|
['默认插槽放 MForm + MFormItem', 'Default slot: MForm + MFormItem'],
|
|
@@ -97,7 +97,7 @@ export const componentDecisions = [
|
|
|
97
97
|
['字段 v-model + fluid;校验用 invalid / errorMessage', 'Fields v-model + fluid; validation via invalid / errorMessage'],
|
|
98
98
|
], [['默认插槽:MFormItem 字段', 'Default: MFormItem fields']], [
|
|
99
99
|
['MForm @submit(或 @submit.prevent)', 'MForm @submit (or @submit.prevent)'],
|
|
100
|
-
['提交按钮 type="submit" +
|
|
100
|
+
['提交按钮 html-type="submit" + type="primary"', 'Submit button html-type="submit" + type="primary"'],
|
|
101
101
|
]),
|
|
102
102
|
relatedSnippets: ['page-content-form', 'form-header', 'form-body', 'form-actions'],
|
|
103
103
|
...anti([
|
|
@@ -639,7 +639,7 @@ export const componentDecisions = [
|
|
|
639
639
|
avoidWhenEn: ['Form intro areas with long descriptions'],
|
|
640
640
|
recipe: recipe([
|
|
641
641
|
['左侧标题、右侧主按钮', 'Title left, primary action right'],
|
|
642
|
-
['主按钮
|
|
642
|
+
['主按钮 type="primary";全页仅一个主按钮', 'Primary button type="primary"; one primary per page'],
|
|
643
643
|
['批量操作条也可放工具栏区', 'Bulk action bars can sit in the toolbar area'],
|
|
644
644
|
], [['#actions 右侧操作', '#actions for right-side actions']]),
|
|
645
645
|
...anti([['需要长描述仍用 Toolbar → PageHeader', 'Long description but Toolbar → PageHeader']]),
|
|
@@ -681,7 +681,7 @@ export const componentDecisions = [
|
|
|
681
681
|
avoidWhenEn: ['Generic content grouping', 'Tables or forms'],
|
|
682
682
|
recipe: recipe([
|
|
683
683
|
['label + value', 'label + value'],
|
|
684
|
-
['trend /
|
|
684
|
+
['trend / trendType / trendDirection 按需', 'trend / trendType / trendDirection as needed'],
|
|
685
685
|
['loading 骨架;layout card|plain', 'loading skeleton; layout card|plain'],
|
|
686
686
|
]),
|
|
687
687
|
...anti([['普通段落用 PageStat → 文案或 Card', 'Paragraph as PageStat → copy or Card']]),
|
|
@@ -1018,7 +1018,7 @@ export const componentDecisions = [
|
|
|
1018
1018
|
avoidWhen: ['可关闭的分类标签', '挂在按钮上的数字'],
|
|
1019
1019
|
avoidWhenEn: ['A closable category label', 'A count attached to a button'],
|
|
1020
1020
|
recipe: recipe([
|
|
1021
|
-
['label +
|
|
1021
|
+
['label + type', 'label + type'],
|
|
1022
1022
|
['variant 默认 dot;可用 tag|text', 'variant default dot; or tag|text'],
|
|
1023
1023
|
['表格状态列优先 MStatus,不要一排实心 Tag', 'Prefer MStatus in table status columns over solid Tags'],
|
|
1024
1024
|
]),
|
|
@@ -1035,7 +1035,7 @@ export const componentDecisions = [
|
|
|
1035
1035
|
avoidWhenEn: ['A lightweight inline status', 'An entity with an image that can be removed'],
|
|
1036
1036
|
recipe: recipe([
|
|
1037
1037
|
['value 或默认插槽文案', 'value or default-slot copy'],
|
|
1038
|
-
['
|
|
1038
|
+
['type;closable + @close', 'type; closable + @close'],
|
|
1039
1039
|
['rounded / bordered 按需', 'rounded / bordered as needed'],
|
|
1040
1040
|
], undefined, [['@close', '@close']]),
|
|
1041
1041
|
...anti([['行内启用/停用状态用 Tag → Status', 'Enabled/disabled inline via Tag → Status']]),
|
|
@@ -1049,7 +1049,7 @@ export const componentDecisions = [
|
|
|
1049
1049
|
recipe: recipe([
|
|
1050
1050
|
['label;icon 或 image', 'label; icon or image'],
|
|
1051
1051
|
['removable + @remove', 'removable + @remove'],
|
|
1052
|
-
['
|
|
1052
|
+
['type 按需', 'type as needed'],
|
|
1053
1053
|
], undefined, [['@remove', '@remove']]),
|
|
1054
1054
|
...anti([['纯状态点用 Chip → Status', 'Status dot via Chip → Status']]),
|
|
1055
1055
|
},
|
|
@@ -1061,10 +1061,13 @@ export const componentDecisions = [
|
|
|
1061
1061
|
avoidWhenEn: ['A standalone status sentence'],
|
|
1062
1062
|
recipe: recipe([
|
|
1063
1063
|
['value 数量;省略则圆点', 'value count; omit for dot'],
|
|
1064
|
-
['
|
|
1064
|
+
['type;max 封顶', 'type; max cap'],
|
|
1065
1065
|
['默认插槽包裹宿主控件', 'Default slot wraps the host control'],
|
|
1066
1066
|
], [['默认插槽:被角标包裹的控件', 'Default slot: host control']]),
|
|
1067
|
-
...anti([
|
|
1067
|
+
...anti([
|
|
1068
|
+
['独立状态文案用 Badge → Status / Tag', 'Standalone status sentence via Badge → Status / Tag'],
|
|
1069
|
+
['MButton badge / badgeColor → 用 MBadge 包裹按钮', 'MButton badge / badgeColor → wrap the button with MBadge'],
|
|
1070
|
+
]),
|
|
1068
1071
|
},
|
|
1069
1072
|
],
|
|
1070
1073
|
},
|
|
@@ -1167,7 +1170,7 @@ export const componentDecisions = [
|
|
|
1167
1170
|
recipe: recipe([
|
|
1168
1171
|
[':model / items 操作项', ':model / items for actions'],
|
|
1169
1172
|
['触发器放默认插槽(按钮/图标)', 'Trigger in default slot (button/icon)'],
|
|
1170
|
-
['
|
|
1173
|
+
['危险项走确认流(ConfirmDialog)', 'Danger items: confirm flow (ConfirmDialog)'],
|
|
1171
1174
|
]),
|
|
1172
1175
|
relatedSnippets: ['row-actions-menu', 'list-row-actions'],
|
|
1173
1176
|
...anti([['表单枚举用 Dropdown → Select', 'Form enum via Dropdown → Select']]),
|
|
@@ -1262,7 +1265,7 @@ export const componentDecisions = [
|
|
|
1262
1265
|
relatedSnippets: ['confirm-delete', 'form-in-dialog'],
|
|
1263
1266
|
...anti([
|
|
1264
1267
|
["toast.add({ summary: '已保存' }) → message.success('已保存')", "toast.add({ summary: 'Saved' }) → message.success('Saved')"],
|
|
1265
|
-
['<MMessage
|
|
1268
|
+
['<MMessage type> 当内嵌 Alert → errorMessage / role="alert"', '<MMessage type> as inline Alert → errorMessage / role="alert"'],
|
|
1266
1269
|
]),
|
|
1267
1270
|
},
|
|
1268
1271
|
{
|
|
@@ -1295,7 +1298,7 @@ export const componentDecisions = [
|
|
|
1295
1298
|
relatedSnippets: ['auth-split-shell'],
|
|
1296
1299
|
...anti([
|
|
1297
1300
|
['登录失败只闪 Toast → 表单区 alert / errorMessage', 'Login failure only via Toast → form alert / errorMessage'],
|
|
1298
|
-
['编造 MMessage
|
|
1301
|
+
['编造 MMessage type / 插槽 Alert API', 'Invented MMessage type / slot Alert API'],
|
|
1299
1302
|
]),
|
|
1300
1303
|
},
|
|
1301
1304
|
],
|
|
@@ -1332,7 +1335,7 @@ export const componentDecisions = [
|
|
|
1332
1335
|
['v-model / modelValue', 'v-model / modelValue'],
|
|
1333
1336
|
['header + message', 'header + message'],
|
|
1334
1337
|
['acceptLabel / rejectLabel', 'acceptLabel / rejectLabel'],
|
|
1335
|
-
['
|
|
1338
|
+
['acceptColor="danger" 用于删除', 'acceptColor="danger" for delete'],
|
|
1336
1339
|
], undefined, [
|
|
1337
1340
|
['@accept 执行删除', '@accept to perform delete'],
|
|
1338
1341
|
['@reject 关闭', '@reject to dismiss'],
|
|
@@ -1357,7 +1360,7 @@ export const componentDecisions = [
|
|
|
1357
1360
|
],
|
|
1358
1361
|
recipe: recipe([
|
|
1359
1362
|
['v-model / modelValue', 'v-model / modelValue'],
|
|
1360
|
-
['message;
|
|
1363
|
+
['message;acceptColor="danger" 按需', 'message; acceptColor="danger" as needed'],
|
|
1361
1364
|
['target 锚定触发元素(或 position)', 'target anchors the trigger (or position)'],
|
|
1362
1365
|
['placement top|bottom|left|right', 'placement top|bottom|left|right'],
|
|
1363
1366
|
], undefined, [['@accept / @reject', '@accept / @reject']]),
|
package/dist/page-snippets.js
CHANGED
|
@@ -32,8 +32,8 @@ function resetFilters() {
|
|
|
32
32
|
/>
|
|
33
33
|
</MSpace>
|
|
34
34
|
<template #actions>
|
|
35
|
-
<MButton
|
|
36
|
-
<MButton
|
|
35
|
+
<MButton>查询</MButton>
|
|
36
|
+
<MButton type="text" @click="resetFilters">重置</MButton>
|
|
37
37
|
</template>
|
|
38
38
|
</MPageFilters>`,
|
|
39
39
|
rules: [
|
|
@@ -105,8 +105,8 @@ function resetFilters() {
|
|
|
105
105
|
/>
|
|
106
106
|
</MSpace>
|
|
107
107
|
<template #actions>
|
|
108
|
-
<MButton
|
|
109
|
-
<MButton
|
|
108
|
+
<MButton>查询</MButton>
|
|
109
|
+
<MButton type="text" @click="resetFilters">重置</MButton>
|
|
110
110
|
</template>
|
|
111
111
|
<template #advanced>
|
|
112
112
|
<MSpace wrap>
|
|
@@ -300,8 +300,8 @@ function resetFilters() {
|
|
|
300
300
|
/>
|
|
301
301
|
</MSpace>
|
|
302
302
|
<template #actions>
|
|
303
|
-
<MButton
|
|
304
|
-
<MButton
|
|
303
|
+
<MButton>查询</MButton>
|
|
304
|
+
<MButton type="text" @click="resetFilters">重置</MButton>
|
|
305
305
|
</template>
|
|
306
306
|
<template #advanced>
|
|
307
307
|
<MSpace wrap>
|
|
@@ -390,8 +390,8 @@ function resetFilters() {
|
|
|
390
390
|
/>
|
|
391
391
|
</MSpace>
|
|
392
392
|
<template #actions>
|
|
393
|
-
<MButton
|
|
394
|
-
<MButton
|
|
393
|
+
<MButton size="small">查询</MButton>
|
|
394
|
+
<MButton size="small" type="text" @click="resetFilters">重置</MButton>
|
|
395
395
|
</template>
|
|
396
396
|
</MPageFilters>`,
|
|
397
397
|
rules: [
|
|
@@ -424,7 +424,7 @@ function resetFilters() {
|
|
|
424
424
|
imports: ['MPageHeader', 'MButton'],
|
|
425
425
|
template: `<MPageHeader title="用户管理" description="维护账号、角色与权限。">
|
|
426
426
|
<template #actions>
|
|
427
|
-
<MButton
|
|
427
|
+
<MButton type="primary">新建用户</MButton>
|
|
428
428
|
</template>
|
|
429
429
|
</MPageHeader>`,
|
|
430
430
|
rules: ['页级标题用 MPageHeader,不要用 MPageToolbar 当第二页头', '主操作放 #actions'],
|
|
@@ -444,12 +444,12 @@ function resetFilters() {
|
|
|
444
444
|
template: `<MPageToolbar>
|
|
445
445
|
<span style="color:var(--m-color-text-muted);font-size:var(--m-font-size-sm)">已选 0 项</span>
|
|
446
446
|
<template #actions>
|
|
447
|
-
<MButton
|
|
448
|
-
<MButton
|
|
447
|
+
<MButton type="text">导出</MButton>
|
|
448
|
+
<MButton danger type="text">删除</MButton>
|
|
449
449
|
</template>
|
|
450
450
|
</MPageToolbar>`,
|
|
451
|
-
rules: ['左侧用 default 插槽展示已选数量', '批量操作用 text/outlined,danger 仅 destructive', '放在 FilterChips 之后、表格之前'],
|
|
452
|
-
rulesEn: ['Use the default slot for selection count', 'Batch actions use text/outlined; danger only for destructive ops', 'Place after FilterChips and before the table'],
|
|
451
|
+
rules: ['左侧用 default 插槽展示已选数量', '批量操作用 type="text" / variant="outlined",danger 仅 destructive', '放在 FilterChips 之后、表格之前'],
|
|
452
|
+
rulesEn: ['Use the default slot for selection count', 'Batch actions use type="text" / variant="outlined"; danger only for destructive ops', 'Place after FilterChips and before the table'],
|
|
453
453
|
avoid: ['不要用 Toolbar title 充当页面标题'],
|
|
454
454
|
avoidEn: ['Do not use Toolbar title as the page heading'],
|
|
455
455
|
},
|
|
@@ -500,7 +500,7 @@ const loading = ref(false)`,
|
|
|
500
500
|
<template #cell-status="{ value }">
|
|
501
501
|
<MStatus
|
|
502
502
|
:label="value === 'active' || value === 'online' ? '启用' : '停用'"
|
|
503
|
-
:
|
|
503
|
+
:type="value === 'active' || value === 'online' ? 'success' : 'secondary'"
|
|
504
504
|
/>
|
|
505
505
|
</template>
|
|
506
506
|
<template #cell-count="{ value }">
|
|
@@ -508,8 +508,8 @@ const loading = ref(false)`,
|
|
|
508
508
|
</template>
|
|
509
509
|
<template #cell-actions>
|
|
510
510
|
<MSpace>
|
|
511
|
-
<MButton
|
|
512
|
-
<MButton
|
|
511
|
+
<MButton size="small" type="text">编辑</MButton>
|
|
512
|
+
<MButton danger size="small" type="text">删除</MButton>
|
|
513
513
|
</MSpace>
|
|
514
514
|
</template>
|
|
515
515
|
<template #empty>
|
|
@@ -519,7 +519,7 @@ const loading = ref(false)`,
|
|
|
519
519
|
icon="inbox"
|
|
520
520
|
>
|
|
521
521
|
<template #extra>
|
|
522
|
-
<MButton
|
|
522
|
+
<MButton type="primary">新建成员</MButton>
|
|
523
523
|
</template>
|
|
524
524
|
</MEmpty>
|
|
525
525
|
</template>
|
|
@@ -562,12 +562,12 @@ const loading = ref(false)`,
|
|
|
562
562
|
imports: ['MSpace', 'MButton'],
|
|
563
563
|
template: `<template #cell-actions>
|
|
564
564
|
<MSpace>
|
|
565
|
-
<MButton
|
|
566
|
-
<MButton
|
|
565
|
+
<MButton size="small" type="text">编辑</MButton>
|
|
566
|
+
<MButton danger size="small" type="text">删除</MButton>
|
|
567
567
|
</MSpace>
|
|
568
568
|
</template>`,
|
|
569
|
-
rules: ['行内操作用 size="small" + text/outlined,避免一排实心按钮', '危险操作使用
|
|
570
|
-
rulesEn: ['Use size="small" with text/outlined row actions', 'Use
|
|
569
|
+
rules: ['行内操作用 size="small" + type="text" / variant="outlined",避免一排实心按钮', '危险操作使用 danger 并配合确认弹窗'],
|
|
570
|
+
rulesEn: ['Use size="small" with type="text" / variant="outlined" row actions', 'Use danger with confirmation for destructive actions'],
|
|
571
571
|
avoid: ['不要用 Dropdown 代替明确的行内按钮组,除非操作很多'],
|
|
572
572
|
avoidEn: ['Do not replace explicit row buttons with Dropdown unless there are many actions'],
|
|
573
573
|
},
|
|
@@ -583,7 +583,7 @@ const loading = ref(false)`,
|
|
|
583
583
|
template: `<template #cell-category="{ value }">
|
|
584
584
|
<MTag
|
|
585
585
|
:value="String(value ?? '')"
|
|
586
|
-
|
|
586
|
+
type="info"
|
|
587
587
|
/>
|
|
588
588
|
</template>`,
|
|
589
589
|
rules: ['分类/强调态用 MTag;行内业务状态用 MStatus(list-status-dot)', '不要用 Button 颜色表达状态'],
|
|
@@ -603,7 +603,7 @@ const loading = ref(false)`,
|
|
|
603
603
|
template: `<template #cell-status="{ value }">
|
|
604
604
|
<MStatus
|
|
605
605
|
:label="value === 'active' || value === 'online' ? '启用' : '停用'"
|
|
606
|
-
:
|
|
606
|
+
:type="value === 'active' || value === 'online' ? 'success' : 'secondary'"
|
|
607
607
|
/>
|
|
608
608
|
</template>`,
|
|
609
609
|
rules: ['行内轻量业务状态优先 MStatus', '不要用 Button 颜色表达状态'],
|
|
@@ -626,20 +626,20 @@ const loading = ref(false)`,
|
|
|
626
626
|
illustration="no-content"
|
|
627
627
|
>
|
|
628
628
|
<template #extra>
|
|
629
|
-
<MButton
|
|
630
|
-
<MButton
|
|
629
|
+
<MButton type="primary">新建成员</MButton>
|
|
630
|
+
<MButton type="text">导入名单</MButton>
|
|
631
631
|
</template>
|
|
632
632
|
</MEmpty>`,
|
|
633
633
|
rules: [
|
|
634
634
|
'正常无数据用 MEmpty,不要用错误色',
|
|
635
635
|
'主区域空态优先 illustration(no-content / no-result / no-message / network-error…);轻量内嵌可用 icon',
|
|
636
|
-
'主 CTA 用
|
|
636
|
+
'主 CTA 用 type="primary",次动作用 type="text"',
|
|
637
637
|
'文案写清「现在可以做什么」,禁止「暂无数据 / No data / 示例」',
|
|
638
638
|
],
|
|
639
639
|
rulesEn: [
|
|
640
640
|
'Use MEmpty for normal emptiness, not error colors',
|
|
641
641
|
'Main-region empties prefer illustration; light in-table empties may use icon',
|
|
642
|
-
'Primary CTA with
|
|
642
|
+
'Primary CTA with type="primary"; lesser actions type="text"',
|
|
643
643
|
'Copy says what to do next — no “暂无数据 / No data / 示例”',
|
|
644
644
|
],
|
|
645
645
|
avoid: ['不要用手写 div 拼空态', '不要用 MResult 表达无数据', '不要放两个 filled primary'],
|
|
@@ -657,7 +657,7 @@ const loading = ref(false)`,
|
|
|
657
657
|
template: `<MResult status="success" description="订单已创建,可在列表中查看详情。">
|
|
658
658
|
<template #extra>
|
|
659
659
|
<MButton label="查看订单" />
|
|
660
|
-
<MButton label="返回列表"
|
|
660
|
+
<MButton label="返回列表" type="text" />
|
|
661
661
|
</template>
|
|
662
662
|
</MResult>`,
|
|
663
663
|
rules: ['流程终点用 MResult', '提供明确下一步操作'],
|
|
@@ -742,8 +742,8 @@ const roleOptions = [
|
|
|
742
742
|
imports: ['MPageSection', 'MSpace', 'MButton'],
|
|
743
743
|
template: `<MPageSection variant="actions">
|
|
744
744
|
<MSpace>
|
|
745
|
-
<MButton
|
|
746
|
-
<MButton
|
|
745
|
+
<MButton html-type="submit" type="primary" :loading="submitting">保存</MButton>
|
|
746
|
+
<MButton>取消</MButton>
|
|
747
747
|
</MSpace>
|
|
748
748
|
</MPageSection>`,
|
|
749
749
|
rules: ['提交按钮在前,取消 secondary', '保存中传 loading 防重复提交'],
|
|
@@ -755,8 +755,8 @@ const roleOptions = [
|
|
|
755
755
|
id: 'dashboard-kpi-grid',
|
|
756
756
|
title: '仪表盘 KPI 栅格',
|
|
757
757
|
titleEn: 'Dashboard KPI grid',
|
|
758
|
-
description: 'MGrid + MPageStat:带 trend / trendDirection /
|
|
759
|
-
descriptionEn: 'MGrid + MPageStat with trend / trendDirection /
|
|
758
|
+
description: 'MGrid + MPageStat:带 trend / trendDirection / trendType;高密条可用 density="compact"。',
|
|
759
|
+
descriptionEn: 'MGrid + MPageStat with trend / trendDirection / trendType; use density="compact" for dense strips.',
|
|
760
760
|
pageTypes: ['dashboard'],
|
|
761
761
|
keywords: ['kpi', '指标', 'stat', 'grid', 'metrics', 'trend', 'compact'],
|
|
762
762
|
imports: ['MGrid', 'MGridItem', 'MPageStat'],
|
|
@@ -766,7 +766,7 @@ const roleOptions = [
|
|
|
766
766
|
value: '12,480',
|
|
767
767
|
trend: '+8.2%',
|
|
768
768
|
trendDirection: 'up' as const,
|
|
769
|
-
|
|
769
|
+
trendType: 'success' as const,
|
|
770
770
|
trendLabel: '较上月',
|
|
771
771
|
icon: 'users',
|
|
772
772
|
},
|
|
@@ -775,7 +775,7 @@ const roleOptions = [
|
|
|
775
775
|
value: '1,926',
|
|
776
776
|
trend: '-3.1%',
|
|
777
777
|
trendDirection: 'down' as const,
|
|
778
|
-
|
|
778
|
+
trendType: 'warning' as const,
|
|
779
779
|
trendLabel: '较昨日',
|
|
780
780
|
icon: 'activity',
|
|
781
781
|
},
|
|
@@ -787,7 +787,7 @@ const roleOptions = [
|
|
|
787
787
|
:value="metric.value"
|
|
788
788
|
:trend="metric.trend"
|
|
789
789
|
:trend-direction="metric.trendDirection"
|
|
790
|
-
:trend-
|
|
790
|
+
:trend-type="metric.trendType"
|
|
791
791
|
:trend-label="metric.trendLabel"
|
|
792
792
|
:icon="metric.icon"
|
|
793
793
|
/>
|
|
@@ -796,13 +796,13 @@ const roleOptions = [
|
|
|
796
796
|
<!-- 高密条带示例:density="compact" layout="plain" orientation="inline" -->`,
|
|
797
797
|
rules: [
|
|
798
798
|
'KPI 用 MPageStat,不要每页自定义 stat CSS',
|
|
799
|
-
'趋势务必带 trendDirection +
|
|
799
|
+
'趋势务必带 trendDirection + trendType(升 success / 降 warning|danger)',
|
|
800
800
|
'responsive="screen" 便于窄屏降列',
|
|
801
801
|
'密集工作台可用 density="compact";加载中用 loading',
|
|
802
802
|
],
|
|
803
803
|
rulesEn: [
|
|
804
804
|
'Use MPageStat for KPIs — no per-page stat CSS',
|
|
805
|
-
'Always set trendDirection +
|
|
805
|
+
'Always set trendDirection + trendType (up→success, down→warning|danger)',
|
|
806
806
|
'Use responsive="screen" for narrow layouts',
|
|
807
807
|
'Dense dashboards may use density="compact"; use loading while fetching',
|
|
808
808
|
],
|
|
@@ -855,7 +855,7 @@ const recentRows = ref<Record<string, unknown>[]>([])`,
|
|
|
855
855
|
template: `<MCard title="最近工单">
|
|
856
856
|
<MTable :columns="recentColumns" :rows="recentRows" size="small" :paginator="false" bordered row-key="id">
|
|
857
857
|
<template #cell-status="{ value }">
|
|
858
|
-
<MStatus :label="String(value ?? '')"
|
|
858
|
+
<MStatus :label="String(value ?? '')" default / type="text" />
|
|
859
859
|
</template>
|
|
860
860
|
</MTable>
|
|
861
861
|
</MCard>`,
|
|
@@ -914,9 +914,9 @@ const recentRows = ref<Record<string, unknown>[]>([])`,
|
|
|
914
914
|
template: `<MPageHeader title="林晓" description="查看账号摘要、属性与近期活动。">
|
|
915
915
|
<template #actions>
|
|
916
916
|
<MSpace>
|
|
917
|
-
<MStatus label="启用"
|
|
918
|
-
<MButton
|
|
919
|
-
<MButton
|
|
917
|
+
<MStatus label="启用" type="success" />
|
|
918
|
+
<MButton type="primary">编辑</MButton>
|
|
919
|
+
<MButton danger type="text">删除</MButton>
|
|
920
920
|
</MSpace>
|
|
921
921
|
</template>
|
|
922
922
|
</MPageHeader>`,
|
|
@@ -941,7 +941,7 @@ const recentRows = ref<Record<string, unknown>[]>([])`,
|
|
|
941
941
|
<MDescriptionsItem label="部门">产品设计</MDescriptionsItem>
|
|
942
942
|
<MDescriptionsItem label="入职日期">2025-03-12</MDescriptionsItem>
|
|
943
943
|
<MDescriptionsItem label="状态">
|
|
944
|
-
<MStatus label="启用"
|
|
944
|
+
<MStatus label="启用" type="success" />
|
|
945
945
|
</MDescriptionsItem>
|
|
946
946
|
</MDescriptions>`,
|
|
947
947
|
rules: [
|
|
@@ -969,8 +969,8 @@ const recentRows = ref<Record<string, unknown>[]>([])`,
|
|
|
969
969
|
template: `<MPageHeader title="用户管理" description="管理成员与角色。">
|
|
970
970
|
<template #actions>
|
|
971
971
|
<MSpace>
|
|
972
|
-
<MButton
|
|
973
|
-
<MButton
|
|
972
|
+
<MButton type="text">导入</MButton>
|
|
973
|
+
<MButton type="primary">新建用户</MButton>
|
|
974
974
|
</MSpace>
|
|
975
975
|
</template>
|
|
976
976
|
</MPageHeader>`,
|
|
@@ -1044,10 +1044,10 @@ async function onSave() {
|
|
|
1044
1044
|
</MForm>
|
|
1045
1045
|
<template #footer>
|
|
1046
1046
|
<MSpace style="justify-content: flex-end; width: 100%">
|
|
1047
|
-
<MButton
|
|
1047
|
+
<MButton type="text" :disabled="submitting" @click="dialogOpen = false">
|
|
1048
1048
|
取消
|
|
1049
1049
|
</MButton>
|
|
1050
|
-
<MButton
|
|
1050
|
+
<MButton type="primary" :loading="submitting" @click="onSave">
|
|
1051
1051
|
保存
|
|
1052
1052
|
</MButton>
|
|
1053
1053
|
</MSpace>
|
|
@@ -1113,10 +1113,10 @@ async function onSave() {
|
|
|
1113
1113
|
</MForm>
|
|
1114
1114
|
<template #footer>
|
|
1115
1115
|
<MSpace style="justify-content: flex-end; width: 100%">
|
|
1116
|
-
<MButton
|
|
1116
|
+
<MButton type="text" :disabled="submitting" @click="drawerOpen = false">
|
|
1117
1117
|
取消
|
|
1118
1118
|
</MButton>
|
|
1119
|
-
<MButton
|
|
1119
|
+
<MButton type="primary" :loading="submitting" @click="onSave">
|
|
1120
1120
|
保存
|
|
1121
1121
|
</MButton>
|
|
1122
1122
|
</MSpace>
|
|
@@ -1156,11 +1156,11 @@ function onAcceptDelete() {
|
|
|
1156
1156
|
message="删除后不可恢复,确定继续?"
|
|
1157
1157
|
accept-label="删除"
|
|
1158
1158
|
reject-label="取消"
|
|
1159
|
-
accept-
|
|
1159
|
+
accept-danger
|
|
1160
1160
|
@accept="onAcceptDelete"
|
|
1161
1161
|
/>`,
|
|
1162
|
-
rules: ['用 MConfirmDialog,不要手写 Dialog 确定/取消', '
|
|
1163
|
-
rulesEn: ['Use MConfirmDialog; do not hand-roll Dialog Yes/No', '
|
|
1162
|
+
rules: ['用 MConfirmDialog,不要手写 Dialog 确定/取消', 'acceptColor="danger"', '成功用 message.success,不要 toast'],
|
|
1163
|
+
rulesEn: ['Use MConfirmDialog; do not hand-roll Dialog Yes/No', 'acceptColor="danger"', 'Success via message.success, not toast'],
|
|
1164
1164
|
avoid: ['普通 Dialog 冒充删除确认', '编辑表单误用 ConfirmDialog'],
|
|
1165
1165
|
avoidEn: ['Faking delete confirm with Dialog', 'Using ConfirmDialog for edit forms'],
|
|
1166
1166
|
},
|
|
@@ -1176,11 +1176,11 @@ function onAcceptDelete() {
|
|
|
1176
1176
|
scriptSetup: `const rowMenu = [
|
|
1177
1177
|
{ label: '编辑', command: () => {/* open edit */} },
|
|
1178
1178
|
{ label: '复制', command: () => {/* duplicate */} },
|
|
1179
|
-
{ label: '删除',
|
|
1179
|
+
{ label: '删除', command: () => {/* askDelete */} },
|
|
1180
1180
|
]`,
|
|
1181
1181
|
template: `<template #cell-actions>
|
|
1182
1182
|
<MDropdown :model="rowMenu">
|
|
1183
|
-
<MButton
|
|
1183
|
+
<MButton size="small" type="text" icon="more-horizontal" aria-label="更多操作" />
|
|
1184
1184
|
</MDropdown>
|
|
1185
1185
|
</template>`,
|
|
1186
1186
|
rules: ['操作很多时再用 Dropdown;2–3 个明确操作用 text 按钮', '危险项走 confirm-delete', '图标按钮必须 aria-label'],
|
|
@@ -1232,9 +1232,9 @@ async function finish() {
|
|
|
1232
1232
|
</MPageSection>
|
|
1233
1233
|
<MPageSection variant="actions">
|
|
1234
1234
|
<MSpace>
|
|
1235
|
-
<MButton
|
|
1236
|
-
<MButton v-if="activeStep < steps.length - 1"
|
|
1237
|
-
<MButton v-else
|
|
1235
|
+
<MButton type="text" :disabled="activeStep === 0" @click="back">上一步</MButton>
|
|
1236
|
+
<MButton v-if="activeStep < steps.length - 1" type="primary" @click="next">下一步</MButton>
|
|
1237
|
+
<MButton v-else type="primary" :loading="submitting" @click="finish">创建</MButton>
|
|
1238
1238
|
</MSpace>
|
|
1239
1239
|
</MPageSection>`,
|
|
1240
1240
|
rules: ['用 :steps(不是 :items)', '每步一个主任务;进入下一步前校验当前步', '完成文案与「下一步」区分'],
|
|
@@ -1289,8 +1289,8 @@ async function onSubmit() {
|
|
|
1289
1289
|
<MInputPassword v-model="model.password" autocomplete="current-password" fluid />
|
|
1290
1290
|
</MFormItem>
|
|
1291
1291
|
<MSpace style="margin-top: var(--m-space-2)" alignment="center">
|
|
1292
|
-
<MButton type="submit" label="登录"
|
|
1293
|
-
<MButton type="button" label="忘记密码"
|
|
1292
|
+
<MButton html-type="submit" label="登录" type="primary" :loading="submitting" />
|
|
1293
|
+
<MButton html-type="button" label="忘记密码" type="text" />
|
|
1294
1294
|
</MSpace>
|
|
1295
1295
|
</MForm>
|
|
1296
1296
|
</div>
|
package/dist/patterns.d.ts
CHANGED
|
@@ -75,20 +75,20 @@ export declare const designRules: {
|
|
|
75
75
|
readonly actions: {
|
|
76
76
|
readonly primary: {
|
|
77
77
|
readonly component: "MButton";
|
|
78
|
-
readonly props: readonly ["
|
|
78
|
+
readonly props: readonly ["type=\"primary\""];
|
|
79
79
|
};
|
|
80
80
|
readonly secondary: {
|
|
81
81
|
readonly component: "MButton";
|
|
82
|
-
readonly props: readonly ["
|
|
82
|
+
readonly props: readonly ["default", "type=\"text\" or variant=\"outlined\""];
|
|
83
83
|
};
|
|
84
84
|
readonly destructive: {
|
|
85
85
|
readonly component: "MButton";
|
|
86
|
-
readonly props: readonly ["
|
|
86
|
+
readonly props: readonly ["danger"];
|
|
87
87
|
readonly requiresConfirmation: true;
|
|
88
88
|
};
|
|
89
89
|
readonly cancel: {
|
|
90
90
|
readonly component: "MButton";
|
|
91
|
-
readonly props: readonly ["
|
|
91
|
+
readonly props: readonly ["type=\"text\""];
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
readonly status: {
|
|
@@ -128,7 +128,7 @@ export declare const designRules: {
|
|
|
128
128
|
};
|
|
129
129
|
readonly inlineMessage: {
|
|
130
130
|
readonly api: "field errorMessage | token-styled role=alert";
|
|
131
|
-
readonly when: readonly ["登录/表单区常驻错误:优先字段 errorMessage", "表单级总结:使用 --m-* 样式的 role=alert 条(见 login-page 黄金样例)", "MMessage 组件当前主要为 message 服务宿主,勿臆造
|
|
131
|
+
readonly when: readonly ["登录/表单区常驻错误:优先字段 errorMessage", "表单级总结:使用 --m-* 样式的 role=alert 条(见 login-page 黄金样例)", "MMessage 组件当前主要为 message 服务宿主,勿臆造 type / 子节点 Alert API"];
|
|
132
132
|
};
|
|
133
133
|
readonly doc: "design-kit/.agents/skills/morya-ui-pages/references/feedback.md";
|
|
134
134
|
};
|
package/dist/patterns.js
CHANGED
|
@@ -76,9 +76,9 @@ export const pagePatterns = [
|
|
|
76
76
|
},
|
|
77
77
|
styleRules: [
|
|
78
78
|
'新增、保存等主操作使用 primary MButton',
|
|
79
|
-
'
|
|
79
|
+
'查询等次要操作使用默认或 variant="outlined" MButton',
|
|
80
80
|
'删除使用 danger MButton,并配合 MConfirmDialog',
|
|
81
|
-
'业务状态优先使用 MStatus(圆点+文案)或 MTag(分类标签),不使用 Button
|
|
81
|
+
'业务状态优先使用 MStatus(圆点+文案)或 MTag(分类标签),不使用 Button color 表达状态',
|
|
82
82
|
'间距、颜色、圆角优先使用 --m-* 设计令牌,不直接硬编码色板',
|
|
83
83
|
],
|
|
84
84
|
interactionRules: [
|
|
@@ -468,7 +468,7 @@ export const pagePatterns = [
|
|
|
468
468
|
styleRules: [
|
|
469
469
|
'轻量状态优先 MStatus;需要芯片感或可关闭时用 MTag',
|
|
470
470
|
'属性网格用 MDescriptions,不要手写 dl',
|
|
471
|
-
'编辑使用 primary 或 outlined
|
|
471
|
+
'编辑使用 type="primary" 或 variant="outlined",删除使用 danger',
|
|
472
472
|
'不使用大面积自定义背景色覆盖组件库 surface Token',
|
|
473
473
|
],
|
|
474
474
|
interactionRules: [
|
|
@@ -762,10 +762,10 @@ export const designRules = {
|
|
|
762
762
|
],
|
|
763
763
|
},
|
|
764
764
|
actions: {
|
|
765
|
-
primary: { component: 'MButton', props: ['
|
|
766
|
-
secondary: { component: 'MButton', props: ['
|
|
767
|
-
destructive: { component: 'MButton', props: ['
|
|
768
|
-
cancel: { component: 'MButton', props: ['
|
|
765
|
+
primary: { component: 'MButton', props: ['type="primary"'] },
|
|
766
|
+
secondary: { component: 'MButton', props: ['default', 'type="text" or variant="outlined"'] },
|
|
767
|
+
destructive: { component: 'MButton', props: ['danger'], requiresConfirmation: true },
|
|
768
|
+
cancel: { component: 'MButton', props: ['type="text"'] },
|
|
769
769
|
},
|
|
770
770
|
status: {
|
|
771
771
|
preferred: 'MStatus',
|
|
@@ -802,7 +802,7 @@ export const designRules = {
|
|
|
802
802
|
when: [
|
|
803
803
|
'登录/表单区常驻错误:优先字段 errorMessage',
|
|
804
804
|
'表单级总结:使用 --m-* 样式的 role=alert 条(见 login-page 黄金样例)',
|
|
805
|
-
'MMessage 组件当前主要为 message 服务宿主,勿臆造
|
|
805
|
+
'MMessage 组件当前主要为 message 服务宿主,勿臆造 type / 子节点 Alert API',
|
|
806
806
|
],
|
|
807
807
|
},
|
|
808
808
|
doc: 'design-kit/.agents/skills/morya-ui-pages/references/feedback.md',
|
package/dist/reference-brief.js
CHANGED
|
@@ -89,8 +89,8 @@ const BLOCK_TO_SNIPPET = {
|
|
|
89
89
|
},
|
|
90
90
|
kpi: {
|
|
91
91
|
snippetId: 'dashboard-kpi-grid',
|
|
92
|
-
notesZh: 'MPageStat 带 trend / trendDirection /
|
|
93
|
-
notesEn: 'MPageStat with trend / trendDirection /
|
|
92
|
+
notesZh: 'MPageStat 带 trend / trendDirection / trendType',
|
|
93
|
+
notesEn: 'MPageStat with trend / trendDirection / trendType',
|
|
94
94
|
},
|
|
95
95
|
chart: {
|
|
96
96
|
snippetId: 'dashboard-chart-card',
|
|
@@ -437,7 +437,7 @@ export function codeCoversBlock(code, block) {
|
|
|
437
437
|
case 'form-body':
|
|
438
438
|
return /<MForm\b/i.test(c);
|
|
439
439
|
case 'form-actions':
|
|
440
|
-
return /native-type=["']submit["']|type=["']submit["']|<MPageSection\b[^>]*variant=["']actions["']/i.test(c);
|
|
440
|
+
return /html-type=["']submit["']|native-type=["']submit["']|type=["']submit["']|<MPageSection\b[^>]*variant=["']actions["']/i.test(c);
|
|
441
441
|
case 'kpi':
|
|
442
442
|
return /<MPageStat\b/i.test(c);
|
|
443
443
|
case 'chart':
|