Regression / regression (push) Canceled after 0s
## 品牌标识(本次会话) 起因:品牌此前没有任何图形标识 —— 唯一 favicon 是内联 data-URI 里的字母「A」, 那是 v2.0.0「Aurora Admin → Kole UI」改名漏掉的一处(PC 顶栏也是「A」, 移动端站已是「K」;移动端文档站则完全没有 favicon)。 - 几何:24 网格三个互不接触的笔画(竖 + 两斜),圆头描边; 描边 2.25 → 16px 标签页尺寸下正好 1.5px = 规范原文「描边1.5px」 - 取色分两套(刻意):favicon 硬编码品牌蓝/白(渲染在浏览器标签栏,不继承 kole-dark); 顶栏标记走 currentColor(实测暗色下自动转 rgb(20,22,28)) - 新增 theme-color 双条(light #FFFFFF / dark #1C1F26,取 --kole-color-card-bg) - 修 site/app.js hero 标语 KOLE ADMIN → KOLE UI(改名变形残留) - 移动端 7 个模板补 favicon(此前计数 0) 验收:门禁 9 条全 OK(site-routing/site-routes/mobile-docs/mobile-site/isolation/ theme/nav/i18n/icons);PC 回归 1464/1464 · 移动端 807/807,各连跑 8 次一致; 两端 favicon 405 字节逐字节一致;PC 站控制台错误 1→0。 ## 并行会话成果(本次一并入库) - 图标系统:2576 图标(TDesign/Element Plus,MIT)+ 11 端注入 + 5 个构建门禁工具 + IconPreview 预览页 + ICON-SPEC.md 冻结规格 - 移动端平台:47 组件 × 6 端 + 文档站 53 页 + 隔离门禁 - PC 组件:103 个大后台组件 / 组件11 批次 - uni-app:PC 端试点 + 移动端端实现 + 真实编译验证 ## 工程 - .gitignore 补 .scratch/ 与 .zcode-preexisting-*.txt(会话中间产物,实测 9.1MB,不入库) - CHANGELOG 补品牌标识条目 - ROADMAP 登 S8-P4(品牌标识任务包 + og:image/apple-touch-icon 未做部分)
134 lines
4.7 KiB
Vue
134 lines
4.7 KiB
Vue
<template>
|
||
<div>
|
||
<slot></slot>
|
||
<div
|
||
class="kole-m-datepicker__mask"
|
||
:class="{ 'is-open': open }"
|
||
aria-hidden="true"
|
||
@click="onMaskClick"
|
||
></div>
|
||
<div
|
||
class="kole-m-datepicker"
|
||
:class="panelClass"
|
||
role="dialog"
|
||
aria-modal="true"
|
||
:aria-labelledby="titleId"
|
||
:aria-hidden="open ? null : 'true'"
|
||
>
|
||
<div class="kole-m-datepicker__header">
|
||
<button class="kole-m-datepicker__btn" type="button" @click="onCancelClick">取消</button>
|
||
<span class="kole-m-datepicker__title" :id="titleId">{{ label }}</span>
|
||
<button
|
||
class="kole-m-datepicker__btn kole-m-datepicker__btn--confirm"
|
||
type="button"
|
||
@click="onConfirmClick"
|
||
>确定</button>
|
||
</div>
|
||
<div class="kole-m-datepicker__columns">
|
||
<ul
|
||
v-for="col in columns"
|
||
:key="col.key"
|
||
class="kole-m-datepicker__column"
|
||
role="listbox"
|
||
:aria-label="col.label"
|
||
>
|
||
<li
|
||
v-for="(option, i) in col.options"
|
||
:key="col.key + '-' + i"
|
||
class="kole-m-datepicker__option"
|
||
:class="{ 'is-selected': isSelected(col.key, option) }"
|
||
role="option"
|
||
:aria-selected="isSelected(col.key, option) ? 'true' : 'false'"
|
||
@click="select(col.key, option)"
|
||
>{{ option }}</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup>
|
||
/* 日期选择器(移动端)— 规格 §18。
|
||
底部浮层 = 装饰性遮罩(aria-hidden)+ 面板;遮罩点击关闭,closeOnMask=false 时不关(规格 §18.5)。
|
||
面板 role="dialog" + aria-modal="true",标题元素 id 由 aria-labelledby 指向(规格 §18.6)。
|
||
每列 role="listbox"、选项 role="option" + aria-selected;is-selected 与 aria-selected 同步
|
||
(选中值以 YYYY-MM-DD 文本呈现:value 直接消费,不依赖视觉滚动位置)。
|
||
本端不发明选择事件(契约只有 confirm / close):点选只改本地高亮。 */
|
||
import { computed, getCurrentInstance, ref } from 'vue';
|
||
|
||
const props = defineProps({
|
||
mode: { type: String, default: 'date' },
|
||
round: { type: Boolean, default: false },
|
||
open: { type: Boolean, default: false },
|
||
closeOnMask: { type: Boolean, default: true },
|
||
value: { type: String, default: '' },
|
||
years: { type: Array, default: () => [] },
|
||
months: { type: Array, default: () => [] },
|
||
days: { type: Array, default: () => [] }
|
||
});
|
||
const emit = defineEmits(['confirm', 'close']);
|
||
|
||
const COLUMN_LABELS = { year: '年', month: '月', day: '日' };
|
||
|
||
/* 面板标题元素 id:取当前实例 uid,保证同页多实例不撞号(不依赖 Vue 3.5 才有的 useId) */
|
||
const titleId = 'kole-m-datepicker-title-' + getCurrentInstance().uid;
|
||
|
||
/* value 形如 YYYY-MM-DD;mode=month 时只有 YYYY-MM,day 为空串 */
|
||
function partsOf(value) {
|
||
const seg = String(value || '').split('-');
|
||
return { year: seg[0] || '', month: seg[1] || '', day: seg[2] || '' };
|
||
}
|
||
|
||
/* 选项文字可能带单位(「9 月」),取首个数字段比较;纯符号选项退回逐字比较 */
|
||
function sameValue(option, part) {
|
||
if (part === undefined || part === null || part === '') return false;
|
||
const digits = String(option).match(/[0-9]+/);
|
||
if (digits) return String(Number(digits[0])) === String(Number(part));
|
||
return String(option) === String(part);
|
||
}
|
||
|
||
/* null = 跟随 value 属性;点选后本地记账,确认前不改宿主的值 */
|
||
const draft = ref(null);
|
||
const picked = computed(() => draft.value || partsOf(props.value));
|
||
const title = computed(() => (props.mode === 'month' ? '选择月份' : '选择日期'));
|
||
const label = computed(() => (props.value ? title.value + ':' + props.value : title.value));
|
||
|
||
/* mode=date → 年/月/日 三列;mode=month → 年/月 两列(规格 §18.3) */
|
||
const columns = computed(() => {
|
||
const cols = [
|
||
{ key: 'year', label: COLUMN_LABELS.year, options: props.years },
|
||
{ key: 'month', label: COLUMN_LABELS.month, options: props.months }
|
||
];
|
||
if (props.mode !== 'month') cols.push({ key: 'day', label: COLUMN_LABELS.day, options: props.days });
|
||
return cols;
|
||
});
|
||
|
||
const panelClass = computed(() => [
|
||
props.round ? 'kole-m-datepicker--round' : '',
|
||
props.open ? 'is-open' : ''
|
||
].filter(Boolean));
|
||
|
||
function isSelected(key, option) {
|
||
return sameValue(option, picked.value[key]);
|
||
}
|
||
|
||
function select(key, option) {
|
||
draft.value = Object.assign({}, picked.value, { [key]: String(option) });
|
||
}
|
||
|
||
function onMaskClick() {
|
||
if (!props.closeOnMask) return;
|
||
emit('close');
|
||
}
|
||
|
||
function onCancelClick() {
|
||
emit('close');
|
||
}
|
||
|
||
function onConfirmClick() {
|
||
emit('confirm');
|
||
}
|
||
</script>
|
||
|
||
<style src="./DatePicker.css"></style>
|