@apexcura/core 0.0.15-Beta118 → 0.0.15-Beta13

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