@apexcura/ui-components 0.0.10 → 0.0.11-Beta0

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
@@ -362,11 +362,30 @@ var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(i
362
362
  var import_react13 = __toESM(require("react"));
363
363
  var import_antd11 = require("antd");
364
364
  var AddMoreTable = (props) => {
365
- const { thead } = props;
366
- console.log("thead--------", thead);
365
+ const { thead, tbody } = props;
366
+ const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
367
+ title: eachHeadEl.label,
368
+ dataIndex: eachHeadEl.name,
369
+ key: eachHeadEl.id
370
+ })) : [];
371
+ const dataSource = tbody && tbody.length > 0 ? tbody.map((eachRow, index) => {
372
+ const variableData = eachRow.variable_data.reduce((acc, curr) => {
373
+ acc[curr.label] = curr.element;
374
+ return acc;
375
+ }, {});
376
+ return {
377
+ key: index.toString(),
378
+ ...variableData,
379
+ ...eachRow
380
+ };
381
+ }) : [];
367
382
  return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
368
383
  import_antd11.Table,
369
- null
384
+ {
385
+ columns,
386
+ expandable: { defaultExpandedRowKeys: ["0"] },
387
+ dataSource
388
+ }
370
389
  ));
371
390
  };
372
391
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -315,11 +315,30 @@ var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "s
315
315
  import React12 from "react";
316
316
  import { Table } from "antd";
317
317
  var AddMoreTable = (props) => {
318
- const { thead } = props;
319
- console.log("thead--------", thead);
318
+ const { thead, tbody } = props;
319
+ const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
320
+ title: eachHeadEl.label,
321
+ dataIndex: eachHeadEl.name,
322
+ key: eachHeadEl.id
323
+ })) : [];
324
+ const dataSource = tbody && tbody.length > 0 ? tbody.map((eachRow, index) => {
325
+ const variableData = eachRow.variable_data.reduce((acc, curr) => {
326
+ acc[curr.label] = curr.element;
327
+ return acc;
328
+ }, {});
329
+ return {
330
+ key: index.toString(),
331
+ ...variableData,
332
+ ...eachRow
333
+ };
334
+ }) : [];
320
335
  return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
321
336
  Table,
322
- null
337
+ {
338
+ columns,
339
+ expandable: { defaultExpandedRowKeys: ["0"] },
340
+ dataSource
341
+ }
323
342
  ));
324
343
  };
325
344
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.10",
3
+ "version": "0.0.11-Beta0",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",