adminforth 2.4.0-next.70 → 2.4.0-next.72

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.
@@ -2,7 +2,10 @@ import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import chalk from 'chalk';
4
4
  import jiti from 'jiti';
5
+ import dotenv from "dotenv";
5
6
 
7
+ dotenv.config({ path: '.env.local', override: true });
8
+ dotenv.config({ path: '.env', override: true });
6
9
 
7
10
  export async function loadAdminForthConfig() {
8
11
  const configFileName = 'index.ts';
@@ -77,11 +77,11 @@
77
77
  aria-label="Sidebar"
78
78
  >
79
79
  <div class="h-full px-3 pb-4 overflow-y-auto bg-lightSidebar dark:bg-darkSidebar border-r border-lightSidebarBorder dark:border-darkSidebarBorder">
80
- <div class="flex ms-2 m-4">
81
- <img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="h-8 me-3" />
80
+ <div class="af-logo-title-wrapper flex ms-2 m-4">
81
+ <img :src="loadFile(coreStore.config?.brandLogo || '@/assets/logo.svg')" :alt="`${ coreStore.config?.brandName } Logo`" class="af-logo h-8 me-3" />
82
82
  <span
83
83
  v-if="coreStore.config?.showBrandNameInSidebar"
84
- class="self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText"
84
+ class="af-title self-center text-lightNavbarText-size font-semibold sm:text-lightNavbarText-size whitespace-nowrap dark:text-darkSidebarText text-lightSidebarText"
85
85
  >
86
86
  {{ coreStore.config?.brandName }}
87
87
  </span>
@@ -1346,13 +1346,13 @@ export interface AdminForthResource extends Omit<AdminForthResourceInput, 'optio
1346
1346
  },
1347
1347
  create?: {
1348
1348
  /**
1349
- * Should return ok: true to continue saving pipeline and allow creating record in database, and ok: false to interrupt pipeline and prevent record creation.
1350
- * If you need to show error on UI, set error: <error message> in response.
1349
+ * Should return `ok: true` to continue saving pipeline and allow creating record in database, and `ok: false` to interrupt pipeline and prevent record creation.
1350
+ * If you need to show error on UI, set `error: \<error message\>` in response.
1351
1351
  *
1352
1352
  * Typical use-cases:
1353
- * - Create record by custom code (return `{ ok: false, newRecordId: <id of created record from custom code>}`)
1354
- * - Validate record before saving to database and interrupt execution if validation failed (return `{ok: false, error: <validation error>}`), though `allowedActions.create` should be preferred in most cases
1355
- * - fill-in adminUser as creator of record (set record.<some field> = x; return {ok: true})
1353
+ * - Create record by custom code (return `{ ok: false, newRecordId: <id of created record from custom code> }`)
1354
+ * - Validate record before saving to database and interrupt execution if validation failed (return `{ ok: false, error: <validation error> }`), though `allowedActions.create` should be preferred in most cases
1355
+ * - fill-in adminUser as creator of record (set `record.<some field> = x; return \{ ok: true \}`)
1356
1356
  * - Attach additional data to record before saving to database (mostly fillOnCreate should be used instead)
1357
1357
  */
1358
1358
  beforeSave?: Array<BeforeCreateSaveFunction>,
@@ -154,7 +154,7 @@ async function saveRecord() {
154
154
  record: record.value,
155
155
  },
156
156
  });
157
- if (response?.error == true) {
157
+ if (response?.error && response?.error !== 'Operation aborted by hook') {
158
158
  showErrorTost(response.error);
159
159
  }
160
160
  saving.value = false;
@@ -177,7 +177,7 @@ async function saveRecord() {
177
177
  record: updates,
178
178
  },
179
179
  });
180
- if (resp.error) {
180
+ if (resp.error && resp.error !== 'Operation aborted by hook') {
181
181
  showErrorTost(resp.error);
182
182
  } else {
183
183
  adminforth.alert({
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`" class="p-4 flex"
2
+ <div :key="`${$route?.params.resourceId}---${$route?.params.primaryKey}`" class="af-resource-parent p-4 flex"
3
3
  :class="limitHeightToPage ? 'h-[calc(100dvh-3.5rem)]': undefined"
4
4
  >
5
5
  <RouterView/>
@@ -1191,13 +1191,13 @@ export interface AdminForthResource extends Omit<AdminForthResourceInput, 'optio
1191
1191
  };
1192
1192
  create?: {
1193
1193
  /**
1194
- * Should return ok: true to continue saving pipeline and allow creating record in database, and ok: false to interrupt pipeline and prevent record creation.
1195
- * If you need to show error on UI, set error: <error message> in response.
1194
+ * Should return `ok: true` to continue saving pipeline and allow creating record in database, and `ok: false` to interrupt pipeline and prevent record creation.
1195
+ * If you need to show error on UI, set `error: \<error message\>` in response.
1196
1196
  *
1197
1197
  * Typical use-cases:
1198
- * - Create record by custom code (return `{ ok: false, newRecordId: <id of created record from custom code>}`)
1199
- * - Validate record before saving to database and interrupt execution if validation failed (return `{ok: false, error: <validation error>}`), though `allowedActions.create` should be preferred in most cases
1200
- * - fill-in adminUser as creator of record (set record.<some field> = x; return {ok: true})
1198
+ * - Create record by custom code (return `{ ok: false, newRecordId: <id of created record from custom code> }`)
1199
+ * - Validate record before saving to database and interrupt execution if validation failed (return `{ ok: false, error: <validation error> }`), though `allowedActions.create` should be preferred in most cases
1200
+ * - fill-in adminUser as creator of record (set `record.<some field> = x; return \{ ok: true \}`)
1201
1201
  * - Attach additional data to record before saving to database (mostly fillOnCreate should be used instead)
1202
1202
  */
1203
1203
  beforeSave?: Array<BeforeCreateSaveFunction>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.4.0-next.70",
3
+ "version": "2.4.0-next.72",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",