@apexcura/core 0.0.17-Beta7 → 0.0.17-Beta71

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
@@ -1,178 +1,178 @@
1
1
  import React from 'react';
2
+ import { UploadFile } from 'antd';
2
3
 
3
4
  type styling = {
4
5
  horizontalGutter?: number;
5
6
  verticalGutter?: number;
6
7
  };
8
+ type pagenationType = {
9
+ page?: number;
10
+ pageSize?: number;
11
+ };
12
+ type SchemaField = {
13
+ name?: string;
14
+ label?: string;
15
+ source?: string;
16
+ visible?: boolean;
17
+ element?: string;
18
+ className?: string;
19
+ action?: string;
20
+ order?: number;
21
+ colCount?: number;
22
+ disabled?: boolean;
23
+ activeClassName?: string;
24
+ listClassName?: string;
25
+ listItemClassName?: string;
26
+ buttonClassName?: string;
27
+ icon?: string;
28
+ placement?: string;
29
+ firstPlaceholder?: string;
30
+ secondPlaceholder?: string;
31
+ enabled_dates?: string;
32
+ profileImageClassName?: string;
33
+ value?: string | number | boolean | null | object | undefined | string[] | UploadFile[] | pagenationType;
34
+ message?: string;
35
+ description?: string;
36
+ notificationType?: 'error' | 'warning' | 'success' | 'info' | undefined;
37
+ showProgress?: boolean;
38
+ picker?: 'date' | 'week' | 'month' | 'quarter' | 'year';
39
+ weekrange?: boolean;
40
+ img?: string;
41
+ primaryText?: string;
42
+ secondaryText?: string;
43
+ count?: number;
44
+ profileImage?: string;
45
+ profileSubClassName?: string;
46
+ containerClassName?: string;
47
+ subContainerClassName?: string;
48
+ secondTextClassName?: string;
49
+ iconsClassName?: string;
50
+ labelClassName?: string;
51
+ view?: boolean;
52
+ isSVGStylesOverride?: boolean;
53
+ rowSelection?: string;
54
+ length?: number;
55
+ loading?: boolean;
56
+ fillText1?: string;
57
+ fillText2?: string;
58
+ pagination?: boolean;
59
+ is_detail?: boolean;
60
+ dateTime?: string;
61
+ minRows?: number;
62
+ maxRows?: number;
63
+ mode?: 'multiple' | 'tags' | undefined;
64
+ items?: {
65
+ icon?: React.JSX.Element | string;
66
+ label?: string;
67
+ active?: boolean;
68
+ text?: string;
69
+ time?: string;
70
+ name?: string;
71
+ y?: number;
72
+ color?: string;
73
+ }[];
74
+ options?: {
75
+ key?: string;
76
+ label?: string;
77
+ value?: string;
78
+ }[];
79
+ firstOptions?: {
80
+ key?: string;
81
+ label?: string;
82
+ value?: string;
83
+ }[];
84
+ secondOptions?: {
85
+ key?: string;
86
+ label?: string;
87
+ value?: string | string[];
88
+ }[];
89
+ selectBefore?: {
90
+ label?: string;
91
+ value?: string;
92
+ }[];
93
+ selectAfter?: {
94
+ label?: string;
95
+ value?: string;
96
+ }[];
97
+ dropDownOptions?: (number | string | boolean | object | null | undefined | (() => void))[];
98
+ required?: boolean;
99
+ prefix?: React.ReactNode;
100
+ suffix?: React.ReactNode;
101
+ addonBefore?: React.ReactNode;
102
+ defaultValue?: string;
103
+ status?: 'error' | 'warning';
104
+ styles?: React.CSSProperties;
105
+ fieldClassName?: string;
106
+ elementClassName?: string;
107
+ variant?: 'outlined' | 'borderless' | 'filled' | undefined;
108
+ thead?: {
109
+ id?: number;
110
+ name?: string;
111
+ label?: string;
112
+ visible?: boolean;
113
+ required?: boolean;
114
+ key?: string;
115
+ render?: () => void;
116
+ ellipsis: boolean;
117
+ }[];
118
+ tbody?: {
119
+ id?: number;
120
+ name?: string;
121
+ label?: string;
122
+ element?: string;
123
+ type?: string;
124
+ variable_data?: {
125
+ id: {
126
+ id?: number;
127
+ };
128
+ Route?: {
129
+ label: string;
130
+ element: string;
131
+ type: string;
132
+ };
133
+ Dose?: {
134
+ label: string;
135
+ element: string;
136
+ type: string;
137
+ };
138
+ Frequency?: {
139
+ label: string;
140
+ element: string;
141
+ type: string;
142
+ };
143
+ When?: {
144
+ label: string;
145
+ element: string;
146
+ type: string;
147
+ };
148
+ Duration?: {
149
+ label: string;
150
+ element: string;
151
+ type: string;
152
+ };
153
+ Instructions?: {
154
+ label: string;
155
+ element: string;
156
+ type: string;
157
+ };
158
+ SubRows?: {
159
+ label: string;
160
+ };
161
+ }[];
162
+ }[];
163
+ payload_keys?: string[];
164
+ api_endpoint?: string;
165
+ next_id?: string;
166
+ fields?: SchemaField[];
167
+ };
168
+ type Schema = SchemaField[];
7
169
  type FormExecutorProps = {
8
170
  data: {
9
171
  className: string;
10
- schema?: {
11
- name?: string;
12
- label?: string;
13
- source?: string;
14
- visible?: boolean;
15
- element?: string;
16
- className?: string;
17
- action?: string;
18
- order?: number;
19
- size?: string;
20
- colCount?: number;
21
- disabled?: boolean;
22
- activeClassName?: string;
23
- listClassName?: string;
24
- listItemClassName?: string;
25
- buttonClassName?: string;
26
- icon?: string;
27
- placement?: string;
28
- profileImageClassName?: string;
29
- value?: string | number | boolean | any[] | null | object;
30
- img?: string;
31
- primaryText?: string;
32
- secondaryText?: string;
33
- count?: number;
34
- profileImage?: string;
35
- profileSubClassName?: string;
36
- containerClassName?: string;
37
- subContainerClassName?: string;
38
- secondTextClassName?: string;
39
- iconsClassName?: string;
40
- labelClassName?: string;
41
- view?: boolean;
42
- isSVGStylesOverride?: boolean;
43
- rowSelection?: boolean;
44
- length?: number;
45
- loading?: boolean;
46
- modalContent?: {
47
- className?: string;
48
- fields?: {
49
- _id?: string;
50
- name?: string;
51
- label?: string;
52
- source?: string;
53
- initial_message?: boolean;
54
- element: string;
55
- className?: string;
56
- position?: string;
57
- }[];
58
- };
59
- items?: {
60
- icon?: React.JSX.Element | string;
61
- label?: string;
62
- active?: boolean;
63
- text?: string;
64
- time?: string;
65
- name?: string;
66
- y?: number;
67
- color?: string;
68
- }[];
69
- fields?: {
70
- name?: string;
71
- label?: string;
72
- placeholder?: string;
73
- element?: string;
74
- type?: string;
75
- value?: string | number | boolean | any[] | null | object;
76
- options?: {
77
- key?: number;
78
- label: string;
79
- value: string;
80
- }[];
81
- firstOptions?: {
82
- key?: number;
83
- label: string;
84
- value: string;
85
- }[];
86
- secondOptions?: {
87
- key?: number;
88
- label: string;
89
- value: string;
90
- }[];
91
- selectBefore?: {
92
- label: string;
93
- value: string;
94
- }[];
95
- selectAfter?: {
96
- label: string;
97
- value: string;
98
- }[];
99
- dropDownOptions?: any[];
100
- visible?: boolean;
101
- disabled?: boolean;
102
- required?: boolean;
103
- prefix?: React.ReactNode;
104
- suffix?: React.ReactNode;
105
- addonBefore?: React.ReactNode;
106
- defaultValue?: string;
107
- status?: "error" | "warning";
108
- styles?: React.CSSProperties;
109
- fieldClassName?: string;
110
- elementClassName?: string;
111
- variant?: string;
112
- thead?: {
113
- id: number;
114
- name?: string;
115
- label?: string;
116
- visible?: boolean;
117
- required?: boolean;
118
- key?: string;
119
- render?: () => void;
120
- ellipsis: boolean;
121
- }[];
122
- tbody?: {
123
- id?: number;
124
- name?: string;
125
- label?: string;
126
- element?: string;
127
- type?: string;
128
- variable_data?: {
129
- id: {
130
- id?: number;
131
- };
132
- Route?: {
133
- label: string;
134
- element: string;
135
- type: string;
136
- };
137
- Dose?: {
138
- label: string;
139
- element: string;
140
- type: string;
141
- };
142
- Frequency?: {
143
- label: string;
144
- element: string;
145
- type: string;
146
- };
147
- When?: {
148
- label: string;
149
- element: string;
150
- type: string;
151
- };
152
- Duration?: {
153
- label: string;
154
- element: string;
155
- type: string;
156
- };
157
- Instructions?: {
158
- label: string;
159
- element: string;
160
- type: string;
161
- };
162
- SubRows?: {
163
- label: string;
164
- };
165
- }[];
166
- }[];
167
- payload_keys?: string[];
168
- api_endpoint?: string;
169
- next_id?: string;
170
- action?: string;
171
- }[];
172
- }[];
172
+ schema: Schema;
173
173
  };
174
- setData: Function;
175
- selectedRecord: Function;
174
+ setData?: (schema: Schema) => void;
175
+ selectedRecord?: (field: Schema) => void;
176
176
  };
177
177
  type ElementExecutorProps = FormExecutorProps & styling;
178
178
  declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,178 +1,178 @@
1
1
  import React from 'react';
2
+ import { UploadFile } from 'antd';
2
3
 
3
4
  type styling = {
4
5
  horizontalGutter?: number;
5
6
  verticalGutter?: number;
6
7
  };
8
+ type pagenationType = {
9
+ page?: number;
10
+ pageSize?: number;
11
+ };
12
+ type SchemaField = {
13
+ name?: string;
14
+ label?: string;
15
+ source?: string;
16
+ visible?: boolean;
17
+ element?: string;
18
+ className?: string;
19
+ action?: string;
20
+ order?: number;
21
+ colCount?: number;
22
+ disabled?: boolean;
23
+ activeClassName?: string;
24
+ listClassName?: string;
25
+ listItemClassName?: string;
26
+ buttonClassName?: string;
27
+ icon?: string;
28
+ placement?: string;
29
+ firstPlaceholder?: string;
30
+ secondPlaceholder?: string;
31
+ enabled_dates?: string;
32
+ profileImageClassName?: string;
33
+ value?: string | number | boolean | null | object | undefined | string[] | UploadFile[] | pagenationType;
34
+ message?: string;
35
+ description?: string;
36
+ notificationType?: 'error' | 'warning' | 'success' | 'info' | undefined;
37
+ showProgress?: boolean;
38
+ picker?: 'date' | 'week' | 'month' | 'quarter' | 'year';
39
+ weekrange?: boolean;
40
+ img?: string;
41
+ primaryText?: string;
42
+ secondaryText?: string;
43
+ count?: number;
44
+ profileImage?: string;
45
+ profileSubClassName?: string;
46
+ containerClassName?: string;
47
+ subContainerClassName?: string;
48
+ secondTextClassName?: string;
49
+ iconsClassName?: string;
50
+ labelClassName?: string;
51
+ view?: boolean;
52
+ isSVGStylesOverride?: boolean;
53
+ rowSelection?: string;
54
+ length?: number;
55
+ loading?: boolean;
56
+ fillText1?: string;
57
+ fillText2?: string;
58
+ pagination?: boolean;
59
+ is_detail?: boolean;
60
+ dateTime?: string;
61
+ minRows?: number;
62
+ maxRows?: number;
63
+ mode?: 'multiple' | 'tags' | undefined;
64
+ items?: {
65
+ icon?: React.JSX.Element | string;
66
+ label?: string;
67
+ active?: boolean;
68
+ text?: string;
69
+ time?: string;
70
+ name?: string;
71
+ y?: number;
72
+ color?: string;
73
+ }[];
74
+ options?: {
75
+ key?: string;
76
+ label?: string;
77
+ value?: string;
78
+ }[];
79
+ firstOptions?: {
80
+ key?: string;
81
+ label?: string;
82
+ value?: string;
83
+ }[];
84
+ secondOptions?: {
85
+ key?: string;
86
+ label?: string;
87
+ value?: string | string[];
88
+ }[];
89
+ selectBefore?: {
90
+ label?: string;
91
+ value?: string;
92
+ }[];
93
+ selectAfter?: {
94
+ label?: string;
95
+ value?: string;
96
+ }[];
97
+ dropDownOptions?: (number | string | boolean | object | null | undefined | (() => void))[];
98
+ required?: boolean;
99
+ prefix?: React.ReactNode;
100
+ suffix?: React.ReactNode;
101
+ addonBefore?: React.ReactNode;
102
+ defaultValue?: string;
103
+ status?: 'error' | 'warning';
104
+ styles?: React.CSSProperties;
105
+ fieldClassName?: string;
106
+ elementClassName?: string;
107
+ variant?: 'outlined' | 'borderless' | 'filled' | undefined;
108
+ thead?: {
109
+ id?: number;
110
+ name?: string;
111
+ label?: string;
112
+ visible?: boolean;
113
+ required?: boolean;
114
+ key?: string;
115
+ render?: () => void;
116
+ ellipsis: boolean;
117
+ }[];
118
+ tbody?: {
119
+ id?: number;
120
+ name?: string;
121
+ label?: string;
122
+ element?: string;
123
+ type?: string;
124
+ variable_data?: {
125
+ id: {
126
+ id?: number;
127
+ };
128
+ Route?: {
129
+ label: string;
130
+ element: string;
131
+ type: string;
132
+ };
133
+ Dose?: {
134
+ label: string;
135
+ element: string;
136
+ type: string;
137
+ };
138
+ Frequency?: {
139
+ label: string;
140
+ element: string;
141
+ type: string;
142
+ };
143
+ When?: {
144
+ label: string;
145
+ element: string;
146
+ type: string;
147
+ };
148
+ Duration?: {
149
+ label: string;
150
+ element: string;
151
+ type: string;
152
+ };
153
+ Instructions?: {
154
+ label: string;
155
+ element: string;
156
+ type: string;
157
+ };
158
+ SubRows?: {
159
+ label: string;
160
+ };
161
+ }[];
162
+ }[];
163
+ payload_keys?: string[];
164
+ api_endpoint?: string;
165
+ next_id?: string;
166
+ fields?: SchemaField[];
167
+ };
168
+ type Schema = SchemaField[];
7
169
  type FormExecutorProps = {
8
170
  data: {
9
171
  className: string;
10
- schema?: {
11
- name?: string;
12
- label?: string;
13
- source?: string;
14
- visible?: boolean;
15
- element?: string;
16
- className?: string;
17
- action?: string;
18
- order?: number;
19
- size?: string;
20
- colCount?: number;
21
- disabled?: boolean;
22
- activeClassName?: string;
23
- listClassName?: string;
24
- listItemClassName?: string;
25
- buttonClassName?: string;
26
- icon?: string;
27
- placement?: string;
28
- profileImageClassName?: string;
29
- value?: string | number | boolean | any[] | null | object;
30
- img?: string;
31
- primaryText?: string;
32
- secondaryText?: string;
33
- count?: number;
34
- profileImage?: string;
35
- profileSubClassName?: string;
36
- containerClassName?: string;
37
- subContainerClassName?: string;
38
- secondTextClassName?: string;
39
- iconsClassName?: string;
40
- labelClassName?: string;
41
- view?: boolean;
42
- isSVGStylesOverride?: boolean;
43
- rowSelection?: boolean;
44
- length?: number;
45
- loading?: boolean;
46
- modalContent?: {
47
- className?: string;
48
- fields?: {
49
- _id?: string;
50
- name?: string;
51
- label?: string;
52
- source?: string;
53
- initial_message?: boolean;
54
- element: string;
55
- className?: string;
56
- position?: string;
57
- }[];
58
- };
59
- items?: {
60
- icon?: React.JSX.Element | string;
61
- label?: string;
62
- active?: boolean;
63
- text?: string;
64
- time?: string;
65
- name?: string;
66
- y?: number;
67
- color?: string;
68
- }[];
69
- fields?: {
70
- name?: string;
71
- label?: string;
72
- placeholder?: string;
73
- element?: string;
74
- type?: string;
75
- value?: string | number | boolean | any[] | null | object;
76
- options?: {
77
- key?: number;
78
- label: string;
79
- value: string;
80
- }[];
81
- firstOptions?: {
82
- key?: number;
83
- label: string;
84
- value: string;
85
- }[];
86
- secondOptions?: {
87
- key?: number;
88
- label: string;
89
- value: string;
90
- }[];
91
- selectBefore?: {
92
- label: string;
93
- value: string;
94
- }[];
95
- selectAfter?: {
96
- label: string;
97
- value: string;
98
- }[];
99
- dropDownOptions?: any[];
100
- visible?: boolean;
101
- disabled?: boolean;
102
- required?: boolean;
103
- prefix?: React.ReactNode;
104
- suffix?: React.ReactNode;
105
- addonBefore?: React.ReactNode;
106
- defaultValue?: string;
107
- status?: "error" | "warning";
108
- styles?: React.CSSProperties;
109
- fieldClassName?: string;
110
- elementClassName?: string;
111
- variant?: string;
112
- thead?: {
113
- id: number;
114
- name?: string;
115
- label?: string;
116
- visible?: boolean;
117
- required?: boolean;
118
- key?: string;
119
- render?: () => void;
120
- ellipsis: boolean;
121
- }[];
122
- tbody?: {
123
- id?: number;
124
- name?: string;
125
- label?: string;
126
- element?: string;
127
- type?: string;
128
- variable_data?: {
129
- id: {
130
- id?: number;
131
- };
132
- Route?: {
133
- label: string;
134
- element: string;
135
- type: string;
136
- };
137
- Dose?: {
138
- label: string;
139
- element: string;
140
- type: string;
141
- };
142
- Frequency?: {
143
- label: string;
144
- element: string;
145
- type: string;
146
- };
147
- When?: {
148
- label: string;
149
- element: string;
150
- type: string;
151
- };
152
- Duration?: {
153
- label: string;
154
- element: string;
155
- type: string;
156
- };
157
- Instructions?: {
158
- label: string;
159
- element: string;
160
- type: string;
161
- };
162
- SubRows?: {
163
- label: string;
164
- };
165
- }[];
166
- }[];
167
- payload_keys?: string[];
168
- api_endpoint?: string;
169
- next_id?: string;
170
- action?: string;
171
- }[];
172
- }[];
172
+ schema: Schema;
173
173
  };
174
- setData: Function;
175
- selectedRecord: Function;
174
+ setData?: (schema: Schema) => void;
175
+ selectedRecord?: (field: Schema) => void;
176
176
  };
177
177
  type ElementExecutorProps = FormExecutorProps & styling;
178
178
  declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(src_exports);
37
37
  // src/libraries/element-executor.tsx
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_ui_components = require("@apexcura/ui-components");
40
+ var import_moment = __toESM(require("moment"));
40
41
 
41
42
  // src/services/http-service.tsx
42
43
  var import_axios = __toESM(require("axios"));
@@ -104,7 +105,7 @@ var ElementExecutor = (props) => {
104
105
  return schema2.map((field) => {
105
106
  if (field.name === name) {
106
107
  field["value"] = value;
107
- props.selectedRecord(field);
108
+ props.selectedRecord && props.selectedRecord(field);
108
109
  }
109
110
  if (field.fields && field.fields.length) {
110
111
  field.fields = updateSchema(field.fields);
@@ -114,8 +115,13 @@ var ElementExecutor = (props) => {
114
115
  };
115
116
  const updatedSchema = updateSchema(schema);
116
117
  setSchema(updatedSchema);
117
- props.setData({ ...props.data, schema: updatedSchema });
118
+ props.setData && props.setData(updatedSchema);
118
119
  };
120
+ (0, import_react.useEffect)(() => {
121
+ if (props?.data?.schema) {
122
+ setSchema([...props.data.schema]);
123
+ }
124
+ }, [props.data]);
119
125
  const handleSelectData = async () => {
120
126
  try {
121
127
  const response = await postService("/products/", "POST", []);
@@ -215,13 +221,19 @@ var ElementExecutor = (props) => {
215
221
  case "add-more":
216
222
  return /* @__PURE__ */ import_react.default.createElement(import_ui_components.AddMoreTable, { ...elementProps });
217
223
  case "div":
218
- return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
224
+ return /* @__PURE__ */ import_react.default.createElement(
225
+ import_ui_components.DivContainer,
226
+ {
227
+ ...elementProps,
228
+ onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
229
+ }
230
+ );
219
231
  case "button":
220
232
  return /* @__PURE__ */ import_react.default.createElement(
221
233
  import_ui_components.ButtonElement,
222
234
  {
223
235
  ...elementProps,
224
- onClick: () => props.selectedRecord(elementProps)
236
+ onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
225
237
  }
226
238
  );
227
239
  case "sidebar":
@@ -258,6 +270,14 @@ var ElementExecutor = (props) => {
258
270
  onChange: (value) => onHandleChange(elementProps.name || "", value)
259
271
  }
260
272
  );
273
+ case "datetimepicker":
274
+ return /* @__PURE__ */ import_react.default.createElement(
275
+ import_ui_components.DatePickerElement,
276
+ {
277
+ ...elementProps,
278
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
279
+ }
280
+ );
261
281
  case "upload":
262
282
  return /* @__PURE__ */ import_react.default.createElement(
263
283
  import_ui_components.FileUpload,
@@ -316,16 +336,96 @@ var ElementExecutor = (props) => {
316
336
  onChange: (value) => onHandleChange(elementProps.name || "", value)
317
337
  }
318
338
  );
319
- case "donut":
320
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Donut, { ...elementProps });
339
+ case "circle-donut":
340
+ return /* @__PURE__ */ import_react.default.createElement(
341
+ import_ui_components.CircleDonut,
342
+ {
343
+ ...elementProps,
344
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
345
+ }
346
+ );
347
+ case "semicircle-donut":
348
+ return /* @__PURE__ */ import_react.default.createElement(
349
+ import_ui_components.SemiCircleDonut,
350
+ {
351
+ ...elementProps,
352
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
353
+ }
354
+ );
355
+ case "horizontal-barchart":
356
+ return /* @__PURE__ */ import_react.default.createElement(
357
+ import_ui_components.HorizontalBarChart,
358
+ {
359
+ ...elementProps,
360
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
361
+ }
362
+ );
363
+ case "linechart":
364
+ return /* @__PURE__ */ import_react.default.createElement(
365
+ import_ui_components.LineChart,
366
+ {
367
+ ...elementProps,
368
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
369
+ }
370
+ );
371
+ case "double-barchart":
372
+ return /* @__PURE__ */ import_react.default.createElement(
373
+ import_ui_components.DoubleBarChart,
374
+ {
375
+ ...elementProps,
376
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
377
+ }
378
+ );
379
+ case "barchart":
380
+ return /* @__PURE__ */ import_react.default.createElement(
381
+ import_ui_components.BarChart,
382
+ {
383
+ ...elementProps,
384
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
385
+ }
386
+ );
387
+ case "color-picker":
388
+ return /* @__PURE__ */ import_react.default.createElement(
389
+ import_ui_components.ColorPickerElement,
390
+ {
391
+ ...elementProps,
392
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
393
+ }
394
+ );
395
+ case "alert":
396
+ return /* @__PURE__ */ import_react.default.createElement(
397
+ import_ui_components.NotificationAlert,
398
+ {
399
+ ...elementProps,
400
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
401
+ }
402
+ );
321
403
  default:
322
404
  return null;
323
405
  }
324
406
  };
325
407
  const renderFields = (schema2) => {
326
- return schema2 && schema2.map((eachSection) => {
408
+ return schema2 && schema2.map((eachSection, index) => {
327
409
  if (eachSection.visible !== false) {
328
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: eachSection.name }, 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));
410
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: index }, 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: index }, renderFields(eachSection.fields)), eachSection.dateTime ? /* @__PURE__ */ import_react.default.createElement(
411
+ "p",
412
+ {
413
+ style: {
414
+ fontSize: "10px",
415
+ textAlign: eachSection.source === "bot" ? "left" : "right"
416
+ }
417
+ },
418
+ (0, import_moment.default)(eachSection.dateTime).format("LT")
419
+ ) : "") : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderElement(eachSection), eachSection.dateTime ? /* @__PURE__ */ import_react.default.createElement(
420
+ "p",
421
+ {
422
+ style: {
423
+ fontSize: "10px",
424
+ textAlign: eachSection.source === "bot" ? "left" : "right"
425
+ }
426
+ },
427
+ (0, import_moment.default)(eachSection.dateTime).format("LT")
428
+ ) : ""));
329
429
  }
330
430
  return null;
331
431
  });
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/libraries/element-executor.tsx
2
- import React, { useState } from "react";
2
+ import React, { useEffect, useState } from "react";
3
3
  import {
4
4
  TextElement,
5
5
  NumberElement,
@@ -25,8 +25,17 @@ import {
25
25
  TabsElement,
26
26
  Upload,
27
27
  OtpElement,
28
- Donut
28
+ CircleDonut,
29
+ SemiCircleDonut,
30
+ HorizontalBarChart,
31
+ DoubleBarChart,
32
+ LineChart,
33
+ BarChart,
34
+ DivContainer,
35
+ ColorPickerElement,
36
+ NotificationAlert
29
37
  } from "@apexcura/ui-components";
38
+ import moment from "moment";
30
39
 
31
40
  // src/services/http-service.tsx
32
41
  import axios from "axios";
@@ -94,7 +103,7 @@ var ElementExecutor = (props) => {
94
103
  return schema2.map((field) => {
95
104
  if (field.name === name) {
96
105
  field["value"] = value;
97
- props.selectedRecord(field);
106
+ props.selectedRecord && props.selectedRecord(field);
98
107
  }
99
108
  if (field.fields && field.fields.length) {
100
109
  field.fields = updateSchema(field.fields);
@@ -104,8 +113,13 @@ var ElementExecutor = (props) => {
104
113
  };
105
114
  const updatedSchema = updateSchema(schema);
106
115
  setSchema(updatedSchema);
107
- props.setData({ ...props.data, schema: updatedSchema });
116
+ props.setData && props.setData(updatedSchema);
108
117
  };
118
+ useEffect(() => {
119
+ if (props?.data?.schema) {
120
+ setSchema([...props.data.schema]);
121
+ }
122
+ }, [props.data]);
109
123
  const handleSelectData = async () => {
110
124
  try {
111
125
  const response = await postService("/products/", "POST", []);
@@ -205,13 +219,19 @@ var ElementExecutor = (props) => {
205
219
  case "add-more":
206
220
  return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
207
221
  case "div":
208
- return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
222
+ return /* @__PURE__ */ React.createElement(
223
+ DivContainer,
224
+ {
225
+ ...elementProps,
226
+ onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
227
+ }
228
+ );
209
229
  case "button":
210
230
  return /* @__PURE__ */ React.createElement(
211
231
  ButtonElement,
212
232
  {
213
233
  ...elementProps,
214
- onClick: () => props.selectedRecord(elementProps)
234
+ onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
215
235
  }
216
236
  );
217
237
  case "sidebar":
@@ -248,6 +268,14 @@ var ElementExecutor = (props) => {
248
268
  onChange: (value) => onHandleChange(elementProps.name || "", value)
249
269
  }
250
270
  );
271
+ case "datetimepicker":
272
+ return /* @__PURE__ */ React.createElement(
273
+ DatePickerElement,
274
+ {
275
+ ...elementProps,
276
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
277
+ }
278
+ );
251
279
  case "upload":
252
280
  return /* @__PURE__ */ React.createElement(
253
281
  FileUpload,
@@ -306,16 +334,96 @@ var ElementExecutor = (props) => {
306
334
  onChange: (value) => onHandleChange(elementProps.name || "", value)
307
335
  }
308
336
  );
309
- case "donut":
310
- return /* @__PURE__ */ React.createElement(Donut, { ...elementProps });
337
+ case "circle-donut":
338
+ return /* @__PURE__ */ React.createElement(
339
+ CircleDonut,
340
+ {
341
+ ...elementProps,
342
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
343
+ }
344
+ );
345
+ case "semicircle-donut":
346
+ return /* @__PURE__ */ React.createElement(
347
+ SemiCircleDonut,
348
+ {
349
+ ...elementProps,
350
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
351
+ }
352
+ );
353
+ case "horizontal-barchart":
354
+ return /* @__PURE__ */ React.createElement(
355
+ HorizontalBarChart,
356
+ {
357
+ ...elementProps,
358
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
359
+ }
360
+ );
361
+ case "linechart":
362
+ return /* @__PURE__ */ React.createElement(
363
+ LineChart,
364
+ {
365
+ ...elementProps,
366
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
367
+ }
368
+ );
369
+ case "double-barchart":
370
+ return /* @__PURE__ */ React.createElement(
371
+ DoubleBarChart,
372
+ {
373
+ ...elementProps,
374
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
375
+ }
376
+ );
377
+ case "barchart":
378
+ return /* @__PURE__ */ React.createElement(
379
+ BarChart,
380
+ {
381
+ ...elementProps,
382
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
383
+ }
384
+ );
385
+ case "color-picker":
386
+ return /* @__PURE__ */ React.createElement(
387
+ ColorPickerElement,
388
+ {
389
+ ...elementProps,
390
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
391
+ }
392
+ );
393
+ case "alert":
394
+ return /* @__PURE__ */ React.createElement(
395
+ NotificationAlert,
396
+ {
397
+ ...elementProps,
398
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
399
+ }
400
+ );
311
401
  default:
312
402
  return null;
313
403
  }
314
404
  };
315
405
  const renderFields = (schema2) => {
316
- return schema2 && schema2.map((eachSection) => {
406
+ return schema2 && schema2.map((eachSection, index) => {
317
407
  if (eachSection.visible !== false) {
318
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: eachSection.name }, 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));
408
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: index }, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: index }, renderFields(eachSection.fields)), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
409
+ "p",
410
+ {
411
+ style: {
412
+ fontSize: "10px",
413
+ textAlign: eachSection.source === "bot" ? "left" : "right"
414
+ }
415
+ },
416
+ moment(eachSection.dateTime).format("LT")
417
+ ) : "") : /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
418
+ "p",
419
+ {
420
+ style: {
421
+ fontSize: "10px",
422
+ textAlign: eachSection.source === "bot" ? "left" : "right"
423
+ }
424
+ },
425
+ moment(eachSection.dateTime).format("LT")
426
+ ) : ""));
319
427
  }
320
428
  return null;
321
429
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.17-Beta7",
3
+ "version": "0.0.17-Beta71",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",
@@ -28,12 +28,13 @@
28
28
  "build": "tsup"
29
29
  },
30
30
  "dependencies": {
31
- "@apexcura/ui-components": "^0.0.15-Beta9",
31
+ "@apexcura/ui-components": "^0.0.15-Beta61",
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",
35
35
  "antd": "^5.16.5",
36
36
  "axios": "^1.6.8",
37
+ "moment": "^2.30.1",
37
38
  "react": "^18.3.1",
38
39
  "react-dom": "^18.3.1",
39
40
  "tsup": "^8.0.2"