@apexcura/core 0.0.15-Beta10 → 0.0.15-Beta101

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
@@ -16,7 +16,7 @@ type FormExecutorProps = {
16
16
  className?: string;
17
17
  action?: string;
18
18
  order?: number;
19
- sie?: string;
19
+ size?: string;
20
20
  colCount?: number;
21
21
  disabled?: boolean;
22
22
  activeClassName?: string;
@@ -26,7 +26,7 @@ type FormExecutorProps = {
26
26
  icon?: string;
27
27
  placement?: string;
28
28
  profileImageClassName?: string;
29
- value?: string | number | boolean | any[] | object[] | null;
29
+ value?: string | number | boolean | any[] | null | object;
30
30
  img?: string;
31
31
  primaryText?: string;
32
32
  secondaryText?: string;
@@ -63,14 +63,19 @@ type FormExecutorProps = {
63
63
  placeholder?: string;
64
64
  element?: string;
65
65
  type?: string;
66
- value?: string | number | boolean | any[] | object[] | null;
67
- fieldNames?: any[];
68
- optionType?: string;
66
+ value?: string | number | boolean | any[] | null | object;
69
67
  options?: {
68
+ key?: number;
69
+ label: string;
70
+ value: string;
71
+ }[];
72
+ selectBefore?: {
73
+ label: string;
74
+ value: string;
75
+ }[];
76
+ selectAfter?: {
70
77
  label: string;
71
78
  value: string;
72
- className?: string;
73
- selectedClassName?: string;
74
79
  }[];
75
80
  dropDownOptions?: any[];
76
81
  visible?: boolean;
@@ -84,7 +89,7 @@ type FormExecutorProps = {
84
89
  styles?: React.CSSProperties;
85
90
  fieldClassName?: string;
86
91
  elementClassName?: string;
87
- variant?: "outlined" | "borderless" | "filled";
92
+ variant?: string;
88
93
  thead?: {
89
94
  id: number;
90
95
  name?: string;
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ type FormExecutorProps = {
16
16
  className?: string;
17
17
  action?: string;
18
18
  order?: number;
19
- sie?: string;
19
+ size?: string;
20
20
  colCount?: number;
21
21
  disabled?: boolean;
22
22
  activeClassName?: string;
@@ -26,7 +26,7 @@ type FormExecutorProps = {
26
26
  icon?: string;
27
27
  placement?: string;
28
28
  profileImageClassName?: string;
29
- value?: string | number | boolean | any[] | object[] | null;
29
+ value?: string | number | boolean | any[] | null | object;
30
30
  img?: string;
31
31
  primaryText?: string;
32
32
  secondaryText?: string;
@@ -63,14 +63,19 @@ type FormExecutorProps = {
63
63
  placeholder?: string;
64
64
  element?: string;
65
65
  type?: string;
66
- value?: string | number | boolean | any[] | object[] | null;
67
- fieldNames?: any[];
68
- optionType?: string;
66
+ value?: string | number | boolean | any[] | null | object;
69
67
  options?: {
68
+ key?: number;
69
+ label: string;
70
+ value: string;
71
+ }[];
72
+ selectBefore?: {
73
+ label: string;
74
+ value: string;
75
+ }[];
76
+ selectAfter?: {
70
77
  label: string;
71
78
  value: string;
72
- className?: string;
73
- selectedClassName?: string;
74
79
  }[];
75
80
  dropDownOptions?: any[];
76
81
  visible?: boolean;
@@ -84,7 +89,7 @@ type FormExecutorProps = {
84
89
  styles?: React.CSSProperties;
85
90
  fieldClassName?: string;
86
91
  elementClassName?: string;
87
- variant?: "outlined" | "borderless" | "filled";
92
+ variant?: string;
88
93
  thead?: {
89
94
  id: number;
90
95
  name?: string;
package/dist/index.js CHANGED
@@ -99,26 +99,23 @@ 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) => {
103
- let prev = schema;
104
- prev?.map((fie) => {
105
- if (fie.name === name) {
106
- fie["value"] = option;
107
- props.selectedRecord(option);
108
- }
109
- if (fie.fields && fie.fields.length) {
110
- fie.fields.map((sub) => {
111
- if (sub.name === name) {
112
- sub["value"] = option;
113
- props.selectedRecord(option);
114
- }
115
- return sub;
116
- });
117
- }
118
- return fie;
119
- });
120
- setSchema([...prev]);
121
- props.setData({ ...props.data, schema: prev });
102
+ const onHandleChange = (name, value) => {
103
+ const updateSchema = (schema2) => {
104
+ return schema2.map((field) => {
105
+ if (field.name === name) {
106
+ field["value"] = value;
107
+ props.selectedRecord(field);
108
+ }
109
+ if (field.fields && field.fields.length) {
110
+ field.fields = updateSchema(field.fields);
111
+ }
112
+ return field;
113
+ });
114
+ };
115
+ console.log("schema--------------", schema);
116
+ const updatedSchema = updateSchema(schema);
117
+ setSchema(updatedSchema);
118
+ props.setData({ ...props.data, schema: updatedSchema });
122
119
  };
123
120
  const handleSelectData = async () => {
124
121
  try {
@@ -156,7 +153,7 @@ var ElementExecutor = (props) => {
156
153
  onChange: (value) => onHandleChange(elementProps.name || "", value)
157
154
  }
158
155
  );
159
- case "input-gender":
156
+ case "single-select":
160
157
  return /* @__PURE__ */ import_react.default.createElement(
161
158
  import_ui_components.SelectElement,
162
159
  {
@@ -221,17 +218,89 @@ var ElementExecutor = (props) => {
221
218
  case "div":
222
219
  return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
223
220
  case "button":
224
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
221
+ return /* @__PURE__ */ import_react.default.createElement(
222
+ import_ui_components.ButtonElement,
223
+ {
224
+ ...elementProps,
225
+ onClick: () => props.selectedRecord(elementProps)
226
+ }
227
+ );
225
228
  case "sidebar":
226
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
229
+ return /* @__PURE__ */ import_react.default.createElement(
230
+ import_ui_components.Sidebar,
231
+ {
232
+ ...elementProps,
233
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
234
+ }
235
+ );
227
236
  case "navbar":
228
237
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
229
238
  case "table":
230
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.TableElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
239
+ return /* @__PURE__ */ import_react.default.createElement(
240
+ import_ui_components.TableElement,
241
+ {
242
+ ...elementProps,
243
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
244
+ }
245
+ );
231
246
  case "daterangepicker":
232
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
247
+ return /* @__PURE__ */ import_react.default.createElement(
248
+ import_ui_components.DateRangePickerElement,
249
+ {
250
+ ...elementProps,
251
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
252
+ }
253
+ );
233
254
  case "datepicker":
234
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
255
+ return /* @__PURE__ */ import_react.default.createElement(
256
+ import_ui_components.DatePickerElement,
257
+ {
258
+ ...elementProps,
259
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
260
+ }
261
+ );
262
+ case "upload":
263
+ return /* @__PURE__ */ import_react.default.createElement(
264
+ import_ui_components.FileUpload,
265
+ {
266
+ ...elementProps,
267
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
268
+ }
269
+ );
270
+ case "image":
271
+ return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Image, { ...elementProps });
272
+ case "input-password":
273
+ return /* @__PURE__ */ import_react.default.createElement(
274
+ import_ui_components.PasswordElement,
275
+ {
276
+ ...elementProps,
277
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
278
+ }
279
+ );
280
+ case "single-checkbox":
281
+ return /* @__PURE__ */ import_react.default.createElement(
282
+ import_ui_components.SingleCheckbox,
283
+ {
284
+ ...elementProps,
285
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
286
+ }
287
+ );
288
+ case "dropdown-group":
289
+ return /* @__PURE__ */ import_react.default.createElement(
290
+ import_ui_components.DropDownGroup,
291
+ {
292
+ ...elementProps,
293
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
294
+ }
295
+ );
296
+ case "tabs":
297
+ return /* @__PURE__ */ import_react.default.createElement(
298
+ import_ui_components.TabsElement,
299
+ {
300
+ ...elementProps,
301
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
302
+ }
303
+ );
235
304
  default:
236
305
  return null;
237
306
  }
@@ -239,7 +308,7 @@ var ElementExecutor = (props) => {
239
308
  const renderFields = (schema2) => {
240
309
  return schema2 && schema2.map((eachSection) => {
241
310
  if (eachSection.visible !== false) {
242
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderElement(eachSection), /* @__PURE__ */ import_react.default.createElement("div", { className: eachSection.className, key: eachSection.name }, eachSection.label && /* @__PURE__ */ import_react.default.createElement("p", { className: eachSection.labelClassName }, eachSection.label), renderFields(eachSection.fields))) : renderElement(eachSection));
311
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderElement(eachSection), /* @__PURE__ */ import_react.default.createElement("div", { className: eachSection.className, key: eachSection.name }, renderFields(eachSection.fields))) : renderElement(eachSection));
243
312
  }
244
313
  return null;
245
314
  });
package/dist/index.mjs CHANGED
@@ -16,7 +16,13 @@ import {
16
16
  Navbar,
17
17
  TableElement,
18
18
  DateRangePickerElement,
19
- DatePickerElement
19
+ DatePickerElement,
20
+ Image,
21
+ PasswordElement,
22
+ SingleCheckbox,
23
+ DropDownGroup,
24
+ FileUpload,
25
+ TabsElement
20
26
  } from "@apexcura/ui-components";
21
27
 
22
28
  // src/services/http-service.tsx
@@ -80,26 +86,23 @@ function postService(url, method, data) {
80
86
  var ElementExecutor = (props) => {
81
87
  const [data, setData] = useState([]);
82
88
  const [schema, setSchema] = useState(props.data.schema);
83
- const onHandleChange = (name, option) => {
84
- let prev = schema;
85
- prev?.map((fie) => {
86
- if (fie.name === name) {
87
- fie["value"] = option;
88
- props.selectedRecord(option);
89
- }
90
- if (fie.fields && fie.fields.length) {
91
- fie.fields.map((sub) => {
92
- if (sub.name === name) {
93
- sub["value"] = option;
94
- props.selectedRecord(option);
95
- }
96
- return sub;
97
- });
98
- }
99
- return fie;
100
- });
101
- setSchema([...prev]);
102
- props.setData({ ...props.data, schema: prev });
89
+ const onHandleChange = (name, value) => {
90
+ const updateSchema = (schema2) => {
91
+ return schema2.map((field) => {
92
+ if (field.name === name) {
93
+ field["value"] = value;
94
+ props.selectedRecord(field);
95
+ }
96
+ if (field.fields && field.fields.length) {
97
+ field.fields = updateSchema(field.fields);
98
+ }
99
+ return field;
100
+ });
101
+ };
102
+ console.log("schema--------------", schema);
103
+ const updatedSchema = updateSchema(schema);
104
+ setSchema(updatedSchema);
105
+ props.setData({ ...props.data, schema: updatedSchema });
103
106
  };
104
107
  const handleSelectData = async () => {
105
108
  try {
@@ -137,7 +140,7 @@ var ElementExecutor = (props) => {
137
140
  onChange: (value) => onHandleChange(elementProps.name || "", value)
138
141
  }
139
142
  );
140
- case "input-gender":
143
+ case "single-select":
141
144
  return /* @__PURE__ */ React.createElement(
142
145
  SelectElement,
143
146
  {
@@ -202,17 +205,89 @@ var ElementExecutor = (props) => {
202
205
  case "div":
203
206
  return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
204
207
  case "button":
205
- return /* @__PURE__ */ React.createElement(ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
208
+ return /* @__PURE__ */ React.createElement(
209
+ ButtonElement,
210
+ {
211
+ ...elementProps,
212
+ onClick: () => props.selectedRecord(elementProps)
213
+ }
214
+ );
206
215
  case "sidebar":
207
- return /* @__PURE__ */ React.createElement(Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
216
+ return /* @__PURE__ */ React.createElement(
217
+ Sidebar,
218
+ {
219
+ ...elementProps,
220
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
221
+ }
222
+ );
208
223
  case "navbar":
209
224
  return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
210
225
  case "table":
211
- return /* @__PURE__ */ React.createElement(TableElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
226
+ return /* @__PURE__ */ React.createElement(
227
+ TableElement,
228
+ {
229
+ ...elementProps,
230
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
231
+ }
232
+ );
212
233
  case "daterangepicker":
213
- return /* @__PURE__ */ React.createElement(DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
234
+ return /* @__PURE__ */ React.createElement(
235
+ DateRangePickerElement,
236
+ {
237
+ ...elementProps,
238
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
239
+ }
240
+ );
214
241
  case "datepicker":
215
- return /* @__PURE__ */ React.createElement(DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
242
+ return /* @__PURE__ */ React.createElement(
243
+ DatePickerElement,
244
+ {
245
+ ...elementProps,
246
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
247
+ }
248
+ );
249
+ case "upload":
250
+ return /* @__PURE__ */ React.createElement(
251
+ FileUpload,
252
+ {
253
+ ...elementProps,
254
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
255
+ }
256
+ );
257
+ case "image":
258
+ return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
259
+ case "input-password":
260
+ return /* @__PURE__ */ React.createElement(
261
+ PasswordElement,
262
+ {
263
+ ...elementProps,
264
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
265
+ }
266
+ );
267
+ case "single-checkbox":
268
+ return /* @__PURE__ */ React.createElement(
269
+ SingleCheckbox,
270
+ {
271
+ ...elementProps,
272
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
273
+ }
274
+ );
275
+ case "dropdown-group":
276
+ return /* @__PURE__ */ React.createElement(
277
+ DropDownGroup,
278
+ {
279
+ ...elementProps,
280
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
281
+ }
282
+ );
283
+ case "tabs":
284
+ return /* @__PURE__ */ React.createElement(
285
+ TabsElement,
286
+ {
287
+ ...elementProps,
288
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
289
+ }
290
+ );
216
291
  default:
217
292
  return null;
218
293
  }
@@ -220,7 +295,7 @@ var ElementExecutor = (props) => {
220
295
  const renderFields = (schema2) => {
221
296
  return schema2 && schema2.map((eachSection) => {
222
297
  if (eachSection.visible !== false) {
223
- return /* @__PURE__ */ React.createElement(React.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: eachSection.name }, eachSection.label && /* @__PURE__ */ React.createElement("p", { className: eachSection.labelClassName }, eachSection.label), renderFields(eachSection.fields))) : renderElement(eachSection));
298
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: eachSection.name }, renderFields(eachSection.fields))) : renderElement(eachSection));
224
299
  }
225
300
  return null;
226
301
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.15-Beta10",
3
+ "version": "0.0.15-Beta101",
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-Beta5",
31
+ "@apexcura/ui-components": "^0.0.13-Beta87",
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",