@apexcura/ui-components 0.0.9-Beta9 → 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.d.mts CHANGED
@@ -20,6 +20,8 @@ type ElementType = {
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
21
  dropDownOptions?: any[];
22
22
  id?: number;
23
+ thead?: any[];
24
+ tbody?: any[];
23
25
  };
24
26
 
25
27
  interface ElementExecuterProps$3 extends ElementType {
@@ -66,6 +68,6 @@ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element
66
68
 
67
69
  declare const ButtonElement: () => React$1.JSX.Element;
68
70
 
69
- declare const AddMoreTable: () => React$1.JSX.Element;
71
+ declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
70
72
 
71
73
  export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
package/dist/index.d.ts CHANGED
@@ -20,6 +20,8 @@ type ElementType = {
20
20
  onChange?: (value: string | number | boolean | any[]) => void;
21
21
  dropDownOptions?: any[];
22
22
  id?: number;
23
+ thead?: any[];
24
+ tbody?: any[];
23
25
  };
24
26
 
25
27
  interface ElementExecuterProps$3 extends ElementType {
@@ -66,6 +68,6 @@ declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element
66
68
 
67
69
  declare const ButtonElement: () => React$1.JSX.Element;
68
70
 
69
- declare const AddMoreTable: () => React$1.JSX.Element;
71
+ declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
70
72
 
71
73
  export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, MultipleSelectElement, NumberElement, PasswordElement, RadioElement, SelectElement, SingleSelectElement, TextElement, TextareaElement };
package/dist/index.js CHANGED
@@ -361,34 +361,30 @@ var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(i
361
361
  // src/Components/AddMoreTable.tsx
362
362
  var import_react13 = __toESM(require("react"));
363
363
  var import_antd11 = require("antd");
364
- var AddMoreTable = () => {
365
- const columns = [
366
- { title: "Name", dataIndex: "name", key: "name" },
367
- { title: "Platform", dataIndex: "platform", key: "platform" },
368
- { title: "Version", dataIndex: "version", key: "version" },
369
- { title: "Upgraded", dataIndex: "upgradeNum", key: "upgradeNum" },
370
- { title: "Creator", dataIndex: "creator", key: "creator" },
371
- { title: "Date", dataIndex: "createdAt", key: "createdAt" },
372
- { title: "Action", key: "operation", render: () => /* @__PURE__ */ import_react13.default.createElement("a", null, "Publish") }
373
- ];
374
- const data = [];
375
- for (let i = 0; i < 3; ++i) {
376
- data.push({
377
- key: i.toString(),
378
- name: "Screen",
379
- platform: "iOS",
380
- version: "10.3.4.5654",
381
- upgradeNum: 500,
382
- creator: "Jack",
383
- createdAt: "2014-12-24 23:12:00"
384
- });
385
- }
364
+ var AddMoreTable = (props) => {
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
+ }) : [];
386
382
  return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
387
383
  import_antd11.Table,
388
384
  {
389
385
  columns,
390
386
  expandable: { defaultExpandedRowKeys: ["0"] },
391
- dataSource: data
387
+ dataSource
392
388
  }
393
389
  ));
394
390
  };
package/dist/index.mjs CHANGED
@@ -314,34 +314,30 @@ var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "s
314
314
  // src/Components/AddMoreTable.tsx
315
315
  import React12 from "react";
316
316
  import { Table } from "antd";
317
- var AddMoreTable = () => {
318
- const columns = [
319
- { title: "Name", dataIndex: "name", key: "name" },
320
- { title: "Platform", dataIndex: "platform", key: "platform" },
321
- { title: "Version", dataIndex: "version", key: "version" },
322
- { title: "Upgraded", dataIndex: "upgradeNum", key: "upgradeNum" },
323
- { title: "Creator", dataIndex: "creator", key: "creator" },
324
- { title: "Date", dataIndex: "createdAt", key: "createdAt" },
325
- { title: "Action", key: "operation", render: () => /* @__PURE__ */ React12.createElement("a", null, "Publish") }
326
- ];
327
- const data = [];
328
- for (let i = 0; i < 3; ++i) {
329
- data.push({
330
- key: i.toString(),
331
- name: "Screen",
332
- platform: "iOS",
333
- version: "10.3.4.5654",
334
- upgradeNum: 500,
335
- creator: "Jack",
336
- createdAt: "2014-12-24 23:12:00"
337
- });
338
- }
317
+ var AddMoreTable = (props) => {
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
+ }) : [];
339
335
  return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
340
336
  Table,
341
337
  {
342
338
  columns,
343
339
  expandable: { defaultExpandedRowKeys: ["0"] },
344
- dataSource: data
340
+ dataSource
345
341
  }
346
342
  ));
347
343
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.9-Beta9",
3
+ "version": "0.0.11-Beta0",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",