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