@apexcura/core 0.0.15-Beta11 → 0.0.15-Beta110

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;
@@ -92,6 +97,7 @@ type FormExecutorProps = {
92
97
  visible?: boolean;
93
98
  required?: boolean;
94
99
  key?: string;
100
+ render?: () => void;
95
101
  }[];
96
102
  tbody?: {
97
103
  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
- 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;
@@ -92,6 +97,7 @@ type FormExecutorProps = {
92
97
  visible?: boolean;
93
98
  required?: boolean;
94
99
  key?: string;
100
+ render?: () => void;
95
101
  }[];
96
102
  tbody?: {
97
103
  id?: number;
package/dist/index.js CHANGED
@@ -99,26 +99,25 @@ 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
+ 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 });
122
121
  };
123
122
  const handleSelectData = async () => {
124
123
  try {
@@ -156,7 +155,7 @@ var ElementExecutor = (props) => {
156
155
  onChange: (value) => onHandleChange(elementProps.name || "", value)
157
156
  }
158
157
  );
159
- case "input-gender":
158
+ case "single-select":
160
159
  return /* @__PURE__ */ import_react.default.createElement(
161
160
  import_ui_components.SelectElement,
162
161
  {
@@ -221,19 +220,89 @@ var ElementExecutor = (props) => {
221
220
  case "div":
222
221
  return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
223
222
  case "button":
224
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
223
+ return /* @__PURE__ */ import_react.default.createElement(
224
+ import_ui_components.ButtonElement,
225
+ {
226
+ ...elementProps,
227
+ onClick: () => props.selectedRecord(elementProps)
228
+ }
229
+ );
225
230
  case "sidebar":
226
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
231
+ return /* @__PURE__ */ import_react.default.createElement(
232
+ import_ui_components.Sidebar,
233
+ {
234
+ ...elementProps,
235
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
236
+ }
237
+ );
227
238
  case "navbar":
228
239
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
229
240
  case "table":
230
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.TableElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
241
+ return /* @__PURE__ */ import_react.default.createElement(
242
+ import_ui_components.TableElement,
243
+ {
244
+ ...elementProps,
245
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
246
+ }
247
+ );
231
248
  case "daterangepicker":
232
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
249
+ return /* @__PURE__ */ import_react.default.createElement(
250
+ import_ui_components.DateRangePickerElement,
251
+ {
252
+ ...elementProps,
253
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
254
+ }
255
+ );
233
256
  case "datepicker":
234
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
257
+ return /* @__PURE__ */ import_react.default.createElement(
258
+ import_ui_components.DatePickerElement,
259
+ {
260
+ ...elementProps,
261
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
262
+ }
263
+ );
235
264
  case "upload":
236
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.UploadElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
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
+ );
237
306
  default:
238
307
  return null;
239
308
  }
@@ -241,7 +310,7 @@ var ElementExecutor = (props) => {
241
310
  const renderFields = (schema2) => {
242
311
  return schema2 && schema2.map((eachSection) => {
243
312
  if (eachSection.visible !== false) {
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));
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));
245
314
  }
246
315
  return null;
247
316
  });
package/dist/index.mjs CHANGED
@@ -17,7 +17,12 @@ import {
17
17
  TableElement,
18
18
  DateRangePickerElement,
19
19
  DatePickerElement,
20
- UploadElement
20
+ Image,
21
+ PasswordElement,
22
+ SingleCheckbox,
23
+ DropDownGroup,
24
+ FileUpload,
25
+ TabsElement
21
26
  } from "@apexcura/ui-components";
22
27
 
23
28
  // src/services/http-service.tsx
@@ -81,26 +86,25 @@ function postService(url, method, data) {
81
86
  var ElementExecutor = (props) => {
82
87
  const [data, setData] = useState([]);
83
88
  const [schema, setSchema] = useState(props.data.schema);
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 });
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 });
104
108
  };
105
109
  const handleSelectData = async () => {
106
110
  try {
@@ -138,7 +142,7 @@ var ElementExecutor = (props) => {
138
142
  onChange: (value) => onHandleChange(elementProps.name || "", value)
139
143
  }
140
144
  );
141
- case "input-gender":
145
+ case "single-select":
142
146
  return /* @__PURE__ */ React.createElement(
143
147
  SelectElement,
144
148
  {
@@ -203,19 +207,89 @@ var ElementExecutor = (props) => {
203
207
  case "div":
204
208
  return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
205
209
  case "button":
206
- return /* @__PURE__ */ React.createElement(ButtonElement, { ...elementProps, onClick: () => props.selectedRecord(elementProps) });
210
+ return /* @__PURE__ */ React.createElement(
211
+ ButtonElement,
212
+ {
213
+ ...elementProps,
214
+ onClick: () => props.selectedRecord(elementProps)
215
+ }
216
+ );
207
217
  case "sidebar":
208
- return /* @__PURE__ */ React.createElement(Sidebar, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
218
+ return /* @__PURE__ */ React.createElement(
219
+ Sidebar,
220
+ {
221
+ ...elementProps,
222
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
223
+ }
224
+ );
209
225
  case "navbar":
210
226
  return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
211
227
  case "table":
212
- return /* @__PURE__ */ React.createElement(TableElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
228
+ return /* @__PURE__ */ React.createElement(
229
+ TableElement,
230
+ {
231
+ ...elementProps,
232
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
233
+ }
234
+ );
213
235
  case "daterangepicker":
214
- return /* @__PURE__ */ React.createElement(DateRangePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
236
+ return /* @__PURE__ */ React.createElement(
237
+ DateRangePickerElement,
238
+ {
239
+ ...elementProps,
240
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
241
+ }
242
+ );
215
243
  case "datepicker":
216
- return /* @__PURE__ */ React.createElement(DatePickerElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
244
+ return /* @__PURE__ */ React.createElement(
245
+ DatePickerElement,
246
+ {
247
+ ...elementProps,
248
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
249
+ }
250
+ );
217
251
  case "upload":
218
- return /* @__PURE__ */ React.createElement(UploadElement, { ...elementProps, onChange: (value) => onHandleChange(elementProps.name || "", value) });
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
+ );
219
293
  default:
220
294
  return null;
221
295
  }
@@ -223,7 +297,7 @@ var ElementExecutor = (props) => {
223
297
  const renderFields = (schema2) => {
224
298
  return schema2 && schema2.map((eachSection) => {
225
299
  if (eachSection.visible !== false) {
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));
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));
227
301
  }
228
302
  return null;
229
303
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.15-Beta11",
3
+ "version": "0.0.15-Beta110",
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-Beta6",
31
+ "@apexcura/ui-components": "^0.0.13-Beta95",
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",