@apexcura/core 0.0.16-Beta22 → 0.0.16-Beta220

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,171 +1,5 @@
1
1
  import React from 'react';
2
2
 
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
- modalContent?: {
42
- className?: string;
43
- fields?: {
44
- _id?: string;
45
- name?: string;
46
- label?: string;
47
- source?: string;
48
- initial_message?: boolean;
49
- element: string;
50
- className?: string;
51
- position?: string;
52
- }[];
53
- };
54
- items?: {
55
- icon?: React.JSX.Element;
56
- label?: string;
57
- active?: boolean;
58
- text?: string;
59
- time?: string;
60
- }[];
61
- fields?: {
62
- name?: string;
63
- label?: string;
64
- placeholder?: string;
65
- element?: string;
66
- type?: string;
67
- value?: string | number | boolean | any[] | null | object;
68
- options?: {
69
- key?: number;
70
- label: string;
71
- value: string;
72
- }[];
73
- firstOptions?: {
74
- key?: number;
75
- label: string;
76
- value: string;
77
- }[];
78
- secondOptions?: {
79
- key?: number;
80
- label: string;
81
- value: string;
82
- }[];
83
- selectBefore?: {
84
- label: string;
85
- value: string;
86
- }[];
87
- selectAfter?: {
88
- label: string;
89
- value: string;
90
- }[];
91
- dropDownOptions?: any[];
92
- visible?: boolean;
93
- disabled?: boolean;
94
- required?: boolean;
95
- prefix?: React.ReactNode;
96
- suffix?: React.ReactNode;
97
- addonBefore?: React.ReactNode;
98
- defaultValue?: string;
99
- status?: "error" | "warning";
100
- styles?: React.CSSProperties;
101
- fieldClassName?: string;
102
- elementClassName?: string;
103
- variant?: string;
104
- thead?: {
105
- id: number;
106
- name?: string;
107
- label?: string;
108
- visible?: boolean;
109
- required?: boolean;
110
- key?: string;
111
- render?: () => void;
112
- }[];
113
- tbody?: {
114
- id?: number;
115
- name?: string;
116
- label?: string;
117
- element?: string;
118
- type?: string;
119
- variable_data?: {
120
- id: {
121
- id?: number;
122
- };
123
- Route?: {
124
- label: string;
125
- element: string;
126
- type: string;
127
- };
128
- Dose?: {
129
- label: string;
130
- element: string;
131
- type: string;
132
- };
133
- Frequency?: {
134
- label: string;
135
- element: string;
136
- type: string;
137
- };
138
- When?: {
139
- label: string;
140
- element: string;
141
- type: string;
142
- };
143
- Duration?: {
144
- label: string;
145
- element: string;
146
- type: string;
147
- };
148
- Instructions?: {
149
- label: string;
150
- element: string;
151
- type: string;
152
- };
153
- SubRows?: {
154
- label: string;
155
- };
156
- }[];
157
- }[];
158
- payload_keys?: string[];
159
- api_endpoint?: string;
160
- next_id?: string;
161
- action?: string;
162
- }[];
163
- }[];
164
- };
165
- setData: Function;
166
- selectedRecord: Function;
167
- };
168
- type ElementExecutorProps = FormExecutorProps & styling;
169
- declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
3
+ declare const HighchartsLineChart: (props: any) => React.JSX.Element;
170
4
 
171
- export { ElementExecutor };
5
+ export { HighchartsLineChart };
package/dist/index.d.ts CHANGED
@@ -1,171 +1,5 @@
1
1
  import React from 'react';
2
2
 
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
- modalContent?: {
42
- className?: string;
43
- fields?: {
44
- _id?: string;
45
- name?: string;
46
- label?: string;
47
- source?: string;
48
- initial_message?: boolean;
49
- element: string;
50
- className?: string;
51
- position?: string;
52
- }[];
53
- };
54
- items?: {
55
- icon?: React.JSX.Element;
56
- label?: string;
57
- active?: boolean;
58
- text?: string;
59
- time?: string;
60
- }[];
61
- fields?: {
62
- name?: string;
63
- label?: string;
64
- placeholder?: string;
65
- element?: string;
66
- type?: string;
67
- value?: string | number | boolean | any[] | null | object;
68
- options?: {
69
- key?: number;
70
- label: string;
71
- value: string;
72
- }[];
73
- firstOptions?: {
74
- key?: number;
75
- label: string;
76
- value: string;
77
- }[];
78
- secondOptions?: {
79
- key?: number;
80
- label: string;
81
- value: string;
82
- }[];
83
- selectBefore?: {
84
- label: string;
85
- value: string;
86
- }[];
87
- selectAfter?: {
88
- label: string;
89
- value: string;
90
- }[];
91
- dropDownOptions?: any[];
92
- visible?: boolean;
93
- disabled?: boolean;
94
- required?: boolean;
95
- prefix?: React.ReactNode;
96
- suffix?: React.ReactNode;
97
- addonBefore?: React.ReactNode;
98
- defaultValue?: string;
99
- status?: "error" | "warning";
100
- styles?: React.CSSProperties;
101
- fieldClassName?: string;
102
- elementClassName?: string;
103
- variant?: string;
104
- thead?: {
105
- id: number;
106
- name?: string;
107
- label?: string;
108
- visible?: boolean;
109
- required?: boolean;
110
- key?: string;
111
- render?: () => void;
112
- }[];
113
- tbody?: {
114
- id?: number;
115
- name?: string;
116
- label?: string;
117
- element?: string;
118
- type?: string;
119
- variable_data?: {
120
- id: {
121
- id?: number;
122
- };
123
- Route?: {
124
- label: string;
125
- element: string;
126
- type: string;
127
- };
128
- Dose?: {
129
- label: string;
130
- element: string;
131
- type: string;
132
- };
133
- Frequency?: {
134
- label: string;
135
- element: string;
136
- type: string;
137
- };
138
- When?: {
139
- label: string;
140
- element: string;
141
- type: string;
142
- };
143
- Duration?: {
144
- label: string;
145
- element: string;
146
- type: string;
147
- };
148
- Instructions?: {
149
- label: string;
150
- element: string;
151
- type: string;
152
- };
153
- SubRows?: {
154
- label: string;
155
- };
156
- }[];
157
- }[];
158
- payload_keys?: string[];
159
- api_endpoint?: string;
160
- next_id?: string;
161
- action?: string;
162
- }[];
163
- }[];
164
- };
165
- setData: Function;
166
- selectedRecord: Function;
167
- };
168
- type ElementExecutorProps = FormExecutorProps & styling;
169
- declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
3
+ declare const HighchartsLineChart: (props: any) => React.JSX.Element;
170
4
 
171
- export { ElementExecutor };
5
+ export { HighchartsLineChart };
package/dist/index.js CHANGED
@@ -30,291 +30,141 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- ElementExecutor: () => ElementExecutor
33
+ HighchartsLineChart: () => HighchartsLineChart
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 import_ui_components = require("@apexcura/ui-components");
40
-
41
- // src/services/http-service.tsx
42
- var import_axios = __toESM(require("axios"));
43
-
44
- // src/constants/network-list.tsx
45
- var networkList = {
46
- base_url: "https://dummyjson.com"
47
- };
48
- var network_list_default = networkList;
49
-
50
- // src/services/http-service.tsx
51
- var HttpClient = import_axios.default.create({
52
- baseURL: network_list_default.base_url,
53
- headers: {
54
- "Content-Type": "application/json",
55
- "accept": "application/json"
56
- }
57
- });
58
- function postService(url, method, data) {
59
- const token = JSON.parse(localStorage.getItem("token") || "null");
60
- const setHref = (str) => {
61
- window.location.href = str;
62
- };
63
- const currenthref = window.location.pathname;
64
- return HttpClient({
65
- method,
66
- url,
67
- data,
68
- headers: {
69
- "authorization": token
70
- }
71
- }).then((response) => {
72
- const responseData = response.data;
73
- const status = response.status;
74
- if (status === 200) {
75
- if (responseData.status) {
76
- return responseData;
77
- } else {
78
- if (responseData.token === "invalid" && currenthref !== "/") {
79
- localStorage.clearAll();
80
- setHref("/");
81
- return;
82
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
83
- localStorage.clearAll();
84
- setHref("/");
85
- return;
86
- } else {
87
- return responseData;
88
- }
39
+ var import_highcharts = __toESM(require("highcharts"));
40
+ var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
41
+ var HighchartsLineChart = (props) => {
42
+ let graph_data = {
43
+ title: {
44
+ text: "U.S Solar Employment Growth",
45
+ align: "left"
46
+ },
47
+ subtitle: {
48
+ text: 'By Job Category. Source: <a href="https://irecusa.org/programs/solar-jobs-census/" target="_blank">IREC</a>.',
49
+ align: "left"
50
+ },
51
+ yAxis: {
52
+ title: {
53
+ text: "Number of Employees"
89
54
  }
90
- } else {
91
- return false;
92
- }
93
- }).catch((error) => {
94
- return false;
95
- });
96
- }
97
-
98
- // src/libraries/element-executor.tsx
99
- var ElementExecutor = (props) => {
100
- const [data, setData] = (0, import_react.useState)([]);
101
- const [schema, setSchema] = (0, import_react.useState)(props.data.schema);
102
- const onHandleChange = (name, value) => {
103
- const updateSchema = (schema2) => {
104
- return schema2.map((field) => {
105
- if (field.name === name) {
106
- field["value"] = value;
107
- props.selectedRecord(field);
108
- }
109
- if (field.fields && field.fields.length) {
110
- field.fields = updateSchema(field.fields);
111
- }
112
- return field;
113
- });
114
- };
115
- const updatedSchema = updateSchema(schema);
116
- setSchema(updatedSchema);
117
- props.setData({ ...props.data, schema: updatedSchema });
118
- };
119
- const handleSelectData = async () => {
120
- try {
121
- const response = await postService("/products/", "POST", []);
122
- if (response !== false && typeof response === "object") {
123
- setData(response.products);
55
+ },
56
+ xAxis: {
57
+ accessibility: {
58
+ rangeDescription: "Range: 2010 to 2020"
124
59
  }
125
- } catch (error) {
126
- console.log(error);
127
- }
128
- };
129
- const renderElement = (elementProps) => {
130
- switch (elementProps.element) {
131
- case "input-text":
132
- return /* @__PURE__ */ import_react.default.createElement(
133
- import_ui_components.TextElement,
134
- {
135
- ...elementProps,
136
- onChange: (value) => onHandleChange(elementProps.name || "", value)
137
- }
138
- );
139
- case "input-number":
140
- return /* @__PURE__ */ import_react.default.createElement(
141
- import_ui_components.NumberElement,
142
- {
143
- ...elementProps,
144
- onChange: (value) => onHandleChange(elementProps.name || "", value)
145
- }
146
- );
147
- case "input-textarea":
148
- return /* @__PURE__ */ import_react.default.createElement(
149
- import_ui_components.TextareaElement,
150
- {
151
- ...elementProps,
152
- onChange: (value) => onHandleChange(elementProps.name || "", value)
153
- }
154
- );
155
- case "single-select":
156
- return /* @__PURE__ */ import_react.default.createElement(
157
- import_ui_components.SelectElement,
158
- {
159
- ...elementProps,
160
- onChange: (value) => onHandleChange(elementProps.name || "", value)
161
- }
162
- );
163
- case "input-mobile":
164
- return /* @__PURE__ */ import_react.default.createElement(
165
- import_ui_components.NumberElement,
166
- {
167
- ...elementProps,
168
- onChange: (value) => onHandleChange(elementProps.name || "", value)
169
- }
170
- );
171
- case "input-checkbox":
172
- return /* @__PURE__ */ import_react.default.createElement(
173
- import_ui_components.CheckboxElement,
174
- {
175
- ...elementProps,
176
- onChange: (value) => onHandleChange(elementProps.name || "", value)
177
- }
178
- );
179
- case "input-radio":
180
- return /* @__PURE__ */ import_react.default.createElement(
181
- import_ui_components.RadioElement,
182
- {
183
- ...elementProps,
184
- onChange: (value) => onHandleChange(elementProps.name || "", value)
185
- }
186
- );
187
- case "input-description":
188
- return /* @__PURE__ */ import_react.default.createElement(
189
- import_ui_components.CkEditor,
190
- {
191
- ...elementProps,
192
- onChange: (value) => onHandleChange(elementProps.name || "", value)
193
- }
194
- );
195
- case "input-single-select":
196
- return /* @__PURE__ */ import_react.default.createElement(
197
- import_ui_components.SingleSelectElement,
198
- {
199
- ...elementProps,
200
- dropDownOptions: data.length > 0 ? data : [],
201
- onChange: (value) => onHandleChange(elementProps.name || "", value),
202
- onClick: handleSelectData
203
- }
204
- );
205
- case "input-multiple-select":
206
- return /* @__PURE__ */ import_react.default.createElement(
207
- import_ui_components.MultipleSelectElement,
208
- {
209
- ...elementProps,
210
- dropDownOptions: data.length > 0 ? data : [],
211
- onChange: (value) => onHandleChange(elementProps.name || "", value),
212
- onClick: handleSelectData
213
- }
214
- );
215
- case "add-more":
216
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.AddMoreTable, { ...elementProps });
217
- case "div":
218
- return /* @__PURE__ */ import_react.default.createElement("div", { className: elementProps.className }, elementProps.label);
219
- case "button":
220
- return /* @__PURE__ */ import_react.default.createElement(
221
- import_ui_components.ButtonElement,
222
- {
223
- ...elementProps,
224
- onClick: () => props.selectedRecord(elementProps)
225
- }
226
- );
227
- case "sidebar":
228
- return /* @__PURE__ */ import_react.default.createElement(
229
- import_ui_components.Sidebar,
230
- {
231
- ...elementProps,
232
- onChange: (value) => onHandleChange(elementProps.name || "", value)
233
- }
234
- );
235
- case "navbar":
236
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Navbar, { ...elementProps });
237
- case "table":
238
- return /* @__PURE__ */ import_react.default.createElement(
239
- import_ui_components.TableElement,
240
- {
241
- ...elementProps,
242
- onChange: (value) => onHandleChange(elementProps.name || "", value)
243
- }
244
- );
245
- case "daterangepicker":
246
- return /* @__PURE__ */ import_react.default.createElement(
247
- import_ui_components.DateRangePickerElement,
248
- {
249
- ...elementProps,
250
- onChange: (value) => onHandleChange(elementProps.name || "", value)
251
- }
252
- );
253
- case "datepicker":
254
- return /* @__PURE__ */ import_react.default.createElement(
255
- import_ui_components.DatePickerElement,
256
- {
257
- ...elementProps,
258
- onChange: (value) => onHandleChange(elementProps.name || "", value)
259
- }
260
- );
261
- case "upload":
262
- return /* @__PURE__ */ import_react.default.createElement(
263
- import_ui_components.FileUpload,
264
- {
265
- ...elementProps,
266
- onChange: (value) => onHandleChange(elementProps.name || "", value)
267
- }
268
- );
269
- case "image":
270
- return /* @__PURE__ */ import_react.default.createElement(import_ui_components.Image, { ...elementProps });
271
- case "input-password":
272
- return /* @__PURE__ */ import_react.default.createElement(
273
- import_ui_components.PasswordElement,
274
- {
275
- ...elementProps,
276
- onChange: (value) => onHandleChange(elementProps.name || "", value)
277
- }
278
- );
279
- case "single-checkbox":
280
- return /* @__PURE__ */ import_react.default.createElement(
281
- import_ui_components.SingleCheckbox,
282
- {
283
- ...elementProps,
284
- onChange: (value) => onHandleChange(elementProps.name || "", value)
285
- }
286
- );
287
- case "dropdown-group":
288
- return /* @__PURE__ */ import_react.default.createElement(
289
- import_ui_components.DropDownGroup,
290
- {
291
- ...elementProps,
292
- onChange: (value) => onHandleChange(elementProps.name || "", value)
293
- }
294
- );
295
- case "tabs":
296
- return /* @__PURE__ */ import_react.default.createElement(
297
- import_ui_components.TabsElement,
298
- {
299
- ...elementProps,
300
- onChange: (value) => onHandleChange(elementProps.name || "", value)
60
+ },
61
+ legend: {
62
+ layout: "vertical",
63
+ align: "right",
64
+ verticalAlign: "middle"
65
+ },
66
+ plotOptions: {
67
+ series: {
68
+ label: {
69
+ connectorAllowed: false
70
+ },
71
+ pointStart: 2010
72
+ }
73
+ },
74
+ series: [{
75
+ name: "Installation & Developers",
76
+ data: [
77
+ 43934,
78
+ 48656,
79
+ 65165,
80
+ 81827,
81
+ 112143,
82
+ 142383,
83
+ 171533,
84
+ 165174,
85
+ 155157,
86
+ 161454,
87
+ 154610
88
+ ]
89
+ }, {
90
+ name: "Manufacturing",
91
+ data: [
92
+ 24916,
93
+ 37941,
94
+ 29742,
95
+ 29851,
96
+ 32490,
97
+ 30282,
98
+ 38121,
99
+ 36885,
100
+ 33726,
101
+ 34243,
102
+ 31050
103
+ ]
104
+ }, {
105
+ name: "Sales & Distribution",
106
+ data: [
107
+ 11744,
108
+ 3e4,
109
+ 16005,
110
+ 19771,
111
+ 20185,
112
+ 24377,
113
+ 32147,
114
+ 30912,
115
+ 29243,
116
+ 29213,
117
+ 25663
118
+ ]
119
+ }, {
120
+ name: "Operations & Maintenance",
121
+ data: [
122
+ null,
123
+ null,
124
+ null,
125
+ null,
126
+ null,
127
+ null,
128
+ null,
129
+ null,
130
+ 11164,
131
+ 11218,
132
+ 10077
133
+ ]
134
+ }, {
135
+ name: "Other",
136
+ data: [
137
+ 21908,
138
+ 5548,
139
+ 8105,
140
+ 11248,
141
+ 8989,
142
+ 11816,
143
+ 18274,
144
+ 17300,
145
+ 13053,
146
+ 11906,
147
+ 10073
148
+ ]
149
+ }],
150
+ responsive: {
151
+ rules: [{
152
+ condition: {
153
+ maxWidth: 500
154
+ },
155
+ chartOptions: {
156
+ legend: {
157
+ layout: "horizontal",
158
+ align: "center",
159
+ verticalAlign: "bottom"
301
160
  }
302
- );
303
- default:
304
- return null;
161
+ }
162
+ }]
305
163
  }
306
164
  };
307
- const renderFields = (schema2) => {
308
- return schema2 && schema2.map((eachSection) => {
309
- if (eachSection.visible !== false) {
310
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderElement(eachSection), /* @__PURE__ */ import_react.default.createElement("div", { className: eachSection.className, key: eachSection.name }, renderFields(eachSection.fields))) : renderElement(eachSection));
311
- }
312
- return null;
313
- });
314
- };
315
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: props.data.className }, renderFields(schema)));
165
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options: graph_data }));
316
166
  };
317
167
  // Annotate the CommonJS export names for ESM import in node:
318
168
  0 && (module.exports = {
319
- ElementExecutor
169
+ HighchartsLineChart
320
170
  });
package/dist/index.mjs CHANGED
@@ -1,306 +1,133 @@
1
1
  // src/libraries/element-executor.tsx
2
- import React, { useState } from "react";
3
- import {
4
- TextElement,
5
- NumberElement,
6
- TextareaElement,
7
- SelectElement,
8
- ButtonElement,
9
- RadioElement,
10
- CheckboxElement,
11
- CkEditor,
12
- SingleSelectElement,
13
- MultipleSelectElement,
14
- AddMoreTable,
15
- Sidebar,
16
- Navbar,
17
- TableElement,
18
- DateRangePickerElement,
19
- DatePickerElement,
20
- Image,
21
- PasswordElement,
22
- SingleCheckbox,
23
- DropDownGroup,
24
- FileUpload,
25
- TabsElement
26
- } from "@apexcura/ui-components";
27
-
28
- // src/services/http-service.tsx
29
- import axios from "axios";
30
-
31
- // src/constants/network-list.tsx
32
- var networkList = {
33
- base_url: "https://dummyjson.com"
34
- };
35
- var network_list_default = networkList;
36
-
37
- // src/services/http-service.tsx
38
- var HttpClient = axios.create({
39
- baseURL: network_list_default.base_url,
40
- headers: {
41
- "Content-Type": "application/json",
42
- "accept": "application/json"
43
- }
44
- });
45
- function postService(url, method, data) {
46
- const token = JSON.parse(localStorage.getItem("token") || "null");
47
- const setHref = (str) => {
48
- window.location.href = str;
49
- };
50
- const currenthref = window.location.pathname;
51
- return HttpClient({
52
- method,
53
- url,
54
- data,
55
- headers: {
56
- "authorization": token
57
- }
58
- }).then((response) => {
59
- const responseData = response.data;
60
- const status = response.status;
61
- if (status === 200) {
62
- if (responseData.status) {
63
- return responseData;
64
- } else {
65
- if (responseData.token === "invalid" && currenthref !== "/") {
66
- localStorage.clearAll();
67
- setHref("/");
68
- return;
69
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
70
- localStorage.clearAll();
71
- setHref("/");
72
- return;
73
- } else {
74
- return responseData;
75
- }
2
+ import React from "react";
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
5
+ var HighchartsLineChart = (props) => {
6
+ let graph_data = {
7
+ title: {
8
+ text: "U.S Solar Employment Growth",
9
+ align: "left"
10
+ },
11
+ subtitle: {
12
+ text: 'By Job Category. Source: <a href="https://irecusa.org/programs/solar-jobs-census/" target="_blank">IREC</a>.',
13
+ align: "left"
14
+ },
15
+ yAxis: {
16
+ title: {
17
+ text: "Number of Employees"
76
18
  }
77
- } else {
78
- return false;
79
- }
80
- }).catch((error) => {
81
- return false;
82
- });
83
- }
84
-
85
- // src/libraries/element-executor.tsx
86
- var ElementExecutor = (props) => {
87
- const [data, setData] = useState([]);
88
- const [schema, setSchema] = useState(props.data.schema);
89
- const onHandleChange = (name, value) => {
90
- const updateSchema = (schema2) => {
91
- return schema2.map((field) => {
92
- if (field.name === name) {
93
- field["value"] = value;
94
- props.selectedRecord(field);
95
- }
96
- if (field.fields && field.fields.length) {
97
- field.fields = updateSchema(field.fields);
98
- }
99
- return field;
100
- });
101
- };
102
- const updatedSchema = updateSchema(schema);
103
- setSchema(updatedSchema);
104
- props.setData({ ...props.data, schema: updatedSchema });
105
- };
106
- const handleSelectData = async () => {
107
- try {
108
- const response = await postService("/products/", "POST", []);
109
- if (response !== false && typeof response === "object") {
110
- setData(response.products);
19
+ },
20
+ xAxis: {
21
+ accessibility: {
22
+ rangeDescription: "Range: 2010 to 2020"
111
23
  }
112
- } catch (error) {
113
- console.log(error);
114
- }
115
- };
116
- const renderElement = (elementProps) => {
117
- switch (elementProps.element) {
118
- case "input-text":
119
- return /* @__PURE__ */ React.createElement(
120
- TextElement,
121
- {
122
- ...elementProps,
123
- onChange: (value) => onHandleChange(elementProps.name || "", value)
124
- }
125
- );
126
- case "input-number":
127
- return /* @__PURE__ */ React.createElement(
128
- NumberElement,
129
- {
130
- ...elementProps,
131
- onChange: (value) => onHandleChange(elementProps.name || "", value)
132
- }
133
- );
134
- case "input-textarea":
135
- return /* @__PURE__ */ React.createElement(
136
- TextareaElement,
137
- {
138
- ...elementProps,
139
- onChange: (value) => onHandleChange(elementProps.name || "", value)
140
- }
141
- );
142
- case "single-select":
143
- return /* @__PURE__ */ React.createElement(
144
- SelectElement,
145
- {
146
- ...elementProps,
147
- onChange: (value) => onHandleChange(elementProps.name || "", value)
148
- }
149
- );
150
- case "input-mobile":
151
- return /* @__PURE__ */ React.createElement(
152
- NumberElement,
153
- {
154
- ...elementProps,
155
- onChange: (value) => onHandleChange(elementProps.name || "", value)
156
- }
157
- );
158
- case "input-checkbox":
159
- return /* @__PURE__ */ React.createElement(
160
- CheckboxElement,
161
- {
162
- ...elementProps,
163
- onChange: (value) => onHandleChange(elementProps.name || "", value)
164
- }
165
- );
166
- case "input-radio":
167
- return /* @__PURE__ */ React.createElement(
168
- RadioElement,
169
- {
170
- ...elementProps,
171
- onChange: (value) => onHandleChange(elementProps.name || "", value)
172
- }
173
- );
174
- case "input-description":
175
- return /* @__PURE__ */ React.createElement(
176
- CkEditor,
177
- {
178
- ...elementProps,
179
- onChange: (value) => onHandleChange(elementProps.name || "", value)
180
- }
181
- );
182
- case "input-single-select":
183
- return /* @__PURE__ */ React.createElement(
184
- SingleSelectElement,
185
- {
186
- ...elementProps,
187
- dropDownOptions: data.length > 0 ? data : [],
188
- onChange: (value) => onHandleChange(elementProps.name || "", value),
189
- onClick: handleSelectData
190
- }
191
- );
192
- case "input-multiple-select":
193
- return /* @__PURE__ */ React.createElement(
194
- MultipleSelectElement,
195
- {
196
- ...elementProps,
197
- dropDownOptions: data.length > 0 ? data : [],
198
- onChange: (value) => onHandleChange(elementProps.name || "", value),
199
- onClick: handleSelectData
200
- }
201
- );
202
- case "add-more":
203
- return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
204
- case "div":
205
- return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
206
- case "button":
207
- return /* @__PURE__ */ React.createElement(
208
- ButtonElement,
209
- {
210
- ...elementProps,
211
- onClick: () => props.selectedRecord(elementProps)
212
- }
213
- );
214
- case "sidebar":
215
- return /* @__PURE__ */ React.createElement(
216
- Sidebar,
217
- {
218
- ...elementProps,
219
- onChange: (value) => onHandleChange(elementProps.name || "", value)
220
- }
221
- );
222
- case "navbar":
223
- return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
224
- case "table":
225
- return /* @__PURE__ */ React.createElement(
226
- TableElement,
227
- {
228
- ...elementProps,
229
- onChange: (value) => onHandleChange(elementProps.name || "", value)
230
- }
231
- );
232
- case "daterangepicker":
233
- return /* @__PURE__ */ React.createElement(
234
- DateRangePickerElement,
235
- {
236
- ...elementProps,
237
- onChange: (value) => onHandleChange(elementProps.name || "", value)
238
- }
239
- );
240
- case "datepicker":
241
- return /* @__PURE__ */ React.createElement(
242
- DatePickerElement,
243
- {
244
- ...elementProps,
245
- onChange: (value) => onHandleChange(elementProps.name || "", value)
246
- }
247
- );
248
- case "upload":
249
- return /* @__PURE__ */ React.createElement(
250
- FileUpload,
251
- {
252
- ...elementProps,
253
- onChange: (value) => onHandleChange(elementProps.name || "", value)
254
- }
255
- );
256
- case "image":
257
- return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
258
- case "input-password":
259
- return /* @__PURE__ */ React.createElement(
260
- PasswordElement,
261
- {
262
- ...elementProps,
263
- onChange: (value) => onHandleChange(elementProps.name || "", value)
264
- }
265
- );
266
- case "single-checkbox":
267
- return /* @__PURE__ */ React.createElement(
268
- SingleCheckbox,
269
- {
270
- ...elementProps,
271
- onChange: (value) => onHandleChange(elementProps.name || "", value)
272
- }
273
- );
274
- case "dropdown-group":
275
- return /* @__PURE__ */ React.createElement(
276
- DropDownGroup,
277
- {
278
- ...elementProps,
279
- onChange: (value) => onHandleChange(elementProps.name || "", value)
280
- }
281
- );
282
- case "tabs":
283
- return /* @__PURE__ */ React.createElement(
284
- TabsElement,
285
- {
286
- ...elementProps,
287
- onChange: (value) => onHandleChange(elementProps.name || "", value)
24
+ },
25
+ legend: {
26
+ layout: "vertical",
27
+ align: "right",
28
+ verticalAlign: "middle"
29
+ },
30
+ plotOptions: {
31
+ series: {
32
+ label: {
33
+ connectorAllowed: false
34
+ },
35
+ pointStart: 2010
36
+ }
37
+ },
38
+ series: [{
39
+ name: "Installation & Developers",
40
+ data: [
41
+ 43934,
42
+ 48656,
43
+ 65165,
44
+ 81827,
45
+ 112143,
46
+ 142383,
47
+ 171533,
48
+ 165174,
49
+ 155157,
50
+ 161454,
51
+ 154610
52
+ ]
53
+ }, {
54
+ name: "Manufacturing",
55
+ data: [
56
+ 24916,
57
+ 37941,
58
+ 29742,
59
+ 29851,
60
+ 32490,
61
+ 30282,
62
+ 38121,
63
+ 36885,
64
+ 33726,
65
+ 34243,
66
+ 31050
67
+ ]
68
+ }, {
69
+ name: "Sales & Distribution",
70
+ data: [
71
+ 11744,
72
+ 3e4,
73
+ 16005,
74
+ 19771,
75
+ 20185,
76
+ 24377,
77
+ 32147,
78
+ 30912,
79
+ 29243,
80
+ 29213,
81
+ 25663
82
+ ]
83
+ }, {
84
+ name: "Operations & Maintenance",
85
+ data: [
86
+ null,
87
+ null,
88
+ null,
89
+ null,
90
+ null,
91
+ null,
92
+ null,
93
+ null,
94
+ 11164,
95
+ 11218,
96
+ 10077
97
+ ]
98
+ }, {
99
+ name: "Other",
100
+ data: [
101
+ 21908,
102
+ 5548,
103
+ 8105,
104
+ 11248,
105
+ 8989,
106
+ 11816,
107
+ 18274,
108
+ 17300,
109
+ 13053,
110
+ 11906,
111
+ 10073
112
+ ]
113
+ }],
114
+ responsive: {
115
+ rules: [{
116
+ condition: {
117
+ maxWidth: 500
118
+ },
119
+ chartOptions: {
120
+ legend: {
121
+ layout: "horizontal",
122
+ align: "center",
123
+ verticalAlign: "bottom"
288
124
  }
289
- );
290
- default:
291
- return null;
125
+ }
126
+ }]
292
127
  }
293
128
  };
294
- const renderFields = (schema2) => {
295
- return schema2 && schema2.map((eachSection) => {
296
- if (eachSection.visible !== false) {
297
- return /* @__PURE__ */ React.createElement(React.Fragment, null, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: eachSection.name }, renderFields(eachSection.fields))) : renderElement(eachSection));
298
- }
299
- return null;
300
- });
301
- };
302
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: props.data.className }, renderFields(schema)));
129
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(HighchartsReact, { highcharts: Highcharts, options: graph_data }));
303
130
  };
304
131
  export {
305
- ElementExecutor
132
+ HighchartsLineChart
306
133
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.16-Beta22",
3
+ "version": "0.0.16-Beta220",
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.14-Beta22",
32
31
  "@testing-library/jest-dom": "^6.4.2",
33
32
  "@testing-library/react": "^15.0.6",
34
33
  "@types/react-global-configuration": "^1.3.3",
35
34
  "antd": "^5.16.5",
36
35
  "axios": "^1.6.8",
36
+ "highcharts": "^11.4.3",
37
+ "highcharts-react-official": "^3.2.1",
37
38
  "react": "^18.3.1",
38
39
  "react-dom": "^18.3.1",
39
40
  "tsup": "^8.0.2"