feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s

This commit is contained in:
aurora-admin
2026-09-12 14:18:41 +08:00
parent 16f365a045
commit c65a69c34e
401 changed files with 22932 additions and 140 deletions
+112
View File
@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aurora Admin · SideMenu (H5)</title>
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css">
<link rel="stylesheet" href="./SideMenu.css">
<style>
.demo { display: flex; gap: 24px; padding: 24px; background: var(--au-color-page-bg); font-family: var(--font-family); }
h1 { font-size: 20px; margin: 0 0 4px; color: var(--au-color-text-title); }
.sub { color: var(--au-color-text-secondary); margin: 0 0 16px; font-size: 12px; }
.col { background: var(--au-color-card-bg); border-radius: 8px; padding: 16px; }
.toggle { margin-bottom: 12px; font-size: 13px; color: var(--au-color-brand); cursor: pointer; user-select: none; }
</style>
</head>
<body>
<div class="demo">
<div class="col">
<h1>SideMenu</h1>
<p class="sub">多级、图标、徽章、选中态+左指示条、折叠</p>
<div class="toggle" id="toggle">⇥ 折叠 / 展开</div>
<div class="aa-sidemenu" role="navigation" id="menu"></div>
</div>
</div>
<script>
const ITEMS = [
{ key: 'dashboard', label: '仪表盘', icon: '▦' },
{ key: 'content', label: '内容管理', icon: '▤', children: [{ key: 'article', label: '文章' }, { key: 'comment', label: '评论' }, { key: 'tag', label: '标签' }] },
{ key: 'user', label: '用户管理', icon: '◍', badge: 8, children: [{ key: 'ulist', label: '用户列表' }, { key: 'role', label: '角色权限' }] },
{ key: 'system', label: '系统设置', icon: '⚙', children: [{ key: 'config', label: '基础配置' }, { key: 'log', label: '操作日志' }] },
{ key: 'help', label: '帮助中心', icon: '?', disabled: true }
];
const menu = document.getElementById('menu');
let active = 'article';
let openKeys = new Set(['content']);
let collapsed = false;
function render() {
menu.classList.toggle('collapsed', collapsed);
menu.innerHTML = '';
ITEMS.forEach(it => {
const hasChild = it.children && it.children.length;
const isOpen = openKeys.has(it.key);
const el = document.createElement('div');
el.className = 'aa-menu-item' + (active === it.key ? ' is-active' : '') + (it.disabled ? ' is-disabled' : '') + (hasChild && isOpen ? ' is-open' : ''); el.setAttribute('role','menuitem'); el.setAttribute('tabindex','0');
el.dataset.key = it.key;
el.innerHTML = `<span class="aa-menu-icon">${it.icon || ''}</span>` +
`<span class="aa-menu-label">${it.label}</span>` +
(it.badge ? `<span class="aa-menu-badge">${it.badge}</span>` : '') +
(hasChild ? `<span class="aa-menu-arrow">›</span>` : '');
menu.appendChild(el);
if (hasChild && isOpen && !collapsed) {
const wrap = document.createElement('div');
wrap.className = 'aa-menu-children';
it.children.forEach(c => {
const cEl = document.createElement('div');
cEl.className = 'aa-menu-item' + (active === c.key ? ' is-active' : ''); cEl.setAttribute('role','menuitem'); cEl.setAttribute('tabindex','0');
cEl.dataset.key = c.key;
cEl.innerHTML = `<span class="aa-menu-label">${c.label}</span>`;
wrap.appendChild(cEl);
});
menu.appendChild(wrap);
}
});
}
menu.addEventListener('click', (e) => {
const item = e.target.closest('.aa-menu-item');
if (!item) return;
const key = item.dataset.key;
const it = ITEMS.find(x => x.key === key);
if (it && it.disabled) return;
if (it && it.children) {
if (openKeys.has(key)) openKeys.delete(key); else openKeys.add(key);
} else {
active = key;
}
render();
});
// 折叠态:悬浮顶层项弹出浮层
let pop = null;
menu.addEventListener('mouseover', (e) => {
if (!collapsed) return;
const item = e.target.closest('.aa-menu-item');
if (!item || item.closest('.aa-menu-children')) return;
const it = ITEMS.find(x => x.key === item.dataset.key);
if (!it) return;
if (pop) pop.remove();
pop = document.createElement('div');
pop.className = 'aa-menu-pop';
pop.style.top = item.offsetTop + 'px';
let html = `<div class="aa-menu-pop-title">${it.label}</div>`;
if (it.children) it.children.forEach(c => {
html += `<div class="aa-menu-item ${active === c.key ? 'is-active' : ''}" role="menuitem" tabindex="0" data-key="${c.key}"><span class="aa-menu-label">${c.label}</span></div>`;
}); else {
html += `<div class="aa-menu-item is-active" role="menuitem" tabindex="0" data-key="${it.key}"><span class="aa-menu-label">${it.label}</span></div>`;
}
pop.innerHTML = html;
menu.appendChild(pop);
});
menu.addEventListener('mouseleave', () => { if (pop) { pop.remove(); pop = null; } });
document.getElementById('toggle').addEventListener('click', () => { collapsed = !collapsed; render(); });
render();
</script>
</body>
</html>
+90
View File
@@ -0,0 +1,90 @@
import React, { useState } from 'react';
import './SideMenu.css';
/**
* Aurora Admin SideMenu(React)
* 对齐 组件7.txt SideMenu 规范:多级、图标、徽章、选中态#F0F5FF+左指示条、折叠悬浮
*
* props:
* - value / defaultValue : 当前选中 key
* - items : [{ key, label, icon?, badge?, children?, disabled? }]
* - collapsed
* - onSelect(key)
*/
export default function SideMenu({ value, defaultValue = '', items = [], collapsed = false, onSelect }) {
const [active, setActive] = useState(value !== undefined ? value : defaultValue);
const [openKeys, setOpenKeys] = useState([]);
const [hoverKey, setHoverKey] = useState('');
const [popTop, setPopTop] = useState(0);
const current = value !== undefined ? value : active;
const select = (key) => { if (value === undefined) setActive(key); onSelect && onSelect(key); setHoverKey(''); };
const onTopClick = (it) => {
if (it.disabled) return;
if (it.children && it.children.length) {
if (collapsed) return;
setOpenKeys(openKeys.includes(it.key) ? openKeys.filter(k => k !== it.key) : [...openKeys, it.key]);
} else select(it.key);
};
const onHover = (it, e) => { if (collapsed && it.children) { setHoverKey(it.key); setPopTop(e.currentTarget.offsetTop); } };
const popItem = items.find(x => x.key === hoverKey) || null;
return (
<div className={`aa-sidemenu${collapsed ? ' collapsed' : ''}`} onMouseLeave={() => setHoverKey('')}>
{items.map(it => {
const hasChild = it.children && it.children.length;
const isOpen = openKeys.includes(it.key);
return (
<div key={it.key}>
<div
className={`aa-menu-item${current === it.key ? ' is-active' : ''}${it.disabled ? ' is-disabled' : ''}${hasChild && isOpen ? ' is-open' : ''}`}
onClick={() => onTopClick(it)}
onMouseEnter={(e) => onHover(it, e)}
>
<span className="aa-menu-icon">{it.icon}</span>
<span className="aa-menu-label">{it.label}</span>
{it.badge && <span className="aa-menu-badge">{it.badge}</span>}
{hasChild && <span className="aa-menu-arrow">›</span>}
</div>
{hasChild && isOpen && !collapsed && (
<div className="aa-menu-children">
{it.children.map(c => (
<div key={c.key} className={`aa-menu-item${current === c.key ? ' is-active' : ''}`} onClick={() => select(c.key)}>
<span className="aa-menu-label">{c.label}</span>
</div>
))}
</div>
)}
</div>
);
})}
{collapsed && hoverKey && popItem && (
<div className="aa-menu-pop" style={{ top: popTop }}>
<div className="aa-menu-pop-title">{popItem.label}</div>
{popItem.children && popItem.children.length ? (
popItem.children.map(c => (
<div key={c.key} className={`aa-menu-item${current === c.key ? ' is-active' : ''}`} onClick={() => select(c.key)}>
<span className="aa-menu-label">{c.label}</span>
</div>
))
) : (
<div className="aa-menu-item is-active" onClick={() => select(popItem.key)}>
<span className="aa-menu-label">{popItem.label}</span>
</div>
)}
</div>
)}
</div>
);
}
/*
用法示例:
import SideMenu from './SideMenu';
const items = [
{ key: 'dashboard', label: '仪表盘', icon: '▦' },
{ key: 'user', label: '用户管理', icon: '◍', badge: 8, children: [{ key: 'list', label: '用户列表' }] }
];
<SideMenu items={items} defaultValue="list" collapsed={false} onSelect={setActive} />
*/
+95
View File
@@ -0,0 +1,95 @@
<template>
<div class="aa-sidemenu" :class="{ collapsed }" @mouseleave="hoverKey = ''">
<div
v-for="it in items" :key="it.key"
class="aa-menu-item"
:class="{ 'is-active': value === it.key, 'is-open': openKeys.indexOf(it.key) > -1, 'is-disabled': it.disabled }"
@click="onTopClick(it)"
@mouseenter="onHover(it, $event)"
>
<span class="aa-menu-icon">{{ it.icon }}</span>
<span class="aa-menu-label">{{ it.label }}</span>
<span v-if="it.badge" class="aa-menu-badge">{{ it.badge }}</span>
<span v-if="it.children && it.children.length" class="aa-menu-arrow">›</span>
</div>
<template v-for="it in items" :key="'c-' + it.key">
<div v-if="it.children && it.children.length && openKeys.indexOf(it.key) > -1 && !collapsed" class="aa-menu-children">
<div
v-for="c in it.children" :key="c.key"
class="aa-menu-item" :class="{ 'is-active': value === c.key }"
@click="select(c.key)"
>
<span class="aa-menu-label">{{ c.label }}</span>
</div>
</div>
</template>
<div v-if="collapsed && hoverKey && popItem" class="aa-menu-pop" :style="{ top: popTop + 'px' }">
<div class="aa-menu-pop-title">{{ popItem.label }}</div>
<template v-if="popItem.children && popItem.children.length">
<div
v-for="c in popItem.children" :key="c.key"
class="aa-menu-item" :class="{ 'is-active': value === c.key }"
@click="select(c.key)"
><span class="aa-menu-label">{{ c.label }}</span></div>
</template>
<div v-else class="aa-menu-item is-active" @click="select(popItem.key)"><span class="aa-menu-label">{{ popItem.label }}</span></div>
</div>
</div>
</template>
<script>
export default {
name: 'AaSideMenu',
props: {
value: { type: String, default: '' }, // 当前选中 key
items: { type: Array, required: true }, // [{ key, label, icon?, badge?, children?, disabled? }]
collapsed: { type: Boolean, default: false }
},
data() { return { openKeys: [], hoverKey: '', popTop: 0 }; },
computed: {
popItem() { return this.items.find(x => x.key === this.hoverKey) || null; }
},
methods: {
onHover(it, e) { if (this.collapsed && it.children) { this.hoverKey = it.key; this.popTop = e.currentTarget.offsetTop; } },
onTopClick(it) {
if (it.disabled) return;
if (it.children && it.children.length) {
if (this.collapsed) return;
this.openKeys = this.openKeys.indexOf(it.key) > -1 ? this.openKeys.filter(k => k !== it.key) : [...this.openKeys, it.key];
} else { this.select(it.key); }
},
select(key) { this.$emit('input', key); this.$emit('select', key); this.hoverKey = ''; }
}
};
</script>
<!-- 样式对齐 组件7.txt SideMenu 规范 -->
<style>
.aa-sidemenu { width: 220px; background: #fff; border-right: 1px solid #E8ECF1; font-family: var(--font-family, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif); color: #262626; user-select: none; }
.aa-sidemenu.collapsed { width: 56px; }
.aa-menu-item { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; cursor: pointer; font-size: 14px; color: #262626; transition: background .15s, color .15s; }
.aa-menu-item:hover { background: #F5F7FA; }
.aa-menu-item.is-active { background: #F0F5FF; color: #2F54EB; font-weight: 500; }
.aa-menu-item.is-active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #2F54EB; }
.aa-menu-item.is-disabled { color: #BFBFBF; cursor: not-allowed; }
.aa-menu-item.is-disabled:hover { background: none; }
.aa-menu-icon { width: 16px; text-align: center; flex-shrink: 0; font-size: 15px; }
.aa-menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-menu-badge { background: #CF1322; color: #fff; font-size: 11px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.aa-menu-arrow { color: #6E6E6E; font-size: 12px; transition: transform .15s; }
.aa-menu-item.is-open > .aa-menu-arrow { transform: rotate(90deg); }
.aa-menu-children { background: #FAFAFA; }
.aa-menu-children .aa-menu-item { height: 40px; padding-left: 40px; font-size: 13px; }
.aa-menu-children .aa-menu-item.is-active::before { display: none; }
.aa-sidemenu.collapsed .aa-menu-label,
.aa-sidemenu.collapsed .aa-menu-badge,
.aa-sidemenu.collapsed .aa-menu-arrow { display: none; }
.aa-sidemenu.collapsed .aa-menu-item { justify-content: center; padding: 0; }
.aa-sidemenu.collapsed .aa-menu-children { display: none; }
.aa-menu-pop { position: absolute; left: 56px; top: 0; min-width: 180px; background: #fff; border: 1px solid #E8ECF1; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 4px 0; z-index: 200; }
.aa-menu-pop-title { padding: 6px 16px; font-size: 12px; color: #6E6E6E; }
.aa-menu-pop .aa-menu-item { padding: 0 16px; }
.aa-menu-pop .aa-menu-item::before { display: none; }
</style>
+104
View File
@@ -0,0 +1,104 @@
<template>
<div class="aa-sidemenu" :class="{ collapsed }" @mouseleave="hoverKey = ''">
<div
v-for="it in items" :key="it.key"
class="aa-menu-item"
:class="{ 'is-active': modelValue === it.key, 'is-open': openKeys.includes(it.key), 'is-disabled': it.disabled }"
@click="onTopClick(it)"
@mouseenter="onHover(it, $event)"
>
<span class="aa-menu-icon">{{ it.icon }}</span>
<span class="aa-menu-label">{{ it.label }}</span>
<span v-if="it.badge" class="aa-menu-badge">{{ it.badge }}</span>
<span v-if="it.children && it.children.length" class="aa-menu-arrow">›</span>
</div>
<template v-for="it in items" :key="'c-' + it.key">
<div v-if="it.children && it.children.length && openKeys.includes(it.key) && !collapsed" class="aa-menu-children">
<div
v-for="c in it.children" :key="c.key"
class="aa-menu-item" :class="{ 'is-active': modelValue === c.key }"
@click="select(c.key)"
>
<span class="aa-menu-label">{{ c.label }}</span>
</div>
</div>
</template>
<!-- 折叠态悬浮浮层 -->
<div v-if="collapsed && hoverKey && popItem" class="aa-menu-pop" :style="{ top: popTop + 'px' }">
<div class="aa-menu-pop-title">{{ popItem.label }}</div>
<template v-if="popItem.children && popItem.children.length">
<div
v-for="c in popItem.children" :key="c.key"
class="aa-menu-item" :class="{ 'is-active': modelValue === c.key }"
@click="select(c.key)"
><span class="aa-menu-label">{{ c.label }}</span></div>
</template>
<div v-else class="aa-menu-item is-active" @click="select(popItem.key)"><span class="aa-menu-label">{{ popItem.label }}</span></div>
</div>
</div>
</template>
<script setup>
import { ref, computed } from 'vue';
const props = defineProps({
modelValue: { type: String, default: '' }, // 当前选中 key
items: { type: Array, required: true }, // [{ key, label, icon?, badge?, children?, disabled? }]
collapsed: { type: Boolean, default: false }
});
const emit = defineEmits(['update:modelValue', 'select']);
const openKeys = ref([]);
const hoverKey = ref('');
const popItem = computed(() => props.items.find(x => x.key === hoverKey.value) || null);
const popTop = ref(0);
function onHover(it, e) {
if (props.collapsed && it.children) { hoverKey.value = it.key; popTop.value = e.currentTarget.offsetTop; }
}
function onTopClick(it) {
if (it.disabled) return;
if (it.children && it.children.length) {
if (props.collapsed) return;
openKeys.value = openKeys.value.includes(it.key) ? openKeys.value.filter(k => k !== it.key) : [...openKeys.value, it.key];
} else {
select(it.key);
}
}
function select(key) {
emit('update:modelValue', key);
emit('select', key);
hoverKey.value = '';
}
</script>
<!-- 样式对齐 组件7.txt SideMenu 规范 -->
<style scoped>
.aa-sidemenu { width: 220px; background: #fff; border-right: 1px solid #E8ECF1; font-family: var(--font-family, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif); color: #262626; user-select: none; }
.aa-sidemenu.collapsed { width: 56px; }
.aa-menu-item { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; cursor: pointer; font-size: 14px; color: #262626; transition: background .15s, color .15s; }
.aa-menu-item:hover { background: #F5F7FA; }
.aa-menu-item.is-active { background: #F0F5FF; color: #2F54EB; font-weight: 500; }
.aa-menu-item.is-active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #2F54EB; }
.aa-menu-item.is-disabled { color: #BFBFBF; cursor: not-allowed; }
.aa-menu-item.is-disabled:hover { background: none; }
.aa-menu-icon { width: 16px; text-align: center; flex-shrink: 0; font-size: 15px; }
.aa-menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-menu-badge { background: #CF1322; color: #fff; font-size: 11px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.aa-menu-arrow { color: #6E6E6E; font-size: 12px; transition: transform .15s; }
.aa-menu-item.is-open > .aa-menu-arrow { transform: rotate(90deg); }
.aa-menu-children { background: #FAFAFA; }
.aa-menu-children .aa-menu-item { height: 40px; padding-left: 40px; font-size: 13px; }
.aa-menu-children .aa-menu-item.is-active::before { display: none; }
.aa-sidemenu.collapsed .aa-menu-label,
.aa-sidemenu.collapsed .aa-menu-badge,
.aa-sidemenu.collapsed .aa-menu-arrow { display: none; }
.aa-sidemenu.collapsed .aa-menu-item { justify-content: center; padding: 0; }
.aa-sidemenu.collapsed .aa-menu-children { display: none; }
.aa-menu-pop { position: absolute; left: 56px; top: 0; min-width: 180px; background: #fff; border: 1px solid #E8ECF1; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 4px 0; z-index: 200; }
.aa-menu-pop-title { padding: 6px 16px; font-size: 12px; color: #6E6E6E; }
.aa-menu-pop .aa-menu-item { padding: 0 16px; }
.aa-menu-pop .aa-menu-item::before { display: none; }
</style>