adminforth 2.4.0-next.12 → 2.4.0-next.121
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/commands/callTsProxy.js +14 -4
- package/commands/cli.js +12 -4
- package/commands/createApp/templates/custom/tsconfig.json.hbs +2 -3
- package/commands/createApp/templates/index.ts.hbs +8 -1
- package/commands/createApp/templates/package.json.hbs +1 -1
- package/commands/createApp/utils.js +27 -2
- package/commands/createCustomComponent/configLoader.js +3 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +16 -3
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +4 -0
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +14 -14
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +22 -5
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +48 -1
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +145 -25
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/styles.d.ts +451 -13
- package/dist/modules/styles.d.ts.map +1 -1
- package/dist/modules/styles.js +507 -31
- package/dist/modules/styles.js.map +1 -1
- package/dist/modules/utils.d.ts +1 -0
- package/dist/modules/utils.d.ts.map +1 -1
- package/dist/modules/utils.js +9 -0
- package/dist/modules/utils.js.map +1 -1
- package/dist/spa/index.html +1 -1
- package/dist/spa/src/App.vue +25 -15
- package/dist/spa/src/adminforth.ts +10 -0
- package/dist/spa/src/afcl/Button.vue +6 -6
- package/dist/spa/src/afcl/Checkbox.vue +21 -13
- package/dist/spa/src/afcl/CountryFlag.vue +4 -1
- package/dist/spa/src/{components/CustomDatePicker.vue → afcl/DatePicker.vue} +95 -9
- package/dist/spa/src/afcl/Dialog.vue +43 -26
- package/dist/spa/src/afcl/Dropzone.vue +10 -10
- package/dist/spa/src/afcl/Input.vue +9 -7
- package/dist/spa/src/afcl/JsonViewer.vue +25 -0
- package/dist/spa/src/afcl/Link.vue +1 -1
- package/dist/spa/src/afcl/LinkButton.vue +1 -1
- package/dist/spa/src/afcl/ProgressBar.vue +7 -7
- package/dist/spa/src/afcl/Select.vue +60 -27
- package/dist/spa/src/afcl/Skeleton.vue +6 -6
- package/dist/spa/src/afcl/Table.vue +13 -13
- package/dist/spa/src/afcl/Textarea.vue +31 -0
- package/dist/spa/src/afcl/Toggle.vue +32 -0
- package/dist/spa/src/afcl/Tooltip.vue +2 -3
- package/dist/spa/src/afcl/VerticalTabs.vue +3 -3
- package/dist/spa/src/afcl/index.ts +4 -3
- package/dist/spa/src/components/AcceptModal.vue +7 -7
- package/dist/spa/src/components/Breadcrumbs.vue +5 -5
- package/dist/spa/src/components/ColumnValueInput.vue +37 -18
- package/dist/spa/src/components/ColumnValueInputWrapper.vue +4 -3
- package/dist/spa/src/components/CustomDateRangePicker.vue +9 -8
- package/dist/spa/src/components/CustomRangePicker.vue +37 -8
- package/dist/spa/src/components/Filters.vue +83 -37
- package/dist/spa/src/components/GroupsTable.vue +9 -8
- package/dist/spa/src/components/MenuLink.vue +3 -3
- package/dist/spa/src/components/ResourceForm.vue +94 -51
- package/dist/spa/src/components/ResourceListTable.vue +38 -40
- package/dist/spa/src/components/ResourceListTableVirtual.vue +31 -33
- package/dist/spa/src/components/ShowTable.vue +17 -12
- package/dist/spa/src/components/SingleSkeletLoader.vue +6 -6
- package/dist/spa/src/components/SkeleteLoader.vue +1 -1
- package/dist/spa/src/components/ThreeDotsMenu.vue +49 -7
- package/dist/spa/src/components/Toast.vue +2 -7
- package/dist/spa/src/components/ValueRenderer.vue +4 -4
- package/dist/spa/src/controls/BoolToggle.vue +34 -0
- package/dist/spa/src/i18n.ts +1 -1
- package/dist/spa/src/shims-vue.d.ts +5 -0
- package/dist/spa/src/spa_types/core.ts +7 -0
- package/dist/spa/src/stores/core.ts +1 -1
- package/dist/spa/src/types/Back.ts +82 -21
- package/dist/spa/src/types/Common.ts +25 -10
- package/dist/spa/src/types/FrontendAPI.ts +8 -0
- package/dist/spa/src/types/adapters/CompletionAdapter.ts +25 -0
- package/dist/spa/src/types/adapters/EmailAdapter.ts +27 -0
- package/dist/spa/src/types/adapters/ImageGenerationAdapter.ts +50 -0
- package/dist/spa/src/types/adapters/ImageVisionAdapter.ts +30 -0
- package/dist/spa/src/types/adapters/OAuth2Adapter.ts +34 -0
- package/dist/spa/src/types/adapters/StorageAdapter.ts +73 -0
- package/dist/spa/src/types/adapters/index.ts +6 -0
- package/dist/spa/src/utils.ts +217 -7
- package/dist/spa/src/views/CreateView.vue +21 -18
- package/dist/spa/src/views/EditView.vue +29 -19
- package/dist/spa/src/views/ListView.vue +60 -51
- package/dist/spa/src/views/LoginView.vue +50 -47
- package/dist/spa/src/views/ResourceParent.vue +1 -1
- package/dist/spa/src/views/ShowView.vue +34 -13
- package/dist/spa/src/websocket.ts +6 -1
- package/dist/spa/tsconfig.app.json +1 -1
- package/dist/spa/vite.config.ts +44 -1
- package/dist/types/Back.d.ts +61 -14
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +23 -8
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +7 -0
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/dist/types/adapters/CompletionAdapter.d.ts +20 -0
- package/dist/types/adapters/CompletionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/CompletionAdapter.js +2 -0
- package/dist/types/adapters/CompletionAdapter.js.map +1 -0
- package/dist/types/adapters/EmailAdapter.d.ts +20 -0
- package/dist/types/adapters/EmailAdapter.d.ts.map +1 -0
- package/dist/types/adapters/EmailAdapter.js +2 -0
- package/dist/types/adapters/EmailAdapter.js.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts +37 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.js +2 -0
- package/dist/types/adapters/ImageGenerationAdapter.js.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts +25 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.js +2 -0
- package/dist/types/adapters/ImageVisionAdapter.js.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts +32 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.js +2 -0
- package/dist/types/adapters/OAuth2Adapter.js.map +1 -0
- package/dist/types/adapters/StorageAdapter.d.ts +63 -0
- package/dist/types/adapters/StorageAdapter.d.ts.map +1 -0
- package/dist/types/adapters/StorageAdapter.js +2 -0
- package/dist/types/adapters/StorageAdapter.js.map +1 -0
- package/dist/types/adapters/index.d.ts +7 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/index.js +2 -0
- package/dist/types/adapters/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/spa/src/types/Adapters.ts +0 -213
- package/dist/types/Adapters.d.ts +0 -168
- package/dist/types/Adapters.d.ts.map +0 -1
- package/dist/types/Adapters.js +0 -2
- package/dist/types/Adapters.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<component
|
|
4
4
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.beforeBreadcrumbs || []"
|
|
5
5
|
:is="getCustomComponent(c)"
|
|
6
|
-
:meta="c.meta"
|
|
6
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
7
7
|
:record="editableRecord"
|
|
8
8
|
:resource="coreStore.resource"
|
|
9
9
|
:adminUser="coreStore.adminUser"
|
|
@@ -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-
|
|
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-
|
|
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" />
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
</button>
|
|
28
28
|
|
|
29
29
|
<ThreeDotsMenu
|
|
30
|
-
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.edit?.threeDotsDropdownItems
|
|
30
|
+
:threeDotsDropdownItems="Array.isArray(coreStore.resourceOptions?.pageInjections?.edit?.threeDotsDropdownItems)
|
|
31
|
+
? coreStore.resourceOptions.pageInjections.edit.threeDotsDropdownItems
|
|
32
|
+
: coreStore.resourceOptions?.pageInjections?.edit?.threeDotsDropdownItems
|
|
33
|
+
? [coreStore.resourceOptions.pageInjections.edit.threeDotsDropdownItems]
|
|
34
|
+
: undefined"
|
|
31
35
|
></ThreeDotsMenu>
|
|
32
36
|
|
|
33
37
|
</BreadcrumbsWithButtons>
|
|
@@ -35,16 +39,16 @@
|
|
|
35
39
|
<component
|
|
36
40
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.afterBreadcrumbs || []"
|
|
37
41
|
:is="getCustomComponent(c)"
|
|
38
|
-
:meta="c.meta"
|
|
42
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
39
43
|
:record="coreStore.record"
|
|
40
44
|
:resource="coreStore.resource"
|
|
41
45
|
:adminUser="coreStore.adminUser"
|
|
42
46
|
/>
|
|
43
47
|
|
|
44
48
|
<SingleSkeletLoader v-if="loading"></SingleSkeletLoader>
|
|
45
|
-
|
|
49
|
+
|
|
46
50
|
<ResourceForm
|
|
47
|
-
v-else
|
|
51
|
+
v-else-if="coreStore.resource"
|
|
48
52
|
:record="editableRecord"
|
|
49
53
|
:resource="coreStore.resource"
|
|
50
54
|
:adminUser="coreStore.adminUser"
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
<component
|
|
59
63
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.edit?.bottom || []"
|
|
60
64
|
:is="getCustomComponent(c)"
|
|
61
|
-
:meta="c.meta"
|
|
65
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
62
66
|
:record="coreStore.record"
|
|
63
67
|
:resource="coreStore.resource"
|
|
64
68
|
:adminUser="coreStore.adminUser"
|
|
@@ -76,12 +80,13 @@ import SingleSkeletLoader from '@/components/SingleSkeletLoader.vue';
|
|
|
76
80
|
import { useCoreStore } from '@/stores/core';
|
|
77
81
|
import { callAdminForthApi, getCustomComponent,checkAcessByAllowedActions, initThreeDotsDropdown } from '@/utils';
|
|
78
82
|
import { IconFloppyDiskSolid } from '@iconify-prerendered/vue-flowbite';
|
|
79
|
-
import { computed, onMounted, ref } from 'vue';
|
|
83
|
+
import { computed, onMounted, ref, type Ref } from 'vue';
|
|
80
84
|
import { useRoute, useRouter } from 'vue-router';
|
|
81
85
|
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
82
86
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
83
87
|
import adminforth from '@/adminforth';
|
|
84
88
|
import { useI18n } from 'vue-i18n';
|
|
89
|
+
import { type AdminForthComponentDeclarationFull } from '@/types/Common.js';
|
|
85
90
|
|
|
86
91
|
const { t } = useI18n();
|
|
87
92
|
const coreStore = useCoreStore();
|
|
@@ -96,9 +101,9 @@ const loading = ref(true);
|
|
|
96
101
|
|
|
97
102
|
const saving = ref(false);
|
|
98
103
|
|
|
99
|
-
const record = ref({});
|
|
104
|
+
const record: Ref<Record<string, any>> = ref({});
|
|
100
105
|
|
|
101
|
-
async function onUpdateRecord(newRecord) {
|
|
106
|
+
async function onUpdateRecord(newRecord: Record<string, any>) {
|
|
102
107
|
record.value = newRecord;
|
|
103
108
|
}
|
|
104
109
|
|
|
@@ -110,7 +115,7 @@ const editableRecord = computed(() => {
|
|
|
110
115
|
coreStore.resource.columns.forEach(column => {
|
|
111
116
|
if (column.foreignResource) {
|
|
112
117
|
if (column.isArray?.enabled) {
|
|
113
|
-
newRecord[column.name] = newRecord[column.name]?.map(fr => fr.pk);
|
|
118
|
+
newRecord[column.name] = newRecord[column.name]?.map((fr: { pk: any }) => fr.pk);
|
|
114
119
|
} else {
|
|
115
120
|
newRecord[column.name] = newRecord[column.name]?.pk;
|
|
116
121
|
}
|
|
@@ -123,16 +128,20 @@ onMounted(async () => {
|
|
|
123
128
|
loading.value = true;
|
|
124
129
|
|
|
125
130
|
await coreStore.fetchResourceFull({
|
|
126
|
-
resourceId: route.params.resourceId
|
|
131
|
+
resourceId: route.params.resourceId as string
|
|
127
132
|
});
|
|
128
133
|
initThreeDotsDropdown();
|
|
129
134
|
|
|
130
135
|
await coreStore.fetchRecord({
|
|
131
|
-
resourceId: route.params.resourceId,
|
|
132
|
-
primaryKey: route.params.primaryKey,
|
|
136
|
+
resourceId: route.params.resourceId as string,
|
|
137
|
+
primaryKey: route.params.primaryKey as string,
|
|
133
138
|
source: 'edit',
|
|
134
139
|
});
|
|
135
|
-
|
|
140
|
+
|
|
141
|
+
if (coreStore.resourceOptions) {
|
|
142
|
+
checkAcessByAllowedActions(coreStore.resourceOptions.allowedActions,'edit');
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
loading.value = false;
|
|
137
146
|
});
|
|
138
147
|
|
|
@@ -145,7 +154,7 @@ async function saveRecord() {
|
|
|
145
154
|
}
|
|
146
155
|
|
|
147
156
|
saving.value = true;
|
|
148
|
-
const updates = {};
|
|
157
|
+
const updates: Record<string, any> = {};
|
|
149
158
|
for (const key in record.value) {
|
|
150
159
|
let columnIsUpdated = false;
|
|
151
160
|
|
|
@@ -157,7 +166,8 @@ async function saveRecord() {
|
|
|
157
166
|
columnIsUpdated = record.value[key] !== coreStore.record[key];
|
|
158
167
|
}
|
|
159
168
|
|
|
160
|
-
|
|
169
|
+
if (!coreStore.resource) return;
|
|
170
|
+
const column = coreStore.resource.columns.find((c) => c.name === key);
|
|
161
171
|
|
|
162
172
|
if (column?.foreignResource) {
|
|
163
173
|
columnIsUpdated = record.value[key] !== coreStore.record[key]?.pk;
|
|
@@ -177,7 +187,7 @@ async function saveRecord() {
|
|
|
177
187
|
record: updates,
|
|
178
188
|
},
|
|
179
189
|
});
|
|
180
|
-
if (resp.error) {
|
|
190
|
+
if (resp.error && resp.error !== 'Operation aborted by hook') {
|
|
181
191
|
showErrorTost(resp.error);
|
|
182
192
|
} else {
|
|
183
193
|
adminforth.alert({
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<Teleport to="body">
|
|
4
4
|
<Filters
|
|
5
5
|
:columns="coreStore.resource?.columns"
|
|
6
|
-
:columnsMinMax="columnsMinMax"
|
|
6
|
+
:columnsMinMax="columnsMinMax"
|
|
7
|
+
:show="filtersShow"
|
|
7
8
|
@hide="filtersShow = false"
|
|
8
9
|
/>
|
|
9
10
|
</Teleport>
|
|
@@ -21,67 +22,65 @@
|
|
|
21
22
|
@click="()=>{checkboxes = []}"
|
|
22
23
|
v-if="checkboxes.length"
|
|
23
24
|
data-tooltip-target="tooltip-remove-all"
|
|
24
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
25
|
+
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
26
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
27
|
+
<Tooltip>
|
|
28
|
+
<IconBanOutline class="w-5 h-5 "/>
|
|
29
|
+
<template #tooltip >
|
|
30
|
+
Remove selection
|
|
31
|
+
</template>
|
|
32
|
+
</Tooltip>
|
|
33
33
|
</button>
|
|
34
34
|
|
|
35
|
-
<
|
|
36
|
-
v-if="checkboxes.length"
|
|
35
|
+
<div
|
|
36
|
+
v-if="checkboxes.length"
|
|
37
37
|
v-for="(action,i) in coreStore.resource?.options?.bulkActions"
|
|
38
|
-
:key="action.id"
|
|
39
|
-
@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
|
-
}"
|
|
46
38
|
>
|
|
47
|
-
<
|
|
48
|
-
v-if="action.
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
39
|
+
<button
|
|
40
|
+
v-if="!action.showInThreeDotsDropdown || action.showInThreeDotsDropdown===false"
|
|
41
|
+
:key="action.id"
|
|
42
|
+
@click="startBulkAction(action.id)"
|
|
43
|
+
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"
|
|
44
|
+
:class="action.buttonCustomCssClass || ''"
|
|
45
|
+
>
|
|
46
|
+
<component
|
|
47
|
+
v-if="action.icon && !bulkActionLoadingStates[action.id]"
|
|
48
|
+
:is="getIcon(action.icon)"
|
|
49
|
+
class="w-5 h-5 transition duration-75 group-hover:text-gray-900 dark:group-hover:text-white"></component>
|
|
50
|
+
<div v-if="bulkActionLoadingStates[action.id]">
|
|
51
|
+
<svg
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
class="w-5 h-5 animate-spin"
|
|
54
|
+
:class="{
|
|
55
|
+
'text-gray-200 dark:text-gray-500 fill-gray-500 dark:fill-gray-300': action.state !== 'danger',
|
|
56
|
+
'text-red-200 dark:text-red-800 fill-red-600 dark:fill-red-500': action.state === 'danger'
|
|
57
|
+
}"
|
|
58
|
+
viewBox="0 0 100 101"
|
|
59
|
+
fill="none"
|
|
60
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
61
|
+
>
|
|
62
|
+
<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"/>
|
|
63
|
+
<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"/>
|
|
64
|
+
</svg>
|
|
65
|
+
<span class="sr-only">Loading...</span>
|
|
66
|
+
</div>
|
|
67
|
+
{{ `${action.label} (${checkboxes.length})` }}
|
|
68
|
+
<div v-if="action.badge" class="text-white bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800
|
|
69
|
+
font-medium rounded-sm text-xs px-1 ml-1 text-center ">
|
|
70
|
+
{{ action.badge }}
|
|
71
|
+
</div>
|
|
72
|
+
</button>
|
|
73
|
+
</div>
|
|
75
74
|
<RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
76
75
|
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
77
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-
|
|
76
|
+
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
77
|
>
|
|
79
78
|
<IconPlusOutline class="w-4 h-4 me-2"/>
|
|
80
79
|
{{ $t('Create') }}
|
|
81
80
|
</RouterLink>
|
|
82
81
|
|
|
83
82
|
<button
|
|
84
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
83
|
+
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
84
|
@click="()=>{filtersShow = !filtersShow}"
|
|
86
85
|
v-if="coreStore.resource?.options?.allowedActions?.filter"
|
|
87
86
|
>
|
|
@@ -96,6 +95,11 @@
|
|
|
96
95
|
|
|
97
96
|
<ThreeDotsMenu
|
|
98
97
|
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.list?.threeDotsDropdownItems"
|
|
98
|
+
:bulkActions="coreStore.resource?.options?.bulkActions"
|
|
99
|
+
:checkboxes="checkboxes"
|
|
100
|
+
@startBulkAction="startBulkAction"
|
|
101
|
+
:updateList="getList"
|
|
102
|
+
:clearCheckboxes="clearCheckboxes"
|
|
99
103
|
></ThreeDotsMenu>
|
|
100
104
|
</BreadcrumbsWithButtons>
|
|
101
105
|
|
|
@@ -125,6 +129,7 @@
|
|
|
125
129
|
:item-height="52.5"
|
|
126
130
|
:buffer-size="listBufferSize"
|
|
127
131
|
/>
|
|
132
|
+
|
|
128
133
|
<ResourceListTable
|
|
129
134
|
v-else
|
|
130
135
|
:resource="coreStore.resource"
|
|
@@ -165,7 +170,7 @@ import { useRoute } from 'vue-router';
|
|
|
165
170
|
import { showErrorTost } from '@/composables/useFrontendApi'
|
|
166
171
|
import { getCustomComponent, initThreeDotsDropdown } from '@/utils';
|
|
167
172
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
168
|
-
|
|
173
|
+
import { Tooltip } from '@/afcl'
|
|
169
174
|
|
|
170
175
|
import {
|
|
171
176
|
IconBanOutline,
|
|
@@ -245,6 +250,10 @@ async function getList() {
|
|
|
245
250
|
return {}
|
|
246
251
|
}
|
|
247
252
|
|
|
253
|
+
function clearCheckboxes() {
|
|
254
|
+
checkboxes.value = [];
|
|
255
|
+
}
|
|
256
|
+
|
|
248
257
|
async function refreshExistingList(pk?: any) {
|
|
249
258
|
const currentData = rows.value;
|
|
250
259
|
if (!currentData) {
|
|
@@ -440,7 +449,7 @@ watch(() => filtersStore.filters, async (to, from) => {
|
|
|
440
449
|
const query = {};
|
|
441
450
|
const currentQ = currentQuery();
|
|
442
451
|
filtersStore.filters.forEach(f => {
|
|
443
|
-
if (f.value) {
|
|
452
|
+
if (f.value !== undefined && f.value !== null && f.value !== '') {
|
|
444
453
|
query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(JSON.stringify(f.value));
|
|
445
454
|
}
|
|
446
455
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative flex items-center justify-center min-h-screen bg-
|
|
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
|
|
|
@@ -23,53 +23,57 @@
|
|
|
23
23
|
|
|
24
24
|
<!-- Main modal -->
|
|
25
25
|
<div id="authentication-modal" tabindex="-1"
|
|
26
|
-
class="overflow-y-auto flex flex-grow
|
|
26
|
+
class="af-login-modal overflow-y-auto flex flex-grow
|
|
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="relative bg-
|
|
30
|
+
<div class="af-login-modal-content relative bg-lightLoginViewBackground rounded-lg shadow dark:bg-darkLoginViewBackground dark:shadow-black" >
|
|
31
31
|
<!-- Modal header -->
|
|
32
|
-
<div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
|
|
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
|
|
|
34
|
-
<
|
|
34
|
+
<template v-if="coreStore?.config?.loginPageInjections?.panelHeader.length > 0">
|
|
35
35
|
<component
|
|
36
36
|
v-for="(c, index) in coreStore?.config?.loginPageInjections?.panelHeader || []"
|
|
37
37
|
:key="index"
|
|
38
38
|
:is="getCustomComponent(c)"
|
|
39
39
|
:meta="c.meta"
|
|
40
40
|
/>
|
|
41
|
-
</
|
|
42
|
-
<h3 v-else class="text-xl font-semibold text-
|
|
41
|
+
</template>
|
|
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>
|
|
46
46
|
<!-- Modal body -->
|
|
47
|
-
<div class="p-4 md:p-5">
|
|
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-
|
|
51
|
-
<
|
|
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
|
+
<Input
|
|
52
|
+
v-model="username"
|
|
52
53
|
autocomplete="username"
|
|
53
54
|
type="username"
|
|
54
55
|
name="username"
|
|
55
56
|
id="username"
|
|
56
57
|
ref="usernameInput"
|
|
57
|
-
oninput="setCustomValidity('')"
|
|
58
58
|
@keydown.enter="passwordInput.focus()"
|
|
59
|
-
class="
|
|
59
|
+
class="w-full"
|
|
60
|
+
placeholder="name@company.com" required />
|
|
60
61
|
</div>
|
|
61
|
-
<div class="
|
|
62
|
-
<label for="password" class="block mb-2 text-sm font-medium text-
|
|
63
|
-
<
|
|
62
|
+
<div class="">
|
|
63
|
+
<label for="password" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your password') }}</label>
|
|
64
|
+
<Input
|
|
65
|
+
v-model="password"
|
|
64
66
|
ref="passwordInput"
|
|
65
67
|
autocomplete="current-password"
|
|
66
|
-
oninput="setCustomValidity('')"
|
|
67
68
|
@keydown.enter="login"
|
|
68
|
-
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="w-full" required>
|
|
70
|
+
<template #rightIcon>
|
|
71
|
+
<button type="button" @click="showPw = !showPw" class="text-lightLoginViewSubTextColor dark:text-darkLoginViewSubTextColor">
|
|
72
|
+
<IconEyeSolid class="w-5 h-5" v-if="!showPw" />
|
|
73
|
+
<IconEyeSlashSolid class="w-5 h-5" v-else />
|
|
74
|
+
</button>
|
|
75
|
+
</template>
|
|
76
|
+
</Input>
|
|
73
77
|
</div>
|
|
74
78
|
|
|
75
79
|
<div v-if="coreStore.config.rememberMeDays"
|
|
@@ -88,7 +92,7 @@
|
|
|
88
92
|
:meta="c.meta"
|
|
89
93
|
/>
|
|
90
94
|
|
|
91
|
-
<div v-if="error" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
|
|
95
|
+
<div v-if="error" class="af-login-modal-error flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
|
|
92
96
|
<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">
|
|
93
97
|
<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"/>
|
|
94
98
|
</svg>
|
|
@@ -97,15 +101,15 @@
|
|
|
97
101
|
{{ error }}
|
|
98
102
|
</div>
|
|
99
103
|
</div>
|
|
100
|
-
|
|
101
|
-
<div v-if="
|
|
102
|
-
class="flex items-center p-4 mb-4 text-sm text-
|
|
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"
|
|
103
107
|
>
|
|
104
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">
|
|
105
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"/>
|
|
106
110
|
</svg>
|
|
107
111
|
<span class="sr-only">{{ $t('Info') }}</span>
|
|
108
|
-
<div v-html="
|
|
112
|
+
<div v-html="loginPromptHTML"></div>
|
|
109
113
|
</div>
|
|
110
114
|
<Button @click="login" :loader="inProgress" :disabled="inProgress" class="w-full">
|
|
111
115
|
{{ $t('Login to your account') }}
|
|
@@ -130,7 +134,7 @@ import { useUserStore } from '@/stores/user';
|
|
|
130
134
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
131
135
|
import { callAdminForthApi, loadFile } from '@/utils';
|
|
132
136
|
import { useRoute, useRouter } from 'vue-router';
|
|
133
|
-
import { Button, Checkbox } from '@/afcl';
|
|
137
|
+
import { Button, Checkbox, Input } from '@/afcl';
|
|
134
138
|
import { useI18n } from 'vue-i18n';
|
|
135
139
|
|
|
136
140
|
const { t } = useI18n();
|
|
@@ -138,11 +142,13 @@ const { t } = useI18n();
|
|
|
138
142
|
const passwordInput = ref(null);
|
|
139
143
|
const usernameInput = ref(null);
|
|
140
144
|
const rememberMeValue= ref(false);
|
|
145
|
+
const username = ref('');
|
|
146
|
+
const password = ref('');
|
|
141
147
|
|
|
142
148
|
const route = useRoute();
|
|
143
149
|
const router = useRouter();
|
|
144
150
|
const inProgress = ref(false);
|
|
145
|
-
|
|
151
|
+
const loginPromptHTML = ref()
|
|
146
152
|
const coreStore = useCoreStore();
|
|
147
153
|
const user = useUserStore();
|
|
148
154
|
|
|
@@ -154,6 +160,15 @@ const backgroundPosition = computed(() => {
|
|
|
154
160
|
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
155
161
|
});
|
|
156
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
|
+
|
|
157
172
|
onBeforeMount(() => {
|
|
158
173
|
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
159
174
|
// if route has next param, redirect
|
|
@@ -167,29 +182,17 @@ onBeforeMount(() => {
|
|
|
167
182
|
})
|
|
168
183
|
|
|
169
184
|
onMounted(async () => {
|
|
185
|
+
getLoginFormConfig();
|
|
170
186
|
if (coreStore.config?.demoCredentials) {
|
|
171
|
-
const [
|
|
172
|
-
|
|
173
|
-
|
|
187
|
+
const [demoUsername, demoPassword] = coreStore.config.demoCredentials.split(':');
|
|
188
|
+
username.value = demoUsername;
|
|
189
|
+
password.value = demoPassword;
|
|
174
190
|
}
|
|
175
191
|
usernameInput.value.focus();
|
|
176
192
|
});
|
|
177
193
|
|
|
178
194
|
|
|
179
195
|
async function login() {
|
|
180
|
-
|
|
181
|
-
const username = usernameInput.value.value;
|
|
182
|
-
const password = passwordInput.value.value;
|
|
183
|
-
|
|
184
|
-
if (!username) {
|
|
185
|
-
usernameInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (!password) {
|
|
189
|
-
passwordInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
196
|
if (inProgress.value) {
|
|
194
197
|
return;
|
|
195
198
|
}
|
|
@@ -198,8 +201,8 @@ async function login() {
|
|
|
198
201
|
path: '/login',
|
|
199
202
|
method: 'POST',
|
|
200
203
|
body: {
|
|
201
|
-
username,
|
|
202
|
-
password,
|
|
204
|
+
username: username.value,
|
|
205
|
+
password: password.value,
|
|
203
206
|
rememberMe: rememberMeValue.value,
|
|
204
207
|
}
|
|
205
208
|
});
|
|
@@ -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/>
|