@apexcura/core 0.0.15-Beta19 → 0.0.15-Beta2

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
@@ -99,18 +99,24 @@ function postService(url, method, data) {
99
99
  var ElementExecutor = (props) => {
100
100
  const [data, setData] = (0, import_react.useState)([]);
101
101
  const [schema, setSchema] = (0, import_react.useState)(props.data.schema);
102
- const onHandleChange = (name, option) => {
102
+ const onHandleChange = (name, value) => {
103
103
  let prev = schema;
104
104
  prev?.map((fie) => {
105
105
  if (fie.name === name) {
106
- fie["value"] = option;
107
- props.selectedRecord(option);
106
+ fie["value"] = value;
107
+ }
108
+ if (fie.element === "input-radio") {
109
+ fie.options.map((eachOption) => {
110
+ if (eachOption.name === name) {
111
+ props.selectedRecord(value);
112
+ }
113
+ });
108
114
  }
109
115
  if (fie.fields && fie.fields.length) {
110
116
  fie.fields.map((sub) => {
111
117
  if (sub.name === name) {
112
- sub["value"] = option;
113
- props.selectedRecord(option);
118
+ sub["value"] = value;
119
+ props.selectedRecord(fie);
114
120
  }
115
121
  return sub;
116
122
  });
@@ -221,7 +227,7 @@ var ElementExecutor = (props) => {
221
227
  case "div":
222
228
  return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
223
229
  case "button":
224
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
230
+ return /* @__PURE__ */ import_react.default.createElement(import_ui_components.ButtonElement, { ...elementProps });
225
231
  case "sidebar":
226
232
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
227
233
  case "navbar":
@@ -232,8 +238,6 @@ var ElementExecutor = (props) => {
232
238
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
233
239
  case "datepicker":
234
240
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
235
- case "upload":
236
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.UploadElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
237
241
  default:
238
242
  return null;
239
243
  }
package/dist/index.mjs CHANGED
@@ -16,8 +16,7 @@ import {
16
16
  Navbar,
17
17
  TableElement,
18
18
  DateRangePickerElement,
19
- DatePickerElement,
20
- UploadElement
19
+ DatePickerElement
21
20
  } from "@apexcura/ui-components";
22
21
 
23
22
  // src/services/http-service.tsx
@@ -81,18 +80,24 @@ function postService(url, method, data) {
81
80
  var ElementExecutor = (props) => {
82
81
  const [data, setData] = useState([]);
83
82
  const [schema, setSchema] = useState(props.data.schema);
84
- const onHandleChange = (name, option) => {
83
+ const onHandleChange = (name, value) => {
85
84
  let prev = schema;
86
85
  prev?.map((fie) => {
87
86
  if (fie.name === name) {
88
- fie["value"] = option;
89
- props.selectedRecord(option);
87
+ fie["value"] = value;
88
+ }
89
+ if (fie.element === "input-radio") {
90
+ fie.options.map((eachOption) => {
91
+ if (eachOption.name === name) {
92
+ props.selectedRecord(value);
93
+ }
94
+ });
90
95
  }
91
96
  if (fie.fields && fie.fields.length) {
92
97
  fie.fields.map((sub) => {
93
98
  if (sub.name === name) {
94
- sub["value"] = option;
95
- props.selectedRecord(option);
99
+ sub["value"] = value;
100
+ props.selectedRecord(fie);
96
101
  }
97
102
  return sub;
98
103
  });
@@ -203,7 +208,7 @@ var ElementExecutor = (props) => {
203
208
  case "div":
204
209
  return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
205
210
  case "button":
206
- return /* @__PURE__ */ React.createElement(ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
211
+ return /* @__PURE__ */ React.createElement(ButtonElement, { ...elementProps });
207
212
  case "sidebar":
208
213
  return /* @__PURE__ */ React.createElement(Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
209
214
  case "navbar":
@@ -214,8 +219,6 @@ var ElementExecutor = (props) => {
214
219
  return /* @__PURE__ */ React.createElement(DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
215
220
  case "datepicker":
216
221
  return /* @__PURE__ */ React.createElement(DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
217
- case "upload":
218
- return /* @__PURE__ */ React.createElement(UploadElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
219
222
  default:
220
223
  return null;
221
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.15-Beta19",
3
+ "version": "0.0.15-Beta2",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",
@@ -28,7 +28,7 @@
28
28
  "build": "tsup"
29
29
  },
30
30
  "dependencies": {
31
- "@apexcura/ui-components": "^0.0.13-Beta13",
31
+ "@apexcura/ui-components": "^0.0.13-Beta0",
32
32
  "@testing-library/jest-dom": "^6.4.2",
33
33
  "@testing-library/react": "^15.0.6",
34
34
  "@types/react-global-configuration": "^1.3.3",