@apexcura/core 0.0.15-Beta1 → 0.0.15-Beta100

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
@@ -100,31 +100,22 @@ 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
102
  const onHandleChange = (name, value) => {
103
- let prev = schema;
104
- prev?.map((fie) => {
105
- if (fie.name === name) {
106
- fie["value"] = value;
107
- }
108
- if (fie.element === "radio=input") {
109
- fie.options.map((eachOption) => {
110
- if (eachOption.name === name) {
111
- props.selectedRecord(value);
112
- }
113
- });
114
- }
115
- if (fie.fields && fie.fields.length) {
116
- fie.fields.map((sub) => {
117
- if (sub.name === name) {
118
- sub["value"] = value;
119
- props.selectedRecord(fie);
120
- }
121
- return sub;
122
- });
123
- }
124
- return fie;
125
- });
126
- setSchema([...prev]);
127
- props.setData({ ...props.data, schema: prev });
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 });
128
119
  };
129
120
  const handleSelectData = async () => {
130
121
  try {
@@ -162,7 +153,7 @@ var ElementExecutor = (props) => {
162
153
  onChange: (value) => onHandleChange(elementProps.name || "", value)
163
154
  }
164
155
  );
165
- case "input-gender":
156
+ case "single-select":
166
157
  return /* @__PURE__ */ import_react.default.createElement(
167
158
  import_ui_components.SelectElement,
168
159
  {
@@ -227,17 +218,89 @@ var ElementExecutor = (props) => {
227
218
  case "div":
228
219
  return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
229
220
  case "button":
230
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.ButtonElement, { ...elementProps });
221
+ return /* @__PURE__ */ import_react.default.createElement(
222
+ import_ui_components.ButtonElement,
223
+ {
224
+ ...elementProps,
225
+ onClick: () => props.selectedRecord(elementProps)
226
+ }
227
+ );
231
228
  case "sidebar":
232
- 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
+ );
233
236
  case "navbar":
234
237
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
235
238
  case "table":
236
- 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
+ );
237
246
  case "daterangepicker":
238
- 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
+ );
239
254
  case "datepicker":
240
- 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
+ );
241
304
  default:
242
305
  return null;
243
306
  }
@@ -245,7 +308,7 @@ var ElementExecutor = (props) => {
245
308
  const renderFields = (schema2) => {
246
309
  return schema2 && schema2.map((eachSection) => {
247
310
  if (eachSection.visible !== false) {
248
- 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));
249
312
  }
250
313
  return null;
251
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
@@ -81,31 +87,22 @@ var ElementExecutor = (props) => {
81
87
  const [data, setData] = useState([]);
82
88
  const [schema, setSchema] = useState(props.data.schema);
83
89
  const onHandleChange = (name, value) => {
84
- let prev = schema;
85
- prev?.map((fie) => {
86
- if (fie.name === name) {
87
- fie["value"] = value;
88
- }
89
- if (fie.element === "radio=input") {
90
- fie.options.map((eachOption) => {
91
- if (eachOption.name === name) {
92
- props.selectedRecord(value);
93
- }
94
- });
95
- }
96
- if (fie.fields && fie.fields.length) {
97
- fie.fields.map((sub) => {
98
- if (sub.name === name) {
99
- sub["value"] = value;
100
- props.selectedRecord(fie);
101
- }
102
- return sub;
103
- });
104
- }
105
- return fie;
106
- });
107
- setSchema([...prev]);
108
- props.setData({ ...props.data, schema: prev });
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 });
109
106
  };
110
107
  const handleSelectData = async () => {
111
108
  try {
@@ -143,7 +140,7 @@ var ElementExecutor = (props) => {
143
140
  onChange: (value) => onHandleChange(elementProps.name || "", value)
144
141
  }
145
142
  );
146
- case "input-gender":
143
+ case "single-select":
147
144
  return /* @__PURE__ */ React.createElement(
148
145
  SelectElement,
149
146
  {
@@ -208,17 +205,89 @@ var ElementExecutor = (props) => {
208
205
  case "div":
209
206
  return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
210
207
  case "button":
211
- return /* @__PURE__ */ React.createElement(ButtonElement, { ...elementProps });
208
+ return /* @__PURE__ */ React.createElement(
209
+ ButtonElement,
210
+ {
211
+ ...elementProps,
212
+ onClick: () => props.selectedRecord(elementProps)
213
+ }
214
+ );
212
215
  case "sidebar":
213
- 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
+ );
214
223
  case "navbar":
215
224
  return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
216
225
  case "table":
217
- 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
+ );
218
233
  case "daterangepicker":
219
- 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
+ );
220
241
  case "datepicker":
221
- 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
+ );
222
291
  default:
223
292
  return null;
224
293
  }
@@ -226,7 +295,7 @@ var ElementExecutor = (props) => {
226
295
  const renderFields = (schema2) => {
227
296
  return schema2 && schema2.map((eachSection) => {
228
297
  if (eachSection.visible !== false) {
229
- 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));
230
299
  }
231
300
  return null;
232
301
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.15-Beta1",
3
+ "version": "0.0.15-Beta100",
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-Beta86",
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",