import {
  escapeObjectForInlineBinding,
  processDefaultTemplate
} from "./template.js";
import { templateToHeader } from "./templateFormTable.js";
export function processTemplateFormTableData(item, parentTemplates, dataVariable) {
  let tableOptions = Object.assign({ title: item.inputLabel || "", dataTemplate: {}, itemTemplate: {} }, item.inputOptions);
  let tableHeader = tableOptions.headers || [];
  if (tableHeader.length === 0) {
    tableHeader = templateToHeader(tableOptions.itemTemplate);
  }
  let tableItemTemplate = "";
  tableHeader.forEach((h) => {
    if (h.template) {
      tableItemTemplate += `\r
<template #item.${h.key}="props">${h.template}</template>`;
    }
  });
  let disableApplyToAll = tableOptions.disableApplyToAll && tableOptions.disableApplyToAll == "partial" ? escapeObjectForInlineBinding(tableOptions.disableApplyToAllPartial?.split(",").map((h) => h.trim()) || []) : !!(tableOptions.disableApplyToAll && tableOptions.disableApplyToAll == "true");
  return processDefaultTemplate(item, void 0, `title="${tableOptions.title}" :headers='${escapeObjectForInlineBinding(tableHeader)}' :itemsInitial='${escapeObjectForInlineBinding(tableOptions.items || [])}' :dataTemplate='${escapeObjectForInlineBinding(tableOptions.dataTemplate)}' :disableApplyToAll='${disableApplyToAll}'`, void 0, dataVariable);
}
