@apexcura/core 0.0.16-Beta195 → 0.0.16-Beta197

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,187 +1,2 @@
1
- import React from 'react';
2
1
 
3
- type styling = {
4
- horizontalGutter?: number;
5
- verticalGutter?: number;
6
- };
7
- type FormExecutorProps = {
8
- data: {
9
- 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
- fillText1?: string;
47
- fillText2?: string;
48
- labels?: any[];
49
- data?: any[];
50
- pagination?: boolean;
51
- is_detail?: boolean;
52
- dateTime?: string;
53
- modalContent?: {
54
- className?: string;
55
- fields?: {
56
- _id?: string;
57
- name?: string;
58
- label?: string;
59
- source?: string;
60
- initial_message?: boolean;
61
- element: string;
62
- className?: string;
63
- position?: string;
64
- }[];
65
- };
66
- items?: {
67
- icon?: React.JSX.Element | string;
68
- label?: string;
69
- active?: boolean;
70
- text?: string;
71
- time?: string;
72
- name?: string;
73
- y?: number;
74
- color?: string;
75
- }[];
76
- fields?: {
77
- name?: string;
78
- label?: string;
79
- placeholder?: string;
80
- element?: string;
81
- type?: string;
82
- value?: string | number | boolean | any[] | null | object;
83
- options?: {
84
- key?: number;
85
- label: string;
86
- value: string;
87
- }[];
88
- firstOptions?: {
89
- key?: number;
90
- label: string;
91
- value: string;
92
- }[];
93
- secondOptions?: {
94
- key?: number;
95
- label: string;
96
- value: string;
97
- }[];
98
- selectBefore?: {
99
- label: string;
100
- value: string;
101
- }[];
102
- selectAfter?: {
103
- label: string;
104
- value: string;
105
- }[];
106
- dropDownOptions?: any[];
107
- visible?: boolean;
108
- disabled?: boolean;
109
- required?: boolean;
110
- prefix?: React.ReactNode;
111
- suffix?: React.ReactNode;
112
- addonBefore?: React.ReactNode;
113
- defaultValue?: string;
114
- status?: "error" | "warning";
115
- styles?: React.CSSProperties;
116
- fieldClassName?: string;
117
- elementClassName?: string;
118
- variant?: string;
119
- thead?: {
120
- id: number;
121
- name?: string;
122
- label?: string;
123
- visible?: boolean;
124
- required?: boolean;
125
- key?: string;
126
- render?: () => void;
127
- ellipsis: boolean;
128
- }[];
129
- tbody?: {
130
- id?: number;
131
- name?: string;
132
- label?: string;
133
- element?: string;
134
- type?: string;
135
- variable_data?: {
136
- id: {
137
- id?: number;
138
- };
139
- Route?: {
140
- label: string;
141
- element: string;
142
- type: string;
143
- };
144
- Dose?: {
145
- label: string;
146
- element: string;
147
- type: string;
148
- };
149
- Frequency?: {
150
- label: string;
151
- element: string;
152
- type: string;
153
- };
154
- When?: {
155
- label: string;
156
- element: string;
157
- type: string;
158
- };
159
- Duration?: {
160
- label: string;
161
- element: string;
162
- type: string;
163
- };
164
- Instructions?: {
165
- label: string;
166
- element: string;
167
- type: string;
168
- };
169
- SubRows?: {
170
- label: string;
171
- };
172
- }[];
173
- }[];
174
- payload_keys?: string[];
175
- api_endpoint?: string;
176
- next_id?: string;
177
- action?: string;
178
- }[];
179
- }[];
180
- };
181
- setData: Function;
182
- selectedRecord: Function;
183
- };
184
- type ElementExecutorProps = FormExecutorProps & styling;
185
- declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
186
-
187
- export { ElementExecutor };
2
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,187 +1,2 @@
1
- import React from 'react';
2
1
 
3
- type styling = {
4
- horizontalGutter?: number;
5
- verticalGutter?: number;
6
- };
7
- type FormExecutorProps = {
8
- data: {
9
- 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
- fillText1?: string;
47
- fillText2?: string;
48
- labels?: any[];
49
- data?: any[];
50
- pagination?: boolean;
51
- is_detail?: boolean;
52
- dateTime?: string;
53
- modalContent?: {
54
- className?: string;
55
- fields?: {
56
- _id?: string;
57
- name?: string;
58
- label?: string;
59
- source?: string;
60
- initial_message?: boolean;
61
- element: string;
62
- className?: string;
63
- position?: string;
64
- }[];
65
- };
66
- items?: {
67
- icon?: React.JSX.Element | string;
68
- label?: string;
69
- active?: boolean;
70
- text?: string;
71
- time?: string;
72
- name?: string;
73
- y?: number;
74
- color?: string;
75
- }[];
76
- fields?: {
77
- name?: string;
78
- label?: string;
79
- placeholder?: string;
80
- element?: string;
81
- type?: string;
82
- value?: string | number | boolean | any[] | null | object;
83
- options?: {
84
- key?: number;
85
- label: string;
86
- value: string;
87
- }[];
88
- firstOptions?: {
89
- key?: number;
90
- label: string;
91
- value: string;
92
- }[];
93
- secondOptions?: {
94
- key?: number;
95
- label: string;
96
- value: string;
97
- }[];
98
- selectBefore?: {
99
- label: string;
100
- value: string;
101
- }[];
102
- selectAfter?: {
103
- label: string;
104
- value: string;
105
- }[];
106
- dropDownOptions?: any[];
107
- visible?: boolean;
108
- disabled?: boolean;
109
- required?: boolean;
110
- prefix?: React.ReactNode;
111
- suffix?: React.ReactNode;
112
- addonBefore?: React.ReactNode;
113
- defaultValue?: string;
114
- status?: "error" | "warning";
115
- styles?: React.CSSProperties;
116
- fieldClassName?: string;
117
- elementClassName?: string;
118
- variant?: string;
119
- thead?: {
120
- id: number;
121
- name?: string;
122
- label?: string;
123
- visible?: boolean;
124
- required?: boolean;
125
- key?: string;
126
- render?: () => void;
127
- ellipsis: boolean;
128
- }[];
129
- tbody?: {
130
- id?: number;
131
- name?: string;
132
- label?: string;
133
- element?: string;
134
- type?: string;
135
- variable_data?: {
136
- id: {
137
- id?: number;
138
- };
139
- Route?: {
140
- label: string;
141
- element: string;
142
- type: string;
143
- };
144
- Dose?: {
145
- label: string;
146
- element: string;
147
- type: string;
148
- };
149
- Frequency?: {
150
- label: string;
151
- element: string;
152
- type: string;
153
- };
154
- When?: {
155
- label: string;
156
- element: string;
157
- type: string;
158
- };
159
- Duration?: {
160
- label: string;
161
- element: string;
162
- type: string;
163
- };
164
- Instructions?: {
165
- label: string;
166
- element: string;
167
- type: string;
168
- };
169
- SubRows?: {
170
- label: string;
171
- };
172
- }[];
173
- }[];
174
- payload_keys?: string[];
175
- api_endpoint?: string;
176
- next_id?: string;
177
- action?: string;
178
- }[];
179
- }[];
180
- };
181
- setData: Function;
182
- selectedRecord: Function;
183
- };
184
- type ElementExecutorProps = FormExecutorProps & styling;
185
- declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
186
-
187
- export { ElementExecutor };
2
+ export { }
package/dist/index.js CHANGED
@@ -5,10 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
8
  var __copyProps = (to, from, except, desc) => {
13
9
  if (from && typeof from === "object" || typeof from === "function") {
14
10
  for (let key of __getOwnPropNames(from))
@@ -29,15 +25,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
25
 
30
26
  // src/index.ts
31
27
  var src_exports = {};
32
- __export(src_exports, {
33
- ElementExecutor: () => ElementExecutor
34
- });
35
28
  module.exports = __toCommonJS(src_exports);
36
29
 
37
30
  // src/libraries/element-executor.tsx
38
31
  var import_react = __toESM(require("react"));
39
32
  var import_ui_components = require("@apexcura/ui-components");
40
- var import_moment = __toESM(require("moment"));
41
33
 
42
34
  // src/services/http-service.tsx
43
35
  var import_axios = __toESM(require("axios"));
@@ -56,348 +48,3 @@ var HttpClient = import_axios.default.create({
56
48
  "accept": "application/json"
57
49
  }
58
50
  });
59
- function postService(url, method, data) {
60
- const token = JSON.parse(localStorage.getItem("token") || "null");
61
- const setHref = (str) => {
62
- window.location.href = str;
63
- };
64
- const currenthref = window.location.pathname;
65
- return HttpClient({
66
- method,
67
- url,
68
- data,
69
- headers: {
70
- "authorization": token
71
- }
72
- }).then((response) => {
73
- const responseData = response.data;
74
- const status = response.status;
75
- if (status === 200) {
76
- if (responseData.status) {
77
- return responseData;
78
- } else {
79
- if (responseData.token === "invalid" && currenthref !== "/") {
80
- localStorage.clearAll();
81
- setHref("/");
82
- return;
83
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
84
- localStorage.clearAll();
85
- setHref("/");
86
- return;
87
- } else {
88
- return responseData;
89
- }
90
- }
91
- } else {
92
- return false;
93
- }
94
- }).catch((error) => {
95
- return false;
96
- });
97
- }
98
-
99
- // src/libraries/element-executor.tsx
100
- var ElementExecutor = (props) => {
101
- const [data, setData] = (0, import_react.useState)([]);
102
- const [schema, setSchema] = (0, import_react.useState)(props.data.schema);
103
- const onHandleChange = (name, value) => {
104
- const updateSchema = (schema2) => {
105
- return schema2.map((field) => {
106
- if (field.name === name) {
107
- field["value"] = value;
108
- props.selectedRecord(field);
109
- }
110
- if (field.fields && field.fields.length) {
111
- field.fields = updateSchema(field.fields);
112
- }
113
- return field;
114
- });
115
- };
116
- const updatedSchema = updateSchema(schema);
117
- setSchema(updatedSchema);
118
- props.setData({ ...props.data, schema: updatedSchema });
119
- };
120
- const handleSelectData = async () => {
121
- try {
122
- const response = await postService("/products/", "POST", []);
123
- if (response !== false && typeof response === "object") {
124
- setData(response.products);
125
- }
126
- } catch (error) {
127
- console.log(error);
128
- }
129
- };
130
- const renderElement = (elementProps) => {
131
- switch (elementProps.element) {
132
- case "input-text":
133
- return /* @__PURE__ */ import_react.default.createElement(
134
- import_ui_components.TextElement,
135
- {
136
- ...elementProps,
137
- onChange: (value) => onHandleChange(elementProps.name || "", value)
138
- }
139
- );
140
- case "input-number":
141
- return /* @__PURE__ */ import_react.default.createElement(
142
- import_ui_components.NumberElement,
143
- {
144
- ...elementProps,
145
- onChange: (value) => onHandleChange(elementProps.name || "", value)
146
- }
147
- );
148
- case "input-textarea":
149
- return /* @__PURE__ */ import_react.default.createElement(
150
- import_ui_components.TextareaElement,
151
- {
152
- ...elementProps,
153
- onChange: (value) => onHandleChange(elementProps.name || "", value)
154
- }
155
- );
156
- case "single-select":
157
- return /* @__PURE__ */ import_react.default.createElement(
158
- import_ui_components.SelectElement,
159
- {
160
- ...elementProps,
161
- onChange: (value) => onHandleChange(elementProps.name || "", value)
162
- }
163
- );
164
- case "input-mobile":
165
- return /* @__PURE__ */ import_react.default.createElement(
166
- import_ui_components.NumberElement,
167
- {
168
- ...elementProps,
169
- onChange: (value) => onHandleChange(elementProps.name || "", value)
170
- }
171
- );
172
- case "input-checkbox":
173
- return /* @__PURE__ */ import_react.default.createElement(
174
- import_ui_components.CheckboxElement,
175
- {
176
- ...elementProps,
177
- onChange: (value) => onHandleChange(elementProps.name || "", value)
178
- }
179
- );
180
- case "input-radio":
181
- return /* @__PURE__ */ import_react.default.createElement(
182
- import_ui_components.RadioElement,
183
- {
184
- ...elementProps,
185
- onChange: (value) => onHandleChange(elementProps.name || "", value)
186
- }
187
- );
188
- case "input-description":
189
- return /* @__PURE__ */ import_react.default.createElement(
190
- import_ui_components.CkEditor,
191
- {
192
- ...elementProps,
193
- onChange: (value) => onHandleChange(elementProps.name || "", value)
194
- }
195
- );
196
- case "input-single-select":
197
- return /* @__PURE__ */ import_react.default.createElement(
198
- import_ui_components.SingleSelectElement,
199
- {
200
- ...elementProps,
201
- dropDownOptions: data.length > 0 ? data : [],
202
- onChange: (value) => onHandleChange(elementProps.name || "", value),
203
- onClick: handleSelectData
204
- }
205
- );
206
- case "input-multiple-select":
207
- return /* @__PURE__ */ import_react.default.createElement(
208
- import_ui_components.MultipleSelectElement,
209
- {
210
- ...elementProps,
211
- dropDownOptions: data.length > 0 ? data : [],
212
- onChange: (value) => onHandleChange(elementProps.name || "", value),
213
- onClick: handleSelectData
214
- }
215
- );
216
- case "add-more":
217
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.AddMoreTable, { ...elementProps });
218
- case "div":
219
- return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
220
- case "button":
221
- return /* @__PURE__ */ import_react.default.createElement(
222
- import_ui_components.ButtonElement,
223
- {
224
- ...elementProps,
225
- onClick: () => props.selectedRecord(elementProps)
226
- }
227
- );
228
- case "sidebar":
229
- return /* @__PURE__ */ import_react.default.createElement(
230
- import_ui_components.Sidebar,
231
- {
232
- ...elementProps,
233
- onChange: (value) => onHandleChange(elementProps.name || "", value)
234
- }
235
- );
236
- case "navbar":
237
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
238
- case "table":
239
- return /* @__PURE__ */ import_react.default.createElement(
240
- import_ui_components.TableElement,
241
- {
242
- ...elementProps,
243
- onChange: (value) => onHandleChange(elementProps.name || "", value)
244
- }
245
- );
246
- case "daterangepicker":
247
- return /* @__PURE__ */ import_react.default.createElement(
248
- import_ui_components.DateRangePickerElement,
249
- {
250
- ...elementProps,
251
- onChange: (value) => onHandleChange(elementProps.name || "", value)
252
- }
253
- );
254
- case "datepicker":
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 "upload-manually":
271
- return /* @__PURE__ */ import_react.default.createElement(
272
- import_ui_components.Upload,
273
- {
274
- ...elementProps,
275
- onChange: (value) => onHandleChange(elementProps.name || "", value)
276
- }
277
- );
278
- case "image":
279
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Image, { ...elementProps });
280
- case "input-password":
281
- return /* @__PURE__ */ import_react.default.createElement(
282
- import_ui_components.PasswordElement,
283
- {
284
- ...elementProps,
285
- onChange: (value) => onHandleChange(elementProps.name || "", value)
286
- }
287
- );
288
- case "single-checkbox":
289
- return /* @__PURE__ */ import_react.default.createElement(
290
- import_ui_components.SingleCheckbox,
291
- {
292
- ...elementProps,
293
- onChange: (value) => onHandleChange(elementProps.name || "", value)
294
- }
295
- );
296
- case "dropdown-group":
297
- return /* @__PURE__ */ import_react.default.createElement(
298
- import_ui_components.DropDownGroup,
299
- {
300
- ...elementProps,
301
- onChange: (value) => onHandleChange(elementProps.name || "", value)
302
- }
303
- );
304
- case "tabs":
305
- return /* @__PURE__ */ import_react.default.createElement(
306
- import_ui_components.TabsElement,
307
- {
308
- ...elementProps,
309
- onChange: (value) => onHandleChange(elementProps.name || "", value)
310
- }
311
- );
312
- case "otp":
313
- return /* @__PURE__ */ import_react.default.createElement(
314
- import_ui_components.OtpElement,
315
- {
316
- ...elementProps,
317
- onChange: (value) => onHandleChange(elementProps.name || "", value)
318
- }
319
- );
320
- case "circle-donut":
321
- return /* @__PURE__ */ import_react.default.createElement(
322
- import_ui_components.CircleDonut,
323
- {
324
- ...elementProps,
325
- onChange: (value) => onHandleChange(elementProps.name || "", value)
326
- }
327
- );
328
- case "semicircle-donut":
329
- return /* @__PURE__ */ import_react.default.createElement(
330
- import_ui_components.SemiCircleDonut,
331
- {
332
- ...elementProps,
333
- onChange: (value) => onHandleChange(elementProps.name || "", value)
334
- }
335
- );
336
- case "horizontal-barchart":
337
- return /* @__PURE__ */ import_react.default.createElement(
338
- import_ui_components.HorizontalBarChart,
339
- {
340
- ...elementProps,
341
- onChange: (value) => onHandleChange(elementProps.name || "", value)
342
- }
343
- );
344
- case "linechart":
345
- return /* @__PURE__ */ import_react.default.createElement(
346
- import_ui_components.LineChart,
347
- {
348
- ...elementProps,
349
- onChange: (value) => onHandleChange(elementProps.name || "", value)
350
- }
351
- );
352
- case "double-barchart":
353
- return /* @__PURE__ */ import_react.default.createElement(
354
- import_ui_components.DoubleBarChart,
355
- {
356
- ...elementProps,
357
- onChange: (value) => onHandleChange(elementProps.name || "", value)
358
- }
359
- );
360
- case "barchart":
361
- return /* @__PURE__ */ import_react.default.createElement(
362
- import_ui_components.BarChart,
363
- {
364
- ...elementProps,
365
- onChange: (value) => onHandleChange(elementProps.name || "", value)
366
- }
367
- );
368
- default:
369
- return null;
370
- }
371
- };
372
- const renderFields = (schema2) => {
373
- return schema2 && schema2.map((eachSection) => {
374
- if (eachSection.visible !== false) {
375
- 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)), eachSection.dateTime ? /* @__PURE__ */ import_react.default.createElement(
376
- "p",
377
- {
378
- style: {
379
- fontSize: "10px",
380
- textAlign: eachSection.source === "bot" ? "left" : "right"
381
- }
382
- },
383
- (0, import_moment.default)(eachSection.dateTime).format("LT")
384
- ) : "") : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderElement(eachSection), eachSection.dateTime ? /* @__PURE__ */ import_react.default.createElement(
385
- "p",
386
- {
387
- style: {
388
- fontSize: "10px",
389
- textAlign: eachSection.source === "bot" ? "left" : "right"
390
- }
391
- },
392
- (0, import_moment.default)(eachSection.dateTime).format("LT")
393
- ) : ""));
394
- }
395
- return null;
396
- });
397
- };
398
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: props.data.className }, renderFields(schema)));
399
- };
400
- // Annotate the CommonJS export names for ESM import in node:
401
- 0 && (module.exports = {
402
- ElementExecutor
403
- });
package/dist/index.mjs CHANGED
@@ -30,9 +30,9 @@ import {
30
30
  HorizontalBarChart,
31
31
  DoubleBarChart,
32
32
  LineChart,
33
- BarChart
33
+ BarChart,
34
+ HighchartsLineChart
34
35
  } from "@apexcura/ui-components";
35
- import moment from "moment";
36
36
 
37
37
  // src/services/http-service.tsx
38
38
  import axios from "axios";
@@ -51,347 +51,3 @@ var HttpClient = axios.create({
51
51
  "accept": "application/json"
52
52
  }
53
53
  });
54
- function postService(url, method, data) {
55
- const token = JSON.parse(localStorage.getItem("token") || "null");
56
- const setHref = (str) => {
57
- window.location.href = str;
58
- };
59
- const currenthref = window.location.pathname;
60
- return HttpClient({
61
- method,
62
- url,
63
- data,
64
- headers: {
65
- "authorization": token
66
- }
67
- }).then((response) => {
68
- const responseData = response.data;
69
- const status = response.status;
70
- if (status === 200) {
71
- if (responseData.status) {
72
- return responseData;
73
- } else {
74
- if (responseData.token === "invalid" && currenthref !== "/") {
75
- localStorage.clearAll();
76
- setHref("/");
77
- return;
78
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
79
- localStorage.clearAll();
80
- setHref("/");
81
- return;
82
- } else {
83
- return responseData;
84
- }
85
- }
86
- } else {
87
- return false;
88
- }
89
- }).catch((error) => {
90
- return false;
91
- });
92
- }
93
-
94
- // src/libraries/element-executor.tsx
95
- var ElementExecutor = (props) => {
96
- const [data, setData] = useState([]);
97
- const [schema, setSchema] = useState(props.data.schema);
98
- const onHandleChange = (name, value) => {
99
- const updateSchema = (schema2) => {
100
- return schema2.map((field) => {
101
- if (field.name === name) {
102
- field["value"] = value;
103
- props.selectedRecord(field);
104
- }
105
- if (field.fields && field.fields.length) {
106
- field.fields = updateSchema(field.fields);
107
- }
108
- return field;
109
- });
110
- };
111
- const updatedSchema = updateSchema(schema);
112
- setSchema(updatedSchema);
113
- props.setData({ ...props.data, schema: updatedSchema });
114
- };
115
- const handleSelectData = async () => {
116
- try {
117
- const response = await postService("/products/", "POST", []);
118
- if (response !== false && typeof response === "object") {
119
- setData(response.products);
120
- }
121
- } catch (error) {
122
- console.log(error);
123
- }
124
- };
125
- const renderElement = (elementProps) => {
126
- switch (elementProps.element) {
127
- case "input-text":
128
- return /* @__PURE__ */ React.createElement(
129
- TextElement,
130
- {
131
- ...elementProps,
132
- onChange: (value) => onHandleChange(elementProps.name || "", value)
133
- }
134
- );
135
- case "input-number":
136
- return /* @__PURE__ */ React.createElement(
137
- NumberElement,
138
- {
139
- ...elementProps,
140
- onChange: (value) => onHandleChange(elementProps.name || "", value)
141
- }
142
- );
143
- case "input-textarea":
144
- return /* @__PURE__ */ React.createElement(
145
- TextareaElement,
146
- {
147
- ...elementProps,
148
- onChange: (value) => onHandleChange(elementProps.name || "", value)
149
- }
150
- );
151
- case "single-select":
152
- return /* @__PURE__ */ React.createElement(
153
- SelectElement,
154
- {
155
- ...elementProps,
156
- onChange: (value) => onHandleChange(elementProps.name || "", value)
157
- }
158
- );
159
- case "input-mobile":
160
- return /* @__PURE__ */ React.createElement(
161
- NumberElement,
162
- {
163
- ...elementProps,
164
- onChange: (value) => onHandleChange(elementProps.name || "", value)
165
- }
166
- );
167
- case "input-checkbox":
168
- return /* @__PURE__ */ React.createElement(
169
- CheckboxElement,
170
- {
171
- ...elementProps,
172
- onChange: (value) => onHandleChange(elementProps.name || "", value)
173
- }
174
- );
175
- case "input-radio":
176
- return /* @__PURE__ */ React.createElement(
177
- RadioElement,
178
- {
179
- ...elementProps,
180
- onChange: (value) => onHandleChange(elementProps.name || "", value)
181
- }
182
- );
183
- case "input-description":
184
- return /* @__PURE__ */ React.createElement(
185
- CkEditor,
186
- {
187
- ...elementProps,
188
- onChange: (value) => onHandleChange(elementProps.name || "", value)
189
- }
190
- );
191
- case "input-single-select":
192
- return /* @__PURE__ */ React.createElement(
193
- SingleSelectElement,
194
- {
195
- ...elementProps,
196
- dropDownOptions: data.length > 0 ? data : [],
197
- onChange: (value) => onHandleChange(elementProps.name || "", value),
198
- onClick: handleSelectData
199
- }
200
- );
201
- case "input-multiple-select":
202
- return /* @__PURE__ */ React.createElement(
203
- MultipleSelectElement,
204
- {
205
- ...elementProps,
206
- dropDownOptions: data.length > 0 ? data : [],
207
- onChange: (value) => onHandleChange(elementProps.name || "", value),
208
- onClick: handleSelectData
209
- }
210
- );
211
- case "add-more":
212
- return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
213
- case "div":
214
- return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
215
- case "button":
216
- return /* @__PURE__ */ React.createElement(
217
- ButtonElement,
218
- {
219
- ...elementProps,
220
- onClick: () => props.selectedRecord(elementProps)
221
- }
222
- );
223
- case "sidebar":
224
- return /* @__PURE__ */ React.createElement(
225
- Sidebar,
226
- {
227
- ...elementProps,
228
- onChange: (value) => onHandleChange(elementProps.name || "", value)
229
- }
230
- );
231
- case "navbar":
232
- return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
233
- case "table":
234
- return /* @__PURE__ */ React.createElement(
235
- TableElement,
236
- {
237
- ...elementProps,
238
- onChange: (value) => onHandleChange(elementProps.name || "", value)
239
- }
240
- );
241
- case "daterangepicker":
242
- return /* @__PURE__ */ React.createElement(
243
- DateRangePickerElement,
244
- {
245
- ...elementProps,
246
- onChange: (value) => onHandleChange(elementProps.name || "", value)
247
- }
248
- );
249
- case "datepicker":
250
- return /* @__PURE__ */ React.createElement(
251
- DatePickerElement,
252
- {
253
- ...elementProps,
254
- onChange: (value) => onHandleChange(elementProps.name || "", value)
255
- }
256
- );
257
- case "upload":
258
- return /* @__PURE__ */ React.createElement(
259
- FileUpload,
260
- {
261
- ...elementProps,
262
- onChange: (value) => onHandleChange(elementProps.name || "", value)
263
- }
264
- );
265
- case "upload-manually":
266
- return /* @__PURE__ */ React.createElement(
267
- Upload,
268
- {
269
- ...elementProps,
270
- onChange: (value) => onHandleChange(elementProps.name || "", value)
271
- }
272
- );
273
- case "image":
274
- return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
275
- case "input-password":
276
- return /* @__PURE__ */ React.createElement(
277
- PasswordElement,
278
- {
279
- ...elementProps,
280
- onChange: (value) => onHandleChange(elementProps.name || "", value)
281
- }
282
- );
283
- case "single-checkbox":
284
- return /* @__PURE__ */ React.createElement(
285
- SingleCheckbox,
286
- {
287
- ...elementProps,
288
- onChange: (value) => onHandleChange(elementProps.name || "", value)
289
- }
290
- );
291
- case "dropdown-group":
292
- return /* @__PURE__ */ React.createElement(
293
- DropDownGroup,
294
- {
295
- ...elementProps,
296
- onChange: (value) => onHandleChange(elementProps.name || "", value)
297
- }
298
- );
299
- case "tabs":
300
- return /* @__PURE__ */ React.createElement(
301
- TabsElement,
302
- {
303
- ...elementProps,
304
- onChange: (value) => onHandleChange(elementProps.name || "", value)
305
- }
306
- );
307
- case "otp":
308
- return /* @__PURE__ */ React.createElement(
309
- OtpElement,
310
- {
311
- ...elementProps,
312
- onChange: (value) => onHandleChange(elementProps.name || "", value)
313
- }
314
- );
315
- case "circle-donut":
316
- return /* @__PURE__ */ React.createElement(
317
- CircleDonut,
318
- {
319
- ...elementProps,
320
- onChange: (value) => onHandleChange(elementProps.name || "", value)
321
- }
322
- );
323
- case "semicircle-donut":
324
- return /* @__PURE__ */ React.createElement(
325
- SemiCircleDonut,
326
- {
327
- ...elementProps,
328
- onChange: (value) => onHandleChange(elementProps.name || "", value)
329
- }
330
- );
331
- case "horizontal-barchart":
332
- return /* @__PURE__ */ React.createElement(
333
- HorizontalBarChart,
334
- {
335
- ...elementProps,
336
- onChange: (value) => onHandleChange(elementProps.name || "", value)
337
- }
338
- );
339
- case "linechart":
340
- return /* @__PURE__ */ React.createElement(
341
- LineChart,
342
- {
343
- ...elementProps,
344
- onChange: (value) => onHandleChange(elementProps.name || "", value)
345
- }
346
- );
347
- case "double-barchart":
348
- return /* @__PURE__ */ React.createElement(
349
- DoubleBarChart,
350
- {
351
- ...elementProps,
352
- onChange: (value) => onHandleChange(elementProps.name || "", value)
353
- }
354
- );
355
- case "barchart":
356
- return /* @__PURE__ */ React.createElement(
357
- BarChart,
358
- {
359
- ...elementProps,
360
- onChange: (value) => onHandleChange(elementProps.name || "", value)
361
- }
362
- );
363
- default:
364
- return null;
365
- }
366
- };
367
- const renderFields = (schema2) => {
368
- return schema2 && schema2.map((eachSection) => {
369
- if (eachSection.visible !== false) {
370
- 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)), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
371
- "p",
372
- {
373
- style: {
374
- fontSize: "10px",
375
- textAlign: eachSection.source === "bot" ? "left" : "right"
376
- }
377
- },
378
- moment(eachSection.dateTime).format("LT")
379
- ) : "") : /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
380
- "p",
381
- {
382
- style: {
383
- fontSize: "10px",
384
- textAlign: eachSection.source === "bot" ? "left" : "right"
385
- }
386
- },
387
- moment(eachSection.dateTime).format("LT")
388
- ) : ""));
389
- }
390
- return null;
391
- });
392
- };
393
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: props.data.className }, renderFields(schema)));
394
- };
395
- export {
396
- ElementExecutor
397
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.16-Beta195",
3
+ "version": "0.0.16-Beta197",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",
@@ -28,13 +28,12 @@
28
28
  "build": "tsup"
29
29
  },
30
30
  "dependencies": {
31
- "@apexcura/ui-components": "^0.0.14-Beta187",
31
+ "@apexcura/ui-components": "^0.0.14-Beta188",
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",
38
37
  "react": "^18.3.1",
39
38
  "react-dom": "^18.3.1",
40
39
  "tsup": "^8.0.2"