feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<!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 · Segmented (H5)</title>
|
||||
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css">
|
||||
<style>
|
||||
/* 对齐 组件2.txt Segmented 规范:高32px、选项内边距8px 16px、容器 #F5F7FA、圆角4px、选中白底、禁用 #BFBFBF */
|
||||
.demo { padding: 24px; background: var(--au-color-page-bg); color: var(--au-color-text-body); font-family: var(--font-family); }
|
||||
h1 { font-size: 20px; margin: 0 0 4px; }
|
||||
.sub { color: var(--au-color-text-secondary); margin: 0 0 24px; font-size: 12px; }
|
||||
|
||||
.aa-segmented {
|
||||
display: inline-flex; align-items: center; background: var(--au-color-page-bg); border-radius: 4px; padding: 2px;
|
||||
}
|
||||
.aa-segmented-item {
|
||||
height: 28px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px;
|
||||
border-radius: 4px; cursor: pointer; font-size: 14px; color: var(--au-color-text-body); border: none; background: none;
|
||||
transition: background .15s, color .15s;
|
||||
}
|
||||
.aa-segmented-item:hover:not(.is-active):not(.is-disabled) { color: var(--au-color-brand); }
|
||||
.aa-segmented-item.is-active { background: var(--au-color-card-bg); color: var(--au-color-text-body); box-shadow: 0 1px 2px rgba(0,0,0,0.08); font-weight: 500; }
|
||||
.aa-segmented-item.is-disabled { color: var(--au-color-text-disabled); cursor: not-allowed; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="demo">
|
||||
<h1>Aurora Admin · Segmented 组件(纯 H5)</h1>
|
||||
<p class="sub">对齐 Segmented 规范:高32px、选项内边距8px 16px、容器 #F5F7FA、圆角4px、选中白底、禁用 #BFBFBF</p>
|
||||
|
||||
<div class="aa-segmented" id="seg">
|
||||
<button class="aa-segmented-item is-active" data-val="list">列表</button>
|
||||
<button class="aa-segmented-item" data-val="kanban">看板</button>
|
||||
<button class="aa-segmented-item" data-val="gantt">甘特图</button>
|
||||
<button class="aa-segmented-item is-disabled" data-val="cal" disabled>日历</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const seg = document.getElementById('seg');
|
||||
seg.addEventListener('click', (e) => {
|
||||
const btn = e.target.closest('.aa-segmented-item');
|
||||
if (!btn || btn.disabled) return;
|
||||
seg.querySelectorAll('.aa-segmented-item').forEach(b => b.classList.remove('is-active'));
|
||||
btn.classList.add('is-active');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
import React from 'react';
|
||||
import './Segmented.css';
|
||||
|
||||
/**
|
||||
* Aurora Admin Segmented(React)
|
||||
* 对齐 组件2.txt Segmented 规范:高32px、选项内边距8px 16px、容器 #F5F7FA、圆角4px、选中白底、禁用 #BFBFBF
|
||||
* options: [{ label, value, icon?, disabled? }]
|
||||
* 受控:value + onChange;非受控:defaultValue
|
||||
*/
|
||||
export default function Segmented({ value, defaultValue, options = [], onChange }) {
|
||||
const current = value !== undefined ? value : defaultValue;
|
||||
|
||||
const choose = (opt) => {
|
||||
if (opt.disabled) return;
|
||||
if (value === undefined) onChange && onChange(opt.value);
|
||||
else onChange && onChange(opt.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="aa-segmented">
|
||||
{options.map((opt) => (
|
||||
<button
|
||||
key={opt.value}
|
||||
className={`aa-segmented-item${current === opt.value ? ' is-active' : ''}${opt.disabled ? ' is-disabled' : ''}`}
|
||||
disabled={opt.disabled}
|
||||
onClick={() => choose(opt)}
|
||||
>
|
||||
{opt.icon && <span className="ico">{opt.icon}</span>}
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
用法示例:
|
||||
import Segmented from './Segmented';
|
||||
const opts = [
|
||||
{ label: '列表', value: 'list' },
|
||||
{ label: '看板', value: 'kanban' },
|
||||
{ label: '日历', value: 'cal', disabled: true }
|
||||
];
|
||||
<Segmented options={opts} defaultValue="list" onChange={setView} />
|
||||
*/
|
||||
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<div class="aa-segmented">
|
||||
<button
|
||||
v-for="opt in options" :key="opt.value"
|
||||
class="aa-segmented-item"
|
||||
:class="{ 'is-active': value === opt.value, 'is-disabled': opt.disabled }"
|
||||
:disabled="opt.disabled"
|
||||
@click="choose(opt)"
|
||||
>
|
||||
<span v-if="opt.icon" class="ico">{{ opt.icon }}</span>
|
||||
{{ opt.label }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AaSegmented',
|
||||
props: {
|
||||
value: { type: [String, Number], default: '' },
|
||||
options: { type: Array, required: true } // [{ label, value, icon?, disabled? }]
|
||||
},
|
||||
methods: {
|
||||
choose(opt) {
|
||||
if (opt.disabled) return;
|
||||
this.$emit('input', opt.value);
|
||||
this.$emit('change', opt.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- 样式对齐 组件2.txt Segmented 规范 -->
|
||||
<style>
|
||||
.aa-segmented {
|
||||
display: inline-flex; align-items: center; background: #F5F7FA; border-radius: 4px; padding: 2px;
|
||||
}
|
||||
.aa-segmented-item {
|
||||
height: 28px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px;
|
||||
border-radius: 4px; cursor: pointer; font-size: 14px; color: #262626; border: none; background: none;
|
||||
transition: background .15s, color .15s;
|
||||
}
|
||||
.aa-segmented-item:hover:not(.is-active):not(.is-disabled) { color: #2F54EB; }
|
||||
.aa-segmented-item.is-active { background: #fff; color: #262626; box-shadow: 0 1px 2px rgba(0,0,0,0.08); font-weight: 500; }
|
||||
.aa-segmented-item.is-disabled { color: #BFBFBF; cursor: not-allowed; }
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="aa-segmented">
|
||||
<button
|
||||
v-for="opt in options" :key="opt.value"
|
||||
class="aa-segmented-item"
|
||||
:class="{ 'is-active': modelValue === opt.value, 'is-disabled': opt.disabled }"
|
||||
:disabled="opt.disabled"
|
||||
@click="choose(opt)"
|
||||
>
|
||||
<span v-if="opt.icon" class="ico">{{ opt.icon }}</span>
|
||||
{{ opt.label }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: [String, Number], default: '' },
|
||||
options: { type: Array, required: true } // [{ label, value, icon?, disabled? }]
|
||||
});
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
function choose(opt) {
|
||||
if (opt.disabled) return;
|
||||
emit('update:modelValue', opt.value);
|
||||
emit('change', opt.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 样式对齐 组件2.txt Segmented 规范 -->
|
||||
<style scoped>
|
||||
.aa-segmented {
|
||||
display: inline-flex; align-items: center; background: #F5F7FA; border-radius: 4px; padding: 2px;
|
||||
}
|
||||
.aa-segmented-item {
|
||||
height: 28px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px;
|
||||
border-radius: 4px; cursor: pointer; font-size: 14px; color: #262626; border: none; background: none;
|
||||
transition: background .15s, color .15s;
|
||||
}
|
||||
.aa-segmented-item:hover:not(.is-active):not(.is-disabled) { color: #2F54EB; }
|
||||
.aa-segmented-item.is-active { background: #fff; color: #262626; box-shadow: 0 1px 2px rgba(0,0,0,0.08); font-weight: 500; }
|
||||
.aa-segmented-item.is-disabled { color: #BFBFBF; cursor: not-allowed; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user