@apexcura/core 0.0.15-Beta2 → 0.0.15-Beta20

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