admin_lsac 1.1.4 → 1.2.2
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/README.md +2 -2
- package/dist/App.d.ts +3 -1
- package/dist/App.js +38 -4
- package/dist/cjs/App.js +48 -0
- package/dist/cjs/components/GenericForm.js +269 -0
- package/dist/cjs/components/Page.js +106 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/pages/event.js +110 -0
- package/dist/cjs/pages/page.js +343 -0
- package/dist/cjs/reportWebVitals.js +34 -0
- package/dist/cjs/schema/schema.config.js +9 -0
- package/dist/cjs/schema/schema.js +7 -0
- package/dist/cjs/setupTests.js +7 -0
- package/dist/components/GenericForm.js +17 -21
- package/dist/components/Page.js +22 -11
- package/dist/esm/App.js +27 -12
- package/dist/esm/components/GenericForm.js +243 -243
- package/dist/esm/components/Page.js +99 -99
- package/dist/esm/index.js +13 -13
- package/dist/esm/pages/event.js +104 -104
- package/dist/esm/pages/page.js +321 -0
- package/dist/esm/reportWebVitals.js +13 -13
- package/dist/esm/schema/schema.config.js +6 -4
- package/dist/esm/schema/schema.js +3 -3
- package/dist/esm/setupTests.js +5 -5
- package/dist/index.js +1 -1
- package/dist/pages/event.js +1 -1
- package/dist/pages/page.js +343 -0
- package/dist/reportWebVitals.js +1 -5
- package/dist/schema/schema.config.js +3 -1
- package/package.json +1 -1
- package/src/App.tsx +22 -17
- package/src/components/Page.tsx +6 -4
- package/src/index.tsx +20 -20
- package/src/pages/page.ts +291 -0
- package/src/schema/schema.config.ts +2 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
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;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
58
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
59
|
+
if (ar || !(i in from)) {
|
|
60
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
61
|
+
ar[i] = from[i];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
65
|
+
};
|
|
66
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
+
exports.page = void 0;
|
|
68
|
+
var Yup = __importStar(require("yup"));
|
|
69
|
+
var typeAdding = function (objectField) {
|
|
70
|
+
objectField.type = "object";
|
|
71
|
+
objectField.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], objectField.simpleFields, true), objectField.dropdownFields, true), objectField.objectFields, true), objectField.arrayFields, true);
|
|
72
|
+
if (objectField.objectFields) {
|
|
73
|
+
objectField.objectFields.map(function (objectField) {
|
|
74
|
+
objectField = typeAdding(objectField);
|
|
75
|
+
return objectField;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (objectField.arrayFields) {
|
|
79
|
+
objectField.arrayFields.map(function (arrayField) {
|
|
80
|
+
arrayField.element = typeAdding(arrayField.element);
|
|
81
|
+
return arrayField;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return objectField;
|
|
85
|
+
};
|
|
86
|
+
var arrayObjs = function (x) {
|
|
87
|
+
if (x > 0)
|
|
88
|
+
return [{
|
|
89
|
+
name: "simpleFields",
|
|
90
|
+
label: "Type SimpleField",
|
|
91
|
+
type: "array",
|
|
92
|
+
element: {
|
|
93
|
+
name: "",
|
|
94
|
+
label: "",
|
|
95
|
+
type: "object",
|
|
96
|
+
fields: [{
|
|
97
|
+
name: "name",
|
|
98
|
+
label: "Name",
|
|
99
|
+
type: "string",
|
|
100
|
+
validationSchema: Yup.string().required()
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "label",
|
|
104
|
+
label: "Label",
|
|
105
|
+
type: "string",
|
|
106
|
+
validationSchema: Yup.string().required()
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "type",
|
|
110
|
+
label: "Type",
|
|
111
|
+
type: "string",
|
|
112
|
+
validationSchema: Yup.string().required()
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "validationSchema",
|
|
116
|
+
label: "Validation Schema",
|
|
117
|
+
type: "string",
|
|
118
|
+
validationSchema: Yup.string().required()
|
|
119
|
+
}]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "dropdownFields",
|
|
124
|
+
label: "Type DropdownField",
|
|
125
|
+
type: "array",
|
|
126
|
+
element: {
|
|
127
|
+
name: "",
|
|
128
|
+
label: "",
|
|
129
|
+
type: "object",
|
|
130
|
+
fields: [{
|
|
131
|
+
name: "name",
|
|
132
|
+
label: "Name",
|
|
133
|
+
type: "string",
|
|
134
|
+
validationSchema: Yup.string().required()
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "label",
|
|
138
|
+
label: "Label",
|
|
139
|
+
type: "string",
|
|
140
|
+
validationSchema: Yup.string().required()
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "options",
|
|
144
|
+
label: "Options",
|
|
145
|
+
type: "array",
|
|
146
|
+
element: {
|
|
147
|
+
name: "",
|
|
148
|
+
label: "",
|
|
149
|
+
type: "object",
|
|
150
|
+
fields: [{
|
|
151
|
+
name: "value",
|
|
152
|
+
label: "Value",
|
|
153
|
+
type: "string",
|
|
154
|
+
validationSchema: Yup.string().required()
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "display",
|
|
158
|
+
label: "Display",
|
|
159
|
+
type: "string",
|
|
160
|
+
validationSchema: Yup.string().required()
|
|
161
|
+
}]
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "getOptions",
|
|
166
|
+
label: "GetOptions Function",
|
|
167
|
+
type: "string",
|
|
168
|
+
validationSchema: Yup.string().required()
|
|
169
|
+
}]
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "objectFields",
|
|
174
|
+
label: "Type ObjectField",
|
|
175
|
+
type: "array",
|
|
176
|
+
element: {
|
|
177
|
+
name: "",
|
|
178
|
+
label: "",
|
|
179
|
+
type: "object",
|
|
180
|
+
fields: __spreadArray([{
|
|
181
|
+
name: "name",
|
|
182
|
+
label: "Name",
|
|
183
|
+
type: "string",
|
|
184
|
+
validationSchema: Yup.string().required()
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "label",
|
|
188
|
+
label: "Label",
|
|
189
|
+
type: "string",
|
|
190
|
+
validationSchema: Yup.string().required()
|
|
191
|
+
}], arrayObjs(x - 1), true)
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "arrayFields",
|
|
196
|
+
label: "Type ArrayField",
|
|
197
|
+
type: "array",
|
|
198
|
+
element: {
|
|
199
|
+
name: "",
|
|
200
|
+
label: "",
|
|
201
|
+
type: "object",
|
|
202
|
+
fields: __spreadArray([{
|
|
203
|
+
name: "name",
|
|
204
|
+
label: "Name",
|
|
205
|
+
type: "string",
|
|
206
|
+
validationSchema: Yup.string().required()
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "label",
|
|
210
|
+
label: "Label",
|
|
211
|
+
type: "string",
|
|
212
|
+
validationSchema: Yup.string().required()
|
|
213
|
+
}], arrayObjs(x - 1), true)
|
|
214
|
+
}
|
|
215
|
+
}];
|
|
216
|
+
else
|
|
217
|
+
return [];
|
|
218
|
+
};
|
|
219
|
+
exports.page = {
|
|
220
|
+
name: "Pages",
|
|
221
|
+
getRequest: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
222
|
+
return [2 /*return*/, []];
|
|
223
|
+
}); }); },
|
|
224
|
+
tableFields: [],
|
|
225
|
+
actions: [{
|
|
226
|
+
name: "Create New Page",
|
|
227
|
+
fields: [{
|
|
228
|
+
name: "name",
|
|
229
|
+
label: "Page Name",
|
|
230
|
+
type: "string",
|
|
231
|
+
validationSchema: Yup.string().required()
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "getRequest",
|
|
235
|
+
label: "GetRequest",
|
|
236
|
+
type: "string",
|
|
237
|
+
validationSchema: Yup.string().required()
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "tableFields",
|
|
241
|
+
label: "TableFields",
|
|
242
|
+
type: "array",
|
|
243
|
+
element: {
|
|
244
|
+
name: "",
|
|
245
|
+
label: "",
|
|
246
|
+
type: "object",
|
|
247
|
+
fields: [{
|
|
248
|
+
name: "name",
|
|
249
|
+
label: "TableField Name",
|
|
250
|
+
type: "string",
|
|
251
|
+
validationSchema: Yup.string().required()
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "access",
|
|
255
|
+
label: "TableField Access Function",
|
|
256
|
+
type: "string",
|
|
257
|
+
validationSchema: Yup.string().required()
|
|
258
|
+
}]
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "actions",
|
|
263
|
+
label: "Actions",
|
|
264
|
+
type: "array",
|
|
265
|
+
element: {
|
|
266
|
+
name: "",
|
|
267
|
+
label: "",
|
|
268
|
+
type: "object",
|
|
269
|
+
fields: __spreadArray(__spreadArray([{
|
|
270
|
+
name: "name",
|
|
271
|
+
label: "Action Name",
|
|
272
|
+
type: "string",
|
|
273
|
+
validationSchema: Yup.string().required()
|
|
274
|
+
}], arrayObjs(4), true), [{
|
|
275
|
+
name: "onSubmit",
|
|
276
|
+
label: "Action OnSubmit Function",
|
|
277
|
+
type: "string",
|
|
278
|
+
validationSchema: Yup.string().required()
|
|
279
|
+
}], false)
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "rowActions",
|
|
284
|
+
label: "Row Actions",
|
|
285
|
+
type: "array",
|
|
286
|
+
element: {
|
|
287
|
+
name: "",
|
|
288
|
+
label: "",
|
|
289
|
+
type: "object",
|
|
290
|
+
fields: __spreadArray(__spreadArray([{
|
|
291
|
+
name: "name",
|
|
292
|
+
label: "Row Action Name",
|
|
293
|
+
type: "string",
|
|
294
|
+
validationSchema: Yup.string().required()
|
|
295
|
+
}], arrayObjs(4), true), [{
|
|
296
|
+
name: "initialise",
|
|
297
|
+
label: "Row Action Initialise Function",
|
|
298
|
+
type: "string",
|
|
299
|
+
validationSchema: ""
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "onSubmit",
|
|
303
|
+
label: "Row Action OnSubmit Function",
|
|
304
|
+
type: "string",
|
|
305
|
+
validationSchema: Yup.string().required()
|
|
306
|
+
}], false)
|
|
307
|
+
}
|
|
308
|
+
}],
|
|
309
|
+
onSubmit: function (formValues) { return __awaiter(void 0, void 0, void 0, function () {
|
|
310
|
+
return __generator(this, function (_a) {
|
|
311
|
+
if (Array.isArray(formValues.actions))
|
|
312
|
+
formValues.actions.map(function (action) {
|
|
313
|
+
var _a, _b, _c;
|
|
314
|
+
(_a = action.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (actionField) { return actionField.type = "dropdown"; });
|
|
315
|
+
(_b = action.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (actionField) { return actionField = typeAdding(actionField); });
|
|
316
|
+
(_c = action.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (actionField) {
|
|
317
|
+
actionField.type = "array";
|
|
318
|
+
actionField.element = typeAdding(actionField.element);
|
|
319
|
+
return actionField;
|
|
320
|
+
});
|
|
321
|
+
action.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], action.simpleFields, true), action.dropdownFields, true), action.objectFields, true), action.arrayFields, true);
|
|
322
|
+
return action;
|
|
323
|
+
});
|
|
324
|
+
if (Array.isArray(formValues.rowActions))
|
|
325
|
+
formValues.actions.map(function (rowAction) {
|
|
326
|
+
var _a, _b, _c;
|
|
327
|
+
(_a = rowAction.dropdownFields) === null || _a === void 0 ? void 0 : _a.map(function (rowActionField) { return rowActionField.type = "dropdown"; });
|
|
328
|
+
(_b = rowAction.objectFields) === null || _b === void 0 ? void 0 : _b.map(function (rowActionField) { return rowActionField = typeAdding(rowActionField); });
|
|
329
|
+
(_c = rowAction.arrayFields) === null || _c === void 0 ? void 0 : _c.map(function (rowActionField) {
|
|
330
|
+
rowActionField.type = "array";
|
|
331
|
+
rowActionField.element = typeAdding(rowActionField.element);
|
|
332
|
+
return rowActionField;
|
|
333
|
+
});
|
|
334
|
+
rowAction.fields = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], rowAction.simpleFields, true), rowAction.dropdownFields, true), rowAction.objectFields, true), rowAction.arrayFields, true);
|
|
335
|
+
return rowAction;
|
|
336
|
+
});
|
|
337
|
+
console.log(formValues);
|
|
338
|
+
return [2 /*return*/, []];
|
|
339
|
+
});
|
|
340
|
+
}); }
|
|
341
|
+
}],
|
|
342
|
+
rowActions: [],
|
|
343
|
+
};
|
package/dist/reportWebVitals.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
5
|
}) : (function(o, m, k, k2) {
|
|
10
6
|
if (k2 === undefined) k2 = k;
|
|
11
7
|
o[k2] = m[k];
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pages = void 0;
|
|
4
4
|
var event_1 = require("../pages/event");
|
|
5
|
+
var page_1 = require("../pages/page");
|
|
5
6
|
exports.pages = [
|
|
6
|
-
event_1.event,
|
|
7
|
+
event_1.event,
|
|
8
|
+
page_1.page,
|
|
7
9
|
];
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { BrowserRouter, Route, Routes } from "react-router-dom";
|
|
|
3
3
|
import { Page } from "./components/Page";
|
|
4
4
|
import { pageToUrl } from "./schema/schema";
|
|
5
5
|
import * as React from "react";
|
|
6
|
+
import { page } from "./pages/page";
|
|
6
7
|
|
|
7
8
|
interface TableField {
|
|
8
9
|
name: string;
|
|
@@ -66,25 +67,29 @@ interface PageSchema {
|
|
|
66
67
|
tableFields: TableField[];
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
function AdminPanel({ pages }: { pages: PageSchema[] }) {
|
|
70
|
+
function AdminPanel({ pages, basePath }: { pages: PageSchema[], basePath: string }) {
|
|
71
|
+
const [pagesToDisplay, setPagesToDisplay] = React.useState(pages);
|
|
72
|
+
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
setPagesToDisplay([...pages, page]);
|
|
75
|
+
}, [])
|
|
76
|
+
|
|
70
77
|
return (
|
|
71
78
|
<ChakraProvider>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</Routes>
|
|
87
|
-
</BrowserRouter>
|
|
79
|
+
<Routes>
|
|
80
|
+
{pagesToDisplay.map((page) => (
|
|
81
|
+
<Route
|
|
82
|
+
path={`${basePath}/${pageToUrl(page)}`}
|
|
83
|
+
element={<Page pages={pagesToDisplay} selectedPage={page} basePath={basePath} />}
|
|
84
|
+
/>
|
|
85
|
+
))}
|
|
86
|
+
{pages[0] ?
|
|
87
|
+
<Route
|
|
88
|
+
path={`${basePath}/*`}
|
|
89
|
+
element={<Page pages={pagesToDisplay} selectedPage={pages[0]} basePath={basePath} />}
|
|
90
|
+
/>
|
|
91
|
+
: null}
|
|
92
|
+
</Routes>
|
|
88
93
|
</ChakraProvider>
|
|
89
94
|
);
|
|
90
95
|
}
|
package/src/components/Page.tsx
CHANGED
|
@@ -22,7 +22,7 @@ import { mkConfig, generateCsv, download } from "export-to-csv";
|
|
|
22
22
|
import Swal from "sweetalert2";
|
|
23
23
|
import MenuItem from "@mui/material/MenuItem";
|
|
24
24
|
|
|
25
|
-
function Header({ pages, data }: { pages: PageSchema[]; data: any[] }) {
|
|
25
|
+
function Header({ pages, data, basePath }: { pages: PageSchema[]; data: any[], basePath: string }) {
|
|
26
26
|
const nav = useNavigate();
|
|
27
27
|
return (
|
|
28
28
|
<Box background="blue.50" padding={1}>
|
|
@@ -34,7 +34,7 @@ function Header({ pages, data }: { pages: PageSchema[]; data: any[] }) {
|
|
|
34
34
|
>
|
|
35
35
|
<Stack margin={4} gap={10} direction="row" alignItems="center">
|
|
36
36
|
{pages.map((p) => (
|
|
37
|
-
<Box as="a" href={pageToUrl(p)}>
|
|
37
|
+
<Box as="a" href={`${basePath}/${pageToUrl(p)}`}>
|
|
38
38
|
{p.name}
|
|
39
39
|
</Box>
|
|
40
40
|
))}
|
|
@@ -87,9 +87,11 @@ function exportToCSV(data: any[], filename: string) {
|
|
|
87
87
|
export function Page({
|
|
88
88
|
pages,
|
|
89
89
|
selectedPage,
|
|
90
|
+
basePath
|
|
90
91
|
}: {
|
|
91
92
|
pages: PageSchema[];
|
|
92
93
|
selectedPage: PageSchema;
|
|
94
|
+
basePath: string;
|
|
93
95
|
}) {
|
|
94
96
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
|
95
97
|
const [selectedAction, setSelectedAction] = useState({} as Action);
|
|
@@ -113,7 +115,7 @@ export function Page({
|
|
|
113
115
|
|
|
114
116
|
return (
|
|
115
117
|
<>
|
|
116
|
-
<Header pages={pages} data={data} />
|
|
118
|
+
<Header pages={pages} data={data} basePath={basePath} />
|
|
117
119
|
|
|
118
120
|
<ThemeProvider theme={createTheme()}>
|
|
119
121
|
<MaterialReactTable
|
|
@@ -148,7 +150,7 @@ export function Page({
|
|
|
148
150
|
</ChakraProvider>
|
|
149
151
|
)}
|
|
150
152
|
enableRowActions
|
|
151
|
-
renderRowActionMenuItems={(obj) => {
|
|
153
|
+
renderRowActionMenuItems={(obj: any) => {
|
|
152
154
|
return selectedPage.rowActions.map((rowAction) => (
|
|
153
155
|
<MenuItem
|
|
154
156
|
onClick={() => {
|
package/src/index.tsx
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom/client";
|
|
3
|
-
import "./index.css";
|
|
4
|
-
import AdminPanel from "./App";
|
|
5
|
-
import reportWebVitals from "./reportWebVitals";
|
|
6
|
-
import { event } from "./pages/event";
|
|
7
|
-
|
|
8
|
-
const root = ReactDOM.createRoot(
|
|
9
|
-
document.getElementById("root") as HTMLElement
|
|
10
|
-
);
|
|
11
|
-
root.render(
|
|
12
|
-
<React.StrictMode>
|
|
13
|
-
<AdminPanel pages={[event]} />
|
|
14
|
-
</React.StrictMode>
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// If you want to start measuring performance in your app, pass a function
|
|
18
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
19
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
20
|
-
reportWebVitals();
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import "./index.css";
|
|
4
|
+
import AdminPanel from "./App";
|
|
5
|
+
import reportWebVitals from "./reportWebVitals";
|
|
6
|
+
import { event } from "./pages/event";
|
|
7
|
+
|
|
8
|
+
const root = ReactDOM.createRoot(
|
|
9
|
+
document.getElementById("root") as HTMLElement
|
|
10
|
+
);
|
|
11
|
+
root.render(
|
|
12
|
+
<React.StrictMode>
|
|
13
|
+
<AdminPanel pages={[event]} basePath="" />
|
|
14
|
+
</React.StrictMode>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
// If you want to start measuring performance in your app, pass a function
|
|
18
|
+
// to log results (for example: reportWebVitals(console.log))
|
|
19
|
+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
20
|
+
reportWebVitals();
|