admin_lsac 1.2.3 → 1.2.4

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.
@@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
24
24
  function verb(n) { return function (v) { return step([n, v]); }; }
25
25
  function step(op) {
26
26
  if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
28
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
29
  if (y = 0, t) op = [op[0] & 2, t.value];
30
30
  switch (op[0]) {
@@ -82,15 +82,15 @@ function parseValidation(fields) {
82
82
  }, {});
83
83
  }
84
84
  function generateSingleField(formfield, fieldName, key) {
85
- return (_jsx(Field, __assign({ name: fieldName }, { children: function (_a) {
85
+ return (_jsx(Field, { name: fieldName, children: function (_a) {
86
86
  var _b;
87
87
  var field = _a.field, form = _a.form;
88
- return (_jsxs(FormControl, __assign({ isInvalid: getIn(form.touched, fieldName) && getIn(form.errors, fieldName) }, { children: [_jsx(FormLabel, __assign({ marginTop: 2 }, { children: formfield.label }), void 0), formfield.type === "string" || formfield.type === "number" ? (_jsx(Input, __assign({}, field, { type: formfield.type === "number" ? "number" : "text", placeholder: "" }), void 0)) : formfield.type === "file" ? (_jsx(Input, { type: "file", name: fieldName, onChange: function (event) {
88
+ return (_jsxs(FormControl, { isInvalid: getIn(form.touched, fieldName) && getIn(form.errors, fieldName), children: [_jsx(FormLabel, { marginTop: 2, children: formfield.label }), formfield.type === "string" || formfield.type === "number" ? (_jsx(Input, __assign({}, field, { type: formfield.type === "number" ? "number" : "text", placeholder: "" }))) : formfield.type === "file" ? (_jsx(Input, { type: "file", name: fieldName, onChange: function (event) {
89
89
  if (event.currentTarget.files != null) {
90
90
  form.setFieldValue(fieldName, event.currentTarget.files[0]);
91
91
  }
92
- } }, void 0)) : (_jsxs(Select, __assign({}, field, { defaultValue: "" }, { children: [_jsx("option", __assign({ disabled: true, value: "" }, { children: "Select an option!" }), void 0), (_b = formfield.options) === null || _b === void 0 ? void 0 : _b.map(function (option, key) { return (_jsx("option", __assign({ value: "".concat(option.value) }, { children: option.display }), key)); })] }), void 0)), _jsx(FormErrorMessage, { children: getIn(form.errors, fieldName) }, void 0)] }), void 0));
93
- } }), key));
92
+ } })) : (_jsxs(Select, __assign({}, field, { defaultValue: "", children: [_jsx("option", { disabled: true, value: "", children: "Select an option!" }), (_b = formfield.options) === null || _b === void 0 ? void 0 : _b.map(function (option, key) { return (_jsx("option", { value: "".concat(option.value), children: option.display }, key)); })] }))), _jsx(FormErrorMessage, { children: getIn(form.errors, fieldName) })] }));
93
+ } }, key));
94
94
  }
95
95
  function parseFields(fields, previous) {
96
96
  if (!fields) {
@@ -103,12 +103,12 @@ function parseFields(fields, previous) {
103
103
  return _jsx(FormControl, { children: objectFields }, fieldName);
104
104
  }
105
105
  else if (formfield.type === "array") {
106
- return (_jsx(FieldArray, __assign({ name: fieldName }, { children: function (_a) {
106
+ return (_jsx(FieldArray, { name: fieldName, children: function (_a) {
107
107
  var remove = _a.remove, push = _a.push, form = _a.form;
108
- return (_jsxs("div", { children: [_jsx(FormLabel, __assign({ marginTop: 2 }, { children: formfield.label }), void 0), getIn(form.values, fieldName).length > 0 &&
109
- getIn(form.values, fieldName).map(function (element, index) { return (_jsxs(Box, __assign({ paddingLeft: 10 }, { children: [_jsx("h4", { children: _jsx("b", { children: "".concat(fieldName, ".").concat(index) }, void 0) }, void 0), _jsx(Box, __assign({ paddingLeft: 10 }, { children: formfield.element.type === "object"
108
+ return (_jsxs("div", { children: [_jsx(FormLabel, { marginTop: 2, children: formfield.label }), getIn(form.values, fieldName).length > 0 &&
109
+ getIn(form.values, fieldName).map(function (element, index) { return (_jsxs(Box, { paddingLeft: 10, children: [_jsx("h4", { children: _jsx("b", { children: "".concat(fieldName, ".").concat(index) }) }), _jsx(Box, { paddingLeft: 10, children: formfield.element.type === "object"
110
110
  ? parseFields(formfield.element.fields, "".concat(fieldName, ".").concat(index))
111
- : generateSingleField(formfield.element, "".concat(fieldName, ".").concat(index), key) }), void 0), _jsxs(Button, __assign({ type: "button", colorScheme: "red", marginY: 2, onClick: function () { return remove(index); } }, { children: ["Remove ", "".concat(fieldName, ".").concat(index)] }), void 0)] }), void 0)); }), _jsxs(Button, __assign({ type: "button", marginY: 2, colorScheme: "blue", onClick: function () {
111
+ : generateSingleField(formfield.element, "".concat(fieldName, ".").concat(index), key) }), _jsxs(Button, { type: "button", colorScheme: "red", marginY: 2, onClick: function () { return remove(index); }, children: ["Remove ", "".concat(fieldName, ".").concat(index)] })] })); }), _jsxs(Button, { type: "button", marginY: 2, colorScheme: "blue", onClick: function () {
112
112
  var value = undefined;
113
113
  if (formfield.element.type === "object") {
114
114
  value = getInitialValues(formfield.element.fields);
@@ -117,8 +117,8 @@ function parseFields(fields, previous) {
117
117
  value = getInitialValues([formfield.element])[0];
118
118
  }
119
119
  push(value);
120
- } }, { children: ["Add ", fieldName] }), void 0)] }, void 0));
121
- } }), void 0));
120
+ }, children: ["Add ", fieldName] })] }));
121
+ } }));
122
122
  }
123
123
  else {
124
124
  return generateSingleField(formfield, fieldName, key);
@@ -202,8 +202,8 @@ export function GenericForm(_a) {
202
202
  });
203
203
  }, []);
204
204
  if (!action.fields)
205
- return _jsx(_Fragment, {}, void 0);
206
- return (_jsx(_Fragment, { children: _jsx(Formik, __assign({ initialValues: initialValues, validationSchema: Yup.object(validationSchema), onSubmit: function (values) { return __awaiter(_this, void 0, void 0, function () {
205
+ return _jsx(_Fragment, {});
206
+ return (_jsx(_Fragment, { children: _jsx(Formik, { initialValues: initialValues, validationSchema: Yup.object(validationSchema), onSubmit: function (values) { return __awaiter(_this, void 0, void 0, function () {
207
207
  var res, e_1, err;
208
208
  return __generator(this, function (_a) {
209
209
  switch (_a.label) {
@@ -236,8 +236,8 @@ export function GenericForm(_a) {
236
236
  case 6: return [2 /*return*/];
237
237
  }
238
238
  });
239
- }); } }, { children: function (_a) {
239
+ }); }, children: function (_a) {
240
240
  var isSubmitting = _a.isSubmitting;
241
- return (_jsxs(Form, { children: [formFields, _jsx(Button, __assign({ mt: 4, colorScheme: "teal", isLoading: isSubmitting, type: "submit" }, { children: "Submit" }), void 0)] }, void 0));
242
- } }), void 0) }, void 0));
241
+ return (_jsxs(Form, { children: [formFields, _jsx(Button, { mt: 4, colorScheme: "teal", isLoading: isSubmitting, type: "submit", children: "Submit" })] }));
242
+ } }) }));
243
243
  }
@@ -1,21 +1,9 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
2
  import { useEffect, useState } from "react";
14
3
  import { ChakraProvider } from "@chakra-ui/react";
15
4
  import { pageToUrl } from "../schema/schema";
16
5
  import { Button, Modal, ModalHeader, ModalBody, useDisclosure, ModalOverlay, ModalContent, ModalCloseButton, Box, Stack, } from "@chakra-ui/react";
17
6
  import { GenericForm } from "./GenericForm";
18
- import { useNavigate } from "react-router";
19
7
  import { ThemeProvider } from "@emotion/react";
20
8
  import { createTheme } from "@mui/material/styles";
21
9
  import { MaterialReactTable } from "material-react-table";
@@ -24,20 +12,27 @@ import Swal from "sweetalert2";
24
12
  import MenuItem from "@mui/material/MenuItem";
25
13
  function Header(_a) {
26
14
  var pages = _a.pages, data = _a.data, basePath = _a.basePath;
27
- var nav = useNavigate();
28
- return (_jsx(Box, __assign({ background: "blue.50", padding: 1 }, { children: _jsxs(Stack, __assign({ margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Stack, __assign({ margin: 4, gap: 10, direction: "row", alignItems: "center" }, { children: pages.map(function (p) { return (_jsx(Box, __assign({ as: "a", href: "".concat(basePath, "/").concat(pageToUrl(p)) }, { children: p.name }), void 0)); }) }), void 0), _jsx(Stack, __assign({ direction: "row" }, { children: _jsx(Button, __assign({ colorScheme: "red", onClick: function () {
15
+ return (_jsx(Box, { background: "blue.50", padding: 1, children: _jsxs(Stack, { margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center", children: [_jsx(Stack, { margin: 4, gap: 10, direction: "row", alignItems: "center", children: pages.map(function (p) { return (_jsx(Box, { as: "a", href: "".concat(basePath, "/").concat(pageToUrl(p)), children: p.name })); }) }), _jsx(Stack, { direction: "row", children: _jsx(Button, { colorScheme: "red", onClick: function () {
29
16
  var filename = prompt("Enter filename:");
30
17
  if (filename)
31
18
  exportToCSV(data, filename);
32
- } }, { children: "Export Data" }), void 0) }), void 0)] }), void 0) }), void 0));
19
+ }, children: "Export Data" }) })] }) }));
33
20
  }
34
21
  function exportToCSV(data, filename) {
35
22
  var formatImageData = function (obj) {
36
23
  var formattedObj = {};
37
- for (var key in obj) {
24
+ var _loop_1 = function (key) {
38
25
  if (typeof obj[key] !== "object") {
39
26
  formattedObj[key] = obj[key];
40
27
  }
28
+ else if (typeof obj[key] === "object" && obj[key] != null) {
29
+ Object.keys(obj[key]).forEach(function (k) {
30
+ formattedObj["".concat(key, ".").concat(k)] = obj[key][k];
31
+ });
32
+ }
33
+ };
34
+ for (var key in obj) {
35
+ _loop_1(key);
41
36
  }
42
37
  return formattedObj;
43
38
  };
@@ -57,7 +52,7 @@ function exportToCSV(data, filename) {
57
52
  });
58
53
  }
59
54
  }
60
- export function Page(_a) {
55
+ export function AdminPage(_a) {
61
56
  var _b;
62
57
  var pages = _a.pages, selectedPage = _a.selectedPage, basePath = _a.basePath;
63
58
  var _c = useDisclosure(), isOpen = _c.isOpen, onOpen = _c.onOpen, onClose = _c.onClose;
@@ -75,14 +70,14 @@ export function Page(_a) {
75
70
  return selectedPage.tableFields.map(function (field) { return field.access(table_data); });
76
71
  }));
77
72
  }, [data]);
78
- return (_jsxs(_Fragment, { children: [_jsx(Header, { pages: pages, data: data, basePath: basePath }, void 0), _jsx(ThemeProvider, __assign({ theme: createTheme() }, { children: _jsx(MaterialReactTable, { columns: selectedPage.tableFields.map(function (field, index) { return ({
73
+ return (_jsxs(_Fragment, { children: [_jsx(Header, { pages: pages, data: data, basePath: basePath }), _jsx(ThemeProvider, { theme: createTheme(), children: _jsx(MaterialReactTable, { columns: selectedPage.tableFields.map(function (field, index) { return ({
79
74
  accessorFn: function (row) { return row[index]; },
80
75
  header: field.name,
81
- }); }), data: displayData, muiTableContainerProps: { sx: { maxHeight: "70vh" } }, enableColumnResizing: true, enableColumnPinning: true, enableGlobalFilterModes: true, enablePagination: true, paginationDisplayMode: "pages", enableRowVirtualization: true, rowVirtualizerOptions: { overscan: 20 }, renderTopToolbarCustomActions: function () { return (_jsx(ChakraProvider, { children: _jsx(Stack, __assign({ margin: 0, padding: 3, direction: "row" }, { children: selectedPage.actions.map(function (action) { return (_jsx(Button, __assign({ colorScheme: "blue", onClick: function () {
76
+ }); }), data: displayData, muiTableContainerProps: { sx: { maxHeight: "70vh" } }, enableColumnResizing: true, enableColumnPinning: true, enableGlobalFilterModes: true, enablePagination: true, paginationDisplayMode: "pages", enableRowVirtualization: true, rowVirtualizerOptions: { overscan: 20 }, renderTopToolbarCustomActions: function () { return (_jsx(ChakraProvider, { children: _jsx(Stack, { margin: 0, padding: 3, direction: "row", children: selectedPage.actions.map(function (action) { return (_jsx(Button, { colorScheme: "blue", onClick: function () {
82
77
  setSelectedAction(action);
83
78
  onOpen();
84
- } }, { children: action.name }), void 0)); }) }), void 0) }, void 0)); }, enableRowActions: true, renderRowActionMenuItems: function (obj) {
85
- return selectedPage.rowActions.map(function (rowAction) { return (_jsx(MenuItem, __assign({ onClick: function () {
79
+ }, children: action.name })); }) }) })); }, enableRowActions: true, renderRowActionMenuItems: function (obj) {
80
+ return selectedPage.rowActions.map(function (rowAction) { return (_jsx(MenuItem, { onClick: function () {
86
81
  setSelectedAction(rowAction);
87
82
  setRowId(obj.row.original[0]);
88
83
  onOpen();
@@ -90,10 +85,10 @@ export function Page(_a) {
90
85
  if (rowActionsMenu) {
91
86
  rowActionsMenu.remove();
92
87
  }
93
- } }, { children: rowAction.name + " " + obj.row.original[0] }), void 0)); });
94
- } }, void 0) }), void 0), _jsxs(Modal, __assign({ size: "6xl", isOpen: isOpen, onClose: onClose }, { children: [_jsx(ModalOverlay, {}, void 0), _jsxs(ModalContent, { children: [_jsx(ModalHeader, { children: selectedAction.name }, void 0), _jsx(ModalCloseButton, {}, void 0), _jsxs(ModalBody, { children: [selectedAction.fields && ((_b = selectedAction.fields) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (_jsx(GenericForm, { action: selectedAction, onClose: onClose, rowId: rowId }, void 0)) : (_jsx(Button, __assign({ colorScheme: "blue", mr: 3, onClick: function () {
88
+ }, children: rowAction.name + " " + obj.row.original[0] })); });
89
+ } }) }), _jsxs(Modal, { size: "6xl", isOpen: isOpen, onClose: onClose, children: [_jsx(ModalOverlay, {}), _jsxs(ModalContent, { children: [_jsx(ModalHeader, { children: selectedAction.name }), _jsx(ModalCloseButton, {}), _jsxs(ModalBody, { children: [selectedAction.fields && ((_b = selectedAction.fields) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (_jsx(GenericForm, { action: selectedAction, onClose: onClose, rowId: rowId })) : (_jsx(Button, { colorScheme: "blue", mr: 3, onClick: function () {
95
90
  selectedAction.onSubmit(rowId);
96
91
  onClose();
97
92
  window.location.reload();
98
- } }, { children: "Confirm Action" }), void 0)), _jsx(Button, __assign({ colorScheme: "red", mr: 3, onClick: onClose }, { children: "Close" }), void 0)] }, void 0)] }, void 0)] }), void 0)] }, void 0));
93
+ }, children: "Confirm Action" })), _jsx(Button, { colorScheme: "red", mr: 3, onClick: onClose, children: "Close" })] })] })] })] }));
99
94
  }
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ import AdminPanel from "./App";
6
6
  import reportWebVitals from "./reportWebVitals";
7
7
  import { event } from "./pages/event";
8
8
  var root = ReactDOM.createRoot(document.getElementById("root"));
9
- root.render(_jsx(React.StrictMode, { children: _jsx(AdminPanel, { pages: [event], basePath: "" }, void 0) }, void 0));
9
+ root.render(_jsx(React.StrictMode, { children: _jsx(AdminPanel, { pages: [event], basePath: "" }) }));
10
10
  // If you want to start measuring performance in your app, pass a function
11
11
  // to log results (for example: reportWebVitals(console.log))
12
12
  // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -43,7 +43,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
43
43
  }
44
44
  return to.concat(ar || Array.prototype.slice.call(from));
45
45
  };
46
- import * as Yup from 'yup';
46
+ import * as Yup from "yup";
47
47
  var typeAdding = function (objectField) {
48
48
  objectField.type = "object";
49
49
  objectField.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], objectField.simpleFields, true), objectField.dropdownFields, true), objectField.objectFields, true), objectField.arrayFields, true);
@@ -63,7 +63,8 @@ var typeAdding = function (objectField) {
63
63
  };
64
64
  var arrayObjs = function (x) {
65
65
  if (x > 0)
66
- return [{
66
+ return [
67
+ {
67
68
  name: "simpleFields",
68
69
  label: "Type SimpleField",
69
70
  type: "array",
@@ -71,31 +72,33 @@ var arrayObjs = function (x) {
71
72
  name: "",
72
73
  label: "",
73
74
  type: "object",
74
- fields: [{
75
+ fields: [
76
+ {
75
77
  name: "name",
76
78
  label: "Name",
77
79
  type: "string",
78
- validationSchema: Yup.string().required()
80
+ validationSchema: Yup.string().required(),
79
81
  },
80
82
  {
81
83
  name: "label",
82
84
  label: "Label",
83
85
  type: "string",
84
- validationSchema: Yup.string().required()
86
+ validationSchema: Yup.string().required(),
85
87
  },
86
88
  {
87
89
  name: "type",
88
90
  label: "Type",
89
91
  type: "string",
90
- validationSchema: Yup.string().required()
92
+ validationSchema: Yup.string().required(),
91
93
  },
92
94
  {
93
95
  name: "validationSchema",
94
96
  label: "Validation Schema",
95
97
  type: "string",
96
- validationSchema: Yup.string().required()
97
- }]
98
- }
98
+ validationSchema: Yup.string().required(),
99
+ },
100
+ ],
101
+ },
99
102
  },
100
103
  {
101
104
  name: "dropdownFields",
@@ -105,17 +108,18 @@ var arrayObjs = function (x) {
105
108
  name: "",
106
109
  label: "",
107
110
  type: "object",
108
- fields: [{
111
+ fields: [
112
+ {
109
113
  name: "name",
110
114
  label: "Name",
111
115
  type: "string",
112
- validationSchema: Yup.string().required()
116
+ validationSchema: Yup.string().required(),
113
117
  },
114
118
  {
115
119
  name: "label",
116
120
  label: "Label",
117
121
  type: "string",
118
- validationSchema: Yup.string().required()
122
+ validationSchema: Yup.string().required(),
119
123
  },
120
124
  {
121
125
  name: "options",
@@ -125,27 +129,30 @@ var arrayObjs = function (x) {
125
129
  name: "",
126
130
  label: "",
127
131
  type: "object",
128
- fields: [{
132
+ fields: [
133
+ {
129
134
  name: "value",
130
135
  label: "Value",
131
136
  type: "string",
132
- validationSchema: Yup.string().required()
137
+ validationSchema: Yup.string().required(),
133
138
  },
134
139
  {
135
140
  name: "display",
136
141
  label: "Display",
137
142
  type: "string",
138
- validationSchema: Yup.string().required()
139
- }]
140
- }
143
+ validationSchema: Yup.string().required(),
144
+ },
145
+ ],
146
+ },
141
147
  },
142
148
  {
143
149
  name: "getOptions",
144
150
  label: "GetOptions Function",
145
151
  type: "string",
146
- validationSchema: Yup.string().required()
147
- }]
148
- }
152
+ validationSchema: Yup.string().required(),
153
+ },
154
+ ],
155
+ },
149
156
  },
150
157
  {
151
158
  name: "objectFields",
@@ -155,19 +162,21 @@ var arrayObjs = function (x) {
155
162
  name: "",
156
163
  label: "",
157
164
  type: "object",
158
- fields: __spreadArray([{
165
+ fields: __spreadArray([
166
+ {
159
167
  name: "name",
160
168
  label: "Name",
161
169
  type: "string",
162
- validationSchema: Yup.string().required()
170
+ validationSchema: Yup.string().required(),
163
171
  },
164
172
  {
165
173
  name: "label",
166
174
  label: "Label",
167
175
  type: "string",
168
- validationSchema: Yup.string().required()
169
- }], arrayObjs(x - 1), true)
170
- }
176
+ validationSchema: Yup.string().required(),
177
+ }
178
+ ], arrayObjs(x - 1), true),
179
+ },
171
180
  },
172
181
  {
173
182
  name: "arrayFields",
@@ -177,20 +186,23 @@ var arrayObjs = function (x) {
177
186
  name: "",
178
187
  label: "",
179
188
  type: "object",
180
- fields: __spreadArray([{
189
+ fields: __spreadArray([
190
+ {
181
191
  name: "name",
182
192
  label: "Name",
183
193
  type: "string",
184
- validationSchema: Yup.string().required()
194
+ validationSchema: Yup.string().required(),
185
195
  },
186
196
  {
187
197
  name: "label",
188
198
  label: "Label",
189
199
  type: "string",
190
- validationSchema: Yup.string().required()
191
- }], arrayObjs(x - 1), true)
192
- }
193
- }];
200
+ validationSchema: Yup.string().required(),
201
+ }
202
+ ], arrayObjs(x - 1), true),
203
+ },
204
+ },
205
+ ];
194
206
  else
195
207
  return [];
196
208
  };
@@ -200,19 +212,21 @@ export var page = {
200
212
  return [2 /*return*/, []];
201
213
  }); }); },
202
214
  tableFields: [],
203
- actions: [{
215
+ actions: [
216
+ {
204
217
  name: "Create New Page",
205
- fields: [{
218
+ fields: [
219
+ {
206
220
  name: "name",
207
221
  label: "Page Name",
208
222
  type: "string",
209
- validationSchema: Yup.string().required()
223
+ validationSchema: Yup.string().required(),
210
224
  },
211
225
  {
212
226
  name: "getRequest",
213
227
  label: "GetRequest",
214
228
  type: "string",
215
- validationSchema: Yup.string().required()
229
+ validationSchema: Yup.string().required(),
216
230
  },
217
231
  {
218
232
  name: "tableFields",
@@ -222,19 +236,21 @@ export var page = {
222
236
  name: "",
223
237
  label: "",
224
238
  type: "object",
225
- fields: [{
239
+ fields: [
240
+ {
226
241
  name: "name",
227
242
  label: "TableField Name",
228
243
  type: "string",
229
- validationSchema: Yup.string().required()
244
+ validationSchema: Yup.string().required(),
230
245
  },
231
246
  {
232
247
  name: "access",
233
248
  label: "TableField Access Function",
234
249
  type: "string",
235
- validationSchema: Yup.string().required()
236
- }]
237
- }
250
+ validationSchema: Yup.string().required(),
251
+ },
252
+ ],
253
+ },
238
254
  },
239
255
  {
240
256
  name: "actions",
@@ -244,18 +260,22 @@ export var page = {
244
260
  name: "",
245
261
  label: "",
246
262
  type: "object",
247
- fields: __spreadArray(__spreadArray([{
263
+ fields: __spreadArray(__spreadArray([
264
+ {
248
265
  name: "name",
249
266
  label: "Action Name",
250
267
  type: "string",
251
- validationSchema: Yup.string().required()
252
- }], arrayObjs(4), true), [{
268
+ validationSchema: Yup.string().required(),
269
+ }
270
+ ], arrayObjs(4), true), [
271
+ {
253
272
  name: "onSubmit",
254
273
  label: "Action OnSubmit Function",
255
274
  type: "string",
256
- validationSchema: Yup.string().required()
257
- }], false)
258
- }
275
+ validationSchema: Yup.string().required(),
276
+ },
277
+ ], false),
278
+ },
259
279
  },
260
280
  {
261
281
  name: "rowActions",
@@ -265,32 +285,37 @@ export var page = {
265
285
  name: "",
266
286
  label: "",
267
287
  type: "object",
268
- fields: __spreadArray(__spreadArray([{
288
+ fields: __spreadArray(__spreadArray([
289
+ {
269
290
  name: "name",
270
291
  label: "Row Action Name",
271
292
  type: "string",
272
- validationSchema: Yup.string().required()
273
- }], arrayObjs(4), true), [{
293
+ validationSchema: Yup.string().required(),
294
+ }
295
+ ], arrayObjs(4), true), [
296
+ {
274
297
  name: "initialise",
275
298
  label: "Row Action Initialise Function",
276
299
  type: "string",
277
- validationSchema: ""
300
+ validationSchema: "",
278
301
  },
279
302
  {
280
303
  name: "onSubmit",
281
304
  label: "Row Action OnSubmit Function",
282
305
  type: "string",
283
- validationSchema: Yup.string().required()
284
- }], false)
285
- }
286
- }],
306
+ validationSchema: Yup.string().required(),
307
+ },
308
+ ], false),
309
+ },
310
+ },
311
+ ],
287
312
  onSubmit: function (formValues) { return __awaiter(void 0, void 0, void 0, function () {
288
313
  return __generator(this, function (_a) {
289
314
  if (Array.isArray(formValues.actions))
290
315
  formValues.actions.map(function (action) {
291
316
  var _a, _b, _c;
292
- (_a = action.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (actionField) { return actionField.type = "dropdown"; });
293
- (_b = action.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (actionField) { return actionField = typeAdding(actionField); });
317
+ (_a = action.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (actionField) { return (actionField.type = "dropdown"); });
318
+ (_b = action.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (actionField) { return (actionField = typeAdding(actionField)); });
294
319
  (_c = action.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (actionField) {
295
320
  actionField.type = "array";
296
321
  actionField.element = typeAdding(actionField.element);
@@ -302,8 +327,10 @@ export var page = {
302
327
  if (Array.isArray(formValues.rowActions))
303
328
  formValues.actions.map(function (rowAction) {
304
329
  var _a, _b, _c;
305
- (_a = rowAction.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (rowActionField) { return rowActionField.type = "dropdown"; });
306
- (_b = rowAction.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (rowActionField) { return rowActionField = typeAdding(rowActionField); });
330
+ (_a = rowAction.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (rowActionField) { return (rowActionField.type = "dropdown"); });
331
+ (_b = rowAction.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (rowActionField) {
332
+ return (rowActionField = typeAdding(rowActionField));
333
+ });
307
334
  (_c = rowAction.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (rowActionField) {
308
335
  rowActionField.type = "array";
309
336
  rowActionField.element = typeAdding(rowActionField.element);
@@ -315,7 +342,8 @@ export var page = {
315
342
  console.log(formValues);
316
343
  return [2 /*return*/, []];
317
344
  });
318
- }); }
319
- }],
345
+ }); },
346
+ },
347
+ ],
320
348
  rowActions: [],
321
349
  };
@@ -1,6 +1,6 @@
1
1
  import { event } from "../pages/event";
2
2
  import { page } from "../pages/page";
3
3
  export var pages = [
4
- event,
4
+ event, // example schema
5
5
  page,
6
6
  ];
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ var App_1 = __importDefault(require("./App"));
11
11
  var reportWebVitals_1 = __importDefault(require("./reportWebVitals"));
12
12
  var event_1 = require("./pages/event");
13
13
  var root = client_1.default.createRoot(document.getElementById("root"));
14
- root.render((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(App_1.default, { pages: [event_1.event], basePath: "" }, void 0) }, void 0));
14
+ root.render((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(App_1.default, { pages: [event_1.event], basePath: "" }) }));
15
15
  // If you want to start measuring performance in your app, pass a function
16
16
  // to log results (for example: reportWebVitals(console.log))
17
17
  // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {