adminforth 2.5.3 → 2.6.0

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 (82) hide show
  1. package/commands/createApp/templates/index.ts.hbs +7 -0
  2. package/commands/createCustomComponent/configLoader.js +3 -0
  3. package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
  4. package/dist/dataConnectors/baseConnector.js +16 -3
  5. package/dist/dataConnectors/baseConnector.js.map +1 -1
  6. package/dist/dataConnectors/mongo.d.ts.map +1 -1
  7. package/dist/dataConnectors/mongo.js +13 -6
  8. package/dist/dataConnectors/mongo.js.map +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +19 -8
  12. package/dist/index.js.map +1 -1
  13. package/dist/modules/codeInjector.d.ts.map +1 -1
  14. package/dist/modules/codeInjector.js +20 -3
  15. package/dist/modules/codeInjector.js.map +1 -1
  16. package/dist/modules/configValidator.d.ts.map +1 -1
  17. package/dist/modules/configValidator.js +48 -1
  18. package/dist/modules/configValidator.js.map +1 -1
  19. package/dist/modules/restApi.d.ts.map +1 -1
  20. package/dist/modules/restApi.js +145 -25
  21. package/dist/modules/restApi.js.map +1 -1
  22. package/dist/modules/styles.d.ts +450 -13
  23. package/dist/modules/styles.d.ts.map +1 -1
  24. package/dist/modules/styles.js +506 -31
  25. package/dist/modules/styles.js.map +1 -1
  26. package/dist/modules/utils.d.ts +1 -0
  27. package/dist/modules/utils.d.ts.map +1 -1
  28. package/dist/modules/utils.js +9 -0
  29. package/dist/modules/utils.js.map +1 -1
  30. package/dist/spa/index.html +1 -1
  31. package/dist/spa/src/App.vue +21 -11
  32. package/dist/spa/src/afcl/Button.vue +3 -3
  33. package/dist/spa/src/afcl/Checkbox.vue +21 -13
  34. package/dist/spa/src/afcl/CountryFlag.vue +4 -1
  35. package/dist/spa/src/{components/CustomDatePicker.vue → afcl/DatePicker.vue} +95 -9
  36. package/dist/spa/src/afcl/Dialog.vue +6 -6
  37. package/dist/spa/src/afcl/Dropzone.vue +10 -10
  38. package/dist/spa/src/afcl/Input.vue +4 -4
  39. package/dist/spa/src/afcl/ProgressBar.vue +7 -7
  40. package/dist/spa/src/afcl/Select.vue +51 -21
  41. package/dist/spa/src/afcl/Skeleton.vue +6 -6
  42. package/dist/spa/src/afcl/Table.vue +11 -11
  43. package/dist/spa/src/afcl/Toggle.vue +32 -0
  44. package/dist/spa/src/afcl/Tooltip.vue +1 -1
  45. package/dist/spa/src/afcl/VerticalTabs.vue +3 -3
  46. package/dist/spa/src/afcl/index.ts +2 -1
  47. package/dist/spa/src/components/AcceptModal.vue +6 -6
  48. package/dist/spa/src/components/Breadcrumbs.vue +5 -5
  49. package/dist/spa/src/components/ColumnValueInput.vue +28 -9
  50. package/dist/spa/src/components/ColumnValueInputWrapper.vue +2 -1
  51. package/dist/spa/src/components/CustomDateRangePicker.vue +9 -8
  52. package/dist/spa/src/components/CustomRangePicker.vue +32 -3
  53. package/dist/spa/src/components/Filters.vue +76 -31
  54. package/dist/spa/src/components/GroupsTable.vue +7 -7
  55. package/dist/spa/src/components/ResourceForm.vue +61 -26
  56. package/dist/spa/src/components/ResourceListTable.vue +28 -29
  57. package/dist/spa/src/components/ResourceListTableVirtual.vue +25 -27
  58. package/dist/spa/src/components/ShowTable.vue +8 -6
  59. package/dist/spa/src/components/SingleSkeletLoader.vue +6 -6
  60. package/dist/spa/src/components/SkeleteLoader.vue +1 -1
  61. package/dist/spa/src/components/ThreeDotsMenu.vue +5 -5
  62. package/dist/spa/src/components/Toast.vue +2 -7
  63. package/dist/spa/src/components/ValueRenderer.vue +4 -4
  64. package/dist/spa/src/controls/BoolToggle.vue +34 -0
  65. package/dist/spa/src/spa_types/core.ts +7 -0
  66. package/dist/spa/src/stores/core.ts +1 -1
  67. package/dist/spa/src/types/Back.ts +71 -10
  68. package/dist/spa/src/types/Common.ts +12 -7
  69. package/dist/spa/src/utils.ts +209 -0
  70. package/dist/spa/src/views/CreateView.vue +4 -4
  71. package/dist/spa/src/views/EditView.vue +3 -3
  72. package/dist/spa/src/views/ListView.vue +13 -18
  73. package/dist/spa/src/views/LoginView.vue +22 -24
  74. package/dist/spa/src/views/ResourceParent.vue +1 -1
  75. package/dist/spa/src/views/ShowView.vue +3 -3
  76. package/dist/types/Back.d.ts +55 -8
  77. package/dist/types/Back.d.ts.map +1 -1
  78. package/dist/types/Back.js.map +1 -1
  79. package/dist/types/Common.d.ts +11 -6
  80. package/dist/types/Common.d.ts.map +1 -1
  81. package/dist/types/Common.js.map +1 -1
  82. package/package.json +1 -1
@@ -7,8 +7,11 @@ import { useUserStore } from './stores/user';
7
7
  import { Dropdown } from 'flowbite';
8
8
  import adminforth from './adminforth';
9
9
  import sanitizeHtml from 'sanitize-html'
10
+ import debounce from 'debounce';
10
11
 
11
12
  const LS_LANG_KEY = `afLanguage`;
13
+ const MAX_CONSECUTIVE_EMPTY_RESULTS = 2;
14
+ const ITEMS_PER_PAGE_LIMIT = 100;
12
15
 
13
16
  export async function callApi({path, method, body=undefined}: {
14
17
  path: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
@@ -208,4 +211,210 @@ export function protectAgainstXSS(value: string) {
208
211
  'img': [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]
209
212
  }
210
213
  });
214
+ }
215
+
216
+ export function isPolymorphicColumn(column: any): boolean {
217
+ return !!(column.foreignResource?.polymorphicResources && column.foreignResource.polymorphicResources.length > 0);
218
+ }
219
+
220
+ export function handleForeignResourcePagination(
221
+ column: any,
222
+ items: any[],
223
+ emptyResultsCount: number = 0,
224
+ isSearching: boolean = false
225
+ ): { hasMore: boolean; emptyResultsCount: number } {
226
+ const isPolymorphic = isPolymorphicColumn(column);
227
+
228
+ if (isPolymorphic) {
229
+ if (isSearching) {
230
+ return {
231
+ hasMore: items.length > 0,
232
+ emptyResultsCount: 0
233
+ };
234
+ } else {
235
+ if (items.length === 0) {
236
+ const newEmptyCount = emptyResultsCount + 1;
237
+ return {
238
+ hasMore: newEmptyCount < MAX_CONSECUTIVE_EMPTY_RESULTS, // Stop loading after 2 consecutive empty results
239
+ emptyResultsCount: newEmptyCount
240
+ };
241
+ } else {
242
+ return {
243
+ hasMore: true,
244
+ emptyResultsCount: 0
245
+ };
246
+ }
247
+ }
248
+ } else {
249
+ return {
250
+ hasMore: items.length === ITEMS_PER_PAGE_LIMIT,
251
+ emptyResultsCount: 0
252
+ };
253
+ }
254
+ }
255
+
256
+ export async function loadMoreForeignOptions({
257
+ columnName,
258
+ searchTerm = '',
259
+ columns,
260
+ resourceId,
261
+ columnOptions,
262
+ columnLoadingState,
263
+ columnOffsets,
264
+ columnEmptyResultsCount
265
+ }: {
266
+ columnName: string;
267
+ searchTerm?: string;
268
+ columns: any[];
269
+ resourceId: string;
270
+ columnOptions: any;
271
+ columnLoadingState: any;
272
+ columnOffsets: any;
273
+ columnEmptyResultsCount: any;
274
+ }) {
275
+ const column = columns?.find(c => c.name === columnName);
276
+ if (!column || !column.foreignResource) return;
277
+
278
+ const state = columnLoadingState[columnName];
279
+ if (state.loading || !state.hasMore) return;
280
+
281
+ state.loading = true;
282
+
283
+ try {
284
+ const list = await callAdminForthApi({
285
+ method: 'POST',
286
+ path: `/get_resource_foreign_data`,
287
+ body: {
288
+ resourceId,
289
+ column: columnName,
290
+ limit: 100,
291
+ offset: columnOffsets[columnName],
292
+ search: searchTerm,
293
+ },
294
+ });
295
+
296
+ if (!list || !Array.isArray(list.items)) {
297
+ console.warn(`Unexpected API response for column ${columnName}:`, list);
298
+ state.hasMore = false;
299
+ return;
300
+ }
301
+
302
+ if (!columnOptions.value) {
303
+ columnOptions.value = {};
304
+ }
305
+ if (!columnOptions.value[columnName]) {
306
+ columnOptions.value[columnName] = [];
307
+ }
308
+ columnOptions.value[columnName].push(...list.items);
309
+
310
+ columnOffsets[columnName] += 100;
311
+
312
+ const paginationResult = handleForeignResourcePagination(
313
+ column,
314
+ list.items,
315
+ columnEmptyResultsCount[columnName] || 0,
316
+ false // not searching
317
+ );
318
+
319
+ columnEmptyResultsCount[columnName] = paginationResult.emptyResultsCount;
320
+ state.hasMore = paginationResult.hasMore;
321
+
322
+ } catch (error) {
323
+ console.error('Error loading more options:', error);
324
+ } finally {
325
+ state.loading = false;
326
+ }
327
+ }
328
+
329
+ export async function searchForeignOptions({
330
+ columnName,
331
+ searchTerm,
332
+ columns,
333
+ resourceId,
334
+ columnOptions,
335
+ columnLoadingState,
336
+ columnOffsets,
337
+ columnEmptyResultsCount
338
+ }: {
339
+ columnName: string;
340
+ searchTerm: string;
341
+ columns: any[];
342
+ resourceId: string;
343
+ columnOptions: any;
344
+ columnLoadingState: any;
345
+ columnOffsets: any;
346
+ columnEmptyResultsCount: any;
347
+ }) {
348
+ const column = columns?.find(c => c.name === columnName);
349
+
350
+ if (!column || !column.foreignResource || !column.foreignResource.searchableFields) {
351
+ return;
352
+ }
353
+
354
+ const state = columnLoadingState[columnName];
355
+ if (state.loading) return;
356
+
357
+ state.loading = true;
358
+
359
+ try {
360
+ const list = await callAdminForthApi({
361
+ method: 'POST',
362
+ path: `/get_resource_foreign_data`,
363
+ body: {
364
+ resourceId,
365
+ column: columnName,
366
+ limit: 100,
367
+ offset: 0,
368
+ search: searchTerm,
369
+ },
370
+ });
371
+
372
+ if (!list || !Array.isArray(list.items)) {
373
+ console.warn(`Unexpected API response for column ${columnName}:`, list);
374
+ state.hasMore = false;
375
+ return;
376
+ }
377
+
378
+ if (!columnOptions.value) {
379
+ columnOptions.value = {};
380
+ }
381
+ columnOptions.value[columnName] = list.items;
382
+ columnOffsets[columnName] = 100;
383
+
384
+ const paginationResult = handleForeignResourcePagination(
385
+ column,
386
+ list.items,
387
+ columnEmptyResultsCount[columnName] || 0,
388
+ true // is searching
389
+ );
390
+
391
+ columnEmptyResultsCount[columnName] = paginationResult.emptyResultsCount;
392
+ state.hasMore = paginationResult.hasMore;
393
+
394
+ } catch (error) {
395
+ console.error('Error searching options:', error);
396
+ } finally {
397
+ state.loading = false;
398
+ }
399
+ }
400
+
401
+ export function createSearchInputHandlers(
402
+ columns: any[],
403
+ searchFunction: (columnName: string, searchTerm: string) => void,
404
+ getDebounceMs?: (column: any) => number
405
+ ) {
406
+ if (!columns) return {};
407
+
408
+ return columns.reduce((acc, c) => {
409
+ if (c.foreignResource && c.foreignResource.searchableFields) {
410
+ const debounceMs = getDebounceMs ? getDebounceMs(c) : 300;
411
+ return {
412
+ ...acc,
413
+ [c.name]: debounce((searchTerm: string) => {
414
+ searchFunction(c.name, searchTerm);
415
+ }, debounceMs),
416
+ };
417
+ }
418
+ return acc;
419
+ }, {} as Record<string, (searchTerm: string) => void>);
211
420
  }
@@ -13,18 +13,18 @@
13
13
  <BreadcrumbsWithButtons>
14
14
  <!-- save and cancle -->
15
15
  <button @click="$router.back()"
16
- class="af-cancel-button flex items-center py-1 px-3 me-2 text-sm font-medium rounded-default text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
16
+ class="af-cancel-button flex items-center py-1 px-3 me-2 text-sm font-medium rounded-default text-lightCreateViewButtonText focus:outline-none bg-lightCreateViewButtonBackground rounded border border-lightCreateViewButtonBorder hover:bg-lightCreateViewButtonBackgroundHover hover:text-lightCreateViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightCreateViewButtonFocusRing dark:focus:ring-darkCreateViewButtonFocusRing dark:bg-darkCreateViewButtonBackground dark:text-darkCreateViewButtonText dark:border-darkCreateViewButtonBorder dark:hover:text-darkCreateViewButtonTextHover dark:hover:bg-darkCreateViewButtonBackgroundHover"
17
17
  >
18
18
  {{ $t('Cancel') }}
19
19
  </button>
20
20
 
21
21
  <button
22
22
  @click="saveRecord"
23
- class="af-save-button flex items-center py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 disabled:opacity-50"
23
+ class="af-save-button flex items-center py-1 px-3 text-sm font-medium rounded-default text-lightCreateViewSaveButtonText focus:outline-none bg-lightCreateViewButtonBackground rounded border border-lightCreateViewButtonBorder hover:bg-lightCreateViewButtonBackgroundHover hover:text-lightCreateViewSaveButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightCreateViewButtonFocusRing dark:focus:ring-darkCreateViewButtonFocusRing dark:bg-darkCreateViewButtonBackground dark:text-darkCreateViewSaveButtonText dark:border-darkCreateViewButtonBorder dark:hover:text-darkCreateViewSaveButtonTextHover dark:hover:bg-darkCreateViewButtonBackgroundHover disabled:opacity-50"
24
24
  :disabled="saving || (validating && !isValid)"
25
25
  >
26
26
  <svg v-if="saving"
27
- aria-hidden="true" class="w-4 h-4 mr-1 text-gray-200 animate-spin dark:text-gray-600 fill-red-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
27
+ aria-hidden="true" class="w-4 h-4 mr-1 text-gray-200 animate-spin dark:text-gray-600 fill-lightCreateViewSaveButtonText" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
28
28
 
29
29
  <IconFloppyDiskSolid v-else class="w-4 h-4 mr-1" />
30
30
  {{ $t('Save') }}
@@ -154,7 +154,7 @@ async function saveRecord() {
154
154
  record: record.value,
155
155
  },
156
156
  });
157
- if (response?.error) {
157
+ if (response?.error && response?.error !== 'Operation aborted by hook') {
158
158
  showErrorTost(response.error);
159
159
  }
160
160
  saving.value = false;
@@ -12,14 +12,14 @@
12
12
  <BreadcrumbsWithButtons>
13
13
  <!-- save and cancle -->
14
14
  <button @click="$router.back()"
15
- class="flex items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 rounded-default focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
15
+ class="flex items-center py-1 px-3 me-2 text-sm font-medium text-lightEditViewButtonText rounded-default focus:outline-none bg-lightEditViewButtonBackground rounded border border-lightEditViewButtonBorder hover:bg-lightEditViewButtonBackgroundHover hover:text-lightEditViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightEditViewButtonFocusRing dark:focus:ring-darkEditViewButtonFocusRing dark:bg-darkEditViewButtonBackground dark:text-darkEditViewButtonText dark:border-darkEditViewButtonBorder dark:hover:text-darkEditViewButtonTextHover dark:hover:bg-darkEditViewButtonBackgroundHover"
16
16
  >
17
17
  {{ $t('Cancel') }}
18
18
  </button>
19
19
 
20
20
  <button
21
21
  @click="saveRecord"
22
- class="flex items-center py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 disabled:opacity-50"
22
+ class="flex items-center py-1 px-3 text-sm font-medium rounded-default text-lightEditViewSaveButtonText focus:outline-none bg-lightEditViewButtonBackground rounded border border-lightEditViewButtonBorder hover:bg-lightEditViewButtonBackgroundHover hover:text-lightEditViewSaveButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightEditViewButtonFocusRing dark:focus:ring-darkEditViewButtonFocusRing dark:bg-darkEditViewButtonBackground dark:text-darkEditViewSaveButtonText dark:border-darkEditViewButtonBorder dark:hover:text-darkEditViewSaveButtonTextHover dark:hover:bg-darkEditViewButtonBackgroundHover disabled:opacity-50"
23
23
  :disabled="saving || (validating && !isValid)"
24
24
  >
25
25
  <IconFloppyDiskSolid class="w-4 h-4" />
@@ -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({
@@ -21,15 +21,14 @@
21
21
  @click="()=>{checkboxes = []}"
22
22
  v-if="checkboxes.length"
23
23
  data-tooltip-target="tooltip-remove-all"
24
- class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-darkListTable dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
24
+ class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default"
25
25
  >
26
- <IconBanOutline class="w-5 h-5 "/>
27
-
28
- <div id="tooltip-remove-all" role="tooltip"
29
- class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
30
- {{ $t('Remove selection') }}
31
- <div class="tooltip-arrow" data-popper-arrow></div>
32
- </div>
26
+ <Tooltip>
27
+ <IconBanOutline class="w-5 h-5 "/>
28
+ <template #tooltip >
29
+ Remove selection
30
+ </template>
31
+ </Tooltip>
33
32
  </button>
34
33
 
35
34
  <button
@@ -37,17 +36,13 @@
37
36
  v-for="(action,i) in coreStore.resource?.options?.bulkActions"
38
37
  :key="action.id"
39
38
  @click="startBulkAction(action.id)"
40
- class="flex gap-1 items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
41
- :class="{
42
- 'bg-red-100 text-red-800 border-red-400 dark:bg-red-700 dark:text-red-400 dark:border-red-400':action.state==='danger',
43
- 'bg-green-100 text-green-800 border-green-400 dark:bg-green-700 dark:text-green-400 dark:border-green-400':action.state==='success',
44
- 'bg-lightPrimaryOpacity text-lightPrimary border-blue-400 dark:bg-blue-700 dark:text-blue-400 dark:border-blue-400':action.state==='active',
45
- }"
39
+ class="flex gap-1 items-center py-1 px-3 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded-default border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover"
40
+ :class="action.buttonCustomCssClass || ''"
46
41
  >
47
42
  <component
48
43
  v-if="action.icon && !bulkActionLoadingStates[action.id]"
49
44
  :is="getIcon(action.icon)"
50
- class="w-5 h-5 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"></component>
45
+ class="w-5 h-5 transition duration-75 group-hover:text-gray-900 dark:group-hover:text-white"></component>
51
46
  <div v-if="bulkActionLoadingStates[action.id]">
52
47
  <svg
53
48
  aria-hidden="true"
@@ -74,14 +69,14 @@
74
69
 
75
70
  <RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
76
71
  :to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
77
- class="af-create-button flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
72
+ class="af-create-button flex items-center py-1 px-3 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default"
78
73
  >
79
74
  <IconPlusOutline class="w-4 h-4 me-2"/>
80
75
  {{ $t('Create') }}
81
76
  </RouterLink>
82
77
 
83
78
  <button
84
- class="af-filter-button flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
79
+ class="af-filter-button flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-lightListViewButtonText focus:outline-none bg-lightListViewButtonBackground rounded border border-lightListViewButtonBorder hover:bg-lightListViewButtonBackgroundHover hover:text-lightListViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightListViewButtonFocusRing dark:focus:ring-darkListViewButtonFocusRing dark:bg-darkListViewButtonBackground dark:text-darkListViewButtonText dark:border-darkListViewButtonBorder dark:hover:text-darkListViewButtonTextHover dark:hover:bg-darkListViewButtonBackgroundHover rounded-default"
85
80
  @click="()=>{filtersShow = !filtersShow}"
86
81
  v-if="coreStore.resource?.options?.allowedActions?.filter"
87
82
  >
@@ -165,7 +160,7 @@ import { useRoute } from 'vue-router';
165
160
  import { showErrorTost } from '@/composables/useFrontendApi'
166
161
  import { getCustomComponent, initThreeDotsDropdown } from '@/utils';
167
162
  import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
168
-
163
+ import { Tooltip } from '@/afcl'
169
164
 
170
165
  import {
171
166
  IconBanOutline,
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800 relative w-screen h-screen"
2
+ <div class="relative flex items-center justify-center min-h-screen bg-lightHtml dark:bg-darkHtml w-screen h-screen"
3
3
  :style="coreStore.config?.loginBackgroundImage && backgroundPosition === 'over' ? {
4
4
  'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
5
5
  'background-size': 'cover',
6
6
  'background-position': 'center',
7
- 'background-blend-mode': 'darken'
7
+ 'background-blend-mode': coreStore.config?.removeBackgroundBlendMode ? 'normal' : 'darken'
8
8
  }: {}"
9
9
  >
10
10
 
@@ -27,7 +27,7 @@
27
27
  overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
28
28
  <div class="relative p-4 w-full max-h-full max-w-[400px]">
29
29
  <!-- Modal content -->
30
- <div class="af-login-modal-content relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black" >
30
+ <div class="af-login-modal-content relative bg-lightLoginViewBackground rounded-lg shadow dark:bg-darkLoginViewBackground dark:shadow-black" >
31
31
  <!-- Modal header -->
32
32
  <div class="af-login-modal-header flex items-center justify-between flex-col p-4 md:p-5 border-b rounded-t dark:border-gray-600">
33
33
 
@@ -39,7 +39,7 @@
39
39
  :meta="c.meta"
40
40
  />
41
41
  </template>
42
- <h3 v-else class="text-xl font-semibold text-gray-900 dark:text-white">
42
+ <h3 v-else class="text-xl font-semibold text-lightLoginViewText dark:text-darkLoginViewTextColor">
43
43
  {{ $t('Sign in to') }} {{ coreStore.config?.brandName }}
44
44
  </h3>
45
45
  </div>
@@ -47,7 +47,7 @@
47
47
  <div class="af-login-modal-body p-4 md:p-5">
48
48
  <form class="space-y-4" @submit.prevent>
49
49
  <div>
50
- <label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ $t('Your') }} {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
50
+ <label for="username" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your') }} {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
51
51
  <Input
52
52
  v-model="username"
53
53
  autocomplete="username"
@@ -55,22 +55,20 @@
55
55
  name="username"
56
56
  id="username"
57
57
  ref="usernameInput"
58
- oninput="setCustomValidity('')"
59
58
  @keydown.enter="passwordInput.focus()"
60
59
  class="w-full"
61
60
  placeholder="name@company.com" required />
62
61
  </div>
63
62
  <div class="">
64
- <label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ $t('Your password') }}</label>
63
+ <label for="password" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your password') }}</label>
65
64
  <Input
66
65
  v-model="password"
67
66
  ref="passwordInput"
68
67
  autocomplete="current-password"
69
- oninput="setCustomValidity('')"
70
68
  @keydown.enter="login"
71
69
  :type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="w-full" required>
72
70
  <template #rightIcon>
73
- <button type="button" @click="showPw = !showPw" class="text-gray-400 dark:text-gray-300">
71
+ <button type="button" @click="showPw = !showPw" class="text-lightLoginViewSubTextColor dark:text-darkLoginViewSubTextColor">
74
72
  <IconEyeSolid class="w-5 h-5" v-if="!showPw" />
75
73
  <IconEyeSlashSolid class="w-5 h-5" v-else />
76
74
  </button>
@@ -103,15 +101,15 @@
103
101
  {{ error }}
104
102
  </div>
105
103
  </div>
106
-
107
- <div v-if="coreStore.config?.loginPromptHTML"
108
- class="flex items-center p-4 mb-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-400" role="alert"
104
+
105
+ <div v-if="loginPromptHTML"
106
+ class="flex items-center p-4 mb-4 text-sm text-lightLoginViewPromptText rounded-lg bg-lightLoginViewPromptBackground dark:bg-darkLoginViewPromptBackground dark:text-darkLoginViewPromptText" role="alert"
109
107
  >
110
108
  <svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
111
109
  <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
112
110
  </svg>
113
111
  <span class="sr-only">{{ $t('Info') }}</span>
114
- <div v-html="coreStore.config?.loginPromptHTML"></div>
112
+ <div v-html="loginPromptHTML"></div>
115
113
  </div>
116
114
  <Button @click="login" :loader="inProgress" :disabled="inProgress" class="w-full">
117
115
  {{ $t('Login to your account') }}
@@ -150,7 +148,7 @@ const password = ref('');
150
148
  const route = useRoute();
151
149
  const router = useRouter();
152
150
  const inProgress = ref(false);
153
-
151
+ const loginPromptHTML = ref()
154
152
  const coreStore = useCoreStore();
155
153
  const user = useUserStore();
156
154
 
@@ -162,6 +160,15 @@ const backgroundPosition = computed(() => {
162
160
  return coreStore.config?.loginBackgroundPosition || '1/2';
163
161
  });
164
162
 
163
+
164
+ async function getLoginFormConfig() {
165
+ const response = await callAdminForthApi({
166
+ path: '/get_login_form_config',
167
+ method: 'GET',
168
+ });
169
+ loginPromptHTML.value = response.loginPromptHTML;
170
+ }
171
+
165
172
  onBeforeMount(() => {
166
173
  if (localStorage.getItem('isAuthorized') === 'true') {
167
174
  // if route has next param, redirect
@@ -175,6 +182,7 @@ onBeforeMount(() => {
175
182
  })
176
183
 
177
184
  onMounted(async () => {
185
+ getLoginFormConfig();
178
186
  if (coreStore.config?.demoCredentials) {
179
187
  const [demoUsername, demoPassword] = coreStore.config.demoCredentials.split(':');
180
188
  username.value = demoUsername;
@@ -185,16 +193,6 @@ onMounted(async () => {
185
193
 
186
194
 
187
195
  async function login() {
188
-
189
- if (!username.value) {
190
- usernameInput.value.setCustomValidity(t('Please fill out this field.'));
191
- return;
192
- }
193
- if (!password.value) {
194
- passwordInput.value.setCustomValidity(t('Please fill out this field.'));
195
- return;
196
- }
197
-
198
196
  if (inProgress.value) {
199
197
  return;
200
198
  }
@@ -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/>
@@ -28,21 +28,21 @@
28
28
  </template>
29
29
  <RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
30
30
  :to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
31
- class="af-add-new-button flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
31
+ class="af-add-new-button flex items-center py-1 px-3 text-sm font-medium text-lightShowViewButtonText focus:outline-none bg-lightShowViewButtonBackground rounded border border-lightShowViewButtonBorder hover:bg-lightShowViewButtonBackgroundHover hover:text-lightShowViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightShowViewButtonFocusRing dark:focus:ring-darkShowViewButtonFocusRing dark:bg-darkShowViewButtonBackground dark:text-darkShowViewButtonText dark:border-darkShowViewButtonBorder dark:hover:text-darkShowViewButtonTextHover dark:hover:bg-darkShowViewButtonBackgroundHover rounded-default"
32
32
  >
33
33
  <IconPlusOutline class="w-4 h-4 me-2"/>
34
34
  {{ $t('Add new') }}
35
35
  </RouterLink>
36
36
 
37
37
  <RouterLink v-if="coreStore?.resourceOptions?.allowedActions?.edit" :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
38
- class="flex items-center af-edit-button py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
38
+ class="flex items-center af-edit-button py-1 px-3 text-sm font-medium text-lightShowViewButtonText focus:outline-none bg-lightShowViewButtonBackground rounded-default border border-lightShowViewButtonBorder hover:bg-lightShowViewButtonBackgroundHover hover:text-lightShowViewButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightShowViewButtonFocusRing dark:focus:ring-darkShowViewButtonFocusRing dark:bg-darkShowViewButtonBackground dark:text-darkShowViewButtonText dark:border-darkShowViewButtonBorder dark:hover:text-darkShowViewButtonTextHover dark:hover:bg-darkShowViewButtonBackgroundHover"
39
39
  >
40
40
  <IconPenSolid class="w-4 h-4" />
41
41
  {{ $t('Edit') }}
42
42
  </RouterLink>
43
43
 
44
44
  <button v-if="coreStore?.resourceOptions?.allowedActions?.delete" @click="deleteRecord"
45
- class="flex items-center af-delete-button py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
45
+ class="flex items-center af-delete-button py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-lightShowViewButtonBackground border border-lightShowViewButtonBorder hover:bg-lightShowViewButtonBackgroundHover hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-lightShowViewButtonFocusRing dark:focus:ring-darkShowViewButtonFocusRing dark:bg-darkShowViewButtonBackground dark:text-red-500 dark:border-darkShowViewButtonBorder dark:hover:text-darkShowViewButtonTextHover dark:hover:bg-darkShowViewButtonBackgroundHover"
46
46
  >
47
47
  <IconTrashBinSolid class="w-4 h-4" />
48
48
  {{ $t('Delete') }}