adminforth 1.2.95 → 1.2.98

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 (101) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/modules/restApi.js +27 -29
  3. package/dist/spa/index.html +4 -4
  4. package/dist/spa/package-lock.json +421 -6
  5. package/dist/spa/package.json +10 -2
  6. package/dist/spa/src/App.vue +236 -94
  7. package/dist/spa/src/assets/base.css +2 -0
  8. package/dist/spa/src/assets/logo.svg +19 -1
  9. package/dist/spa/src/components/AcceptModal.vue +3 -10
  10. package/dist/spa/src/components/Breadcrumbs.vue +3 -2
  11. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +1 -1
  12. package/dist/spa/src/components/CustomDatePicker.vue +25 -10
  13. package/dist/spa/src/components/CustomDateRangePicker.vue +14 -5
  14. package/dist/spa/src/components/Dropdown.vue +19 -5
  15. package/dist/spa/src/components/Filters.vue +103 -38
  16. package/dist/spa/src/components/MenuLink.vue +3 -3
  17. package/dist/spa/src/components/ResourceForm.vue +205 -116
  18. package/dist/spa/{spa/src → src}/components/ResourceListTable.vue +6 -3
  19. package/dist/spa/{spa/src → src}/components/Toast.vue +9 -3
  20. package/dist/spa/src/components/ValueRenderer.vue +30 -8
  21. package/dist/spa/src/index.scss +2 -1
  22. package/dist/spa/src/main.ts +2 -2
  23. package/dist/spa/src/router/index.ts +29 -19
  24. package/dist/spa/src/stores/core.ts +65 -59
  25. package/dist/spa/src/stores/modal.ts +13 -3
  26. package/dist/spa/src/types/AdminForthConfig.ts +1477 -0
  27. package/dist/spa/src/types/FrontendAPI.ts +121 -0
  28. package/dist/spa/src/utils.ts +69 -10
  29. package/dist/spa/src/views/CreateView.vue +69 -16
  30. package/dist/spa/src/views/EditView.vue +68 -14
  31. package/dist/spa/src/views/ListView.vue +100 -371
  32. package/dist/spa/src/views/LoginView.vue +67 -29
  33. package/dist/spa/src/views/ResourceParent.vue +1 -2
  34. package/dist/spa/src/views/ShowView.vue +116 -25
  35. package/dist/spa/tailwind.config.js +8 -3
  36. package/dist/spa/vite.config.ts +13 -0
  37. package/index.ts +2 -1
  38. package/modules/restApi.ts +31 -31
  39. package/package.json +1 -1
  40. package/dist/spa/.vscode/extensions.json +0 -6
  41. package/dist/spa/public/favicon.ico +0 -0
  42. package/dist/spa/spa/.eslintrc.cjs +0 -14
  43. package/dist/spa/spa/.vscode/extensions.json +0 -6
  44. package/dist/spa/spa/README.md +0 -39
  45. package/dist/spa/spa/env.d.ts +0 -1
  46. package/dist/spa/spa/index.html +0 -23
  47. package/dist/spa/spa/package-lock.json +0 -4573
  48. package/dist/spa/spa/package.json +0 -49
  49. package/dist/spa/spa/postcss.config.js +0 -6
  50. package/dist/spa/spa/public/favicon.ico +0 -0
  51. package/dist/spa/spa/src/App.vue +0 -314
  52. package/dist/spa/spa/src/assets/base.css +0 -0
  53. package/dist/spa/spa/src/assets/logo.svg +0 -19
  54. package/dist/spa/spa/src/components/AcceptModal.vue +0 -45
  55. package/dist/spa/spa/src/components/Breadcrumbs.vue +0 -40
  56. package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  57. package/dist/spa/spa/src/components/CustomDatePicker.vue +0 -174
  58. package/dist/spa/spa/src/components/CustomDateRangePicker.vue +0 -218
  59. package/dist/spa/spa/src/components/Dropdown.vue +0 -168
  60. package/dist/spa/spa/src/components/Filters.vue +0 -222
  61. package/dist/spa/spa/src/components/HelloWorld.vue +0 -17
  62. package/dist/spa/spa/src/components/MenuLink.vue +0 -24
  63. package/dist/spa/spa/src/components/ResourceForm.vue +0 -289
  64. package/dist/spa/spa/src/components/SingleSkeletLoader.vue +0 -13
  65. package/dist/spa/spa/src/components/ValueRenderer.vue +0 -66
  66. package/dist/spa/spa/src/components/icons/IconCalendar.vue +0 -5
  67. package/dist/spa/spa/src/components/icons/IconCommunity.vue +0 -7
  68. package/dist/spa/spa/src/components/icons/IconDocumentation.vue +0 -7
  69. package/dist/spa/spa/src/components/icons/IconEcosystem.vue +0 -7
  70. package/dist/spa/spa/src/components/icons/IconSupport.vue +0 -7
  71. package/dist/spa/spa/src/components/icons/IconTime.vue +0 -5
  72. package/dist/spa/spa/src/components/icons/IconTooling.vue +0 -19
  73. package/dist/spa/spa/src/index.scss +0 -27
  74. package/dist/spa/spa/src/main.ts +0 -18
  75. package/dist/spa/spa/src/router/index.ts +0 -63
  76. package/dist/spa/spa/src/stores/core.ts +0 -144
  77. package/dist/spa/spa/src/stores/modal.ts +0 -48
  78. package/dist/spa/spa/src/utils.ts +0 -103
  79. package/dist/spa/spa/src/views/CreateView.vue +0 -156
  80. package/dist/spa/spa/src/views/EditView.vue +0 -157
  81. package/dist/spa/spa/src/views/HomeView.vue +0 -8
  82. package/dist/spa/spa/src/views/ListView.vue +0 -258
  83. package/dist/spa/spa/src/views/LoginView.vue +0 -143
  84. package/dist/spa/spa/src/views/ResourceParent.vue +0 -17
  85. package/dist/spa/spa/src/views/ShowView.vue +0 -184
  86. package/dist/spa/spa/tailwind.config.js +0 -17
  87. package/dist/spa/spa/tsconfig.app.json +0 -14
  88. package/dist/spa/spa/tsconfig.json +0 -11
  89. package/dist/spa/spa/tsconfig.node.json +0 -19
  90. package/dist/spa/spa/vite.config.ts +0 -56
  91. package/dist/spa/src/views/HomeView.vue +0 -8
  92. package/dist/types.js +0 -30
  93. /package/dist/spa/{spa/public → public}/assets/favicon.png +0 -0
  94. /package/dist/spa/{spa/src → src}/components/CustomRangePicker.vue +0 -0
  95. /package/dist/spa/{spa/src → src}/components/SkeleteLoader.vue +0 -0
  96. /package/dist/spa/{spa/src → src}/composables/useFrontendApi.ts +0 -0
  97. /package/dist/spa/{spa/src → src}/composables/useStores.ts +0 -0
  98. /package/dist/spa/{spa/src → src}/spa_types/core.ts +0 -0
  99. /package/dist/spa/{spa/src → src}/stores/filters.ts +0 -0
  100. /package/dist/spa/{spa/src → src}/stores/toast.ts +0 -0
  101. /package/dist/spa/{spa/src → src}/stores/user.ts +0 -0
package/dist/index.js CHANGED
@@ -23,10 +23,11 @@ import { ADMINFORTH_VERSION, listify } from './modules/utils.js';
23
23
  import { AdminForthFilterOperators, AdminForthDataTypes, AdminForthResourcePages, } from './types/AdminForthConfig.js';
24
24
  import AdminForthPlugin from './basePlugin.js';
25
25
  import ConfigValidator from './modules/configValidator.js';
26
- import AdminForthRestAPI from './modules/restApi.js';
26
+ import AdminForthRestAPI, { interpretResource } from './modules/restApi.js';
27
27
  import ClickhouseConnector from './dataConnectors/clickhouse.js';
28
28
  // exports
29
29
  export * from './types/AdminForthConfig.js';
30
+ export { interpretResource };
30
31
  export { AdminForthPlugin };
31
32
  class AdminForth {
32
33
  constructor(config) {
@@ -10,6 +10,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { AdminForthFilterOperators, AdminForthDataTypes, AllowedActionsEnum, ActionCheckSource } from "../types/AdminForthConfig.js";
11
11
  import { ADMINFORTH_VERSION, listify } from './utils.js';
12
12
  import AdminForthAuth from "../auth.js";
13
+ export function interpretResource(adminUser, resource, meta, source) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ var _a;
16
+ // if (process.env.HEAVY_DEBUG) {
17
+ // console.log('🪲Interpreting resource', resource.resourceId, source, 'adminUser', adminUser);
18
+ // }
19
+ const allowedActions = {};
20
+ yield Promise.all(Object.entries(((_a = resource.options) === null || _a === void 0 ? void 0 : _a.allowedActions) || {}).map((_b) => __awaiter(this, [_b], void 0, function* ([key, value]) {
21
+ if (process.env.HEAVY_DEBUG) {
22
+ console.log('🪲checking for allowed call', key, 'value:', value, 'typeof', typeof value);
23
+ }
24
+ // if callable then call
25
+ if (typeof value === 'function') {
26
+ allowedActions[key] = yield value({ adminUser, resource, meta, source });
27
+ }
28
+ else {
29
+ allowedActions[key] = value;
30
+ }
31
+ })));
32
+ return { allowedActions };
33
+ });
34
+ }
13
35
  export default class AdminForthRestAPI {
14
36
  constructor(adminforth) {
15
37
  this.adminforth = adminforth;
@@ -159,12 +181,10 @@ export default class AdminForthRestAPI {
159
181
  };
160
182
  function processMenuItem(menuItem) {
161
183
  return __awaiter(this, void 0, void 0, function* () {
162
- console.log('super hueta');
163
184
  if (menuItem.badge) {
164
- console.log('hueta');
165
- // if (typeof menuItem.badge !== 'string') {
166
- menuItem.badge = yield menuItem.badge(adminUser);
167
- // }
185
+ if (typeof menuItem.badge === 'function') {
186
+ menuItem.badge = yield menuItem.badge(adminUser);
187
+ }
168
188
  }
169
189
  });
170
190
  }
@@ -185,12 +205,12 @@ export default class AdminForthRestAPI {
185
205
  continue;
186
206
  }
187
207
  }
188
- processMenuItem(newChild);
208
+ yield processMenuItem(newChild);
189
209
  newChildren.push(newChild);
190
210
  }
191
211
  newMenuItem = Object.assign(Object.assign({}, newMenuItem), { children: newChildren });
192
212
  }
193
- processMenuItem(newMenuItem);
213
+ yield processMenuItem(newMenuItem);
194
214
  newMenu.push(newMenuItem);
195
215
  }
196
216
  const announcementBadge = (_o = (_m = this.adminforth.config.customization).announcementBadge) === null || _o === void 0 ? void 0 : _o.call(_m, adminUser);
@@ -217,28 +237,6 @@ export default class AdminForthRestAPI {
217
237
  };
218
238
  }),
219
239
  });
220
- function interpretResource(adminUser, resource, meta, source) {
221
- return __awaiter(this, void 0, void 0, function* () {
222
- var _a;
223
- // if (process.env.HEAVY_DEBUG) {
224
- // console.log('🪲Interpreting resource', resource.resourceId, source, 'adminUser', adminUser);
225
- // }
226
- const allowedActions = {};
227
- yield Promise.all(Object.entries(((_a = resource.options) === null || _a === void 0 ? void 0 : _a.allowedActions) || {}).map((_b) => __awaiter(this, [_b], void 0, function* ([key, value]) {
228
- if (process.env.HEAVY_DEBUG) {
229
- console.log('🪲checking for allowed call', key, 'value:', value, 'typeof', typeof value);
230
- }
231
- // if callable then call
232
- if (typeof value === 'function') {
233
- allowedActions[key] = yield value({ adminUser, resource, meta, source });
234
- }
235
- else {
236
- allowedActions[key] = value;
237
- }
238
- })));
239
- return { allowedActions };
240
- });
241
- }
242
240
  function checkAccess(action, allowedActions) {
243
241
  const allowed = allowedActions[action];
244
242
  if (allowed !== true) {
@@ -2,9 +2,9 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
- <link rel="icon" href="/favicon.ico">
5
+ <link rel="icon" href="/* IMPORTANT:ADMINFORTH FAVICON */">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
7
+ <title>/* IMPORTANT:ADMINFORTH TITLE */</title>
8
8
  <!--
9
9
  <script>
10
10
  // On page load or when changing themes, best to add inline in `head` to avoid FOUC
@@ -16,8 +16,8 @@
16
16
  </script> -->
17
17
 
18
18
  </head>
19
- <body>
20
- <div id="app" class="min-h-screen dark:bg-gray-800"></div>
19
+ <body class=" ">
20
+ <div id="app" class="min-h-screen bg-lightHtml dark:bg-darkHtml"></div>
21
21
  <script type="module" src="/src/main.ts"></script>
22
22
  </body>
23
23
  </html>