twico-ui 1.31.0 → 1.31.1

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.cts CHANGED
@@ -2112,8 +2112,9 @@ interface DatatableState {
2112
2112
  density: "compact" | "standard" | "comfortable";
2113
2113
  /** #292: user-resized Filters popover size (px). Absent until the user drags the panel grip. */
2114
2114
  filterPanelSize?: { w?: number; h?: number };
2115
- /** #292: user-resized Filters field widths (px, panel-global — not per data column). Absent until dragged. */
2116
- filterFieldWidths?: { col?: number; op?: number; val?: number };
2115
+ /** #292: user-resized Filters field widths (px, panel-global — not per data column). Absent until dragged.
2116
+ * `logic` is the #330 And/Or connector field. */
2117
+ filterFieldWidths?: { col?: number; op?: number; val?: number; logic?: number };
2117
2118
  /** #304: user-resized sizes of the other toolbar popovers (Columns/Aggregation/Pivot/Batch-edit),
2118
2119
  * keyed by popover id → `{ w, h }` in px. Absent until a popover is dragged with `resizablePopovers`. */
2119
2120
  popoverSizes?: Record<string, { w?: number; h?: number }>;
package/dist/index.d.ts CHANGED
@@ -2112,8 +2112,9 @@ interface DatatableState {
2112
2112
  density: "compact" | "standard" | "comfortable";
2113
2113
  /** #292: user-resized Filters popover size (px). Absent until the user drags the panel grip. */
2114
2114
  filterPanelSize?: { w?: number; h?: number };
2115
- /** #292: user-resized Filters field widths (px, panel-global — not per data column). Absent until dragged. */
2116
- filterFieldWidths?: { col?: number; op?: number; val?: number };
2115
+ /** #292: user-resized Filters field widths (px, panel-global — not per data column). Absent until dragged.
2116
+ * `logic` is the #330 And/Or connector field. */
2117
+ filterFieldWidths?: { col?: number; op?: number; val?: number; logic?: number };
2117
2118
  /** #304: user-resized sizes of the other toolbar popovers (Columns/Aggregation/Pivot/Batch-edit),
2118
2119
  * keyed by popover id → `{ w, h }` in px. Absent until a popover is dragged with `resizablePopovers`. */
2119
2120
  popoverSizes?: Record<string, { w?: number; h?: number }>;
package/dist/index.mjs CHANGED
@@ -8191,7 +8191,6 @@ function classifyDiff(from = [], to = [], columns = [], rowKey, opts = {}) {
8191
8191
  return { rows, counts };
8192
8192
  }
8193
8193
  var DT_FILTER_PANEL_W = 620;
8194
- var DT_FILTER_LOGIC_W = 68;
8195
8194
  var DT_CSS = `
8196
8195
  .twc-dt { display: flex; flex-direction: column; font-family: var(--font-sans); color: var(--color-text);
8197
8196
  border: var(--border-thin) solid var(--color-border); border-radius: var(--radius-lg);
@@ -8616,8 +8615,11 @@ th.twc-dt__rownum .twc-dt__th-inner { padding-inline: 8px; gap: 2px; justify-con
8616
8615
  .twc-dt__link:hover { background: var(--color-primary-subtle); }
8617
8616
  /* #330: MUI DataGrid-style per-row And/Or connector. Row 1 shows a static "Where"; the first connector
8618
8617
  row (row 2) hosts an editable And/Or Select bound to the single filterLogic; rows 3+ echo it as static
8619
- text. Fixed-width leading cell so the Column/Operator/Value cells stay aligned across rows. */
8620
- .twc-dt__f-logic { position: relative; flex: none; width: 68px; }
8618
+ text. Leading cell aligns the Column/Operator/Value cells across rows. It is a first-class resizable
8619
+ filter field like col/op: auto-fit to its content (-fit, from the #289 measurer) with a user drag tier
8620
+ (-usr) winning in the clamp cascade, so it no longer truncates and the width can be adjusted manually. */
8621
+ .twc-dt__f-logic { position: relative; flex: none; min-width: 84px;
8622
+ width: clamp(84px, var(--twc-dt-flogic-usr, var(--twc-dt-flogic-fit, 84px)), var(--twc-dt-flogic-cap, 180px)); }
8621
8623
  .twc-dt__f-where { display: inline-flex; align-items: center; height: 38px; padding-inline: 6px; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: var(--font-medium); }
8622
8624
 
8623
8625
  /* Filter panel \u2014 user-resizable (#292): panel size + per-field widths resolve through a two-tier CSS var
@@ -9431,7 +9433,7 @@ function Datatable({
9431
9433
  density,
9432
9434
  // #292: additive, optional — user-resized filter panel + field widths (panel-global, not per column).
9433
9435
  filterPanelSize: fPanelSize || void 0,
9434
- filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null ? fWidths : void 0,
9436
+ filterFieldWidths: fWidths.col != null || fWidths.op != null || fWidths.val != null || fWidths.logic != null ? fWidths : void 0,
9435
9437
  // #304: additive, optional — user-resized sizes of the other toolbar popovers, keyed by popover id.
9436
9438
  popoverSizes: Object.keys(popSizes).length ? popSizes : void 0
9437
9439
  });
@@ -9461,7 +9463,7 @@ function Datatable({
9461
9463
  if (s.density === "compact" || s.density === "standard" || s.density === "comfortable") setDensity(s.density);
9462
9464
  if (s.filterFieldWidths && typeof s.filterFieldWidths === "object") {
9463
9465
  const fw = {};
9464
- for (const k of ["col", "op", "val"]) if (typeof s.filterFieldWidths[k] === "number") fw[k] = s.filterFieldWidths[k];
9466
+ for (const k of ["col", "op", "val", "logic"]) if (typeof s.filterFieldWidths[k] === "number") fw[k] = s.filterFieldWidths[k];
9465
9467
  if (Object.keys(fw).length) setFWidths(fw);
9466
9468
  }
9467
9469
  if (s.filterPanelSize && typeof s.filterPanelSize === "object") {
@@ -10832,9 +10834,11 @@ function Datatable({
10832
10834
  const pad2 = trigger ? (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0) : 24;
10833
10835
  const chrome = pad2 + 8 + 16 + 4;
10834
10836
  const widest = (labels) => labels.reduce((m, l) => Math.max(m, ctx.measureText(String(l)).width), 0);
10835
- const colCap = Math.max(118, Math.min(210, el.clientWidth - DT_FILTER_LOGIC_W - 118 - 30 - 30 - 140 - 5 * 6 - 2 * 4));
10837
+ const logicW = Math.min(180, Math.max(84, Math.ceil(widest(["And", "Or"]) + chrome)));
10838
+ const colCap = Math.max(118, Math.min(210, el.clientWidth - logicW - 118 - 30 - 30 - 140 - 5 * 6 - 2 * 4));
10836
10839
  const colW = Math.min(colCap, Math.max(118, Math.ceil(widest(filterableCols.map((c) => c.headerName ?? c.field)) + chrome)));
10837
10840
  const opW = Math.min(170, Math.max(118, Math.ceil(widest(ALL_OP_LABELS) + chrome)));
10841
+ if (Number.isFinite(logicW)) el.style.setProperty("--twc-dt-flogic-fit", `${logicW}px`);
10838
10842
  if (Number.isFinite(colW)) el.style.setProperty("--twc-dt-fcol-fit", `${colW}px`);
10839
10843
  if (Number.isFinite(opW)) el.style.setProperty("--twc-dt-fop-fit", `${opW}px`);
10840
10844
  };
@@ -10848,10 +10852,10 @@ function Datatable({
10848
10852
  }
10849
10853
  return () => ro?.disconnect();
10850
10854
  }, [panel, filterableCols, filters.length]);
10851
- const F_MIN = { col: 118, op: 118, val: 140 };
10852
- const F_VAR = { col: "--twc-dt-fcol-usr", op: "--twc-dt-fop-usr", val: "--twc-dt-fval-usr" };
10853
- const F_SEL = { col: ".twc-dt__f-col", op: ".twc-dt__f-op", val: ".twc-dt__f-val" };
10854
- const F_LABEL = { col: "column", op: "operator", val: "value" };
10855
+ const F_MIN = { col: 118, op: 118, val: 140, logic: 84 };
10856
+ const F_VAR = { col: "--twc-dt-fcol-usr", op: "--twc-dt-fop-usr", val: "--twc-dt-fval-usr", logic: "--twc-dt-flogic-usr" };
10857
+ const F_SEL = { col: ".twc-dt__f-col", op: ".twc-dt__f-op", val: ".twc-dt__f-val", logic: ".twc-dt__f-logic" };
10858
+ const F_LABEL = { col: "column", op: "operator", val: "value", logic: "connector" };
10855
10859
  const fMaxW = () => typeof window === "undefined" ? 9999 : window.innerWidth - 32;
10856
10860
  const fMaxH = () => typeof window === "undefined" ? 9999 : window.innerHeight - 32;
10857
10861
  const clampNum = (v, lo, hi) => Math.max(lo, Math.min(hi, Math.round(v)));
@@ -10860,11 +10864,12 @@ function Datatable({
10860
10864
  return el ? el.getBoundingClientRect().width : F_MIN[field];
10861
10865
  };
10862
10866
  const fCap = (field) => {
10867
+ if (field === "logic") return 180;
10863
10868
  if (field === "col") return filterFieldMaxWidth || 360;
10864
10869
  if (field === "op") return filterFieldMaxWidth || 260;
10865
10870
  const p = filterPanelRef.current;
10866
10871
  if (!p) return 640;
10867
- return clampNum(p.clientWidth - DT_FILTER_LOGIC_W - fLiveW("col") - fLiveW("op") - 30 - 30 - 5 * 6 - 2 * 4, F_MIN.val, 640);
10872
+ return clampNum(p.clientWidth - fLiveW("logic") - fLiveW("col") - fLiveW("op") - 30 - 30 - 5 * 6 - 2 * 4, F_MIN.val, 640);
10868
10873
  };
10869
10874
  const isRtl = () => {
10870
10875
  const p = filterPanelRef.current;
@@ -10997,12 +11002,12 @@ function Datatable({
10997
11002
  setFPanelSize(null);
10998
11003
  const p = filterPanelRef.current;
10999
11004
  if (p) {
11000
- ["--twc-dt-fcol-usr", "--twc-dt-fop-usr", "--twc-dt-fval-usr", "--twc-dt-panel-w", "--twc-dt-panel-h"].forEach((v) => p.style.removeProperty(v));
11005
+ ["--twc-dt-fcol-usr", "--twc-dt-fop-usr", "--twc-dt-fval-usr", "--twc-dt-flogic-usr", "--twc-dt-panel-w", "--twc-dt-panel-h"].forEach((v) => p.style.removeProperty(v));
11001
11006
  p.removeAttribute("data-val-fixed");
11002
11007
  p.removeAttribute("data-panel-sized");
11003
11008
  }
11004
11009
  };
11005
- const hasFilterSizeOverride = fWidths.col != null || fWidths.op != null || fWidths.val != null || fPanelSize != null;
11010
+ const hasFilterSizeOverride = fWidths.col != null || fWidths.op != null || fWidths.val != null || fWidths.logic != null || fPanelSize != null;
11006
11011
  const POP_MIN_W = { columns: 240, agg: 240, pivot: 260, batchedit: 260 };
11007
11012
  const popMinW = (id) => POP_MIN_W[id] || 200;
11008
11013
  const clearPop = (id, node) => {
@@ -12552,6 +12557,7 @@ function Datatable({
12552
12557
  "--twc-dt-fcol-usr": fWidths.col != null ? `${fWidths.col}px` : void 0,
12553
12558
  "--twc-dt-fop-usr": fWidths.op != null ? `${fWidths.op}px` : void 0,
12554
12559
  "--twc-dt-fval-usr": fWidths.val != null ? `${fWidths.val}px` : void 0,
12560
+ "--twc-dt-flogic-usr": fWidths.logic != null ? `${fWidths.logic}px` : void 0,
12555
12561
  "--twc-dt-panel-w": fPanelSize?.w != null ? `${fPanelSize.w}px` : void 0,
12556
12562
  "--twc-dt-panel-h": fPanelSize?.h != null ? `${fPanelSize.h}px` : void 0,
12557
12563
  "--twc-dt-fcol-cap": filterFieldMaxWidth ? `${filterFieldMaxWidth}px` : void 0,
@@ -12572,17 +12578,20 @@ function Datatable({
12572
12578
  const ops = opsFor(filterTypeOf(col));
12573
12579
  const op = ops.find((o) => o.value === f.op) || ops[0];
12574
12580
  return /* @__PURE__ */ jsxs("div", { className: "twc-dt__frow", children: [
12575
- /* @__PURE__ */ jsx("div", { className: "twc-dt__f-logic", children: i === 0 ? /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: "Where" }) : i === 1 ? /* @__PURE__ */ jsx(
12576
- Select,
12577
- {
12578
- size: "sm",
12579
- portal: true,
12580
- "aria-label": "Combine with the other filters",
12581
- value: filterLogic,
12582
- options: [{ value: "and", label: "And" }, { value: "or", label: "Or" }],
12583
- onChange: (v) => setFilterLogic(v)
12584
- }
12585
- ) : /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: filterLogic === "or" ? "Or" : "And" }) }),
12581
+ /* @__PURE__ */ jsxs("div", { className: "twc-dt__f-logic", children: [
12582
+ i === 0 ? /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: "Where" }) : i === 1 ? /* @__PURE__ */ jsx(
12583
+ Select,
12584
+ {
12585
+ size: "sm",
12586
+ portal: true,
12587
+ "aria-label": "Combine with the other filters",
12588
+ value: filterLogic,
12589
+ options: [{ value: "and", label: "And" }, { value: "or", label: "Or" }],
12590
+ onChange: (v) => setFilterLogic(v)
12591
+ }
12592
+ ) : /* @__PURE__ */ jsx("span", { className: "twc-dt__f-where", children: filterLogic === "or" ? "Or" : "And" }),
12593
+ fieldHandle("logic", i)
12594
+ ] }),
12586
12595
  /* @__PURE__ */ jsxs("div", { className: "twc-dt__f-col", children: [
12587
12596
  /* @__PURE__ */ jsx(
12588
12597
  Select,