@apexcura/core 0.0.17-Beta72 → 0.0.17-Beta721

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.
@@ -0,0 +1,8 @@
1
+ interface ResponseData {
2
+ [x: string]: string | boolean | undefined;
3
+ status: boolean;
4
+ token?: string;
5
+ IS_MAINTENANCE_MODE?: boolean;
6
+ }
7
+ export default function postService(url: string, method: string, data: string): Promise<false | ResponseData>;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ type StorageProps = {
2
+ key: string;
3
+ data?: object;
4
+ };
5
+ declare class Storage {
6
+ store({ key, data }: StorageProps): void;
7
+ getJson({ key }: StorageProps): any;
8
+ get({ key }: StorageProps): string | null;
9
+ remove({ key }: StorageProps): void;
10
+ clearAll(): void;
11
+ }
12
+ declare const _default: Storage;
13
+ export default _default;
package/package.json CHANGED
@@ -1,54 +1,57 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.17-Beta72",
4
- "description": "Apex cura React components library",
5
- "keywords": [
6
- "apex cura",
7
- "input",
8
- "ui",
9
- "react",
10
- "react-component"
11
- ],
12
- "homepage": "https://www.apexcura.com/",
13
- "bugs": {
14
- "url": "https://github.com/apexcura/core/issues"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/apexcura/core.git",
19
- "directory": "packages/core"
3
+ "version": "0.0.17-Beta721",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "webpack --config webpack.config.js",
8
+ "lint": "eslint src",
9
+ "format": "prettier --write src",
10
+ "prepare": "npm run build"
20
11
  },
21
- "author": "Apex Cura <hello@apexcura.com>",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "keywords": [],
16
+ "author": "",
22
17
  "license": "ISC",
23
- "main": "./dist/index.js",
24
- "module": "./dist/index.mjs",
25
- "types": "./dist/index.d.ts",
26
- "scripts": {
27
- "test": "jest",
28
- "build": "tsup"
18
+ "description": "",
19
+ "lint-staged": {
20
+ "src/**/*.{ts,tsx}": [
21
+ "eslint --fix",
22
+ "prettier --write"
23
+ ]
29
24
  },
30
- "dependencies": {
31
- "@apexcura/ui-components": "^0.0.15-Beta61",
32
- "@testing-library/jest-dom": "^6.4.2",
33
- "@testing-library/react": "^15.0.6",
34
- "@types/react-global-configuration": "^1.3.3",
35
- "antd": "^5.16.5",
36
- "axios": "^1.6.8",
37
- "moment": "^2.30.1",
25
+ "peerDependencies": {
38
26
  "react": "^18.3.1",
39
- "react-dom": "^18.3.1",
40
- "tsup": "^8.0.2"
27
+ "react-dom": "^18.3.1"
41
28
  },
42
- "devDependencies": {
43
- "@types/jest": "^29.5.12",
44
- "@types/react": "^18.3.1",
45
- "@types/testing-library__react": "^10.2.0",
46
- "jest": "^29.7.0",
47
- "jest-environment-jsdom": "^29.7.0",
48
- "ts-jest": "^29.1.2",
49
- "typescript": "^5.4.5"
29
+ "dependencies": {
30
+ "@apexcura/highcharts": "^0.0.0-Beta186",
31
+ "@apexcura/ui-components": "^0.0.16-Beta481",
32
+ "antd": "^5.19.2",
33
+ "axios": "^1.7.2"
50
34
  },
51
- "engines": {
52
- "node": ">=18.0.0"
35
+ "devDependencies": {
36
+ "@types/highcharts": "^7.0.0",
37
+ "@types/react": "^18.3.3",
38
+ "@types/react-dom": "^18.3.0",
39
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
40
+ "@typescript-eslint/parser": "^7.15.0",
41
+ "clean-webpack-plugin": "^4.0.0",
42
+ "eslint": "^8.57.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-plugin-prettier": "^5.1.3",
45
+ "eslint-plugin-react": "^7.34.3",
46
+ "eslint-webpack-plugin": "^4.2.0",
47
+ "husky": "^9.0.11",
48
+ "lint-staged": "^15.2.7",
49
+ "prettier": "^3.3.2",
50
+ "source-map-loader": "^5.0.0",
51
+ "ts-loader": "^9.5.1",
52
+ "typescript": "^5.5.3",
53
+ "webpack": "^5.92.1",
54
+ "webpack-bundle-analyzer": "^4.10.2",
55
+ "webpack-cli": "^5.1.4"
53
56
  }
54
57
  }
package/dist/index.mjs DELETED
@@ -1,435 +0,0 @@
1
- // src/libraries/element-executor.tsx
2
- import React, { useEffect, 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
- Upload,
27
- OtpElement,
28
- CircleDonut,
29
- SemiCircleDonut,
30
- HorizontalBarChart,
31
- DoubleBarChart,
32
- LineChart,
33
- BarChart,
34
- DivContainer,
35
- ColorPickerElement,
36
- NotificationAlert
37
- } from "@apexcura/ui-components";
38
- import moment from "moment";
39
-
40
- // src/services/http-service.tsx
41
- import axios from "axios";
42
-
43
- // src/constants/network-list.tsx
44
- var networkList = {
45
- base_url: "https://dummyjson.com"
46
- };
47
- var network_list_default = networkList;
48
-
49
- // src/services/http-service.tsx
50
- var HttpClient = axios.create({
51
- baseURL: network_list_default.base_url,
52
- headers: {
53
- "Content-Type": "application/json",
54
- "accept": "application/json"
55
- }
56
- });
57
- function postService(url, method, data) {
58
- const token = JSON.parse(localStorage.getItem("token") || "null");
59
- const setHref = (str) => {
60
- window.location.href = str;
61
- };
62
- const currenthref = window.location.pathname;
63
- return HttpClient({
64
- method,
65
- url,
66
- data,
67
- headers: {
68
- "authorization": token
69
- }
70
- }).then((response) => {
71
- const responseData = response.data;
72
- const status = response.status;
73
- if (status === 200) {
74
- if (responseData.status) {
75
- return responseData;
76
- } else {
77
- if (responseData.token === "invalid" && currenthref !== "/") {
78
- localStorage.clearAll();
79
- setHref("/");
80
- return;
81
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
82
- localStorage.clearAll();
83
- setHref("/");
84
- return;
85
- } else {
86
- return responseData;
87
- }
88
- }
89
- } else {
90
- return false;
91
- }
92
- }).catch((error) => {
93
- return false;
94
- });
95
- }
96
-
97
- // src/libraries/element-executor.tsx
98
- var ElementExecutor = (props) => {
99
- const [data, setData] = useState([]);
100
- const [schema, setSchema] = useState(props.data.schema);
101
- const onHandleChange = (name, value) => {
102
- const updateSchema = (schema2) => {
103
- return schema2.map((field) => {
104
- if (field.name === name) {
105
- field["value"] = value;
106
- props.selectedRecord && props.selectedRecord(field);
107
- }
108
- if (field.fields && field.fields.length) {
109
- field.fields = updateSchema(field.fields);
110
- }
111
- return field;
112
- });
113
- };
114
- const updatedSchema = updateSchema(schema);
115
- setSchema(updatedSchema);
116
- props.setData && props.setData(updatedSchema);
117
- };
118
- useEffect(() => {
119
- if (props?.data?.schema) {
120
- setSchema([...props.data.schema]);
121
- }
122
- }, [props.data]);
123
- const handleSelectData = async () => {
124
- try {
125
- const response = await postService("/products/", "POST", []);
126
- if (response !== false && typeof response === "object") {
127
- setData(response.products);
128
- }
129
- } catch (error) {
130
- console.log(error);
131
- }
132
- };
133
- const renderElement = (elementProps) => {
134
- switch (elementProps.element) {
135
- case "input-text":
136
- return /* @__PURE__ */ React.createElement(
137
- TextElement,
138
- {
139
- ...elementProps,
140
- onChange: (value) => onHandleChange(elementProps.name || "", value)
141
- }
142
- );
143
- case "input-number":
144
- return /* @__PURE__ */ React.createElement(
145
- NumberElement,
146
- {
147
- ...elementProps,
148
- onChange: (value) => onHandleChange(elementProps.name || "", value)
149
- }
150
- );
151
- case "input-textarea":
152
- return /* @__PURE__ */ React.createElement(
153
- TextareaElement,
154
- {
155
- ...elementProps,
156
- onChange: (value) => onHandleChange(elementProps.name || "", value)
157
- }
158
- );
159
- case "single-select":
160
- return /* @__PURE__ */ React.createElement(
161
- SelectElement,
162
- {
163
- ...elementProps,
164
- onChange: (value) => onHandleChange(elementProps.name || "", value)
165
- }
166
- );
167
- case "input-mobile":
168
- return /* @__PURE__ */ React.createElement(
169
- NumberElement,
170
- {
171
- ...elementProps,
172
- onChange: (value) => onHandleChange(elementProps.name || "", value)
173
- }
174
- );
175
- case "input-checkbox":
176
- return /* @__PURE__ */ React.createElement(
177
- CheckboxElement,
178
- {
179
- ...elementProps,
180
- onChange: (value) => onHandleChange(elementProps.name || "", value)
181
- }
182
- );
183
- case "input-radio":
184
- return /* @__PURE__ */ React.createElement(
185
- RadioElement,
186
- {
187
- ...elementProps,
188
- onChange: (value) => onHandleChange(elementProps.name || "", value)
189
- }
190
- );
191
- case "input-description":
192
- return /* @__PURE__ */ React.createElement(
193
- CkEditor,
194
- {
195
- ...elementProps,
196
- onChange: (value) => onHandleChange(elementProps.name || "", value)
197
- }
198
- );
199
- case "input-single-select":
200
- return /* @__PURE__ */ React.createElement(
201
- SingleSelectElement,
202
- {
203
- ...elementProps,
204
- dropDownOptions: data.length > 0 ? data : [],
205
- onChange: (value) => onHandleChange(elementProps.name || "", value),
206
- onClick: handleSelectData
207
- }
208
- );
209
- case "input-multiple-select":
210
- return /* @__PURE__ */ React.createElement(
211
- MultipleSelectElement,
212
- {
213
- ...elementProps,
214
- dropDownOptions: data.length > 0 ? data : [],
215
- onChange: (value) => onHandleChange(elementProps.name || "", value),
216
- onClick: handleSelectData
217
- }
218
- );
219
- case "add-more":
220
- return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
221
- case "div":
222
- return /* @__PURE__ */ React.createElement(
223
- DivContainer,
224
- {
225
- ...elementProps,
226
- onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
227
- }
228
- );
229
- case "button":
230
- return /* @__PURE__ */ React.createElement(
231
- ButtonElement,
232
- {
233
- ...elementProps,
234
- onClick: () => props.selectedRecord && props.selectedRecord(elementProps)
235
- }
236
- );
237
- case "sidebar":
238
- return /* @__PURE__ */ React.createElement(
239
- Sidebar,
240
- {
241
- ...elementProps,
242
- onChange: (value) => onHandleChange(elementProps.name || "", value)
243
- }
244
- );
245
- case "navbar":
246
- return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
247
- case "table":
248
- return /* @__PURE__ */ React.createElement(
249
- TableElement,
250
- {
251
- ...elementProps,
252
- onChange: (value) => onHandleChange(elementProps.name || "", value)
253
- }
254
- );
255
- case "daterangepicker":
256
- return /* @__PURE__ */ React.createElement(
257
- DateRangePickerElement,
258
- {
259
- ...elementProps,
260
- onChange: (value) => onHandleChange(elementProps.name || "", value)
261
- }
262
- );
263
- case "datepicker":
264
- return /* @__PURE__ */ React.createElement(
265
- DatePickerElement,
266
- {
267
- ...elementProps,
268
- onChange: (value) => onHandleChange(elementProps.name || "", value)
269
- }
270
- );
271
- case "datetimepicker":
272
- return /* @__PURE__ */ React.createElement(
273
- DatePickerElement,
274
- {
275
- ...elementProps,
276
- onChange: (value) => onHandleChange(elementProps.name || "", value)
277
- }
278
- );
279
- case "upload":
280
- return /* @__PURE__ */ React.createElement(
281
- FileUpload,
282
- {
283
- ...elementProps,
284
- onChange: (value) => onHandleChange(elementProps.name || "", value)
285
- }
286
- );
287
- case "upload-manually":
288
- return /* @__PURE__ */ React.createElement(
289
- Upload,
290
- {
291
- ...elementProps,
292
- onChange: (value) => onHandleChange(elementProps.name || "", value)
293
- }
294
- );
295
- case "image":
296
- return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
297
- case "input-password":
298
- return /* @__PURE__ */ React.createElement(
299
- PasswordElement,
300
- {
301
- ...elementProps,
302
- onChange: (value) => onHandleChange(elementProps.name || "", value)
303
- }
304
- );
305
- case "single-checkbox":
306
- return /* @__PURE__ */ React.createElement(
307
- SingleCheckbox,
308
- {
309
- ...elementProps,
310
- onChange: (value) => onHandleChange(elementProps.name || "", value)
311
- }
312
- );
313
- case "dropdown-group":
314
- return /* @__PURE__ */ React.createElement(
315
- DropDownGroup,
316
- {
317
- ...elementProps,
318
- onChange: (value) => onHandleChange(elementProps.name || "", value)
319
- }
320
- );
321
- case "tabs":
322
- return /* @__PURE__ */ React.createElement(
323
- TabsElement,
324
- {
325
- ...elementProps,
326
- onChange: (value) => onHandleChange(elementProps.name || "", value)
327
- }
328
- );
329
- case "otp":
330
- return /* @__PURE__ */ React.createElement(
331
- OtpElement,
332
- {
333
- ...elementProps,
334
- onChange: (value) => onHandleChange(elementProps.name || "", value)
335
- }
336
- );
337
- case "circle-donut":
338
- return /* @__PURE__ */ React.createElement(
339
- CircleDonut,
340
- {
341
- ...elementProps,
342
- onChange: (value) => onHandleChange(elementProps.name || "", value)
343
- }
344
- );
345
- case "semicircle-donut":
346
- return /* @__PURE__ */ React.createElement(
347
- SemiCircleDonut,
348
- {
349
- ...elementProps,
350
- onChange: (value) => onHandleChange(elementProps.name || "", value)
351
- }
352
- );
353
- case "horizontal-barchart":
354
- return /* @__PURE__ */ React.createElement(
355
- HorizontalBarChart,
356
- {
357
- ...elementProps,
358
- onChange: (value) => onHandleChange(elementProps.name || "", value)
359
- }
360
- );
361
- case "linechart":
362
- return /* @__PURE__ */ React.createElement(
363
- LineChart,
364
- {
365
- ...elementProps,
366
- onChange: (value) => onHandleChange(elementProps.name || "", value)
367
- }
368
- );
369
- case "double-barchart":
370
- return /* @__PURE__ */ React.createElement(
371
- DoubleBarChart,
372
- {
373
- ...elementProps,
374
- onChange: (value) => onHandleChange(elementProps.name || "", value)
375
- }
376
- );
377
- case "barchart":
378
- return /* @__PURE__ */ React.createElement(
379
- BarChart,
380
- {
381
- ...elementProps,
382
- onChange: (value) => onHandleChange(elementProps.name || "", value)
383
- }
384
- );
385
- case "color-picker":
386
- return /* @__PURE__ */ React.createElement(
387
- ColorPickerElement,
388
- {
389
- ...elementProps,
390
- onChange: (value) => onHandleChange(elementProps.name || "", value)
391
- }
392
- );
393
- case "alert":
394
- return /* @__PURE__ */ React.createElement(
395
- NotificationAlert,
396
- {
397
- ...elementProps,
398
- onChange: (value) => onHandleChange(elementProps.name || "", value)
399
- }
400
- );
401
- default:
402
- return null;
403
- }
404
- };
405
- const renderFields = (schema2) => {
406
- return schema2 && schema2.map((eachSection, index) => {
407
- if (eachSection.visible !== false) {
408
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: index }, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: index }, renderFields(eachSection.fields)), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
409
- "p",
410
- {
411
- style: {
412
- fontSize: "10px",
413
- textAlign: eachSection.source === "bot" ? "left" : "right"
414
- }
415
- },
416
- moment(eachSection.dateTime).format("LT")
417
- ) : "") : /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), eachSection.dateTime ? /* @__PURE__ */ React.createElement(
418
- "p",
419
- {
420
- style: {
421
- fontSize: "10px",
422
- textAlign: eachSection.source === "bot" ? "left" : "right"
423
- }
424
- },
425
- moment(eachSection.dateTime).format("LT")
426
- ) : ""));
427
- }
428
- return null;
429
- });
430
- };
431
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: props.data.className }, renderFields(schema)));
432
- };
433
- export {
434
- ElementExecutor
435
- };
package/jest.config.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'jsdom',
4
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
5
- moduleNameMapper: {
6
- '\\.(css|less)$': 'identity-obj-proxy',
7
- },
8
- testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'],
9
- };