UNPKG

@premieroctet/next-admin

Version:

Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje

97 lines (96 loc) 3.66 kB
"use strict"; var __webpack_require__ = {}; (()=>{ __webpack_require__.d = (exports1, definition)=>{ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { enumerable: true, get: definition[key] }); }; })(); (()=>{ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); })(); (()=>{ __webpack_require__.r = (exports1)=>{ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports1, '__esModule', { value: true }); }; })(); var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { NextAdminRouterAdapter: ()=>NextAdminRouterAdapter, NextAdmin: ()=>NextAdmin, useRemixRouterAdapter: ()=>useRemixRouterAdapter, MainLayout: ()=>MainLayout }); const react_namespaceObject = require("@remix-run/react"); const external_react_namespaceObject = require("react"); const external_components_js_namespaceObject = require("./components.js"); const external_context_js_namespaceObject = require("./context.js"); const useRemixRouterAdapter = ()=>{ const location = (0, react_namespaceObject.useLocation)(); const navigate = (0, react_namespaceObject.useNavigate)(); const revalidator = (0, react_namespaceObject.useRevalidator)(); const pathname = location.pathname; const query = (0, external_react_namespaceObject.useMemo)(()=>new URLSearchParams(location.search), [ location.search ]); const push = (params)=>{ navigate({ pathname: params.pathname, search: params.query ? new URLSearchParams(params.query).toString() : void 0 }); }; const replace = (params)=>{ navigate({ pathname: params.pathname, search: params.query ? new URLSearchParams(params.query).toString() : void 0 }, { replace: true }); }; const refresh = ()=>{ revalidator.revalidate(); }; const setQuery = (queryArg, merge = false)=>{ const currentQuery = Object.fromEntries(query); const newQuery = merge ? { ...currentQuery, ...queryArg } : queryArg; const searchParams = new URLSearchParams(); for (const [key, value] of Object.entries(newQuery))if (value) searchParams.set(key, value); window.location.search = searchParams.toString(); }; return { router: { push, replace, refresh, setQuery }, pathname, query: Object.fromEntries(query) }; }; const NextAdminRouterAdapter = (0, external_context_js_namespaceObject.createRouterAdapter)(useRemixRouterAdapter); const { NextAdmin, MainLayout } = (0, external_components_js_namespaceObject.createNextAdminComponents)(NextAdminRouterAdapter); exports.MainLayout = __webpack_exports__.MainLayout; exports.NextAdmin = __webpack_exports__.NextAdmin; exports.NextAdminRouterAdapter = __webpack_exports__.NextAdminRouterAdapter; exports.useRemixRouterAdapter = __webpack_exports__.useRemixRouterAdapter; for(var __webpack_i__ in __webpack_exports__)if (-1 === [ "MainLayout", "NextAdmin", "NextAdminRouterAdapter", "useRemixRouterAdapter" ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__]; Object.defineProperty(exports, '__esModule', { value: true });