@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.js CHANGED
@@ -2253,6 +2253,20 @@ var BUILTIN_TRANSFORMS = {
2253
2253
  return parts[parts.length - 1] || "";
2254
2254
  },
2255
2255
  initials: (v) => v.split(/\s+/).map((w) => w[0] || "").join("").toUpperCase(),
2256
+ // Name parts. Handles "Last, First [Middle]" (comma form) and "First [Middle]
2257
+ // Last" (no comma). firstName → the given name(s); lastName → the surname.
2258
+ firstName: (v) => {
2259
+ const c = v.indexOf(",");
2260
+ if (c >= 0) return v.slice(c + 1).trim();
2261
+ const parts = v.trim().split(/\s+/).filter(Boolean);
2262
+ return parts.length > 1 ? parts.slice(0, -1).join(" ") : parts[0] || "";
2263
+ },
2264
+ lastName: (v) => {
2265
+ const c = v.indexOf(",");
2266
+ if (c >= 0) return v.slice(0, c).trim();
2267
+ const parts = v.trim().split(/\s+/).filter(Boolean);
2268
+ return parts.length > 1 ? parts[parts.length - 1] : parts[0] || "";
2269
+ },
2256
2270
  // Numeric / substring
2257
2271
  last4: (v) => v.slice(-4),
2258
2272
  last2: (v) => v.slice(-2),
@@ -2989,8 +3003,13 @@ ${row.join(",")}`, "csv");
2989
3003
  if (isRedactField(field)) {
2990
3004
  return null;
2991
3005
  }
3006
+ const textStyle = {
3007
+ letterSpacing: field.letterSpacing ? `${field.letterSpacing}pt` : void 0,
3008
+ lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
3009
+ ...getCssTextStyle(field)
3010
+ };
2992
3011
  if (field.formula) {
2993
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value formula", style: getCssTextStyle(field), children: field.value || "" });
3012
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value formula", style: textStyle, children: field.value || "" });
2994
3013
  }
2995
3014
  const editable = field.assignee === signer;
2996
3015
  if (!editable) {
@@ -3000,7 +3019,7 @@ ${row.join(",")}`, "csv");
3000
3019
  if (field.type === "checkbox") {
3001
3020
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "field-checkbox-display readonly", children: field.value === "true" ? "\u2713" : "" });
3002
3021
  }
3003
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-placeholder readonly", style: getCssTextStyle(field), children: field.value || field.placeholder });
3022
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-placeholder readonly", style: textStyle, children: field.value || field.placeholder });
3004
3023
  }
3005
3024
  if (isSignatureField(field)) {
3006
3025
  if (field.value) {
@@ -3022,13 +3041,8 @@ ${row.join(",")}`, "csv");
3022
3041
  );
3023
3042
  }
3024
3043
  if (field.type === "signed-date") {
3025
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value", style: getCssTextStyle(field), children: field.value || (/* @__PURE__ */ new Date()).toLocaleDateString() });
3044
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FitText, { maxPt: field.fontSize, shrink: !!field.autoShrink, className: "field-overlay-value", style: textStyle, children: field.value || (/* @__PURE__ */ new Date()).toLocaleDateString() });
3026
3045
  }
3027
- const fontStyle = {
3028
- letterSpacing: field.letterSpacing ? `${field.letterSpacing}pt` : void 0,
3029
- lineHeight: field.lineHeight ? `${field.lineHeight}` : void 0,
3030
- ...getCssTextStyle(field)
3031
- };
3032
3046
  if (field.type === "dropdown" || field.options && field.options.length > 0) {
3033
3047
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3034
3048
  "select",
@@ -3038,7 +3052,7 @@ ${row.join(",")}`, "csv");
3038
3052
  onChange: (e) => handleFieldUpdate(field.id, e.target.value),
3039
3053
  onFocus: () => setSelectedFieldId(field.id),
3040
3054
  onClick: (e) => e.stopPropagation(),
3041
- style: { fontSize: `${field.fontSize}pt`, ...fontStyle },
3055
+ style: { fontSize: `${field.fontSize}pt`, ...textStyle },
3042
3056
  children: [
3043
3057
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: field.placeholder || "Select..." }),
3044
3058
  (field.options || []).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: opt, children: opt }, opt))
@@ -3059,7 +3073,7 @@ ${row.join(",")}`, "csv");
3059
3073
  onChange: (e) => handleFieldUpdate(field.id, e.target.value),
3060
3074
  onFocus: () => setSelectedFieldId(field.id),
3061
3075
  onClick: (e) => e.stopPropagation(),
3062
- style: fontStyle
3076
+ style: textStyle
3063
3077
  }
3064
3078
  );
3065
3079
  }, [signer, handleFieldUpdate, setSelectedFieldId]);