gantt-renderer 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [0.12.0](https://github.com/doberkofler/gantt-renderer/compare/v0.11.0...v0.12.0) (2026-05-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **gantt:** align timeline right edge to full scale bucket ([614cd66](https://github.com/doberkofler/gantt-renderer/commit/614cd66e93ae7c7a7c6a71034feafce19299aad7))
|
|
7
|
+
|
|
1
8
|
# [0.11.0](https://github.com/doberkofler/gantt-renderer/compare/v0.10.0...v0.11.0) (2026-05-13)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.mjs
CHANGED
|
@@ -706,6 +706,20 @@ function nextScaleBoundary(date, scale) {
|
|
|
706
706
|
case "year": return new Date(Date.UTC(date.getUTCFullYear() + 1, 0, 1));
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
+
/**
|
|
710
|
+
* Rounds a date up to the end boundary of the containing scale bucket.
|
|
711
|
+
* If the date is already on a boundary, it is returned unchanged.
|
|
712
|
+
*
|
|
713
|
+
* @param date - The date to round.
|
|
714
|
+
* @param scale - The target {@link TimeScale}.
|
|
715
|
+
* @param weekStartsOn - First day of the week (`0`-Sun, `1`-Mon, `6`-Sat). Defaults to `1` (Monday).
|
|
716
|
+
* @returns A boundary-aligned date at or after the input.
|
|
717
|
+
*/
|
|
718
|
+
function ceilToScaleBoundary(date, scale, weekStartsOn = 1) {
|
|
719
|
+
const start = snapToScaleBoundary(date, scale, weekStartsOn);
|
|
720
|
+
if (start.getTime() === date.getTime()) return start;
|
|
721
|
+
return nextScaleBoundary(start, scale);
|
|
722
|
+
}
|
|
709
723
|
//#endregion
|
|
710
724
|
//#region src/lib/timeline/pixelMapper.ts
|
|
711
725
|
/**
|
|
@@ -3492,8 +3506,10 @@ var GanttChart = class {
|
|
|
3492
3506
|
#computeState(input) {
|
|
3493
3507
|
const allRows = flattenTree(buildTaskTree(input.tasks), this.#expandedIds);
|
|
3494
3508
|
const [vpStart, vpEnd] = this.#opts.viewportStart !== void 0 && this.#opts.viewportEnd !== void 0 ? [this.#opts.viewportStart, this.#opts.viewportEnd] : deriveViewport(allRows, 48);
|
|
3509
|
+
const weekStartsOn = this.#locale.weekStartsOn ?? 1;
|
|
3510
|
+
const renderViewportEnd = ceilToScaleBoundary(vpEnd, this.#scale, weekStartsOn);
|
|
3495
3511
|
const mapper = createPixelMapper(this.#scale, vpStart);
|
|
3496
|
-
const totalWidth = Math.ceil(mapper.toX(
|
|
3512
|
+
const totalWidth = Math.ceil(mapper.toX(renderViewportEnd)) + 1;
|
|
3497
3513
|
const layouts = computeLayout(allRows, mapper);
|
|
3498
3514
|
const links = routeLinks(input.links, layouts);
|
|
3499
3515
|
const containerH = this.#height - HEADER_H;
|
|
@@ -3514,7 +3530,7 @@ var GanttChart = class {
|
|
|
3514
3530
|
allRows,
|
|
3515
3531
|
mapper,
|
|
3516
3532
|
viewportStart: vpStart,
|
|
3517
|
-
viewportEnd:
|
|
3533
|
+
viewportEnd: renderViewportEnd,
|
|
3518
3534
|
totalWidth,
|
|
3519
3535
|
layouts,
|
|
3520
3536
|
links,
|