UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

34 lines (33 loc) 1.08 kB
"use client"; import g from "../../../../_virtual/dayjs.min.js"; import { GanttDimensionsSettings as o } from "../constants/DimensionsSettings.js"; import { GanttUnitOfTimes as s } from "../enums/GanttUnitOfTimes.js"; import { GanttConsts as i } from "../constants/GanttConsts.js"; const I = (n, a) => { switch (o[n].unitOfTime) { case s.DAY: { const t = i.HOURS_IN_DAY / o[n].hours; let e = 0; return new Array(t).fill(0).map((r, u) => { if (t < i.HOURS_IN_DAY) { const c = e, m = i.HOURS_IN_DAY / t + e; return e = m, `${c.toLocaleString("en-US", { minimumIntegerDigits: 2 })} - ${m.toLocaleString("en-US", { minimumIntegerDigits: 2 })}`; } return u.toLocaleString("en-US", { minimumIntegerDigits: 2 }); }); } case s.MONTH: { const t = g.unix(a).daysInMonth(); return new Array(t).fill(0).map((e, r) => (r + 1).toLocaleString("en-US", { minimumIntegerDigits: 2 })); } default: return []; } }; export { I as getScaleItems };