admin_lsac 1.3.2 → 1.4.1

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.
Files changed (79) hide show
  1. package/.eslintrc.cjs +18 -0
  2. package/README.md +162 -162
  3. package/dist/src/App.d.ts +7 -0
  4. package/dist/src/App.js +10 -0
  5. package/dist/src/components/AdminPage.d.ts +8 -0
  6. package/dist/{esm/components/Page.js → src/components/AdminPage.js} +35 -43
  7. package/dist/src/components/GenericForm.d.ts +8 -0
  8. package/dist/src/components/GenericForm.js +151 -0
  9. package/dist/src/main.d.ts +1 -0
  10. package/dist/src/main.js +7 -0
  11. package/dist/{App.d.ts → src/schema.d.ts} +53 -76
  12. package/dist/src/testSchemas/event.d.ts +2 -0
  13. package/dist/src/testSchemas/event.js +86 -0
  14. package/dist/src/utils/websockets.d.ts +1 -0
  15. package/dist/{esm → src}/utils/websockets.js +5 -5
  16. package/index.html +13 -0
  17. package/package.json +42 -73
  18. package/tsconfig.app.json +27 -0
  19. package/tsconfig.json +11 -31
  20. package/tsconfig.node.json +13 -0
  21. package/vite.config.ts +7 -0
  22. package/dist/App.js +0 -12
  23. package/dist/cjs/App.js +0 -12
  24. package/dist/cjs/components/GenericForm.js +0 -305
  25. package/dist/cjs/components/Page.js +0 -119
  26. package/dist/cjs/index.js +0 -18
  27. package/dist/cjs/pages/event.js +0 -134
  28. package/dist/cjs/pages/page.js +0 -375
  29. package/dist/cjs/reportWebVitals.js +0 -38
  30. package/dist/cjs/schema/schema.config.js +0 -9
  31. package/dist/cjs/schema/schema.js +0 -2
  32. package/dist/cjs/setupTests.js +0 -7
  33. package/dist/cjs/utils/websockets.js +0 -22
  34. package/dist/components/GenericForm.js +0 -305
  35. package/dist/components/Page.js +0 -119
  36. package/dist/esm/App.js +0 -10
  37. package/dist/esm/components/GenericForm.js +0 -275
  38. package/dist/esm/index.js +0 -13
  39. package/dist/esm/pages/event.js +0 -128
  40. package/dist/esm/pages/page.js +0 -349
  41. package/dist/esm/reportWebVitals.js +0 -13
  42. package/dist/esm/schema/schema.config.js +0 -6
  43. package/dist/esm/setupTests.js +0 -5
  44. package/dist/index.js +0 -18
  45. package/dist/pages/event.js +0 -134
  46. package/dist/pages/page.js +0 -375
  47. package/dist/reportWebVitals.js +0 -38
  48. package/dist/schema/schema.config.js +0 -9
  49. package/dist/schema/schema.js +0 -2
  50. package/dist/setupTests.js +0 -7
  51. package/dist/utils/websockets.js +0 -22
  52. package/public/favicon.ico +0 -0
  53. package/public/index.html +0 -43
  54. package/public/logo192.png +0 -0
  55. package/public/logo512.png +0 -0
  56. package/public/manifest.json +0 -25
  57. package/public/robots.txt +0 -3
  58. package/server/.env.example +0 -3
  59. package/server/deploy.js +0 -29
  60. package/server/package-lock.json +0 -712
  61. package/server/package.json +0 -18
  62. package/src/App.css +0 -38
  63. package/src/App.tsx +0 -50
  64. package/src/components/GenericForm.tsx +0 -308
  65. package/src/components/Page.tsx +0 -243
  66. package/src/index.css +0 -13
  67. package/src/index.tsx +0 -20
  68. package/src/logo.svg +0 -1
  69. package/src/pages/event.ts +0 -93
  70. package/src/pages/page.ts +0 -336
  71. package/src/react-app-env.d.ts +0 -1
  72. package/src/reportWebVitals.ts +0 -15
  73. package/src/schema/schema.config.ts +0 -8
  74. package/src/schema/schema.ts +0 -63
  75. package/src/setupTests.ts +0 -5
  76. package/src/utils/websockets.tsx +0 -17
  77. package/tsconfig.esm.json +0 -7
  78. package/webpack.config.js +0 -22
  79. /package/dist/{esm/schema → src}/schema.js +0 -0
@@ -1,349 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
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
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
- if (ar || !(i in from)) {
40
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
- ar[i] = from[i];
42
- }
43
- }
44
- return to.concat(ar || Array.prototype.slice.call(from));
45
- };
46
- import * as Yup from "yup";
47
- var typeAdding = function (objectField) {
48
- objectField.type = "object";
49
- objectField.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], objectField.simpleFields, true), objectField.dropdownFields, true), objectField.objectFields, true), objectField.arrayFields, true);
50
- if (objectField.objectFields) {
51
- objectField.objectFields.map(function (objectField) {
52
- objectField = typeAdding(objectField);
53
- return objectField;
54
- });
55
- }
56
- if (objectField.arrayFields) {
57
- objectField.arrayFields.map(function (arrayField) {
58
- arrayField.element = typeAdding(arrayField.element);
59
- return arrayField;
60
- });
61
- }
62
- return objectField;
63
- };
64
- var arrayObjs = function (x) {
65
- if (x > 0)
66
- return [
67
- {
68
- name: "simpleFields",
69
- label: "Type SimpleField",
70
- type: "array",
71
- element: {
72
- name: "",
73
- label: "",
74
- type: "object",
75
- fields: [
76
- {
77
- name: "name",
78
- label: "Name",
79
- type: "string",
80
- validationSchema: Yup.string().required(),
81
- },
82
- {
83
- name: "label",
84
- label: "Label",
85
- type: "string",
86
- validationSchema: Yup.string().required(),
87
- },
88
- {
89
- name: "type",
90
- label: "Type",
91
- type: "string",
92
- validationSchema: Yup.string().required(),
93
- },
94
- {
95
- name: "validationSchema",
96
- label: "Validation Schema",
97
- type: "string",
98
- validationSchema: Yup.string().required(),
99
- },
100
- ],
101
- },
102
- },
103
- {
104
- name: "dropdownFields",
105
- label: "Type DropdownField",
106
- type: "array",
107
- element: {
108
- name: "",
109
- label: "",
110
- type: "object",
111
- fields: [
112
- {
113
- name: "name",
114
- label: "Name",
115
- type: "string",
116
- validationSchema: Yup.string().required(),
117
- },
118
- {
119
- name: "label",
120
- label: "Label",
121
- type: "string",
122
- validationSchema: Yup.string().required(),
123
- },
124
- {
125
- name: "options",
126
- label: "Options",
127
- type: "array",
128
- element: {
129
- name: "",
130
- label: "",
131
- type: "object",
132
- fields: [
133
- {
134
- name: "value",
135
- label: "Value",
136
- type: "string",
137
- validationSchema: Yup.string().required(),
138
- },
139
- {
140
- name: "display",
141
- label: "Display",
142
- type: "string",
143
- validationSchema: Yup.string().required(),
144
- },
145
- ],
146
- },
147
- },
148
- {
149
- name: "getOptions",
150
- label: "GetOptions Function",
151
- type: "string",
152
- validationSchema: Yup.string().required(),
153
- },
154
- ],
155
- },
156
- },
157
- {
158
- name: "objectFields",
159
- label: "Type ObjectField",
160
- type: "array",
161
- element: {
162
- name: "",
163
- label: "",
164
- type: "object",
165
- fields: __spreadArray([
166
- {
167
- name: "name",
168
- label: "Name",
169
- type: "string",
170
- validationSchema: Yup.string().required(),
171
- },
172
- {
173
- name: "label",
174
- label: "Label",
175
- type: "string",
176
- validationSchema: Yup.string().required(),
177
- }
178
- ], arrayObjs(x - 1), true),
179
- },
180
- },
181
- {
182
- name: "arrayFields",
183
- label: "Type ArrayField",
184
- type: "array",
185
- element: {
186
- name: "",
187
- label: "",
188
- type: "object",
189
- fields: __spreadArray([
190
- {
191
- name: "name",
192
- label: "Name",
193
- type: "string",
194
- validationSchema: Yup.string().required(),
195
- },
196
- {
197
- name: "label",
198
- label: "Label",
199
- type: "string",
200
- validationSchema: Yup.string().required(),
201
- }
202
- ], arrayObjs(x - 1), true),
203
- },
204
- },
205
- ];
206
- else
207
- return [];
208
- };
209
- export var page = {
210
- name: "Pages",
211
- getRequest: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
212
- return [2 /*return*/, []];
213
- }); }); },
214
- tableFields: [],
215
- actions: [
216
- {
217
- name: "Create New Page",
218
- fields: [
219
- {
220
- name: "name",
221
- label: "Page Name",
222
- type: "string",
223
- validationSchema: Yup.string().required(),
224
- },
225
- {
226
- name: "getRequest",
227
- label: "GetRequest",
228
- type: "string",
229
- validationSchema: Yup.string().required(),
230
- },
231
- {
232
- name: "tableFields",
233
- label: "TableFields",
234
- type: "array",
235
- element: {
236
- name: "",
237
- label: "",
238
- type: "object",
239
- fields: [
240
- {
241
- name: "name",
242
- label: "TableField Name",
243
- type: "string",
244
- validationSchema: Yup.string().required(),
245
- },
246
- {
247
- name: "access",
248
- label: "TableField Access Function",
249
- type: "string",
250
- validationSchema: Yup.string().required(),
251
- },
252
- ],
253
- },
254
- },
255
- {
256
- name: "actions",
257
- label: "Actions",
258
- type: "array",
259
- element: {
260
- name: "",
261
- label: "",
262
- type: "object",
263
- fields: __spreadArray(__spreadArray([
264
- {
265
- name: "name",
266
- label: "Action Name",
267
- type: "string",
268
- validationSchema: Yup.string().required(),
269
- }
270
- ], arrayObjs(4), true), [
271
- {
272
- name: "onSubmit",
273
- label: "Action OnSubmit Function",
274
- type: "string",
275
- validationSchema: Yup.string().required(),
276
- },
277
- ], false),
278
- },
279
- },
280
- {
281
- name: "rowActions",
282
- label: "Row Actions",
283
- type: "array",
284
- element: {
285
- name: "",
286
- label: "",
287
- type: "object",
288
- fields: __spreadArray(__spreadArray([
289
- {
290
- name: "name",
291
- label: "Row Action Name",
292
- type: "string",
293
- validationSchema: Yup.string().required(),
294
- }
295
- ], arrayObjs(4), true), [
296
- {
297
- name: "initialise",
298
- label: "Row Action Initialise Function",
299
- type: "string",
300
- validationSchema: "",
301
- },
302
- {
303
- name: "onSubmit",
304
- label: "Row Action OnSubmit Function",
305
- type: "string",
306
- validationSchema: Yup.string().required(),
307
- },
308
- ], false),
309
- },
310
- },
311
- ],
312
- onSubmit: function (formValues) { return __awaiter(void 0, void 0, void 0, function () {
313
- return __generator(this, function (_a) {
314
- if (Array.isArray(formValues.actions))
315
- formValues.actions.map(function (action) {
316
- var _a, _b, _c;
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)); });
319
- (_c = action.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (actionField) {
320
- actionField.type = "array";
321
- actionField.element = typeAdding(actionField.element);
322
- return actionField;
323
- });
324
- action.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], action.simpleFields, true), action.dropdownFields, true), action.objectFields, true), action.arrayFields, true);
325
- return action;
326
- });
327
- if (Array.isArray(formValues.rowActions))
328
- formValues.actions.map(function (rowAction) {
329
- var _a, _b, _c;
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
- });
334
- (_c = rowAction.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (rowActionField) {
335
- rowActionField.type = "array";
336
- rowActionField.element = typeAdding(rowActionField.element);
337
- return rowActionField;
338
- });
339
- rowAction.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], rowAction.simpleFields, true), rowAction.dropdownFields, true), rowAction.objectFields, true), rowAction.arrayFields, true);
340
- return rowAction;
341
- });
342
- console.log(formValues);
343
- return [2 /*return*/, []];
344
- });
345
- }); },
346
- },
347
- ],
348
- rowActions: [],
349
- };
@@ -1,13 +0,0 @@
1
- var reportWebVitals = function (onPerfEntry) {
2
- if (onPerfEntry && onPerfEntry instanceof Function) {
3
- import("web-vitals").then(function (_a) {
4
- var getCLS = _a.getCLS, getFID = _a.getFID, getFCP = _a.getFCP, getLCP = _a.getLCP, getTTFB = _a.getTTFB;
5
- getCLS(onPerfEntry);
6
- getFID(onPerfEntry);
7
- getFCP(onPerfEntry);
8
- getLCP(onPerfEntry);
9
- getTTFB(onPerfEntry);
10
- });
11
- }
12
- };
13
- export default reportWebVitals;
@@ -1,6 +0,0 @@
1
- import { event } from "../pages/event";
2
- import { page } from "../pages/page";
3
- export var pages = [
4
- event, // example schema
5
- page,
6
- ];
@@ -1,5 +0,0 @@
1
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
- // allows you to do things like:
3
- // expect(element).toHaveTextContent(/react/i)
4
- // learn more: https://github.com/testing-library/jest-dom
5
- import "@testing-library/jest-dom";
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var jsx_runtime_1 = require("react/jsx-runtime");
7
- var react_1 = __importDefault(require("react"));
8
- var client_1 = __importDefault(require("react-dom/client"));
9
- require("./index.css");
10
- var App_1 = __importDefault(require("./App"));
11
- var reportWebVitals_1 = __importDefault(require("./reportWebVitals"));
12
- var schema_config_1 = require("./schema/schema.config");
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: schema_config_1.pages, basePath: "" }) }));
15
- // If you want to start measuring performance in your app, pass a function
16
- // to log results (for example: reportWebVitals(console.log))
17
- // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
18
- (0, reportWebVitals_1.default)();
@@ -1,134 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
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
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.event = void 0;
43
- var react_1 = __importDefault(require("react"));
44
- var domain = "http://localhost:3001";
45
- exports.event = {
46
- name: "Events",
47
- actions: [],
48
- rowActions: [
49
- // {
50
- // name: "Delete Event",
51
- // fields: [
52
- // {
53
- // name: "input",
54
- // label: "Mock Field",
55
- // type: "string",
56
- // validationSchema: "",
57
- // },
58
- // ],
59
- // initialise: async (eventId: number) => {
60
- // const res = await axios.get(domain + "/events/" + eventId);
61
- // let obj: any = {};
62
- // obj.input = res.data.name;
63
- // return obj;
64
- // },
65
- // onSubmit: async (formValues: any, eventId: number) => {
66
- // const res = await axios.delete(
67
- // domain + "/events/" + eventId
68
- // );
69
- // return res.data;
70
- // },
71
- // }
72
- ],
73
- getRequest: function () { return __awaiter(void 0, void 0, void 0, function () {
74
- return __generator(this, function (_a) {
75
- // const res = await axios.get(domain + "/events");
76
- // return res.data;
77
- return [2 /*return*/, []];
78
- });
79
- }); },
80
- tableFields: [
81
- {
82
- name: "Id",
83
- access: function (obj) { return obj.id; },
84
- },
85
- {
86
- name: "Event Name",
87
- access: function (obj) { return obj.name; },
88
- },
89
- {
90
- name: "Description",
91
- access: function (obj) { return obj.description; },
92
- },
93
- {
94
- name: "Category",
95
- access: function (obj) { return obj.category; },
96
- },
97
- {
98
- name: "Ticket Type",
99
- access: function (obj) { return obj.ticketType; },
100
- },
101
- {
102
- name: "Date",
103
- access: function (obj) { return obj.date; },
104
- },
105
- {
106
- name: "Release",
107
- access: function (obj) { return obj.release; },
108
- },
109
- {
110
- name: "Is Released",
111
- access: function (obj) { return (obj.isReleased ? "Is Released" : "Not Released"); },
112
- },
113
- {
114
- name: "Available Tickets",
115
- access: function (obj) { return obj.availableTickets; },
116
- },
117
- {
118
- name: "Max Tickets",
119
- access: function (obj) { return obj.maxTickets; },
120
- },
121
- {
122
- name: "Image",
123
- access: function (obj) {
124
- return obj.imgUrl
125
- ? react_1.default.createElement("img", {
126
- src: obj.imgUrl,
127
- alt: "ERROR",
128
- style: { width: "100px" },
129
- })
130
- : "No Image Available";
131
- },
132
- },
133
- ],
134
- };