@apexcura/ui-components 0.0.12-Beta6 → 0.0.12

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
@@ -22,7 +22,6 @@ type ElementType = {
22
22
  id?: number;
23
23
  thead?: any[];
24
24
  tbody?: any[];
25
- variable_data?: any[];
26
25
  };
27
26
 
28
27
  interface ElementExecuterProps$3 extends ElementType {
package/dist/index.d.ts CHANGED
@@ -22,7 +22,6 @@ type ElementType = {
22
22
  id?: number;
23
23
  thead?: any[];
24
24
  tbody?: any[];
25
- variable_data?: any[];
26
25
  };
27
26
 
28
27
  interface ElementExecuterProps$3 extends ElementType {
package/dist/index.js CHANGED
@@ -360,85 +360,11 @@ var ButtonElement = () => /* @__PURE__ */ import_react12.default.createElement(i
360
360
 
361
361
  // src/Components/AddMoreTable.tsx
362
362
  var import_react13 = __toESM(require("react"));
363
- var import_antd11 = require("antd");
364
- var import_icons2 = require("@ant-design/icons");
365
363
  var AddMoreTable = (props) => {
366
364
  const { thead, tbody } = props;
367
- const [tableData, setTableData] = (0, import_react13.useState)({});
368
- const [rows, setRows] = (0, import_react13.useState)(tbody || []);
369
- function isColumnType(column) {
370
- return column.dataIndex !== void 0;
371
- }
372
- const onHandleChange = (name, value) => {
373
- setTableData((prev) => ({ ...prev, [name]: value }));
374
- console.log(tableData);
375
- };
376
- const onHandleRows = () => {
377
- const lastRow = rows[rows.length - 1];
378
- const newId = lastRow ? lastRow.id + 1 : lastRow.id;
379
- const newRow = {
380
- ...lastRow,
381
- id: newId
382
- };
383
- setRows((prevData) => [...prevData, newRow]);
384
- };
385
- const onHandleDelete = (index) => {
386
- const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
387
- setRows(remainingRows);
388
- };
389
- const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
390
- title: eachHeadEl.label,
391
- dataIndex: eachHeadEl.name,
392
- key: eachHeadEl.id
393
- })) : [];
394
- const renderInputElement = (element) => {
395
- const { element: type, label } = element;
396
- console.log("type....", type);
397
- if (type === "single-select") {
398
- return /* @__PURE__ */ import_react13.default.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
399
- } else if (type === "textarea") {
400
- return /* @__PURE__ */ import_react13.default.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
401
- } else {
402
- return null;
403
- }
404
- };
405
- const dataSource = rows.map((eachRow, index) => {
406
- const rowElements = {};
407
- if (eachRow.element && eachRow.label) {
408
- rowElements[eachRow.label] = renderInputElement(eachRow);
409
- }
410
- const variableData = eachRow.variable_data && Array.isArray(eachRow.variable_data) ? eachRow.variable_data.reduce((acc, curr) => {
411
- if (!curr.label || !curr.element) {
412
- console.error(`Invalid element in row ${index}:`, curr);
413
- return acc;
414
- }
415
- acc[curr.label] = renderInputElement(curr);
416
- return acc;
417
- }, {}) : {};
418
- return {
419
- key: index.toString(),
420
- "#": index + 1,
421
- ...eachRow,
422
- ...rowElements,
423
- ...variableData,
424
- actions: /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("button", { onClick: () => onHandleDelete(index) }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ import_react13.default.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ import_react13.default.createElement(import_icons2.PlusOutlined, null)))
425
- };
426
- });
427
- if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
428
- columns.push({
429
- title: "Actions",
430
- dataIndex: "actions",
431
- key: "actions"
432
- });
433
- }
434
- return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement(
435
- import_antd11.Table,
436
- {
437
- columns,
438
- expandable: { defaultExpandedRowKeys: ["0"] },
439
- dataSource
440
- }
441
- ));
365
+ console.log("tbody----------", tbody);
366
+ console.log("thead----------", thead);
367
+ return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null);
442
368
  };
443
369
  // Annotate the CommonJS export names for ESM import in node:
444
370
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -312,86 +312,12 @@ import { Button as Button2, Flex as Flex2 } from "antd";
312
312
  var ButtonElement = () => /* @__PURE__ */ React11.createElement(Flex2, { gap: "small" }, /* @__PURE__ */ React11.createElement(Button2, { type: "primary" }, "Primary Button"));
313
313
 
314
314
  // src/Components/AddMoreTable.tsx
315
- import React12, { useState as useState3 } from "react";
316
- import { Table } from "antd";
317
- import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
315
+ import React12 from "react";
318
316
  var AddMoreTable = (props) => {
319
317
  const { thead, tbody } = props;
320
- const [tableData, setTableData] = useState3({});
321
- const [rows, setRows] = useState3(tbody || []);
322
- function isColumnType(column) {
323
- return column.dataIndex !== void 0;
324
- }
325
- const onHandleChange = (name, value) => {
326
- setTableData((prev) => ({ ...prev, [name]: value }));
327
- console.log(tableData);
328
- };
329
- const onHandleRows = () => {
330
- const lastRow = rows[rows.length - 1];
331
- const newId = lastRow ? lastRow.id + 1 : lastRow.id;
332
- const newRow = {
333
- ...lastRow,
334
- id: newId
335
- };
336
- setRows((prevData) => [...prevData, newRow]);
337
- };
338
- const onHandleDelete = (index) => {
339
- const remainingRows = rows.filter((eachRow) => eachRow.id !== index);
340
- setRows(remainingRows);
341
- };
342
- const columns = thead && thead.length > 0 ? thead.map((eachHeadEl) => ({
343
- title: eachHeadEl.label,
344
- dataIndex: eachHeadEl.name,
345
- key: eachHeadEl.id
346
- })) : [];
347
- const renderInputElement = (element) => {
348
- const { element: type, label } = element;
349
- console.log("type....", type);
350
- if (type === "single-select") {
351
- return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value) => onHandleChange(label, value) });
352
- } else if (type === "textarea") {
353
- return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value) => onHandleChange(label, value) });
354
- } else {
355
- return null;
356
- }
357
- };
358
- const dataSource = rows.map((eachRow, index) => {
359
- const rowElements = {};
360
- if (eachRow.element && eachRow.label) {
361
- rowElements[eachRow.label] = renderInputElement(eachRow);
362
- }
363
- const variableData = eachRow.variable_data && Array.isArray(eachRow.variable_data) ? eachRow.variable_data.reduce((acc, curr) => {
364
- if (!curr.label || !curr.element) {
365
- console.error(`Invalid element in row ${index}:`, curr);
366
- return acc;
367
- }
368
- acc[curr.label] = renderInputElement(curr);
369
- return acc;
370
- }, {}) : {};
371
- return {
372
- key: index.toString(),
373
- "#": index + 1,
374
- ...eachRow,
375
- ...rowElements,
376
- ...variableData,
377
- actions: /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement("button", { onClick: () => onHandleDelete(index) }, /* @__PURE__ */ React12.createElement(DeleteOutlined, null)), index === rows.length - 1 && /* @__PURE__ */ React12.createElement("button", { onClick: onHandleRows }, /* @__PURE__ */ React12.createElement(PlusOutlined, null)))
378
- };
379
- });
380
- if (!columns.some((col) => isColumnType(col) && col.dataIndex === "actions")) {
381
- columns.push({
382
- title: "Actions",
383
- dataIndex: "actions",
384
- key: "actions"
385
- });
386
- }
387
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
388
- Table,
389
- {
390
- columns,
391
- expandable: { defaultExpandedRowKeys: ["0"] },
392
- dataSource
393
- }
394
- ));
318
+ console.log("tbody----------", tbody);
319
+ console.log("thead----------", thead);
320
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null);
395
321
  };
396
322
  export {
397
323
  AddMoreTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.12-Beta6",
3
+ "version": "0.0.12",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",