@apexcura/core 0.0.17-Beta2 → 0.0.17-Beta200

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,53 +1,56 @@
1
1
  {
2
2
  "name": "@apexcura/core",
3
- "version": "0.0.17-Beta2",
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-Beta200",
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-Beta3",
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",
25
+ "peerDependencies": {
37
26
  "react": "^18.3.1",
38
- "react-dom": "^18.3.1",
39
- "tsup": "^8.0.2"
27
+ "react-dom": "^18.3.1"
40
28
  },
41
- "devDependencies": {
42
- "@types/jest": "^29.5.12",
43
- "@types/react": "^18.3.1",
44
- "@types/testing-library__react": "^10.2.0",
45
- "jest": "^29.7.0",
46
- "jest-environment-jsdom": "^29.7.0",
47
- "ts-jest": "^29.1.2",
48
- "typescript": "^5.4.5"
29
+ "dependencies": {
30
+ "@apexcura/ui-components": "^0.0.16-Beta98",
31
+ "antd": "^5.19.2",
32
+ "axios": "^1.7.2"
49
33
  },
50
- "engines": {
51
- "node": ">=18.0.0"
34
+ "devDependencies": {
35
+ "@types/highcharts": "^7.0.0",
36
+ "@types/react": "^18.3.3",
37
+ "@types/react-dom": "^18.3.0",
38
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
39
+ "@typescript-eslint/parser": "^7.15.0",
40
+ "clean-webpack-plugin": "^4.0.0",
41
+ "eslint": "^8.57.0",
42
+ "eslint-config-prettier": "^9.1.0",
43
+ "eslint-plugin-prettier": "^5.1.3",
44
+ "eslint-plugin-react": "^7.34.3",
45
+ "eslint-webpack-plugin": "^4.2.0",
46
+ "husky": "^9.0.11",
47
+ "lint-staged": "^15.2.7",
48
+ "prettier": "^3.3.2",
49
+ "source-map-loader": "^5.0.0",
50
+ "ts-loader": "^9.5.1",
51
+ "typescript": "^5.5.3",
52
+ "webpack": "^5.92.1",
53
+ "webpack-bundle-analyzer": "^4.10.2",
54
+ "webpack-cli": "^5.1.4"
52
55
  }
53
56
  }
package/dist/index.d.mts DELETED
@@ -1,180 +0,0 @@
1
- import React from 'react';
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
- view?: boolean;
42
- isSVGStylesOverride?: boolean;
43
- rowSelection?: boolean;
44
- length?: number;
45
- loading?: boolean;
46
- modalContent?: {
47
- className?: string;
48
- fields?: {
49
- _id?: string;
50
- name?: string;
51
- label?: string;
52
- source?: string;
53
- initial_message?: boolean;
54
- element: string;
55
- className?: string;
56
- position?: string;
57
- }[];
58
- };
59
- items?: {
60
- icon?: React.JSX.Element | string;
61
- label?: string;
62
- active?: boolean;
63
- text?: string;
64
- time?: string;
65
- name?: string;
66
- y?: number;
67
- color?: string;
68
- }[];
69
- fields?: {
70
- name?: string;
71
- label?: string;
72
- placeholder?: string;
73
- element?: string;
74
- type?: string;
75
- value?: string | number | boolean | any[] | null | object;
76
- options?: {
77
- key?: number;
78
- label: string;
79
- value: string;
80
- }[];
81
- firstOptions?: {
82
- key?: number;
83
- label: string;
84
- value: string;
85
- }[];
86
- secondOptions?: {
87
- key?: number;
88
- label: string;
89
- value: string;
90
- }[];
91
- selectBefore?: {
92
- label: string;
93
- value: string;
94
- }[];
95
- selectAfter?: {
96
- label: string;
97
- value: string;
98
- }[];
99
- dropDownOptions?: any[];
100
- visible?: boolean;
101
- disabled?: boolean;
102
- required?: boolean;
103
- prefix?: React.ReactNode;
104
- suffix?: React.ReactNode;
105
- addonBefore?: React.ReactNode;
106
- defaultValue?: string;
107
- status?: "error" | "warning";
108
- styles?: React.CSSProperties;
109
- fieldClassName?: string;
110
- elementClassName?: string;
111
- variant?: string;
112
- thead?: {
113
- id: number;
114
- name?: string;
115
- label?: string;
116
- visible?: boolean;
117
- required?: boolean;
118
- key?: string;
119
- render?: () => void;
120
- ellipsis: boolean;
121
- }[];
122
- tbody?: {
123
- id?: number;
124
- name?: string;
125
- label?: string;
126
- element?: string;
127
- type?: string;
128
- variable_data?: {
129
- id: {
130
- id?: number;
131
- };
132
- Route?: {
133
- label: string;
134
- element: string;
135
- type: string;
136
- };
137
- Dose?: {
138
- label: string;
139
- element: string;
140
- type: string;
141
- };
142
- Frequency?: {
143
- label: string;
144
- element: string;
145
- type: string;
146
- };
147
- When?: {
148
- label: string;
149
- element: string;
150
- type: string;
151
- };
152
- Duration?: {
153
- label: string;
154
- element: string;
155
- type: string;
156
- };
157
- Instructions?: {
158
- label: string;
159
- element: string;
160
- type: string;
161
- };
162
- SubRows?: {
163
- label: string;
164
- };
165
- }[];
166
- }[];
167
- payload_keys?: string[];
168
- api_endpoint?: string;
169
- next_id?: string;
170
- action?: string;
171
- }[];
172
- }[];
173
- };
174
- setData: Function;
175
- selectedRecord: Function;
176
- };
177
- type ElementExecutorProps = FormExecutorProps & styling;
178
- declare const ElementExecutor: (props: ElementExecutorProps) => React.JSX.Element;
179
-
180
- export { ElementExecutor };
package/dist/index.mjs DELETED
@@ -1,327 +0,0 @@
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
- Upload,
27
- OtpElement,
28
- Donut
29
- } from "@apexcura/ui-components";
30
-
31
- // src/services/http-service.tsx
32
- import axios from "axios";
33
-
34
- // src/constants/network-list.tsx
35
- var networkList = {
36
- base_url: "https://dummyjson.com"
37
- };
38
- var network_list_default = networkList;
39
-
40
- // src/services/http-service.tsx
41
- var HttpClient = axios.create({
42
- baseURL: network_list_default.base_url,
43
- headers: {
44
- "Content-Type": "application/json",
45
- "accept": "application/json"
46
- }
47
- });
48
- function postService(url, method, data) {
49
- const token = JSON.parse(localStorage.getItem("token") || "null");
50
- const setHref = (str) => {
51
- window.location.href = str;
52
- };
53
- const currenthref = window.location.pathname;
54
- return HttpClient({
55
- method,
56
- url,
57
- data,
58
- headers: {
59
- "authorization": token
60
- }
61
- }).then((response) => {
62
- const responseData = response.data;
63
- const status = response.status;
64
- if (status === 200) {
65
- if (responseData.status) {
66
- return responseData;
67
- } else {
68
- if (responseData.token === "invalid" && currenthref !== "/") {
69
- localStorage.clearAll();
70
- setHref("/");
71
- return;
72
- } else if (responseData.IS_MAINTENANCE_MODE && url !== "checkAuthToken" && url !== "login") {
73
- localStorage.clearAll();
74
- setHref("/");
75
- return;
76
- } else {
77
- return responseData;
78
- }
79
- }
80
- } else {
81
- return false;
82
- }
83
- }).catch((error) => {
84
- return false;
85
- });
86
- }
87
-
88
- // src/libraries/element-executor.tsx
89
- var ElementExecutor = (props) => {
90
- const [data, setData] = useState([]);
91
- const [schema, setSchema] = useState(props.data.schema);
92
- const onHandleChange = (name, value) => {
93
- const updateSchema = (schema2) => {
94
- return schema2.map((field) => {
95
- if (field.name === name) {
96
- field["value"] = value;
97
- props.selectedRecord(field);
98
- }
99
- if (field.fields && field.fields.length) {
100
- field.fields = updateSchema(field.fields);
101
- }
102
- return field;
103
- });
104
- };
105
- const updatedSchema = updateSchema(schema);
106
- setSchema(updatedSchema);
107
- props.setData({ ...props.data, schema: updatedSchema });
108
- };
109
- const handleSelectData = async () => {
110
- try {
111
- const response = await postService("/products/", "POST", []);
112
- if (response !== false && typeof response === "object") {
113
- setData(response.products);
114
- }
115
- } catch (error) {
116
- console.log(error);
117
- }
118
- };
119
- const renderElement = (elementProps) => {
120
- switch (elementProps.element) {
121
- case "input-text":
122
- return /* @__PURE__ */ React.createElement(
123
- TextElement,
124
- {
125
- ...elementProps,
126
- onChange: (value) => onHandleChange(elementProps.name || "", value)
127
- }
128
- );
129
- case "input-number":
130
- return /* @__PURE__ */ React.createElement(
131
- NumberElement,
132
- {
133
- ...elementProps,
134
- onChange: (value) => onHandleChange(elementProps.name || "", value)
135
- }
136
- );
137
- case "input-textarea":
138
- return /* @__PURE__ */ React.createElement(
139
- TextareaElement,
140
- {
141
- ...elementProps,
142
- onChange: (value) => onHandleChange(elementProps.name || "", value)
143
- }
144
- );
145
- case "single-select":
146
- return /* @__PURE__ */ React.createElement(
147
- SelectElement,
148
- {
149
- ...elementProps,
150
- onChange: (value) => onHandleChange(elementProps.name || "", value)
151
- }
152
- );
153
- case "input-mobile":
154
- return /* @__PURE__ */ React.createElement(
155
- NumberElement,
156
- {
157
- ...elementProps,
158
- onChange: (value) => onHandleChange(elementProps.name || "", value)
159
- }
160
- );
161
- case "input-checkbox":
162
- return /* @__PURE__ */ React.createElement(
163
- CheckboxElement,
164
- {
165
- ...elementProps,
166
- onChange: (value) => onHandleChange(elementProps.name || "", value)
167
- }
168
- );
169
- case "input-radio":
170
- return /* @__PURE__ */ React.createElement(
171
- RadioElement,
172
- {
173
- ...elementProps,
174
- onChange: (value) => onHandleChange(elementProps.name || "", value)
175
- }
176
- );
177
- case "input-description":
178
- return /* @__PURE__ */ React.createElement(
179
- CkEditor,
180
- {
181
- ...elementProps,
182
- onChange: (value) => onHandleChange(elementProps.name || "", value)
183
- }
184
- );
185
- case "input-single-select":
186
- return /* @__PURE__ */ React.createElement(
187
- SingleSelectElement,
188
- {
189
- ...elementProps,
190
- dropDownOptions: data.length > 0 ? data : [],
191
- onChange: (value) => onHandleChange(elementProps.name || "", value),
192
- onClick: handleSelectData
193
- }
194
- );
195
- case "input-multiple-select":
196
- return /* @__PURE__ */ React.createElement(
197
- MultipleSelectElement,
198
- {
199
- ...elementProps,
200
- dropDownOptions: data.length > 0 ? data : [],
201
- onChange: (value) => onHandleChange(elementProps.name || "", value),
202
- onClick: handleSelectData
203
- }
204
- );
205
- case "add-more":
206
- return /* @__PURE__ */ React.createElement(AddMoreTable, { ...elementProps });
207
- case "div":
208
- return /* @__PURE__ */ React.createElement("div", { className: elementProps.className }, elementProps.label);
209
- case "button":
210
- return /* @__PURE__ */ React.createElement(
211
- ButtonElement,
212
- {
213
- ...elementProps,
214
- onClick: () => props.selectedRecord(elementProps)
215
- }
216
- );
217
- case "sidebar":
218
- return /* @__PURE__ */ React.createElement(
219
- Sidebar,
220
- {
221
- ...elementProps,
222
- onChange: (value) => onHandleChange(elementProps.name || "", value)
223
- }
224
- );
225
- case "navbar":
226
- return /* @__PURE__ */ React.createElement(Navbar, { ...elementProps });
227
- case "table":
228
- return /* @__PURE__ */ React.createElement(
229
- TableElement,
230
- {
231
- ...elementProps,
232
- onChange: (value) => onHandleChange(elementProps.name || "", value)
233
- }
234
- );
235
- case "daterangepicker":
236
- return /* @__PURE__ */ React.createElement(
237
- DateRangePickerElement,
238
- {
239
- ...elementProps,
240
- onChange: (value) => onHandleChange(elementProps.name || "", value)
241
- }
242
- );
243
- case "datepicker":
244
- return /* @__PURE__ */ React.createElement(
245
- DatePickerElement,
246
- {
247
- ...elementProps,
248
- onChange: (value) => onHandleChange(elementProps.name || "", value)
249
- }
250
- );
251
- case "upload":
252
- return /* @__PURE__ */ React.createElement(
253
- FileUpload,
254
- {
255
- ...elementProps,
256
- onChange: (value) => onHandleChange(elementProps.name || "", value)
257
- }
258
- );
259
- case "upload-manually":
260
- return /* @__PURE__ */ React.createElement(
261
- Upload,
262
- {
263
- ...elementProps,
264
- onChange: (value) => onHandleChange(elementProps.name || "", value)
265
- }
266
- );
267
- case "image":
268
- return /* @__PURE__ */ React.createElement(Image, { ...elementProps });
269
- case "input-password":
270
- return /* @__PURE__ */ React.createElement(
271
- PasswordElement,
272
- {
273
- ...elementProps,
274
- onChange: (value) => onHandleChange(elementProps.name || "", value)
275
- }
276
- );
277
- case "single-checkbox":
278
- return /* @__PURE__ */ React.createElement(
279
- SingleCheckbox,
280
- {
281
- ...elementProps,
282
- onChange: (value) => onHandleChange(elementProps.name || "", value)
283
- }
284
- );
285
- case "dropdown-group":
286
- return /* @__PURE__ */ React.createElement(
287
- DropDownGroup,
288
- {
289
- ...elementProps,
290
- onChange: (value) => onHandleChange(elementProps.name || "", value)
291
- }
292
- );
293
- case "tabs":
294
- return /* @__PURE__ */ React.createElement(
295
- TabsElement,
296
- {
297
- ...elementProps,
298
- onChange: (value) => onHandleChange(elementProps.name || "", value)
299
- }
300
- );
301
- case "otp":
302
- return /* @__PURE__ */ React.createElement(
303
- OtpElement,
304
- {
305
- ...elementProps,
306
- onChange: (value) => onHandleChange(elementProps.name || "", value)
307
- }
308
- );
309
- case "donut":
310
- return /* @__PURE__ */ React.createElement(Donut, { ...elementProps });
311
- default:
312
- return null;
313
- }
314
- };
315
- const renderFields = (schema2) => {
316
- return schema2 && schema2.map((eachSection) => {
317
- if (eachSection.visible !== false) {
318
- return /* @__PURE__ */ React.createElement(React.Fragment, { key: eachSection.name }, eachSection.fields && eachSection.fields.length > 0 ? /* @__PURE__ */ React.createElement(React.Fragment, null, renderElement(eachSection), /* @__PURE__ */ React.createElement("div", { className: eachSection.className, key: eachSection.name }, renderFields(eachSection.fields))) : renderElement(eachSection));
319
- }
320
- return null;
321
- });
322
- };
323
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: props.data.className }, renderFields(schema)));
324
- };
325
- export {
326
- ElementExecutor
327
- };
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
- };