@unlev/exeq 0.5.6 → 0.5.7

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.mjs CHANGED
@@ -2185,6 +2185,20 @@ var BUILTIN_TRANSFORMS = {
2185
2185
  return parts[parts.length - 1] || "";
2186
2186
  },
2187
2187
  initials: (v) => v.split(/\s+/).map((w) => w[0] || "").join("").toUpperCase(),
2188
+ // Name parts. Handles "Last, First [Middle]" (comma form) and "First [Middle]
2189
+ // Last" (no comma). firstName → the given name(s); lastName → the surname.
2190
+ firstName: (v) => {
2191
+ const c = v.indexOf(",");
2192
+ if (c >= 0) return v.slice(c + 1).trim();
2193
+ const parts = v.trim().split(/\s+/).filter(Boolean);
2194
+ return parts.length > 1 ? parts.slice(0, -1).join(" ") : parts[0] || "";
2195
+ },
2196
+ lastName: (v) => {
2197
+ const c = v.indexOf(",");
2198
+ if (c >= 0) return v.slice(0, c).trim();
2199
+ const parts = v.trim().split(/\s+/).filter(Boolean);
2200
+ return parts.length > 1 ? parts[parts.length - 1] : parts[0] || "";
2201
+ },
2188
2202
  // Numeric / substring
2189
2203
  last4: (v) => v.slice(-4),
2190
2204
  last2: (v) => v.slice(-2),
@@ -2921,8 +2935,13 @@ ${row.join(",")}`, "csv");
2921
2935
  if (isRedactField(field)) {
2922
2936
  return null;
2923
2937
  }
2938
+ const textStyle = {
2939
+ letterSpacing: field.letterSpacing ? `${field.letterSpacing}pt` : void 0,
2940
+ lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
2941
+ ...getCssTextStyle(field)
2942
+ };
2924
2943
  if (field.formula) {
2925
- return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value formula", style: getCssTextStyle(field), children: field.value || "" });
2944
+ return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value formula", style: textStyle, children: field.value || "" });
2926
2945
  }
2927
2946
  const editable = field.assignee === signer;
2928
2947
  if (!editable) {
@@ -2932,7 +2951,7 @@ ${row.join(",")}`, "csv");
2932
2951
  if (field.type === "checkbox") {
2933
2952
  return /* @__PURE__ */ jsx6("div", { className: "field-checkbox-display readonly", children: field.value === "true" ? "\u2713" : "" });
2934
2953
  }
2935
- return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-placeholder readonly", style: getCssTextStyle(field), children: field.value || field.placeholder });
2954
+ return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-placeholder readonly", style: textStyle, children: field.value || field.placeholder });
2936
2955
  }
2937
2956
  if (isSignatureField(field)) {
2938
2957
  if (field.value) {
@@ -2954,13 +2973,8 @@ ${row.join(",")}`, "csv");
2954
2973
  );
2955
2974
  }
2956
2975
  if (field.type === "signed-date") {
2957
- return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value", style: getCssTextStyle(field), children: field.value || (/* @__PURE__ */ new Date()).toLocaleDateString() });
2976
+ return /* @__PURE__ */ jsx6(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value", style: textStyle, children: field.value || (/* @__PURE__ */ new Date()).toLocaleDateString() });
2958
2977
  }
2959
- const fontStyle = {
2960
- letterSpacing: field.letterSpacing ? `${field.letterSpacing}pt` : void 0,
2961
- lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
2962
- ...getCssTextStyle(field)
2963
- };
2964
2978
  if (field.type === "dropdown" || field.options && field.options.length > 0) {
2965
2979
  return /* @__PURE__ */ jsxs6(
2966
2980
  "select",
@@ -2970,7 +2984,7 @@ ${row.join(",")}`, "csv");
2970
2984
  onChange: (e) => handleFieldUpdate(field.id, e.target.value),
2971
2985
  onFocus: () => setSelectedFieldId(field.id),
2972
2986
  onClick: (e) => e.stopPropagation(),
2973
- style: { fontSize: `${field.fontSize}pt`, ...fontStyle },
2987
+ style: { fontSize: `${field.fontSize}pt`, ...textStyle },
2974
2988
  children: [
2975
2989
  /* @__PURE__ */ jsx6("option", { value: "", children: field.placeholder || "Select..." }),
2976
2990
  (field.options || []).map((opt) => /* @__PURE__ */ jsx6("option", { value: opt, children: opt }, opt))
@@ -2991,7 +3005,7 @@ ${row.join(",")}`, "csv");
2991
3005
  onChange: (e) => handleFieldUpdate(field.id, e.target.value),
2992
3006
  onFocus: () => setSelectedFieldId(field.id),
2993
3007
  onClick: (e) => e.stopPropagation(),
2994
- style: fontStyle
3008
+ style: textStyle
2995
3009
  }
2996
3010
  );
2997
3011
  }, [signer, handleFieldUpdate, setSelectedFieldId]);