@apexcura/core 0.0.17-Beta6 → 0.0.17-Beta61

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
@@ -25,8 +25,19 @@ type FormExecutorProps = {
25
25
  buttonClassName?: string;
26
26
  icon?: string;
27
27
  placement?: string;
28
+ firstValue?: string;
29
+ secondValue?: string;
30
+ firstPlaceholder?: string;
31
+ secondPlaceholder?: string;
32
+ enabled_dates?: string;
28
33
  profileImageClassName?: string;
29
34
  value?: string | number | boolean | any[] | null | object;
35
+ message?: string;
36
+ description?: string;
37
+ notificationType?: string;
38
+ showProgress?: boolean;
39
+ picker?: "date" | "week" | "month" | "quarter" | "year";
40
+ weekrange?: boolean;
30
41
  img?: string;
31
42
  primaryText?: string;
32
43
  secondaryText?: string;
@@ -43,18 +54,20 @@ type FormExecutorProps = {
43
54
  rowSelection?: boolean;
44
55
  length?: number;
45
56
  loading?: boolean;
57
+ fillText1?: string;
58
+ fillText2?: string;
59
+ labels?: any[];
60
+ data?: any[];
61
+ pagination?: boolean;
62
+ is_detail?: boolean;
63
+ dateTime?: string;
64
+ minRows?: number;
65
+ maxRows?: number;
66
+ mode?: "multiple" | "tags" | undefined;
46
67
  modalContent?: {
68
+ name?: string;
47
69
  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
- }[];
70
+ fields?: any[];
58
71
  };
59
72
  items?: {
60
73
  icon?: React.JSX.Element | string;
@@ -171,8 +184,8 @@ type FormExecutorProps = {
171
184
  }[];
172
185
  }[];
173
186
  };
174
- setData: Function;
175
- selectedRecord: Function;
187
+ setData?: Function;
188
+ selectedRecord?: Function;
176
189
  };
177
190
  type ElementExecutorProps = FormExecutorProps & styling;
178
191
  declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -25,8 +25,19 @@ type FormExecutorProps = {
25
25
  buttonClassName?: string;
26
26
  icon?: string;
27
27
  placement?: string;
28
+ firstValue?: string;
29
+ secondValue?: string;
30
+ firstPlaceholder?: string;
31
+ secondPlaceholder?: string;
32
+ enabled_dates?: string;
28
33
  profileImageClassName?: string;
29
34
  value?: string | number | boolean | any[] | null | object;
35
+ message?: string;
36
+ description?: string;
37
+ notificationType?: string;
38
+ showProgress?: boolean;
39
+ picker?: "date" | "week" | "month" | "quarter" | "year";
40
+ weekrange?: boolean;
30
41
  img?: string;
31
42
  primaryText?: string;
32
43
  secondaryText?: string;
@@ -43,18 +54,20 @@ type FormExecutorProps = {
43
54
  rowSelection?: boolean;
44
55
  length?: number;
45
56
  loading?: boolean;
57
+ fillText1?: string;
58
+ fillText2?: string;
59
+ labels?: any[];
60
+ data?: any[];
61
+ pagination?: boolean;
62
+ is_detail?: boolean;
63
+ dateTime?: string;
64
+ minRows?: number;
65
+ maxRows?: number;
66
+ mode?: "multiple" | "tags" | undefined;
46
67
  modalContent?: {
68
+ name?: string;
47
69
  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
- }[];
70
+ fields?: any[];
58
71
  };
59
72
  items?: {
60
73
  icon?: React.JSX.Element | string;
@@ -171,8 +184,8 @@ type FormExecutorProps = {
171
184
  }[];
172
185
  }[];
173
186
  };
174
- setData: Function;
175
- selectedRecord: Function;
187
+ setData?: Function;
188
+ selectedRecord?: Function;
176
189
  };
177
190
  type ElementExecutorProps = FormExecutorProps & styling;
178
191
  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({ ...props.data, schema: 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({ ...props.data, schema: 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-Beta6",
3
+ "version": "0.0.17-Beta61",
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-Beta8",
31
+ "@apexcura/ui-components": "^0.0.15-Beta51",
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"