@freegridjs/core 1.9.4 → 1.9.5

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/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { default as en } from './locales/en.js';
5
5
  declare function createGrid(host: HTMLElement, options: GridOptions): GridApi;
6
6
 
7
7
  /** FreeGrid version (kept in sync with releases.json by scripts/release.mjs). */
8
- declare const version = "1.9.4";
8
+ declare const version = "1.9.5";
9
9
 
10
10
  interface LicenseInfo {
11
11
  /** Licensed domains; each also covers every subdomain below it (`*.example.com` means the same as `example.com`). */
package/dist/index.js CHANGED
@@ -596,9 +596,31 @@ var ColumnModel = class {
596
596
  relayout() {
597
597
  const visible = this.leafNodes().filter((n) => !n.hide && this.shownByGroups(n));
598
598
  const fixed = visible.reduce((s, n) => s + (n.flex ? 0 : n.width), 0);
599
- const totalFlex = visible.reduce((s, n) => s + (n.flex ?? 0), 0);
600
- const free = Math.max(0, this.containerWidth - fixed);
601
- const widthOf = (n) => n.flex ? clampWidth(n.def, Math.floor(free * n.flex / totalFlex)) : n.width;
599
+ const flexWidth = /* @__PURE__ */ new Map();
600
+ let pending = visible.filter((n) => n.flex);
601
+ let free = Math.max(0, this.containerWidth - fixed);
602
+ while (pending.length) {
603
+ const totalFlex = pending.reduce((s, n) => s + n.flex, 0);
604
+ const share = (n) => Math.floor(free * n.flex / totalFlex);
605
+ const excess = pending.reduce((s, n) => s + clampWidth(n.def, share(n)) - share(n), 0);
606
+ const clamped = pending.filter((n) => {
607
+ const d = clampWidth(n.def, share(n)) - share(n);
608
+ return excess > 0 ? d > 0 : excess < 0 ? d < 0 : false;
609
+ });
610
+ if (!clamped.length) {
611
+ for (const n of pending) flexWidth.set(n, clampWidth(n.def, share(n)));
612
+ break;
613
+ }
614
+ let used = 0;
615
+ for (const n of clamped) {
616
+ const w = clampWidth(n.def, share(n));
617
+ flexWidth.set(n, w);
618
+ used += w;
619
+ }
620
+ free = Math.max(0, free - used);
621
+ pending = pending.filter((n) => !clamped.includes(n));
622
+ }
623
+ const widthOf = (n) => flexWidth.get(n) ?? n.width;
602
624
  const next = { left: [], center: [], right: [] };
603
625
  this.leafById = /* @__PURE__ */ new Map();
604
626
  let index = 0;
@@ -7757,7 +7779,7 @@ var PAID_FEATURES = {
7757
7779
  };
7758
7780
 
7759
7781
  // src/version.ts
7760
- var version = "1.9.4";
7782
+ var version = "1.9.5";
7761
7783
 
7762
7784
  // src/license.ts
7763
7785
  var PUBLIC_KEY = { kty: "EC", crv: "P-256", x: "sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE", y: "j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freegridjs/core",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "FreeGrid — a fast data grid for the web: virtual scrolling, grouping, pivot, charts, Excel export, 7 languages. Free core; paid features free with a personal key.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",