@composy/attendance-core
v0.0.1
Published
考勤组件 - 打卡状态可视化与考勤统计面板
Maintainers
Readme
@composy/attendance-core
框架无关的考勤核心包,提供考勤日历、打卡面板、统计面板、请假面板、状态工具和演示数据生成器。
特性
- 考勤日历:月份切换、回到今天、选中日期、状态图例、排班展示和键盘可访问点击。
- 打卡面板:自动判断上班/下班打卡,支持默认地点、打卡方式、禁用态、打卡记录回调。
- 统计面板:出勤率、准点率、异常次数、工作时长、请假余额。
- 请假面板:假期余额进度、请假记录、审批状态、记录点击回调。
- 样式规范:所有组件 class 使用
ldesign-attendance-*前缀;颜色使用packages/color生成的--ld-*变量,尺寸使用packages/size生成的--ld-*变量。 - 产物:
dist、es、esm、lib四套目录,包含 JS、声明文件和 CSS。
使用
import {
createAttendanceCalendar,
generateMonthRecords,
generateSchedules,
getCurrentMonth,
} from '@composy/attendance-core'
import '@composy/attendance-core/index.css'
const month = getCurrentMonth()
const calendar = createAttendanceCalendar({
container: '#calendar',
month,
records: generateMonthRecords(month),
schedules: generateSchedules(month),
showShift: true,
selectedDate: `${month}-01`,
onDateClick(date, record) {
console.log(date, record)
},
})
calendar.nextMonth()公开入口
@composy/attendance-core:核心 API 与类型。@composy/attendance-core/index.css:完整组件样式。@composy/attendance-core/style:样式子路径。@composy/attendance-core/core/*、theme/*、utils/*、types:按需子路径。
验证
pnpm --filter @composy/attendance-core type-check
pnpm --filter @composy/attendance-core buildLicense
MIT
