@apexcura/ui-components 0.0.10 → 0.0.11-Beta1

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,32 @@ 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
+ console.log("eachRow---------", eachRow);
382
+ console.log("VariableData", { ...variableData });
383
+ }) : [];
367
384
  return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
368
385
  import_antd11.Table,
369
- null
386
+ {
387
+ columns,
388
+ expandable: { defaultExpandedRowKeys: ["0"] },
389
+ dataSource
390
+ }
370
391
  ));
371
392
  };
372
393
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -315,11 +315,32 @@ 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
+ console.log("eachRow---------", eachRow);
335
+ console.log("VariableData", { ...variableData });
336
+ }) : [];
320
337
  return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
321
338
  Table,
322
- null
339
+ {
340
+ columns,
341
+ expandable: { defaultExpandedRowKeys: ["0"] },
342
+ dataSource
343
+ }
323
344
  ));
324
345
  };
325
346
  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-Beta1",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",