@apexcura/core 0.0.16-Beta221 → 0.0.16-Beta224

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,5 +1,184 @@
1
1
  import React from 'react';
2
2
 
3
- declare const HighchartsLineChart: (props: any) => React.JSX.Element;
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
+ modalContent?: {
51
+ className?: string;
52
+ fields?: {
53
+ _id?: string;
54
+ name?: string;
55
+ label?: string;
56
+ source?: string;
57
+ initial_message?: boolean;
58
+ element: string;
59
+ className?: string;
60
+ position?: string;
61
+ }[];
62
+ };
63
+ items?: {
64
+ icon?: React.JSX.Element | string;
65
+ label?: string;
66
+ active?: boolean;
67
+ text?: string;
68
+ time?: string;
69
+ name?: string;
70
+ y?: number;
71
+ color?: string;
72
+ }[];
73
+ fields?: {
74
+ name?: string;
75
+ label?: string;
76
+ placeholder?: string;
77
+ element?: string;
78
+ type?: string;
79
+ value?: string | number | boolean | any[] | null | object;
80
+ options?: {
81
+ key?: number;
82
+ label: string;
83
+ value: string;
84
+ }[];
85
+ firstOptions?: {
86
+ key?: number;
87
+ label: string;
88
+ value: string;
89
+ }[];
90
+ secondOptions?: {
91
+ key?: number;
92
+ label: string;
93
+ value: string;
94
+ }[];
95
+ selectBefore?: {
96
+ label: string;
97
+ value: string;
98
+ }[];
99
+ selectAfter?: {
100
+ label: string;
101
+ value: string;
102
+ }[];
103
+ dropDownOptions?: any[];
104
+ visible?: boolean;
105
+ disabled?: boolean;
106
+ required?: boolean;
107
+ prefix?: React.ReactNode;
108
+ suffix?: React.ReactNode;
109
+ addonBefore?: React.ReactNode;
110
+ defaultValue?: string;
111
+ status?: "error" | "warning";
112
+ styles?: React.CSSProperties;
113
+ fieldClassName?: string;
114
+ elementClassName?: string;
115
+ variant?: string;
116
+ thead?: {
117
+ id: number;
118
+ name?: string;
119
+ label?: string;
120
+ visible?: boolean;
121
+ required?: boolean;
122
+ key?: string;
123
+ render?: () => void;
124
+ ellipsis: boolean;
125
+ }[];
126
+ tbody?: {
127
+ id?: number;
128
+ name?: string;
129
+ label?: string;
130
+ element?: string;
131
+ type?: string;
132
+ variable_data?: {
133
+ id: {
134
+ id?: number;
135
+ };
136
+ Route?: {
137
+ label: string;
138
+ element: string;
139
+ type: string;
140
+ };
141
+ Dose?: {
142
+ label: string;
143
+ element: string;
144
+ type: string;
145
+ };
146
+ Frequency?: {
147
+ label: string;
148
+ element: string;
149
+ type: string;
150
+ };
151
+ When?: {
152
+ label: string;
153
+ element: string;
154
+ type: string;
155
+ };
156
+ Duration?: {
157
+ label: string;
158
+ element: string;
159
+ type: string;
160
+ };
161
+ Instructions?: {
162
+ label: string;
163
+ element: string;
164
+ type: string;
165
+ };
166
+ SubRows?: {
167
+ label: string;
168
+ };
169
+ }[];
170
+ }[];
171
+ payload_keys?: string[];
172
+ api_endpoint?: string;
173
+ next_id?: string;
174
+ action?: string;
175
+ }[];
176
+ }[];
177
+ };
178
+ setData: Function;
179
+ selectedRecord: Function;
180
+ };
181
+ type ElementExecutorProps = FormExecutorProps & styling;
182
+ declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
4
183
 
5
- export { HighchartsLineChart };
184
+ export { ElementExecutor };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,184 @@
1
1
  import React from 'react';
2
2
 
3
- declare const HighchartsLineChart: (props: any) => React.JSX.Element;
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
+ modalContent?: {
51
+ className?: string;
52
+ fields?: {
53
+ _id?: string;
54
+ name?: string;
55
+ label?: string;
56
+ source?: string;
57
+ initial_message?: boolean;
58
+ element: string;
59
+ className?: string;
60
+ position?: string;
61
+ }[];
62
+ };
63
+ items?: {
64
+ icon?: React.JSX.Element | string;
65
+ label?: string;
66
+ active?: boolean;
67
+ text?: string;
68
+ time?: string;
69
+ name?: string;
70
+ y?: number;
71
+ color?: string;
72
+ }[];
73
+ fields?: {
74
+ name?: string;
75
+ label?: string;
76
+ placeholder?: string;
77
+ element?: string;
78
+ type?: string;
79
+ value?: string | number | boolean | any[] | null | object;
80
+ options?: {
81
+ key?: number;
82
+ label: string;
83
+ value: string;
84
+ }[];
85
+ firstOptions?: {
86
+ key?: number;
87
+ label: string;
88
+ value: string;
89
+ }[];
90
+ secondOptions?: {
91
+ key?: number;
92
+ label: string;
93
+ value: string;
94
+ }[];
95
+ selectBefore?: {
96
+ label: string;
97
+ value: string;
98
+ }[];
99
+ selectAfter?: {
100
+ label: string;
101
+ value: string;
102
+ }[];
103
+ dropDownOptions?: any[];
104
+ visible?: boolean;
105
+ disabled?: boolean;
106
+ required?: boolean;
107
+ prefix?: React.ReactNode;
108
+ suffix?: React.ReactNode;
109
+ addonBefore?: React.ReactNode;
110
+ defaultValue?: string;
111
+ status?: "error" | "warning";
112
+ styles?: React.CSSProperties;
113
+ fieldClassName?: string;
114
+ elementClassName?: string;
115
+ variant?: string;
116
+ thead?: {
117
+ id: number;
118
+ name?: string;
119
+ label?: string;
120
+ visible?: boolean;
121
+ required?: boolean;
122
+ key?: string;
123
+ render?: () => void;
124
+ ellipsis: boolean;
125
+ }[];
126
+ tbody?: {
127
+ id?: number;
128
+ name?: string;
129
+ label?: string;
130
+ element?: string;
131
+ type?: string;
132
+ variable_data?: {
133
+ id: {
134
+ id?: number;
135
+ };
136
+ Route?: {
137
+ label: string;
138
+ element: string;
139
+ type: string;
140
+ };
141
+ Dose?: {
142
+ label: string;
143
+ element: string;
144
+ type: string;
145
+ };
146
+ Frequency?: {
147
+ label: string;
148
+ element: string;
149
+ type: string;
150
+ };
151
+ When?: {
152
+ label: string;
153
+ element: string;
154
+ type: string;
155
+ };
156
+ Duration?: {
157
+ label: string;
158
+ element: string;
159
+ type: string;
160
+ };
161
+ Instructions?: {
162
+ label: string;
163
+ element: string;
164
+ type: string;
165
+ };
166
+ SubRows?: {
167
+ label: string;
168
+ };
169
+ }[];
170
+ }[];
171
+ payload_keys?: string[];
172
+ api_endpoint?: string;
173
+ next_id?: string;
174
+ action?: string;
175
+ }[];
176
+ }[];
177
+ };
178
+ setData: Function;
179
+ selectedRecord: Function;
180
+ };
181
+ type ElementExecutorProps = FormExecutorProps & styling;
182
+ declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
4
183
 
5
- export { HighchartsLineChart };
184
+ export { ElementExecutor };
package/dist/index.js CHANGED
@@ -30,16 +30,483 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- HighchartsLineChart: () => HighchartsLineChart
33
+ ElementExecutor: () => ElementExecutor
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
36
 
37
37
  // src/libraries/element-executor.tsx
38
38
  var import_react = __toESM(require("react"));
39
- var HighchartsLineChart = (props) => {
40
- return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("h1", null, "asf"));
39
+ var import_highcharts = __toESM(require("highcharts"));
40
+ var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
41
+ var import_ui_components = require("@apexcura/ui-components");
42
+
43
+ // src/services/http-service.tsx
44
+ var import_axios = __toESM(require("axios"));
45
+
46
+ // src/constants/network-list.tsx
47
+ var networkList = {
48
+ base_url: "https://dummyjson.com"
49
+ };
50
+ var network_list_default = networkList;
51
+
52
+ // src/services/http-service.tsx
53
+ var HttpClient = import_axios.default.create({
54
+ baseURL: network_list_default.base_url,
55
+ headers: {
56
+ "Content-Type": "application/json",
57
+ "accept": "application/json"
58
+ }
59
+ });
60
+ function postService(url, method, data) {
61
+ const token = JSON.parse(localStorage.getItem("token") || "null");
62
+ const setHref = (str) => {
63
+ window.location.href = str;
64
+ };
65
+ const currenthref = window.location.pathname;
66
+ return HttpClient({
67
+ method,
68
+ url,
69
+ data,
70
+ headers: {
71
+ "authorization": token
72
+ }
73
+ }).then((response) => {
74
+ const responseData = response.data;
75
+ const status = response.status;
76
+ if (status === 200) {
77
+ if (responseData.status) {
78
+ return responseData;
79
+ } else {
80
+ if (responseData.token === "invalid" && currenthref !== "/") {
81
+ localStorage.clearAll();
82
+ setHref("/");
83
+ return;
84
+ } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
85
+ localStorage.clearAll();
86
+ setHref("/");
87
+ return;
88
+ } else {
89
+ return responseData;
90
+ }
91
+ }
92
+ } else {
93
+ return false;
94
+ }
95
+ }).catch((error) => {
96
+ return false;
97
+ });
98
+ }
99
+
100
+ // src/libraries/element-executor.tsx
101
+ var ElementExecutor = (props) => {
102
+ const [data, setData] = (0, import_react.useState)([]);
103
+ const [schema, setSchema] = (0, import_react.useState)(props.data.schema);
104
+ const onHandleChange = (name, 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
+ const updatedSchema = updateSchema(schema);
118
+ setSchema(updatedSchema);
119
+ props.setData({ ...props.data, schema: updatedSchema });
120
+ };
121
+ const handleSelectData = async () => {
122
+ try {
123
+ const response = await postService("/products/", "POST", []);
124
+ if (response !== false && typeof response === "object") {
125
+ setData(response.products);
126
+ }
127
+ } catch (error) {
128
+ console.log(error);
129
+ }
130
+ };
131
+ const renderElement = (elementProps) => {
132
+ switch (elementProps.element) {
133
+ case "input-text":
134
+ return /* @__PURE__ */ import_react.default.createElement(
135
+ import_ui_components.TextElement,
136
+ {
137
+ ...elementProps,
138
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
139
+ }
140
+ );
141
+ case "input-number":
142
+ return /* @__PURE__ */ import_react.default.createElement(
143
+ import_ui_components.NumberElement,
144
+ {
145
+ ...elementProps,
146
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
147
+ }
148
+ );
149
+ case "input-textarea":
150
+ return /* @__PURE__ */ import_react.default.createElement(
151
+ import_ui_components.TextareaElement,
152
+ {
153
+ ...elementProps,
154
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
155
+ }
156
+ );
157
+ case "single-select":
158
+ return /* @__PURE__ */ import_react.default.createElement(
159
+ import_ui_components.SelectElement,
160
+ {
161
+ ...elementProps,
162
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
163
+ }
164
+ );
165
+ case "input-mobile":
166
+ return /* @__PURE__ */ import_react.default.createElement(
167
+ import_ui_components.NumberElement,
168
+ {
169
+ ...elementProps,
170
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
171
+ }
172
+ );
173
+ case "input-checkbox":
174
+ return /* @__PURE__ */ import_react.default.createElement(
175
+ import_ui_components.CheckboxElement,
176
+ {
177
+ ...elementProps,
178
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
179
+ }
180
+ );
181
+ case "input-radio":
182
+ return /* @__PURE__ */ import_react.default.createElement(
183
+ import_ui_components.RadioElement,
184
+ {
185
+ ...elementProps,
186
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
187
+ }
188
+ );
189
+ case "input-description":
190
+ return /* @__PURE__ */ import_react.default.createElement(
191
+ import_ui_components.CkEditor,
192
+ {
193
+ ...elementProps,
194
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
195
+ }
196
+ );
197
+ case "input-single-select":
198
+ return /* @__PURE__ */ import_react.default.createElement(
199
+ import_ui_components.SingleSelectElement,
200
+ {
201
+ ...elementProps,
202
+ dropDownOptions: data.length > 0 ? data : [],
203
+ onChange: (value) => onHandleChange(elementProps.name || "", value),
204
+ onClick: handleSelectData
205
+ }
206
+ );
207
+ case "input-multiple-select":
208
+ return /* @__PURE__ */ import_react.default.createElement(
209
+ import_ui_components.MultipleSelectElement,
210
+ {
211
+ ...elementProps,
212
+ dropDownOptions: data.length > 0 ? data : [],
213
+ onChange: (value) => onHandleChange(elementProps.name || "", value),
214
+ onClick: handleSelectData
215
+ }
216
+ );
217
+ case "add-more":
218
+ return /* @__PURE__ */ import_react.default.createElement(import_ui_components.AddMoreTable, { ...elementProps });
219
+ case "div":
220
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
221
+ case "button":
222
+ return /* @__PURE__ */ import_react.default.createElement(
223
+ import_ui_components.ButtonElement,
224
+ {
225
+ ...elementProps,
226
+ onClick: () => props.selectedRecord(elementProps)
227
+ }
228
+ );
229
+ case "sidebar":
230
+ return /* @__PURE__ */ import_react.default.createElement(
231
+ import_ui_components.Sidebar,
232
+ {
233
+ ...elementProps,
234
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
235
+ }
236
+ );
237
+ case "navbar":
238
+ return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
239
+ case "table":
240
+ return /* @__PURE__ */ import_react.default.createElement(
241
+ import_ui_components.TableElement,
242
+ {
243
+ ...elementProps,
244
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
245
+ }
246
+ );
247
+ case "daterangepicker":
248
+ return /* @__PURE__ */ import_react.default.createElement(
249
+ import_ui_components.DateRangePickerElement,
250
+ {
251
+ ...elementProps,
252
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
253
+ }
254
+ );
255
+ case "datepicker":
256
+ return /* @__PURE__ */ import_react.default.createElement(
257
+ import_ui_components.DatePickerElement,
258
+ {
259
+ ...elementProps,
260
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
261
+ }
262
+ );
263
+ case "upload":
264
+ return /* @__PURE__ */ import_react.default.createElement(
265
+ import_ui_components.FileUpload,
266
+ {
267
+ ...elementProps,
268
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
269
+ }
270
+ );
271
+ case "upload-manually":
272
+ return /* @__PURE__ */ import_react.default.createElement(
273
+ import_ui_components.Upload,
274
+ {
275
+ ...elementProps,
276
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
277
+ }
278
+ );
279
+ case "image":
280
+ return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Image, { ...elementProps });
281
+ case "input-password":
282
+ return /* @__PURE__ */ import_react.default.createElement(
283
+ import_ui_components.PasswordElement,
284
+ {
285
+ ...elementProps,
286
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
287
+ }
288
+ );
289
+ case "single-checkbox":
290
+ return /* @__PURE__ */ import_react.default.createElement(
291
+ import_ui_components.SingleCheckbox,
292
+ {
293
+ ...elementProps,
294
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
295
+ }
296
+ );
297
+ case "dropdown-group":
298
+ return /* @__PURE__ */ import_react.default.createElement(
299
+ import_ui_components.DropDownGroup,
300
+ {
301
+ ...elementProps,
302
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
303
+ }
304
+ );
305
+ case "tabs":
306
+ return /* @__PURE__ */ import_react.default.createElement(
307
+ import_ui_components.TabsElement,
308
+ {
309
+ ...elementProps,
310
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
311
+ }
312
+ );
313
+ case "otp":
314
+ return /* @__PURE__ */ import_react.default.createElement(
315
+ import_ui_components.OtpElement,
316
+ {
317
+ ...elementProps,
318
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
319
+ }
320
+ );
321
+ case "circle-donut":
322
+ return /* @__PURE__ */ import_react.default.createElement(
323
+ import_ui_components.CircleDonut,
324
+ {
325
+ ...elementProps,
326
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
327
+ }
328
+ );
329
+ case "semicircle-donut":
330
+ return /* @__PURE__ */ import_react.default.createElement(
331
+ import_ui_components.SemiCircleDonut,
332
+ {
333
+ ...elementProps,
334
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
335
+ }
336
+ );
337
+ case "horizontal-barchart":
338
+ return /* @__PURE__ */ import_react.default.createElement(
339
+ import_ui_components.HorizontalBarChart,
340
+ {
341
+ ...elementProps,
342
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
343
+ }
344
+ );
345
+ case "linechart":
346
+ return /* @__PURE__ */ import_react.default.createElement(
347
+ import_ui_components.LineChart,
348
+ {
349
+ ...elementProps,
350
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
351
+ }
352
+ );
353
+ case "double-barchart":
354
+ return /* @__PURE__ */ import_react.default.createElement(
355
+ import_ui_components.DoubleBarChart,
356
+ {
357
+ ...elementProps,
358
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
359
+ }
360
+ );
361
+ case "barchart":
362
+ return /* @__PURE__ */ import_react.default.createElement(
363
+ import_ui_components.BarChart,
364
+ {
365
+ ...elementProps,
366
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
367
+ }
368
+ );
369
+ default:
370
+ return null;
371
+ }
372
+ };
373
+ const renderFields = (schema2) => {
374
+ return schema2 && schema2.map((eachSection) => {
375
+ if (eachSection.visible !== false) {
376
+ 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));
377
+ }
378
+ return null;
379
+ });
380
+ };
381
+ let graph_data = {
382
+ chart: {
383
+ height: "50%"
384
+ },
385
+ title: {
386
+ text: "U.S Solar Employment Growth",
387
+ align: "left"
388
+ },
389
+ subtitle: {
390
+ text: 'By Job Category. Source: <a href="https://irecusa.org/programs/solar-jobs-census/" target="_blank">IREC</a>.',
391
+ align: "left"
392
+ },
393
+ yAxis: {
394
+ title: {
395
+ text: "Number of Employees"
396
+ }
397
+ },
398
+ xAxis: {
399
+ accessibility: {
400
+ rangeDescription: "Range: 2010 to 2020"
401
+ }
402
+ },
403
+ legend: {
404
+ layout: "vertical",
405
+ align: "right",
406
+ verticalAlign: "middle"
407
+ },
408
+ plotOptions: {
409
+ series: {
410
+ label: {
411
+ connectorAllowed: false
412
+ },
413
+ pointStart: 2010
414
+ }
415
+ },
416
+ series: [{
417
+ name: "Installation & Developers",
418
+ data: [
419
+ 43934,
420
+ 48656,
421
+ 65165,
422
+ 81827,
423
+ 112143,
424
+ 142383,
425
+ 171533,
426
+ 165174,
427
+ 155157,
428
+ 161454,
429
+ 154610
430
+ ]
431
+ }, {
432
+ name: "Manufacturing",
433
+ data: [
434
+ 24916,
435
+ 37941,
436
+ 29742,
437
+ 29851,
438
+ 32490,
439
+ 30282,
440
+ 38121,
441
+ 36885,
442
+ 33726,
443
+ 34243,
444
+ 31050
445
+ ]
446
+ }, {
447
+ name: "Sales & Distribution",
448
+ data: [
449
+ 11744,
450
+ 3e4,
451
+ 16005,
452
+ 19771,
453
+ 20185,
454
+ 24377,
455
+ 32147,
456
+ 30912,
457
+ 29243,
458
+ 29213,
459
+ 25663
460
+ ]
461
+ }, {
462
+ name: "Operations & Maintenance",
463
+ data: [
464
+ null,
465
+ null,
466
+ null,
467
+ null,
468
+ null,
469
+ null,
470
+ null,
471
+ null,
472
+ 11164,
473
+ 11218,
474
+ 10077
475
+ ]
476
+ }, {
477
+ name: "Other",
478
+ data: [
479
+ 21908,
480
+ 5548,
481
+ 8105,
482
+ 11248,
483
+ 8989,
484
+ 11816,
485
+ 18274,
486
+ 17300,
487
+ 13053,
488
+ 11906,
489
+ 10073
490
+ ]
491
+ }],
492
+ responsive: {
493
+ rules: [{
494
+ condition: {
495
+ maxWidth: 500
496
+ },
497
+ chartOptions: {
498
+ legend: {
499
+ layout: "horizontal",
500
+ align: "center",
501
+ verticalAlign: "bottom"
502
+ }
503
+ }
504
+ }]
505
+ }
506
+ };
507
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("h1", null, "direct"), /* @__PURE__ */ import_react.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options: graph_data }), /* @__PURE__ */ import_react.default.createElement("div", { className: props.data.className }, renderFields(schema)));
41
508
  };
42
509
  // Annotate the CommonJS export names for ESM import in node:
43
510
  0 && (module.exports = {
44
- HighchartsLineChart
511
+ ElementExecutor
45
512
  });
package/dist/index.mjs CHANGED
@@ -1,8 +1,506 @@
1
1
  // src/libraries/element-executor.tsx
2
- import React from "react";
3
- var HighchartsLineChart = (props) => {
4
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h1", null, "asf"));
2
+ import React, { useState } from "react";
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
5
+ import {
6
+ TextElement,
7
+ NumberElement,
8
+ TextareaElement,
9
+ SelectElement,
10
+ ButtonElement,
11
+ RadioElement,
12
+ CheckboxElement,
13
+ CkEditor,
14
+ SingleSelectElement,
15
+ MultipleSelectElement,
16
+ AddMoreTable,
17
+ Sidebar,
18
+ Navbar,
19
+ TableElement,
20
+ DateRangePickerElement,
21
+ DatePickerElement,
22
+ Image,
23
+ PasswordElement,
24
+ SingleCheckbox,
25
+ DropDownGroup,
26
+ FileUpload,
27
+ TabsElement,
28
+ Upload,
29
+ OtpElement,
30
+ CircleDonut,
31
+ SemiCircleDonut,
32
+ HorizontalBarChart,
33
+ DoubleBarChart,
34
+ LineChart,
35
+ BarChart
36
+ } from "@apexcura/ui-components";
37
+
38
+ // src/services/http-service.tsx
39
+ import axios from "axios";
40
+
41
+ // src/constants/network-list.tsx
42
+ var networkList = {
43
+ base_url: "https://dummyjson.com"
44
+ };
45
+ var network_list_default = networkList;
46
+
47
+ // src/services/http-service.tsx
48
+ var HttpClient = axios.create({
49
+ baseURL: network_list_default.base_url,
50
+ headers: {
51
+ "Content-Type": "application/json",
52
+ "accept": "application/json"
53
+ }
54
+ });
55
+ function postService(url, method, data) {
56
+ const token = JSON.parse(localStorage.getItem("token") || "null");
57
+ const setHref = (str) => {
58
+ window.location.href = str;
59
+ };
60
+ const currenthref = window.location.pathname;
61
+ return HttpClient({
62
+ method,
63
+ url,
64
+ data,
65
+ headers: {
66
+ "authorization": token
67
+ }
68
+ }).then((response) => {
69
+ const responseData = response.data;
70
+ const status = response.status;
71
+ if (status === 200) {
72
+ if (responseData.status) {
73
+ return responseData;
74
+ } else {
75
+ if (responseData.token === "invalid" && currenthref !== "/") {
76
+ localStorage.clearAll();
77
+ setHref("/");
78
+ return;
79
+ } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
80
+ localStorage.clearAll();
81
+ setHref("/");
82
+ return;
83
+ } else {
84
+ return responseData;
85
+ }
86
+ }
87
+ } else {
88
+ return false;
89
+ }
90
+ }).catch((error) => {
91
+ return false;
92
+ });
93
+ }
94
+
95
+ // src/libraries/element-executor.tsx
96
+ var ElementExecutor = (props) => {
97
+ const [data, setData] = useState([]);
98
+ const [schema, setSchema] = useState(props.data.schema);
99
+ const onHandleChange = (name, value) => {
100
+ const updateSchema = (schema2) => {
101
+ return schema2.map((field) => {
102
+ if (field.name === name) {
103
+ field["value"] = value;
104
+ props.selectedRecord(field);
105
+ }
106
+ if (field.fields && field.fields.length) {
107
+ field.fields = updateSchema(field.fields);
108
+ }
109
+ return field;
110
+ });
111
+ };
112
+ const updatedSchema = updateSchema(schema);
113
+ setSchema(updatedSchema);
114
+ props.setData({ ...props.data, schema: updatedSchema });
115
+ };
116
+ const handleSelectData = async () => {
117
+ try {
118
+ const response = await postService("/products/", "POST", []);
119
+ if (response !== false && typeof response === "object") {
120
+ setData(response.products);
121
+ }
122
+ } catch (error) {
123
+ console.log(error);
124
+ }
125
+ };
126
+ const renderElement = (elementProps) => {
127
+ switch (elementProps.element) {
128
+ case "input-text":
129
+ return /* @__PURE__ */ React.createElement(
130
+ TextElement,
131
+ {
132
+ ...elementProps,
133
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
134
+ }
135
+ );
136
+ case "input-number":
137
+ return /* @__PURE__ */ React.createElement(
138
+ NumberElement,
139
+ {
140
+ ...elementProps,
141
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
142
+ }
143
+ );
144
+ case "input-textarea":
145
+ return /* @__PURE__ */ React.createElement(
146
+ TextareaElement,
147
+ {
148
+ ...elementProps,
149
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
150
+ }
151
+ );
152
+ case "single-select":
153
+ return /* @__PURE__ */ React.createElement(
154
+ SelectElement,
155
+ {
156
+ ...elementProps,
157
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
158
+ }
159
+ );
160
+ case "input-mobile":
161
+ return /* @__PURE__ */ React.createElement(
162
+ NumberElement,
163
+ {
164
+ ...elementProps,
165
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
166
+ }
167
+ );
168
+ case "input-checkbox":
169
+ return /* @__PURE__ */ React.createElement(
170
+ CheckboxElement,
171
+ {
172
+ ...elementProps,
173
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
174
+ }
175
+ );
176
+ case "input-radio":
177
+ return /* @__PURE__ */ React.createElement(
178
+ RadioElement,
179
+ {
180
+ ...elementProps,
181
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
182
+ }
183
+ );
184
+ case "input-description":
185
+ return /* @__PURE__ */ React.createElement(
186
+ CkEditor,
187
+ {
188
+ ...elementProps,
189
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
190
+ }
191
+ );
192
+ case "input-single-select":
193
+ return /* @__PURE__ */ React.createElement(
194
+ SingleSelectElement,
195
+ {
196
+ ...elementProps,
197
+ dropDownOptions: data.length > 0 ? data : [],
198
+ onChange: (value) => onHandleChange(elementProps.name || "", value),
199
+ onClick: handleSelectData
200
+ }
201
+ );
202
+ case "input-multiple-select":
203
+ return /* @__PURE__ */ React.createElement(
204
+ MultipleSelectElement,
205
+ {
206
+ ...elementProps,
207
+ dropDownOptions: data.length > 0 ? data : [],
208
+ onChange: (value) => onHandleChange(elementProps.name || "", value),
209
+ onClick: handleSelectData
210
+ }
211
+ );
212
+ case "add-more":
213
+ return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
214
+ case "div":
215
+ return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
216
+ case "button":
217
+ return /* @__PURE__ */ React.createElement(
218
+ ButtonElement,
219
+ {
220
+ ...elementProps,
221
+ onClick: () => props.selectedRecord(elementProps)
222
+ }
223
+ );
224
+ case "sidebar":
225
+ return /* @__PURE__ */ React.createElement(
226
+ Sidebar,
227
+ {
228
+ ...elementProps,
229
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
230
+ }
231
+ );
232
+ case "navbar":
233
+ return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
234
+ case "table":
235
+ return /* @__PURE__ */ React.createElement(
236
+ TableElement,
237
+ {
238
+ ...elementProps,
239
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
240
+ }
241
+ );
242
+ case "daterangepicker":
243
+ return /* @__PURE__ */ React.createElement(
244
+ DateRangePickerElement,
245
+ {
246
+ ...elementProps,
247
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
248
+ }
249
+ );
250
+ case "datepicker":
251
+ return /* @__PURE__ */ React.createElement(
252
+ DatePickerElement,
253
+ {
254
+ ...elementProps,
255
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
256
+ }
257
+ );
258
+ case "upload":
259
+ return /* @__PURE__ */ React.createElement(
260
+ FileUpload,
261
+ {
262
+ ...elementProps,
263
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
264
+ }
265
+ );
266
+ case "upload-manually":
267
+ return /* @__PURE__ */ React.createElement(
268
+ Upload,
269
+ {
270
+ ...elementProps,
271
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
272
+ }
273
+ );
274
+ case "image":
275
+ return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
276
+ case "input-password":
277
+ return /* @__PURE__ */ React.createElement(
278
+ PasswordElement,
279
+ {
280
+ ...elementProps,
281
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
282
+ }
283
+ );
284
+ case "single-checkbox":
285
+ return /* @__PURE__ */ React.createElement(
286
+ SingleCheckbox,
287
+ {
288
+ ...elementProps,
289
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
290
+ }
291
+ );
292
+ case "dropdown-group":
293
+ return /* @__PURE__ */ React.createElement(
294
+ DropDownGroup,
295
+ {
296
+ ...elementProps,
297
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
298
+ }
299
+ );
300
+ case "tabs":
301
+ return /* @__PURE__ */ React.createElement(
302
+ TabsElement,
303
+ {
304
+ ...elementProps,
305
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
306
+ }
307
+ );
308
+ case "otp":
309
+ return /* @__PURE__ */ React.createElement(
310
+ OtpElement,
311
+ {
312
+ ...elementProps,
313
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
314
+ }
315
+ );
316
+ case "circle-donut":
317
+ return /* @__PURE__ */ React.createElement(
318
+ CircleDonut,
319
+ {
320
+ ...elementProps,
321
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
322
+ }
323
+ );
324
+ case "semicircle-donut":
325
+ return /* @__PURE__ */ React.createElement(
326
+ SemiCircleDonut,
327
+ {
328
+ ...elementProps,
329
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
330
+ }
331
+ );
332
+ case "horizontal-barchart":
333
+ return /* @__PURE__ */ React.createElement(
334
+ HorizontalBarChart,
335
+ {
336
+ ...elementProps,
337
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
338
+ }
339
+ );
340
+ case "linechart":
341
+ return /* @__PURE__ */ React.createElement(
342
+ LineChart,
343
+ {
344
+ ...elementProps,
345
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
346
+ }
347
+ );
348
+ case "double-barchart":
349
+ return /* @__PURE__ */ React.createElement(
350
+ DoubleBarChart,
351
+ {
352
+ ...elementProps,
353
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
354
+ }
355
+ );
356
+ case "barchart":
357
+ return /* @__PURE__ */ React.createElement(
358
+ BarChart,
359
+ {
360
+ ...elementProps,
361
+ onChange: (value) => onHandleChange(elementProps.name || "", value)
362
+ }
363
+ );
364
+ default:
365
+ return null;
366
+ }
367
+ };
368
+ const renderFields = (schema2) => {
369
+ return schema2 && schema2.map((eachSection) => {
370
+ if (eachSection.visible !== false) {
371
+ 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));
372
+ }
373
+ return null;
374
+ });
375
+ };
376
+ let graph_data = {
377
+ chart: {
378
+ height: "50%"
379
+ },
380
+ title: {
381
+ text: "U.S Solar Employment Growth",
382
+ align: "left"
383
+ },
384
+ subtitle: {
385
+ text: 'By Job Category. Source: <a href="https://irecusa.org/programs/solar-jobs-census/" target="_blank">IREC</a>.',
386
+ align: "left"
387
+ },
388
+ yAxis: {
389
+ title: {
390
+ text: "Number of Employees"
391
+ }
392
+ },
393
+ xAxis: {
394
+ accessibility: {
395
+ rangeDescription: "Range: 2010 to 2020"
396
+ }
397
+ },
398
+ legend: {
399
+ layout: "vertical",
400
+ align: "right",
401
+ verticalAlign: "middle"
402
+ },
403
+ plotOptions: {
404
+ series: {
405
+ label: {
406
+ connectorAllowed: false
407
+ },
408
+ pointStart: 2010
409
+ }
410
+ },
411
+ series: [{
412
+ name: "Installation & Developers",
413
+ data: [
414
+ 43934,
415
+ 48656,
416
+ 65165,
417
+ 81827,
418
+ 112143,
419
+ 142383,
420
+ 171533,
421
+ 165174,
422
+ 155157,
423
+ 161454,
424
+ 154610
425
+ ]
426
+ }, {
427
+ name: "Manufacturing",
428
+ data: [
429
+ 24916,
430
+ 37941,
431
+ 29742,
432
+ 29851,
433
+ 32490,
434
+ 30282,
435
+ 38121,
436
+ 36885,
437
+ 33726,
438
+ 34243,
439
+ 31050
440
+ ]
441
+ }, {
442
+ name: "Sales & Distribution",
443
+ data: [
444
+ 11744,
445
+ 3e4,
446
+ 16005,
447
+ 19771,
448
+ 20185,
449
+ 24377,
450
+ 32147,
451
+ 30912,
452
+ 29243,
453
+ 29213,
454
+ 25663
455
+ ]
456
+ }, {
457
+ name: "Operations & Maintenance",
458
+ data: [
459
+ null,
460
+ null,
461
+ null,
462
+ null,
463
+ null,
464
+ null,
465
+ null,
466
+ null,
467
+ 11164,
468
+ 11218,
469
+ 10077
470
+ ]
471
+ }, {
472
+ name: "Other",
473
+ data: [
474
+ 21908,
475
+ 5548,
476
+ 8105,
477
+ 11248,
478
+ 8989,
479
+ 11816,
480
+ 18274,
481
+ 17300,
482
+ 13053,
483
+ 11906,
484
+ 10073
485
+ ]
486
+ }],
487
+ responsive: {
488
+ rules: [{
489
+ condition: {
490
+ maxWidth: 500
491
+ },
492
+ chartOptions: {
493
+ legend: {
494
+ layout: "horizontal",
495
+ align: "center",
496
+ verticalAlign: "bottom"
497
+ }
498
+ }
499
+ }]
500
+ }
501
+ };
502
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h1", null, "direct"), /* @__PURE__ */ React.createElement(HighchartsReact, { highcharts: Highcharts, options: graph_data }), /* @__PURE__ */ React.createElement("div", { className: props.data.className }, renderFields(schema)));
5
503
  };
6
504
  export {
7
- HighchartsLineChart
505
+ ElementExecutor
8
506
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.16-Beta221",
3
+ "version": "0.0.16-Beta224",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",
@@ -28,6 +28,7 @@
28
28
  "build": "tsup"
29
29
  },
30
30
  "dependencies": {
31
+ "@apexcura/ui-components": "^0.0.14-Beta196",
31
32
  "@testing-library/jest-dom": "^6.4.2",
32
33
  "@testing-library/react": "^15.0.6",
33
34
  "@types/react-global-configuration": "^1.3.3",