Skip to content

Commit 533c5db

Browse files
committed
Merge branch 'next' of https://github.com/devforth/adminforth into hide-columns-by-showIn
2 parents 73d0185 + c42ba35 commit 533c5db

39 files changed

+1744
-257
lines changed

adminforth/modules/configValidator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ export default class ConfigValidator implements IConfigValidator {
227227

228228
bulkActions.push({
229229
label: `Delete checked`,
230-
state: 'danger',
231230
icon: 'flowbite:trash-bin-outline',
232231
confirm: 'Are you sure you want to delete selected items?',
233232
allowed: async ({ resource, adminUser, allowedActions }) => { return allowedActions.delete },

adminforth/modules/restApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
801801
})
802802
);
803803

804+
const pkField = resource.columns.find((col) => col.primaryKey)?.name;
804805
// remove all columns which are not defined in resources, or defined but backendOnly
805806
data.data.forEach((item) => {
806807
Object.keys(item).forEach((key) => {

adminforth/modules/styles.ts

Lines changed: 565 additions & 57 deletions
Large diffs are not rendered by default.

adminforth/spa/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="flex items-center ms-3 ">
2727
<span
2828
v-if="!coreStore.config?.singleTheme"
29-
@click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-lightHtml dark:text-darkSidebarTextHover dark:hover:bg-darkHtml dark:hover:text-darkSidebarTextActive" role="menuitem">
29+
@click="toggleTheme" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black dark:text-darkSidebarTextHover dark:hover:text-darkSidebarTextActive" role="menuitem">
3030
<IconMoonSolid class="w-5 h-5 text-blue-300" v-if="coreStore.theme !== 'dark'" />
3131
<IconSunSolid class="w-5 h-5 text-yellow-300" v-else />
3232
</span>

adminforth/spa/src/afcl/Button.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<button
33
v-bind="$attrs"
44
type="submit"
5-
class="afcl-button flex items-center justify-center gap-1 text-lightPrimaryContrast bg-lightPrimary dark:bg-darkPrimary hover:brightness-110
6-
focus:ring-4 focus:outline-none focus:ring-lightPrimary focus:ring-opacity-50 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-darkPrimary dark:focus:ring-opacity-50"
5+
class="afcl-button flex items-center justify-center gap-1 text-lightButtonsText bg-lightButtonsBackground border border-lightButtonsBorder dark:bg-darkButtonsBackground hover:bg-lightButtonsHover hover:border-lightButtonsBorderHover
6+
focus:ring-4 focus:outline-none focus:ring-lightButtonFocusRing focus:ring-opacity-50 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-darkButtonFocusRing dark:text-darkButtonsText dark:border-darkButtonsBorder dark:hover:bg-darkButtonsHover dark:hover:border-darkButtonsBorderHover"
77
:class="{
88
'cursor-default opacity-50 pointer-events-none': props.disabled,
99
'active brightness-200 hover:brightness-150' : props.active
1010
}"
1111
>
1212
<svg v-if="props.loader"
13-
aria-hidden="true" class="w-4 h-4 text-gray-200 animate-spin dark:text-gray-600 fill-lightPrimary dark:fill-darkPrimary"
13+
aria-hidden="true" class="w-4 h-4 text-lightButtonsText animate-spin dark:text-darkButtonsText fill-lightButtonsBackground dark:fill-darkPrimary"
1414
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>
1515
<slot></slot>
1616
</button>

adminforth/spa/src/afcl/Dialog.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
<div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-full max-h-full">
1010
<div v-bind="$attrs" class="relative p-4 max-w-2xl max-h-full" :class="$attrs.class?.includes('w-') ? '' : 'w-full'">
1111
<!-- Modal content -->
12-
<div class="relative bg-white rounded-lg shadow-sm dark:bg-gray-700">
12+
<div class="relative bg-lightDialogBackgorund rounded-lg shadow-sm dark:bg-darkDialogBackgorund">
1313
<!-- Modal header -->
1414
<div
1515
v-if="header"
16-
class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600 border-gray-200"
16+
class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-darkDialogBreakLine border-lightDialogBreakLine"
1717
>
18-
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
18+
<h3 class="text-xl font-semibold text-lightDialogHeaderText dark:text-darkDialogHeaderText">
1919
{{ header }}
2020
</h3>
2121
<button
2222
v-if="headerCloseButton"
2323
type="button"
24-
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white"
24+
class="text-lightDialogCloseButton bg-transparent hover:bg-lightDialogCloseButtonHoverBackground hover:text-lightDialogCloseButtonHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkDialogCloseButton dark:hover:bg-darkDialogCloseButtonHoverBackground dark:hover:text-darkDialogCloseButtonHover"
2525
@click="modal?.hide()"
2626
>
2727
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
@@ -31,13 +31,13 @@
3131
</button>
3232
</div>
3333
<!-- Modal body -->
34-
<div class="p-4 md:p-5 space-y-4 text-gray-700 dark:text-gray-400">
34+
<div class="p-4 md:p-5 space-y-4 text-lightDialogBodyText dark:text-darkDialogBodyText">
3535
<slot></slot>
3636
</div>
3737
<!-- Modal footer -->
3838
<div
3939
v-if="buttons.length"
40-
class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600"
40+
class="flex items-center p-4 md:p-5 border-t border-lightDialogBreakLine rounded-b dark:border-darkDialogBreakLine"
4141
>
4242
<Button
4343
v-for="(button, buttonIndex) in buttons"

adminforth/spa/src/afcl/Dropzone.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@
55
@dragleave.prevent="dragging = false"
66
@drop.prevent="dragging = false; doEmit($event.dataTransfer.files)"
77
>
8-
<label :id="id" class="flex flex-col items-center justify-center w-full border-2 border-dashed rounded-lg cursor-pointer dark:hover:bg-gray-800
9-
hover:bg-gray-100 dark:hover:border-gray-500 dark:hover:bg-gray-600"
8+
<label :id="id" class="flex flex-col items-center justify-center w-full border-2 border-dashed rounded-lg cursor-pointer
9+
hover:bg-lightDropzoneBackgroundHover hover:border-lightDropzoneBorderHover dark:hover:border-darkDropzoneBorderHover dark:hover:bg-darkDropzoneBackgroundHover"
1010
:class="{
11-
'border-blue-600 dark:border-blue-400': dragging,
12-
'border-gray-300 dark:border-gray-600': !dragging,
13-
'bg-blue-50 dark:bg-blue-800': dragging,
14-
'bg-gray-50 dark:bg-gray-800': !dragging,
11+
'border-lightDropzoneBorderDragging dark:border-darkDropzoneBorderDragging': dragging,
12+
'border-lightDropzoneBorder dark:border-darkDropzoneBorder': !dragging,
13+
'bg-lightDropzoneBackgroundDragging dark:bg-darkDropzoneBackgroundDragging': dragging,
14+
'bg-lightDropzoneBackground dark:bg-darkDropzoneBackground': !dragging,
1515
'min-h-32 h-full': props.multiple,
1616
'h-32': !props.multiple,
1717
}"
1818
>
1919
<div class="flex flex-col items-center justify-center pt-5 pb-6">
2020

2121

22-
<svg v-if="!selectedFiles.length" class="w-8 h-8 mb-4 text-gray-500 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
22+
<svg v-if="!selectedFiles.length" class="w-8 h-8 mb-4 text-lightDropzoneIcon dark:text-darkDropzoneIcon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
2323
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"/>
2424
</svg>
2525
<div v-else class="flex items-center justify-center flex-wrap gap-1 w-full mt-1 mb-4">
2626
<template v-for="file in selectedFiles">
27-
<p class="text-sm text-gray-500 dark:text-gray-400 flex items-center gap-1">
27+
<p class="text-sm text-lightDropzoneIcon dark:text-darkDropzoneIcon flex items-center gap-1">
2828
<IconFileSolid class="w-5 h-5" />
2929
{{ file.name }} ({{ humanifySize(file.size) }})
3030
</p>
3131
</template>
3232

3333
</div>
3434

35-
<p v-if="!selectedFiles.length" class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">{{ $t('Click to upload') }}</span> {{ $t('or drag and drop') }}</p>
36-
<p class="text-xs text-gray-500 dark:text-gray-400">
35+
<p v-if="!selectedFiles.length" class="mb-2 text-sm text-lightDropzoneText dark:text-darkDropzoneText"><span class="font-semibold">{{ $t('Click to upload') }}</span> {{ $t('or drag and drop') }}</p>
36+
<p class="text-xs text-lightDropzoneText dark:text-darkDropzoneText">
3737
{{ props.extensions.join(', ').toUpperCase().replace(/\./g, '') }}
3838
<template v-if="props.maxSizeBytes">
3939
(Max size: {{ humanifySize(props.maxSizeBytes) }})

adminforth/spa/src/afcl/Input.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="afcl-input-wrapper flex z-0 relative" :class="{'opacity-50' : readonly}">
44
<span
55
v-if="$slots.prefix || prefix"
6-
class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-s-0 border-gray-300 rounded-s-md dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600">
6+
class="inline-flex items-center px-3 text-sm text-lightInputText bg-lightInputBackground border border-s-0 border-lightInputBorder rounded-s-md dark:bg-darkInputBackground dark:text-darkInputText dark:border-darkInputBorder">
77
<slot name="prefix">{{ prefix }}</slot>
88
</span>
99

@@ -15,8 +15,8 @@
1515
@input="$emit('update:modelValue', $event.target?.value)"
1616
:value="modelValue"
1717
aria-describedby="helper-text-explanation"
18-
class="afcl-input inline-flex bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
19-
blue-500 focus:border-blue-500 block w-20 p-2.5 dark:bg-gray-700 dark:border-gray-600 placeholder-gray-500 dark:placeholder-gray-400 dark:text-white translate-y-0"
18+
class="afcl-input inline-flex bg-lightInputBackground border border-lightInputBorder text-lightInputText text-sm rounded-0 focus:ring-lightPrimary focus:border-lightPrimary dark:focus:ring-darkPrimary dark:focus:border-darkPrimary
19+
blue-500 focus:border-blue-500 block w-20 p-2.5 dark:bg-darkInputBackground dark:border-darkInputBorder placeholder-lightInputPlaceholderText dark:placeholder-darkInputPlaceholderText dark:text-darkInputText translate-y-0"
2020
:class="{'rounded-l-md': !$slots.prefix && !prefix, 'rounded-r-md': !$slots.suffix && !suffix, 'w-full': fullWidth}"
2121
:disabled="readonly"
2222
>
@@ -26,7 +26,7 @@
2626
</div>
2727
<span
2828
v-if="$slots.suffix || suffix"
29-
class="inline-flex items-center px-3 text-sm text-gray-900 bg-gray-200 border border-s-0 border-gray-300 rounded-e-md dark:bg-gray-600 dark:text-gray-400 dark:border-gray-600 ">
29+
class="inline-flex items-center px-3 text-sm text-lightInputText bg-lightInputBackground border border-s-0 border-lightInputBorder rounded-e-md dark:bg-darkInputBackground dark:text-darkInputText dark:border-darkInputBorder ">
3030
<slot name="suffix">{{ suffix }}</slot>
3131
</span>
3232

adminforth/spa/src/afcl/ProgressBar.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
2-
<div class="relative mt-4 lg:mt-10 w-full max-w-[700px] bg-gray-200 rounded-full h-2.5 dark:bg-gray-700">
3-
<span class="absolute -top-6 left-0 text-sm text-gray-500">{{ leftLabel }}</span>
4-
<span class="absolute -top-6 right-0 text-sm text-gray-500">{{ rightLabel }}</span>
2+
<div class="relative mt-4 lg:mt-10 w-full max-w-[700px] bg-lightProgressBarUnfilledColor rounded-full h-2.5 dark:bg-darkProgressBarUnfilledColor">
3+
<span class="absolute -top-6 left-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ leftLabel }}</span>
4+
<span class="absolute -top-6 right-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ rightLabel }}</span>
55
<div
6-
class="bg-lightPrimary dark:bg-darkPrimary h-2.5 rounded-full transition-all duration-300 ease-in-out"
6+
class="bg-lightProgressBarFilledColor dark:bg-darkProgressBarFilledColor h-2.5 rounded-full transition-all duration-300 ease-in-out"
77
:style="{ width: `${percentage}%` }"
88
></div>
9-
<span v-if="showValues" class="absolute top-4 left-0 text-sm text-gray-500">{{ formatValue(minValue) }}</span>
10-
<span v-if="showProgress" class="absolute top-4 right-1/2 translate-x-1/2 text-sm text-gray-500">{{ progressText }}</span>
11-
<span v-if="showValues" class="absolute top-4 right-0 text-sm text-gray-500">{{ formatValue(maxValue) }}</span>
9+
<span v-if="showValues" class="absolute top-4 left-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(minValue) }}</span>
10+
<span v-if="showProgress" class="absolute top-4 right-1/2 translate-x-1/2 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ progressText }}</span>
11+
<span v-if="showValues" class="absolute top-4 right-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(maxValue) }}</span>
1212
</div>
1313
</template>
1414

0 commit comments

Comments
 (0)