adminforth 1.1.33 → 1.1.34

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 (93) hide show
  1. package/dist/modules/styles.js +1 -1
  2. package/dist/plugins/AccessControl/index.js +66 -0
  3. package/dist/plugins/AccessControl/types.js +1 -0
  4. package/dist/spa/index.html +2 -2
  5. package/dist/spa/package-lock.json +4 -17
  6. package/dist/spa/package.json +1 -2
  7. package/dist/spa/public/favicon.ico +0 -0
  8. package/dist/spa/spa/.eslintrc.cjs +14 -0
  9. package/dist/spa/spa/.vscode/extensions.json +6 -0
  10. package/dist/spa/spa/README.md +39 -0
  11. package/dist/spa/spa/env.d.ts +1 -0
  12. package/dist/spa/spa/index.html +23 -0
  13. package/dist/spa/spa/package-lock.json +4359 -0
  14. package/dist/spa/spa/package.json +47 -0
  15. package/dist/spa/spa/postcss.config.js +6 -0
  16. package/dist/spa/spa/public/favicon.ico +0 -0
  17. package/dist/spa/spa/public/favicon.png +0 -0
  18. package/dist/spa/spa/src/App.vue +271 -0
  19. package/dist/spa/spa/src/assets/base.css +0 -0
  20. package/dist/spa/spa/src/assets/logo.svg +19 -0
  21. package/dist/spa/spa/src/components/AcceptModal.vue +45 -0
  22. package/dist/spa/spa/src/components/Breadcrumbs.vue +40 -0
  23. package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
  24. package/dist/spa/spa/src/components/CustomDatePicker.vue +174 -0
  25. package/dist/spa/spa/src/components/CustomDateRangePicker.vue +218 -0
  26. package/dist/spa/spa/src/components/CustomRangePicker.vue +148 -0
  27. package/dist/spa/spa/src/components/Dropdown.vue +168 -0
  28. package/dist/spa/spa/src/components/Filters.vue +211 -0
  29. package/dist/spa/spa/src/components/HelloWorld.vue +17 -0
  30. package/dist/spa/spa/src/components/MenuLink.vue +24 -0
  31. package/dist/spa/spa/src/components/ResourceForm.vue +265 -0
  32. package/dist/spa/{src → spa/src}/components/ResourceListTable.vue +10 -1
  33. package/dist/spa/spa/src/components/SingleSkeletLoader.vue +13 -0
  34. package/dist/spa/spa/src/components/ValueRenderer.vue +60 -0
  35. package/dist/spa/spa/src/components/icons/IconCalendar.vue +5 -0
  36. package/dist/spa/spa/src/components/icons/IconCommunity.vue +7 -0
  37. package/dist/spa/spa/src/components/icons/IconDocumentation.vue +7 -0
  38. package/dist/spa/spa/src/components/icons/IconEcosystem.vue +7 -0
  39. package/dist/spa/spa/src/components/icons/IconSupport.vue +7 -0
  40. package/dist/spa/spa/src/components/icons/IconTime.vue +5 -0
  41. package/dist/spa/spa/src/components/icons/IconTooling.vue +19 -0
  42. package/dist/spa/spa/src/index.scss +26 -0
  43. package/dist/spa/spa/src/main.ts +18 -0
  44. package/dist/spa/spa/src/router/index.ts +64 -0
  45. package/dist/spa/spa/src/stores/core.ts +144 -0
  46. package/dist/spa/spa/src/stores/modal.ts +48 -0
  47. package/dist/spa/spa/src/utils.ts +101 -0
  48. package/dist/spa/spa/src/views/CreateView.vue +163 -0
  49. package/dist/spa/spa/src/views/EditView.vue +165 -0
  50. package/dist/spa/spa/src/views/ListView.vue +257 -0
  51. package/dist/spa/spa/src/views/LoginView.vue +134 -0
  52. package/dist/spa/spa/src/views/ResourceParent.vue +18 -0
  53. package/dist/spa/spa/src/views/ShowView.vue +188 -0
  54. package/dist/spa/spa/tailwind.config.js +15 -0
  55. package/dist/spa/spa/tsconfig.app.json +14 -0
  56. package/dist/spa/spa/tsconfig.json +11 -0
  57. package/dist/spa/spa/tsconfig.node.json +19 -0
  58. package/dist/spa/spa/vite.config.ts +49 -0
  59. package/dist/spa/src/App.vue +45 -125
  60. package/dist/spa/src/assets/logo.svg +1 -19
  61. package/dist/spa/src/components/AcceptModal.vue +9 -2
  62. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  63. package/dist/spa/src/components/CustomDatePicker.vue +3 -16
  64. package/dist/spa/src/components/CustomDateRangePicker.vue +2 -11
  65. package/dist/spa/src/components/Dropdown.vue +1 -6
  66. package/dist/spa/src/components/Filters.vue +19 -40
  67. package/dist/spa/src/components/ResourceForm.vue +24 -26
  68. package/dist/spa/src/components/ValueRenderer.vue +8 -14
  69. package/dist/spa/src/main.ts +1 -1
  70. package/dist/spa/src/router/index.ts +20 -30
  71. package/dist/spa/src/stores/core.ts +31 -48
  72. package/dist/spa/src/stores/modal.ts +3 -13
  73. package/dist/spa/src/utils.ts +7 -62
  74. package/dist/spa/src/views/CreateView.vue +15 -67
  75. package/dist/spa/src/views/EditView.vue +11 -45
  76. package/dist/spa/src/views/ListView.vue +366 -82
  77. package/dist/spa/src/views/LoginView.vue +4 -16
  78. package/dist/spa/src/views/ShowView.vue +21 -105
  79. package/dist/spa/tailwind.config.js +1 -1
  80. package/dist/spa/vite.config.ts +0 -6
  81. package/dist/types.js +30 -0
  82. package/modules/styles.ts +1 -1
  83. package/package.json +1 -1
  84. package/spa/src/App.vue +2 -2
  85. package/spa/src/components/ResourceListTable.vue +10 -1
  86. /package/dist/spa/{public → spa/public}/assets/favicon.png +0 -0
  87. /package/dist/spa/{src → spa/src}/components/Toast.vue +0 -0
  88. /package/dist/spa/{src → spa/src}/composables/useFrontendApi.ts +0 -0
  89. /package/dist/spa/{src → spa/src}/composables/useStores.ts +0 -0
  90. /package/dist/spa/{src → spa/src}/spa_types/core.ts +0 -0
  91. /package/dist/spa/{src → spa/src}/stores/filters.ts +0 -0
  92. /package/dist/spa/{src → spa/src}/stores/toast.ts +0 -0
  93. /package/dist/spa/{src → spa/src}/stores/user.ts +0 -0
@@ -11,7 +11,7 @@ export const styles = () => `
11
11
  "header-logo-color": "#333333", // Dark grey logo
12
12
  "header-border-color": "rgb(229 231 235)", // Light grey border
13
13
 
14
- "nav-menu-bg": "#f9fafb", // Very light grey
14
+ "nav-menu-bg": "#ffffff", // Very light grey
15
15
  "nav-menu-border": "rgb(229 231 235)",
16
16
  "nav-menu-bg-hover": "rgb(243 244 246)", // Light grey hover
17
17
  "nav-menu-bg-active": "rgb(233, 234, 236)", // Light grey active
@@ -0,0 +1,66 @@
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
+ import { AllowedActionsEnum } from "../../types/AdminForthConfig.js";
11
+ import AdminForthPlugin from "../base.js";
12
+ class AccessControlPlugin extends AdminForthPlugin {
13
+ constructor(options) {
14
+ super(options, import.meta.url);
15
+ this.options = options;
16
+ }
17
+ modifyResourceConfig(adminforth, resourceConfig) {
18
+ super.modifyResourceConfig(adminforth, resourceConfig);
19
+ this.adminforth = adminforth;
20
+ if (!resourceConfig.hooks) {
21
+ resourceConfig.hooks = {};
22
+ }
23
+ const checkAccess = (adminUser, action, meta) => __awaiter(this, void 0, void 0, function* () {
24
+ const hasAccessOrError = yield this.options.hasAccess(adminUser, action, meta);
25
+ if (hasAccessOrError === true) {
26
+ return { ok: true };
27
+ }
28
+ else {
29
+ return { ok: false, error: hasAccessOrError || AccessControlPlugin.defaultError };
30
+ }
31
+ });
32
+ const bindHookCheck = (action, hookName) => {
33
+ if (!resourceConfig.hooks[action]) {
34
+ resourceConfig.hooks[action] = {};
35
+ }
36
+ if (!resourceConfig.hooks[action][hookName]) {
37
+ resourceConfig.hooks[action][hookName] = [];
38
+ }
39
+ if (hookName === 'beforeDatasourceRequest') {
40
+ resourceConfig.hooks[action][hookName].unshift((_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, query }) {
41
+ return checkAccess(adminUser, action, { query });
42
+ }));
43
+ }
44
+ else {
45
+ resourceConfig.hooks[action][hookName].unshift((_b) => __awaiter(this, [_b], void 0, function* ({ adminUser, record }) {
46
+ return checkAccess(adminUser, action, { record });
47
+ }));
48
+ }
49
+ };
50
+ // List check
51
+ bindHookCheck(AllowedActionsEnum.list, 'beforeDatasourceRequest');
52
+ // Show check
53
+ bindHookCheck(AllowedActionsEnum.show, 'beforeDatasourceRequest');
54
+ // Edit check
55
+ bindHookCheck(AllowedActionsEnum.edit, 'beforeDatasourceRequest');
56
+ // create check
57
+ bindHookCheck(AllowedActionsEnum.create, 'beforeSave');
58
+ // edit check
59
+ bindHookCheck(AllowedActionsEnum.edit, 'beforeSave');
60
+ // delete check
61
+ bindHookCheck(AllowedActionsEnum.delete, 'beforeSave');
62
+ console.log('resourceConfig', resourceConfig);
63
+ }
64
+ }
65
+ AccessControlPlugin.defaultError = 'Sorry, you do not have access to this resource.';
66
+ export default AccessControlPlugin;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,9 +2,9 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <link rel="icon" href="/* IMPORTANT:ADMINFORTH FAVICON */">
5
+ <link rel="icon" href="/favicon.ico">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>/* IMPORTANT:ADMINFORTH TITLE */</title>
7
+ <title>Vite App</title>
8
8
  <!--
9
9
  <script>
10
10
  // On page load or when changing themes, best to add inline in `head` to avoid FOUC
@@ -17,7 +17,6 @@
17
17
  "flowbite-datepicker": "^1.2.6",
18
18
  "pinia": "^2.1.7",
19
19
  "unhead": "^1.9.12",
20
- "uuid": "^10.0.0",
21
20
  "vue": "^3.4.21",
22
21
  "vue-router": "^4.3.0",
23
22
  "vue-slider-component": "^4.1.0-beta.7"
@@ -37,7 +36,7 @@
37
36
  "sass": "^1.77.2",
38
37
  "tailwindcss": "^3.4.3",
39
38
  "typescript": "~5.4.0",
40
- "vite": "^5.2.13",
39
+ "vite": "^5.2.12",
41
40
  "vue-tsc": "^2.0.11"
42
41
  }
43
42
  },
@@ -4033,22 +4032,10 @@
4033
4032
  "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
4034
4033
  "dev": true
4035
4034
  },
4036
- "node_modules/uuid": {
4037
- "version": "10.0.0",
4038
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
4039
- "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
4040
- "funding": [
4041
- "https://github.com/sponsors/broofa",
4042
- "https://github.com/sponsors/ctavan"
4043
- ],
4044
- "bin": {
4045
- "uuid": "dist/bin/uuid"
4046
- }
4047
- },
4048
4035
  "node_modules/vite": {
4049
- "version": "5.2.13",
4050
- "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.13.tgz",
4051
- "integrity": "sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==",
4036
+ "version": "5.2.12",
4037
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.12.tgz",
4038
+ "integrity": "sha512-/gC8GxzxMK5ntBwb48pR32GGhENnjtY30G4A0jemunsBkiEZFw60s8InGpN8gkhHEkjnRK1aSAxeQgwvFhUHAA==",
4052
4039
  "dev": true,
4053
4040
  "dependencies": {
4054
4041
  "esbuild": "^0.20.1",
@@ -21,7 +21,6 @@
21
21
  "flowbite-datepicker": "^1.2.6",
22
22
  "pinia": "^2.1.7",
23
23
  "unhead": "^1.9.12",
24
- "uuid": "^10.0.0",
25
24
  "vue": "^3.4.21",
26
25
  "vue-router": "^4.3.0",
27
26
  "vue-slider-component": "^4.1.0-beta.7"
@@ -41,7 +40,7 @@
41
40
  "sass": "^1.77.2",
42
41
  "tailwindcss": "^3.4.3",
43
42
  "typescript": "~5.4.0",
44
- "vite": "^5.2.13",
43
+ "vite": "^5.2.12",
45
44
  "vue-tsc": "^2.0.11"
46
45
  }
47
46
  }
Binary file
@@ -0,0 +1,14 @@
1
+ /* eslint-env node */
2
+ require('@rushstack/eslint-patch/modern-module-resolution')
3
+
4
+ module.exports = {
5
+ root: true,
6
+ 'extends': [
7
+ 'plugin:vue/vue3-essential',
8
+ 'eslint:recommended',
9
+ '@vue/eslint-config-typescript'
10
+ ],
11
+ parserOptions: {
12
+ ecmaVersion: 'latest'
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "recommendations": [
3
+ "Vue.volar",
4
+ "dbaeumer.vscode-eslint"
5
+ ]
6
+ }
@@ -0,0 +1,39 @@
1
+ # spa
2
+
3
+ This template should help get you started developing with Vue 3 in Vite.
4
+
5
+ ## Recommended IDE Setup
6
+
7
+ [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8
+
9
+ ## Type Support for `.vue` Imports in TS
10
+
11
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12
+
13
+ ## Customize configuration
14
+
15
+ See [Vite Configuration Reference](https://vitejs.dev/config/).
16
+
17
+ ## Project Setup
18
+
19
+ ```sh
20
+ npm install
21
+ ```
22
+
23
+ ### Compile and Hot-Reload for Development
24
+
25
+ ```sh
26
+ npm run dev
27
+ ```
28
+
29
+ ### Type-Check, Compile and Minify for Production
30
+
31
+ ```sh
32
+ npm run build
33
+ ```
34
+
35
+ ### Lint with [ESLint](https://eslint.org/)
36
+
37
+ ```sh
38
+ npm run lint
39
+ ```
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" href="/* IMPORTANT:ADMINFORTH FAVICON */">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>/* IMPORTANT:ADMINFORTH TITLE */</title>
8
+ <!--
9
+ <script>
10
+ // On page load or when changing themes, best to add inline in `head` to avoid FOUC
11
+ if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
12
+ document.documentElement.classList.add('dark');
13
+ } else {
14
+ document.documentElement.classList.remove('dark')
15
+ }
16
+ </script> -->
17
+
18
+ </head>
19
+ <body class=" ">
20
+ <div id="app" class="min-h-screen bg-html-bg dark:bg-gray-800"></div>
21
+ <script type="module" src="/src/main.ts"></script>
22
+ </body>
23
+ </html>