admin_lsac 1.2.5 → 1.2.6

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 CHANGED
@@ -10,9 +10,13 @@ This command will download and install the specified package and its dependencie
10
10
 
11
11
  Export-to-csv package latest version is not working properly, so make sure you have the last functional version of this package install.
12
12
 
13
+ ## What do you need to import?
14
+
15
+ ### `import { pageToUrl } from 'admin_lsac'`
16
+
13
17
  ### `import { AdminPage } from 'admin_lsac'`
14
18
 
15
- You can import this component in App.js / App.ts. If your project is TypeScript-based, you need to write the following line as well:
19
+ You can import these 2 functions in App.js / App.ts. If your project is TypeScript-based, you need to write the following line as well:
16
20
 
17
21
  ### `import { PageSchema } from 'admin_lsac'`
18
22
 
package/dist/App.js CHANGED
@@ -4,9 +4,9 @@ var jsx_runtime_1 = require("react/jsx-runtime");
4
4
  var react_1 = require("@chakra-ui/react");
5
5
  var react_router_dom_1 = require("react-router-dom");
6
6
  var Page_1 = require("./components/Page");
7
- var schema_1 = require("./schema/schema");
7
+ var Page_2 = require("./components/Page");
8
8
  function AdminPanel(_a) {
9
9
  var pages = _a.pages, basePath = _a.basePath;
10
- return ((0, jsx_runtime_1.jsx)(react_1.ChakraProvider, { children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [pages.map(function (page) { return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/").concat((0, schema_1.pageToUrl)(page)), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: page, basePath: basePath }) })); }), pages[0] ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/*"), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath }) })) : null] }) }) }));
10
+ return ((0, jsx_runtime_1.jsx)(react_1.ChakraProvider, { children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [pages.map(function (page) { return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/").concat((0, Page_2.pageToUrl)(page)), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: page, basePath: basePath }) })); }), pages[0] ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/*"), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath }) })) : null] }) }) }));
11
11
  }
12
12
  exports.default = AdminPanel;
package/dist/cjs/App.js CHANGED
@@ -4,9 +4,9 @@ var jsx_runtime_1 = require("react/jsx-runtime");
4
4
  var react_1 = require("@chakra-ui/react");
5
5
  var react_router_dom_1 = require("react-router-dom");
6
6
  var Page_1 = require("./components/Page");
7
- var schema_1 = require("./schema/schema");
7
+ var Page_2 = require("./components/Page");
8
8
  function AdminPanel(_a) {
9
9
  var pages = _a.pages, basePath = _a.basePath;
10
- return ((0, jsx_runtime_1.jsx)(react_1.ChakraProvider, { children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [pages.map(function (page) { return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/").concat((0, schema_1.pageToUrl)(page)), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: page, basePath: basePath }) })); }), pages[0] ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/*"), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath }) })) : null] }) }) }));
10
+ return ((0, jsx_runtime_1.jsx)(react_1.ChakraProvider, { children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [pages.map(function (page) { return ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/").concat((0, Page_2.pageToUrl)(page)), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: page, basePath: basePath }) })); }), pages[0] ? ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "".concat(basePath, "/*"), element: (0, jsx_runtime_1.jsx)(Page_1.AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath }) })) : null] }) }) }));
11
11
  }
12
12
  exports.default = AdminPanel;
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AdminPage = void 0;
6
+ exports.AdminPage = exports.pageToUrl = void 0;
7
7
  var jsx_runtime_1 = require("react/jsx-runtime");
8
8
  var react_1 = require("react");
9
9
  var react_2 = require("@chakra-ui/react");
10
- var schema_1 = require("../schema/schema");
11
10
  var react_3 = require("@chakra-ui/react");
12
11
  var GenericForm_1 = require("./GenericForm");
13
12
  var react_4 = require("@emotion/react");
@@ -16,9 +15,13 @@ var material_react_table_1 = require("material-react-table");
16
15
  var export_to_csv_1 = require("export-to-csv");
17
16
  var sweetalert2_1 = __importDefault(require("sweetalert2"));
18
17
  var MenuItem_1 = __importDefault(require("@mui/material/MenuItem"));
18
+ function pageToUrl(page) {
19
+ return "".concat(page.name.toLowerCase().replace(" ", "_"));
20
+ }
21
+ exports.pageToUrl = pageToUrl;
19
22
  function Header(_a) {
20
23
  var pages = _a.pages, data = _a.data, basePath = _a.basePath;
21
- return ((0, jsx_runtime_1.jsx)(react_3.Box, { background: "blue.50", padding: 1, children: (0, jsx_runtime_1.jsxs)(react_3.Stack, { margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_3.Stack, { margin: 4, gap: 10, direction: "row", alignItems: "center", children: pages.map(function (p) { return ((0, jsx_runtime_1.jsx)(react_3.Box, { as: "a", href: "".concat(basePath, "/").concat((0, schema_1.pageToUrl)(p)), children: p.name })); }) }), (0, jsx_runtime_1.jsx)(react_3.Stack, { direction: "row", children: (0, jsx_runtime_1.jsx)(react_3.Button, { colorScheme: "red", onClick: function () {
24
+ return ((0, jsx_runtime_1.jsx)(react_3.Box, { background: "blue.50", padding: 1, children: (0, jsx_runtime_1.jsxs)(react_3.Stack, { margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_3.Stack, { margin: 4, gap: 10, direction: "row", alignItems: "center", children: pages.map(function (p) { return ((0, jsx_runtime_1.jsx)(react_3.Box, { as: "a", href: "".concat(basePath, "/").concat(pageToUrl(p)), children: p.name })); }) }), (0, jsx_runtime_1.jsx)(react_3.Stack, { direction: "row", children: (0, jsx_runtime_1.jsx)(react_3.Button, { colorScheme: "red", onClick: function () {
22
25
  var filename = prompt("Enter filename:");
23
26
  if (filename)
24
27
  exportToCSV(data, filename);
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pageToUrl = void 0;
4
- function pageToUrl(page) {
5
- return "".concat(page.name.toLowerCase().replace(" ", "_"));
6
- }
7
- exports.pageToUrl = pageToUrl;
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AdminPage = void 0;
6
+ exports.AdminPage = exports.pageToUrl = void 0;
7
7
  var jsx_runtime_1 = require("react/jsx-runtime");
8
8
  var react_1 = require("react");
9
9
  var react_2 = require("@chakra-ui/react");
10
- var schema_1 = require("../schema/schema");
11
10
  var react_3 = require("@chakra-ui/react");
12
11
  var GenericForm_1 = require("./GenericForm");
13
12
  var react_4 = require("@emotion/react");
@@ -16,9 +15,13 @@ var material_react_table_1 = require("material-react-table");
16
15
  var export_to_csv_1 = require("export-to-csv");
17
16
  var sweetalert2_1 = __importDefault(require("sweetalert2"));
18
17
  var MenuItem_1 = __importDefault(require("@mui/material/MenuItem"));
18
+ function pageToUrl(page) {
19
+ return "".concat(page.name.toLowerCase().replace(" ", "_"));
20
+ }
21
+ exports.pageToUrl = pageToUrl;
19
22
  function Header(_a) {
20
23
  var pages = _a.pages, data = _a.data, basePath = _a.basePath;
21
- return ((0, jsx_runtime_1.jsx)(react_3.Box, { background: "blue.50", padding: 1, children: (0, jsx_runtime_1.jsxs)(react_3.Stack, { margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_3.Stack, { margin: 4, gap: 10, direction: "row", alignItems: "center", children: pages.map(function (p) { return ((0, jsx_runtime_1.jsx)(react_3.Box, { as: "a", href: "".concat(basePath, "/").concat((0, schema_1.pageToUrl)(p)), children: p.name })); }) }), (0, jsx_runtime_1.jsx)(react_3.Stack, { direction: "row", children: (0, jsx_runtime_1.jsx)(react_3.Button, { colorScheme: "red", onClick: function () {
24
+ return ((0, jsx_runtime_1.jsx)(react_3.Box, { background: "blue.50", padding: 1, children: (0, jsx_runtime_1.jsxs)(react_3.Stack, { margin: 3, direction: "row", justifyContent: "space-between", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(react_3.Stack, { margin: 4, gap: 10, direction: "row", alignItems: "center", children: pages.map(function (p) { return ((0, jsx_runtime_1.jsx)(react_3.Box, { as: "a", href: "".concat(basePath, "/").concat(pageToUrl(p)), children: p.name })); }) }), (0, jsx_runtime_1.jsx)(react_3.Stack, { direction: "row", children: (0, jsx_runtime_1.jsx)(react_3.Button, { colorScheme: "red", onClick: function () {
22
25
  var filename = prompt("Enter filename:");
23
26
  if (filename)
24
27
  exportToCSV(data, filename);
package/dist/esm/App.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChakraProvider } from "@chakra-ui/react";
3
3
  import { BrowserRouter, Route, Routes } from "react-router-dom";
4
4
  import { AdminPage } from "./components/Page";
5
- import { pageToUrl } from "./schema/schema";
5
+ import { pageToUrl } from "./components/Page";
6
6
  function AdminPanel(_a) {
7
7
  var pages = _a.pages, basePath = _a.basePath;
8
8
  return (_jsx(ChakraProvider, { children: _jsx(BrowserRouter, { children: _jsxs(Routes, { children: [pages.map(function (page) { return (_jsx(Route, { path: "".concat(basePath, "/").concat(pageToUrl(page)), element: _jsx(AdminPage, { pages: pages, selectedPage: page, basePath: basePath }) })); }), pages[0] ? (_jsx(Route, { path: "".concat(basePath, "/*"), element: _jsx(AdminPage, { pages: pages, selectedPage: pages[0], basePath: basePath }) })) : null] }) }) }));
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { ChakraProvider } from "@chakra-ui/react";
4
- import { pageToUrl } from "../schema/schema";
5
4
  import { Button, Modal, ModalHeader, ModalBody, useDisclosure, ModalOverlay, ModalContent, ModalCloseButton, Box, Stack, } from "@chakra-ui/react";
6
5
  import { GenericForm } from "./GenericForm";
7
6
  import { ThemeProvider } from "@emotion/react";
@@ -10,6 +9,9 @@ import { MaterialReactTable } from "material-react-table";
10
9
  import { mkConfig, generateCsv, download } from "export-to-csv";
11
10
  import Swal from "sweetalert2";
12
11
  import MenuItem from "@mui/material/MenuItem";
12
+ export function pageToUrl(page) {
13
+ return "".concat(page.name.toLowerCase().replace(" ", "_"));
14
+ }
13
15
  function Header(_a) {
14
16
  var pages = _a.pages, data = _a.data, basePath = _a.basePath;
15
17
  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 () {
@@ -1,3 +1 @@
1
- export function pageToUrl(page) {
2
- return "".concat(page.name.toLowerCase().replace(" ", "_"));
3
- }
1
+ export {};
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pageToUrl = void 0;
4
- function pageToUrl(page) {
5
- return "".concat(page.name.toLowerCase().replace(" ", "_"));
6
- }
7
- exports.pageToUrl = pageToUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admin_lsac",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Generic Admin Panel created for storing events' data",
5
5
  "private": false,
6
6
  "dependencies": {
package/src/App.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ChakraProvider } from "@chakra-ui/react";
2
2
  import { BrowserRouter, Route, Routes } from "react-router-dom";
3
3
  import { AdminPage } from "./components/Page";
4
- import { pageToUrl } from "./schema/schema";
4
+ import { pageToUrl } from "./components/Page";
5
5
  import * as React from "react";
6
6
 
7
7
  interface TableField {
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { ChakraProvider } from "@chakra-ui/react";
3
- import { PageSchema, Action, pageToUrl } from "../schema/schema";
3
+ import { PageSchema, Action } from "../schema/schema";
4
4
  import {
5
5
  Button,
6
6
  Modal,
@@ -21,6 +21,10 @@ import { mkConfig, generateCsv, download } from "export-to-csv";
21
21
  import Swal from "sweetalert2";
22
22
  import MenuItem from "@mui/material/MenuItem";
23
23
 
24
+ export function pageToUrl(page: PageSchema): string {
25
+ return `${page.name.toLowerCase().replace(" ", "_")}`;
26
+ }
27
+
24
28
  function Header({
25
29
  pages,
26
30
  data,
@@ -62,7 +62,3 @@ export interface PageSchema {
62
62
  getRequest: () => Promise<any[]>;
63
63
  tableFields: TableField[];
64
64
  }
65
-
66
- export function pageToUrl(page: PageSchema): string {
67
- return `${page.name.toLowerCase().replace(" ", "_")}`;
68
- }