@pdfme/ui 6.1.13-dev.13 → 6.1.13-dev.17

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
@@ -46152,9 +46152,22 @@ var replacePlaceholders = (arg) => {
46152
46152
  var EPSILON = .01;
46153
46153
  /** Calculate the content height of a page (drawable area excluding padding) */
46154
46154
  var getContentHeight = (basePdf) => basePdf.height - basePdf.padding[0] - basePdf.padding[2];
46155
+ /**
46156
+ * Resolve a readOnly table body.
46157
+ * Uses input[schema.name] when present (array or JSON string) and never runs
46158
+ * replacePlaceholders. Falls back to schema.content (Designer sample).
46159
+ */
46160
+ var getReadOnlyTableValue = (schema, input) => {
46161
+ if (input && Object.prototype.hasOwnProperty.call(input, schema.name)) {
46162
+ const value = input[schema.name];
46163
+ if (value !== void 0 && value !== null) return typeof value === "string" ? value : JSON.stringify(value);
46164
+ }
46165
+ return schema.content || "";
46166
+ };
46155
46167
  /** Get the input value for a schema */
46156
46168
  var getSchemaValue = (schema, input, schemas) => {
46157
46169
  if (!schema.readOnly) return input?.[schema.name] || "";
46170
+ if (schema.type === "table") return getReadOnlyTableValue(schema, input);
46158
46171
  if (schema.type !== "text" && schema.type !== "multiVariableText") return schema.content || "";
46159
46172
  return replacePlaceholders({
46160
46173
  content: schema.content || "",
@@ -225859,7 +225872,7 @@ var StaticSchema = (props) => {
225859
225872
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: schemasForUI.map((schema) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Renderer, {
225860
225873
  schema,
225861
225874
  basePdf,
225862
- value: schema.readOnly ? replacePlaceholders({
225875
+ value: schema.readOnly && schema.type === "table" ? getReadOnlyTableValue(schema, input) : schema.readOnly ? replacePlaceholders({
225863
225876
  content: schema.content || "",
225864
225877
  variables: {
225865
225878
  ...input,
@@ -226235,7 +226248,7 @@ var Canvas = (props, ref) => {
226235
226248
  const mode = editing && activeElements.map((ae) => ae.id).includes(schema.id) ? "designer" : "viewer";
226236
226249
  const content = schema.content || "";
226237
226250
  let value = content;
226238
- if (mode !== "designer" && schema.readOnly) value = replacePlaceholders({
226251
+ if (mode !== "designer" && schema.readOnly && schema.type !== "table") value = replacePlaceholders({
226239
226252
  content,
226240
226253
  variables: {
226241
226254
  ...schemasList.flat().reduce((acc, currSchema) => {
@@ -227664,7 +227677,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
227664
227677
  backgrounds,
227665
227678
  renderSchema: ({ schema, index }) => {
227666
227679
  const hasInputValue = Boolean(input && Object.prototype.hasOwnProperty.call(input, schema.name));
227667
- const value = schema.readOnly ? replacePlaceholders({
227680
+ const value = schema.readOnly && schema.type === "table" ? getReadOnlyTableValue(schema, input) : schema.readOnly ? replacePlaceholders({
227668
227681
  content: schema.content || "",
227669
227682
  variables: {
227670
227683
  ...input,