adminforth 1.0.26 → 1.0.28
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/dataConnectors/postgres.ts +3 -6
- package/dist/dataConnectors/postgres.js +3 -5
- package/dist/index.js +16 -0
- package/dist/spa/spa/.eslintrc.cjs +14 -0
- package/dist/spa/spa/.vscode/extensions.json +6 -0
- package/dist/spa/spa/README.md +39 -0
- package/dist/spa/spa/env.d.ts +1 -0
- package/dist/spa/spa/index.html +23 -0
- package/dist/spa/spa/package-lock.json +4158 -0
- package/dist/spa/spa/package.json +41 -0
- package/dist/spa/spa/postcss.config.js +6 -0
- package/dist/spa/spa/public/favicon.ico +0 -0
- package/dist/spa/spa/src/App.vue +172 -0
- package/dist/spa/spa/src/assets/base.css +0 -0
- package/dist/spa/spa/src/assets/logo.svg +1 -0
- package/dist/spa/spa/src/components/AcceptModal.vue +52 -0
- package/dist/spa/spa/src/components/Breadcrumbs.vue +40 -0
- package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
- package/dist/spa/spa/src/components/CustomDatePicker.vue +161 -0
- package/dist/spa/spa/src/components/CustomDateRangePicker.vue +209 -0
- package/dist/spa/spa/src/components/Dropdown.vue +154 -0
- package/dist/spa/spa/src/components/Filters.vue +157 -0
- package/dist/spa/spa/src/components/HelloWorld.vue +17 -0
- package/dist/spa/spa/src/components/MenuLink.vue +24 -0
- package/dist/spa/spa/src/components/ResourceForm.vue +205 -0
- package/dist/spa/spa/src/components/SingleSkeletLoader.vue +13 -0
- package/dist/spa/spa/src/components/ValueRenderer.vue +44 -0
- package/dist/spa/spa/src/components/icons/IconCalendar.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconCommunity.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconDocumentation.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconEcosystem.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconSupport.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconTime.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconTooling.vue +19 -0
- package/dist/spa/spa/src/index.scss +26 -0
- package/dist/spa/spa/src/main.ts +18 -0
- package/dist/spa/spa/src/router/index.ts +53 -0
- package/dist/spa/spa/src/stores/core.ts +138 -0
- package/dist/spa/spa/src/stores/modal.ts +38 -0
- package/dist/spa/spa/src/utils.ts +44 -0
- package/dist/spa/spa/src/views/CreateView.vue +103 -0
- package/dist/spa/spa/src/views/EditView.vue +103 -0
- package/dist/spa/spa/src/views/HomeView.vue +8 -0
- package/dist/spa/spa/src/views/ListView.vue +529 -0
- package/dist/spa/spa/src/views/LoginView.vue +122 -0
- package/dist/spa/spa/src/views/ResourceParent.vue +18 -0
- package/dist/spa/spa/src/views/ShowView.vue +93 -0
- package/dist/spa/spa/tailwind.config.js +12 -0
- package/dist/spa/spa/tsconfig.app.json +14 -0
- package/dist/spa/spa/tsconfig.json +11 -0
- package/dist/spa/spa/tsconfig.node.json +19 -0
- package/dist/spa/spa/vite.config.ts +43 -0
- package/dist/spa/src/views/ListView.vue +7 -6
- package/index.ts +31 -2
- package/package.json +1 -1
- package/spa/src/views/ListView.vue +7 -6
|
@@ -126,15 +126,14 @@ class PostgresConnector {
|
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
if (field._underlineType == 'timestamp' || field._underlineType == 'int') {
|
|
129
|
-
return dayjs
|
|
129
|
+
return dayjs(value).toISOString();
|
|
130
130
|
} else if (field._underlineType == 'varchar') {
|
|
131
|
-
return dayjs
|
|
131
|
+
return dayjs(value).toISOString();
|
|
132
132
|
} else {
|
|
133
133
|
throw new Error(`AdminForth does not support row type: ${field._underlineType} for timestamps, use VARCHAR (with iso strings) or TIMESTAMP/INT (with unix timestamps)`);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
137
|
return value;
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -167,10 +166,8 @@ class PostgresConnector {
|
|
|
167
166
|
return null;
|
|
168
167
|
}
|
|
169
168
|
if (field._underlineType == 'timestamp' || field._underlineType == 'int') {
|
|
170
|
-
|
|
171
|
-
return dayjs(value).unix();
|
|
169
|
+
return dayjs(value);
|
|
172
170
|
} else if (field._underlineType == 'varchar') {
|
|
173
|
-
// value is iso string now, convert to unix timestamp
|
|
174
171
|
return dayjs(value).toISOString();
|
|
175
172
|
}
|
|
176
173
|
} else if (field.type == AdminForthTypes.BOOLEAN) {
|
|
@@ -127,10 +127,10 @@ class PostgresConnector {
|
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
129
|
if (field._underlineType == 'timestamp' || field._underlineType == 'int') {
|
|
130
|
-
return dayjs
|
|
130
|
+
return dayjs(value).toISOString();
|
|
131
131
|
}
|
|
132
132
|
else if (field._underlineType == 'varchar') {
|
|
133
|
-
return dayjs
|
|
133
|
+
return dayjs(value).toISOString();
|
|
134
134
|
}
|
|
135
135
|
else {
|
|
136
136
|
throw new Error(`AdminForth does not support row type: ${field._underlineType} for timestamps, use VARCHAR (with iso strings) or TIMESTAMP/INT (with unix timestamps)`);
|
|
@@ -167,11 +167,9 @@ class PostgresConnector {
|
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
169
|
if (field._underlineType == 'timestamp' || field._underlineType == 'int') {
|
|
170
|
-
|
|
171
|
-
return dayjs(value).unix();
|
|
170
|
+
return dayjs(value);
|
|
172
171
|
}
|
|
173
172
|
else if (field._underlineType == 'varchar') {
|
|
174
|
-
// value is iso string now, convert to unix timestamp
|
|
175
173
|
return dayjs(value).toISOString();
|
|
176
174
|
}
|
|
177
175
|
}
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { v1 as uuid } from 'uuid';
|
|
|
24
24
|
import fs from 'fs';
|
|
25
25
|
import { AdminForthFilterOperators, AdminForthTypes } from './types.js';
|
|
26
26
|
const AVAILABLE_SHOW_IN = ['list', 'edit', 'create', 'filter', 'show'];
|
|
27
|
+
const DEFAULT_ALLOWED_ACTIONS = { create: true, edit: true, show: true, delete: true };
|
|
27
28
|
class AdminForth {
|
|
28
29
|
constructor(config) {
|
|
29
30
|
_AdminForth_defaultConfig.set(this, {
|
|
@@ -130,6 +131,9 @@ class AdminForth {
|
|
|
130
131
|
}
|
|
131
132
|
col.showIn = ((_b = col.showIn) === null || _b === void 0 ? void 0 : _b.map(c => c.toLowerCase())) || AVAILABLE_SHOW_IN;
|
|
132
133
|
});
|
|
134
|
+
if (!res.options) {
|
|
135
|
+
res.options = { bulkActions: [], allowedActions: {} };
|
|
136
|
+
}
|
|
133
137
|
//check if resource has bulkActions
|
|
134
138
|
if ((_b = res.options) === null || _b === void 0 ? void 0 : _b.bulkActions) {
|
|
135
139
|
let bulkActions = res.options.bulkActions;
|
|
@@ -155,6 +159,18 @@ class AdminForth {
|
|
|
155
159
|
});
|
|
156
160
|
bulkActions = newBulkActions;
|
|
157
161
|
}
|
|
162
|
+
//add default allowedActions to resources
|
|
163
|
+
if (res.options.allowedActions) {
|
|
164
|
+
//check if allowedActions is an object
|
|
165
|
+
if (typeof res.options.allowedActions !== 'object') {
|
|
166
|
+
errors.push(`Resource "${res.resourceId}" allowedActions must be an object`);
|
|
167
|
+
}
|
|
168
|
+
const userAllowedActions = res.options.allowedActions;
|
|
169
|
+
res.options.allowedActions = Object.assign({}, DEFAULT_ALLOWED_ACTIONS, userAllowedActions);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
res.options.allowedActions = DEFAULT_ALLOWED_ACTIONS;
|
|
173
|
+
}
|
|
158
174
|
});
|
|
159
175
|
if (!this.config.menu) {
|
|
160
176
|
errors.push('No config.menu defined');
|
|
@@ -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,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="/favicon.ico">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Vite App</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>
|
|
20
|
+
<div id="app" class="min-h-screen dark:bg-gray-800"></div>
|
|
21
|
+
<script type="module" src="/src/main.ts"></script>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|