{"version":3,"file":"h-helper.mjs","names":[],"sources":["../../../../../../packages/components/table/src/h-helper.ts"],"sourcesContent":["import { h } from 'vue'\nimport { isUndefined } from '@element-plus/utils'\n\nimport type { TableColumnCtx } from './table-column/defaults'\nimport type { DefaultRow } from './table/defaults'\n\ntype Props = {\n  tableLayout: 'fixed' | 'auto'\n  columns?: TableColumnCtx<DefaultRow>[]\n}\n\nexport function hColgroup(props: Props) {\n  const isAuto = props.tableLayout === 'auto'\n  let columns = props.columns || []\n  if (isAuto) {\n    if (columns.every(({ width }) => isUndefined(width))) {\n      columns = []\n    }\n  }\n  const getPropsData = (column: TableColumnCtx<DefaultRow>) => {\n    const propsData = {\n      key: `${props.tableLayout}_${column.id}`,\n      style: {},\n      name: undefined as string | undefined,\n    }\n    if (isAuto) {\n      propsData.style = {\n        width: `${column.width}px`,\n      }\n    } else {\n      propsData.name = column.id\n    }\n    return propsData\n  }\n\n  return h(\n    'colgroup',\n    {},\n    columns.map((column) => h('col', getPropsData(column)))\n  )\n}\n\nhColgroup.props = ['columns', 'tableLayout']\n"],"mappings":";;;AAWA,SAAgB,UAAU,OAAc;CACtC,MAAM,SAAS,MAAM,gBAAgB;CACrC,IAAI,UAAU,MAAM,WAAW,CAAC;CAChC,IAAI,QACE;MAAA,QAAQ,OAAO,EAAE,YAAY,YAAY,KAAK,CAAC,GACjD,UAAU,CAAC;CAAA;CAGf,MAAM,gBAAgB,WAAuC;EAC3D,MAAM,YAAY;GAChB,KAAK,GAAG,MAAM,YAAY,GAAG,OAAO;GACpC,OAAO,CAAC;GACR,MAAM,KAAA;EACR;EACA,IAAI,QACF,UAAU,QAAQ,EAChB,OAAO,GAAG,OAAO,MAAM,IACzB;OAEA,UAAU,OAAO,OAAO;EAE1B,OAAO;CACT;CAEA,OAAO,EACL,YACA,CAAC,GACD,QAAQ,KAAK,WAAW,EAAE,OAAO,aAAa,MAAM,CAAC,CAAC,CACxD;AACF;AAEA,UAAU,QAAQ,CAAC,WAAW,aAAa"}