adminforth 2.4.0-next.15 → 2.4.0-next.151
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 +10 -2
- package/commands/createApp/templates/package.json.hbs +1 -1
- package/commands/createApp/utils.js +27 -2
- package/commands/createCustomComponent/configLoader.js +3 -0
- package/commands/createCustomComponent/main.js +1 -0
- package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +38 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +46 -15
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +15 -0
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +44 -15
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/dataConnectors/mysql.d.ts.map +1 -1
- package/dist/dataConnectors/mysql.js +11 -0
- package/dist/dataConnectors/mysql.js.map +1 -1
- package/dist/dataConnectors/postgres.d.ts.map +1 -1
- package/dist/dataConnectors/postgres.js +11 -0
- package/dist/dataConnectors/postgres.js.map +1 -1
- package/dist/dataConnectors/sqlite.d.ts.map +1 -1
- package/dist/dataConnectors/sqlite.js +11 -0
- package/dist/dataConnectors/sqlite.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 +54 -3
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +147 -25
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/styles.d.ts +457 -13
- package/dist/modules/styles.d.ts.map +1 -1
- package/dist/modules/styles.js +513 -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 +33 -15
- package/dist/spa/src/adminforth.ts +30 -10
- package/dist/spa/src/afcl/BarChart.vue +2 -2
- 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 +44 -27
- package/dist/spa/src/afcl/Dropzone.vue +12 -12
- package/dist/spa/src/afcl/Input.vue +6 -6
- package/dist/spa/src/afcl/JsonViewer.vue +25 -0
- package/dist/spa/src/afcl/LinkButton.vue +1 -1
- package/dist/spa/src/afcl/PieChart.vue +5 -5
- package/dist/spa/src/afcl/ProgressBar.vue +7 -7
- package/dist/spa/src/afcl/Select.vue +68 -34
- package/dist/spa/src/afcl/Skeleton.vue +6 -6
- package/dist/spa/src/afcl/Table.vue +199 -71
- 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 +1 -2
- 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 +38 -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/ErrorMessage.vue +21 -0
- 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 +78 -80
- package/dist/spa/src/components/ResourceListTableVirtual.vue +70 -72
- 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 +3 -3
- package/dist/spa/src/components/ThreeDotsMenu.vue +73 -14
- package/dist/spa/src/components/Toast.vue +27 -9
- package/dist/spa/src/components/ValueRenderer.vue +43 -16
- 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 +8 -1
- package/dist/spa/src/stores/core.ts +1 -1
- package/dist/spa/src/stores/modal.ts +6 -1
- package/dist/spa/src/stores/toast.ts +22 -3
- package/dist/spa/src/types/Back.ts +107 -21
- package/dist/spa/src/types/Common.ts +45 -31
- package/dist/spa/src/types/FrontendAPI.ts +15 -2
- 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 +18 -19
- package/dist/spa/src/views/EditView.vue +25 -19
- package/dist/spa/src/views/ListView.vue +124 -79
- package/dist/spa/src/views/LoginView.vue +36 -44
- package/dist/spa/src/views/ResourceParent.vue +2 -2
- package/dist/spa/src/views/ShowView.vue +59 -39
- package/dist/spa/src/websocket.ts +6 -1
- package/dist/spa/tsconfig.app.json +1 -1
- package/dist/spa/vite.config.ts +45 -2
- package/dist/types/Back.d.ts +75 -14
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js +15 -0
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +38 -28
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +15 -1
- 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 +3 -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,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>
|
|
@@ -11,81 +12,83 @@
|
|
|
11
12
|
<component
|
|
12
13
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeBreadcrumbs || []"
|
|
13
14
|
:is="getCustomComponent(c)"
|
|
14
|
-
:meta="c.meta"
|
|
15
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
15
16
|
:resource="coreStore.resource"
|
|
16
17
|
:adminUser="coreStore.adminUser"
|
|
17
18
|
/>
|
|
18
19
|
|
|
19
20
|
<BreadcrumbsWithButtons>
|
|
21
|
+
<component
|
|
22
|
+
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.beforeActionButtons || []"
|
|
23
|
+
:is="getCustomComponent(c)"
|
|
24
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
25
|
+
:resource="coreStore.resource"
|
|
26
|
+
:adminUser="coreStore.adminUser"
|
|
27
|
+
/>
|
|
20
28
|
<button
|
|
21
29
|
@click="()=>{checkboxes = []}"
|
|
22
30
|
v-if="checkboxes.length"
|
|
23
31
|
data-tooltip-target="tooltip-remove-all"
|
|
24
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
32
|
+
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
33
|
>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</div>
|
|
34
|
+
<Tooltip>
|
|
35
|
+
<IconBanOutline class="w-5 h-5 "/>
|
|
36
|
+
<template #tooltip >
|
|
37
|
+
Remove selection
|
|
38
|
+
</template>
|
|
39
|
+
</Tooltip>
|
|
33
40
|
</button>
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
v-if="checkboxes.length"
|
|
42
|
+
<div
|
|
43
|
+
v-if="checkboxes.length"
|
|
37
44
|
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
45
|
>
|
|
47
|
-
<
|
|
48
|
-
v-if="
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{{ action.
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
<button
|
|
47
|
+
v-if="!action.showInThreeDotsDropdown"
|
|
48
|
+
:key="action.id"
|
|
49
|
+
@click="startBulkAction(action.id!)"
|
|
50
|
+
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"
|
|
51
|
+
:class="action.buttonCustomCssClass || ''"
|
|
52
|
+
>
|
|
53
|
+
<component
|
|
54
|
+
v-if="action.icon && !bulkActionLoadingStates[action.id!]"
|
|
55
|
+
:is="getIcon(action.icon)"
|
|
56
|
+
class="w-5 h-5 transition duration-75 group-hover:text-gray-900 dark:group-hover:text-white"></component>
|
|
57
|
+
<div v-if="bulkActionLoadingStates[action.id!]">
|
|
58
|
+
<svg
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
class="w-5 h-5 animate-spin text-gray-200 dark:text-gray-500 fill-gray-500 dark:fill-gray-300"
|
|
61
|
+
viewBox="0 0 100 101"
|
|
62
|
+
fill="none"
|
|
63
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
+
>
|
|
65
|
+
<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"/>
|
|
66
|
+
<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"/>
|
|
67
|
+
</svg>
|
|
68
|
+
<span class="sr-only">Loading...</span>
|
|
69
|
+
</div>
|
|
70
|
+
{{ `${action.label} (${checkboxes.length})` }}
|
|
71
|
+
<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
|
|
72
|
+
font-medium rounded-sm text-xs px-1 ml-1 text-center ">
|
|
73
|
+
{{ action.badge }}
|
|
74
|
+
</div>
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
74
77
|
|
|
75
78
|
<RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
76
79
|
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
77
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-
|
|
80
|
+
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 gap-1"
|
|
78
81
|
>
|
|
79
|
-
<IconPlusOutline class="w-4 h-4
|
|
82
|
+
<IconPlusOutline class="w-4 h-4"/>
|
|
80
83
|
{{ $t('Create') }}
|
|
81
84
|
</RouterLink>
|
|
82
85
|
|
|
83
86
|
<button
|
|
84
|
-
class="flex gap-1 items-center py-1 px-3 me-2 text-sm font-medium text-
|
|
87
|
+
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
88
|
@click="()=>{filtersShow = !filtersShow}"
|
|
86
89
|
v-if="coreStore.resource?.options?.allowedActions?.filter"
|
|
87
90
|
>
|
|
88
|
-
<IconFilterOutline class="w-4 h-4
|
|
91
|
+
<IconFilterOutline class="w-4 h-4"/>
|
|
89
92
|
{{ $t('Filter') }}
|
|
90
93
|
<span
|
|
91
94
|
class="bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-red-400 border border-red-400"
|
|
@@ -95,14 +98,19 @@
|
|
|
95
98
|
</button>
|
|
96
99
|
|
|
97
100
|
<ThreeDotsMenu
|
|
98
|
-
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.list?.threeDotsDropdownItems"
|
|
99
|
-
|
|
101
|
+
:threeDotsDropdownItems="(coreStore.resourceOptions?.pageInjections?.list?.threeDotsDropdownItems as [])"
|
|
102
|
+
:bulkActions="coreStore.resource?.options?.bulkActions"
|
|
103
|
+
:checkboxes="checkboxes"
|
|
104
|
+
@startBulkAction="startBulkAction"
|
|
105
|
+
:updateList="getList"
|
|
106
|
+
:clearCheckboxes="clearCheckboxes"
|
|
107
|
+
></ThreeDotsMenu>
|
|
100
108
|
</BreadcrumbsWithButtons>
|
|
101
109
|
|
|
102
110
|
<component
|
|
103
111
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.afterBreadcrumbs || []"
|
|
104
112
|
:is="getCustomComponent(c)"
|
|
105
|
-
:meta="c.meta"
|
|
113
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
106
114
|
:resource="coreStore.resource"
|
|
107
115
|
:adminUser="coreStore.adminUser"
|
|
108
116
|
/>
|
|
@@ -119,12 +127,23 @@
|
|
|
119
127
|
:pageSize="pageSize"
|
|
120
128
|
:totalRows="totalRows"
|
|
121
129
|
:checkboxes="checkboxes"
|
|
122
|
-
:customActionsInjection="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
123
|
-
|
|
130
|
+
:customActionsInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIcons)
|
|
131
|
+
? coreStore.resourceOptions.pageInjections.list.customActionIcons
|
|
132
|
+
: coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
133
|
+
? [coreStore.resourceOptions.pageInjections.list.customActionIcons]
|
|
134
|
+
: []
|
|
135
|
+
"
|
|
136
|
+
:tableBodyStartInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart)
|
|
137
|
+
? coreStore.resourceOptions.pageInjections.list.tableBodyStart
|
|
138
|
+
: coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart
|
|
139
|
+
? [coreStore.resourceOptions.pageInjections.list.tableBodyStart]
|
|
140
|
+
: []
|
|
141
|
+
"
|
|
124
142
|
:container-height="1100"
|
|
125
143
|
:item-height="52.5"
|
|
126
144
|
:buffer-size="listBufferSize"
|
|
127
145
|
/>
|
|
146
|
+
|
|
128
147
|
<ResourceListTable
|
|
129
148
|
v-else
|
|
130
149
|
:resource="coreStore.resource"
|
|
@@ -138,14 +157,24 @@
|
|
|
138
157
|
:pageSize="pageSize"
|
|
139
158
|
:totalRows="totalRows"
|
|
140
159
|
:checkboxes="checkboxes"
|
|
141
|
-
:customActionsInjection="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
142
|
-
|
|
160
|
+
:customActionsInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.customActionIcons)
|
|
161
|
+
? coreStore.resourceOptions.pageInjections.list.customActionIcons
|
|
162
|
+
: coreStore.resourceOptions?.pageInjections?.list?.customActionIcons
|
|
163
|
+
? [coreStore.resourceOptions.pageInjections.list.customActionIcons]
|
|
164
|
+
: []
|
|
165
|
+
"
|
|
166
|
+
:tableBodyStartInjection="Array.isArray(coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart)
|
|
167
|
+
? coreStore.resourceOptions.pageInjections.list.tableBodyStart
|
|
168
|
+
: coreStore.resourceOptions?.pageInjections?.list?.tableBodyStart
|
|
169
|
+
? [coreStore.resourceOptions.pageInjections.list.tableBodyStart]
|
|
170
|
+
: []
|
|
171
|
+
"
|
|
143
172
|
/>
|
|
144
173
|
|
|
145
174
|
<component
|
|
146
175
|
v-for="c in coreStore?.resourceOptions?.pageInjections?.list?.bottom || []"
|
|
147
176
|
:is="getCustomComponent(c)"
|
|
148
|
-
:meta="c.meta"
|
|
177
|
+
:meta="(c as AdminForthComponentDeclarationFull).meta"
|
|
149
178
|
:resource="coreStore.resource"
|
|
150
179
|
:adminUser="coreStore.adminUser"
|
|
151
180
|
/>
|
|
@@ -165,6 +194,8 @@ import { useRoute } from 'vue-router';
|
|
|
165
194
|
import { showErrorTost } from '@/composables/useFrontendApi'
|
|
166
195
|
import { getCustomComponent, initThreeDotsDropdown } from '@/utils';
|
|
167
196
|
import ThreeDotsMenu from '@/components/ThreeDotsMenu.vue';
|
|
197
|
+
import { Tooltip } from '@/afcl'
|
|
198
|
+
import type { AdminForthComponentDeclarationFull } from '@/types/Common';
|
|
168
199
|
|
|
169
200
|
|
|
170
201
|
import {
|
|
@@ -185,7 +216,7 @@ const route = useRoute();
|
|
|
185
216
|
|
|
186
217
|
const page = ref(1);
|
|
187
218
|
const columnsMinMax = ref({});
|
|
188
|
-
const sort = ref(
|
|
219
|
+
const sort = ref();
|
|
189
220
|
|
|
190
221
|
watch(() => sort, async (to, from) => {
|
|
191
222
|
// in store sort might be needed for plugins
|
|
@@ -229,11 +260,11 @@ async function getList() {
|
|
|
229
260
|
totalRows.value = 0;
|
|
230
261
|
return {error: data.error};
|
|
231
262
|
}
|
|
232
|
-
rows.value = data.data?.map(row => {
|
|
233
|
-
if (coreStore.resource
|
|
234
|
-
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)
|
|
235
|
-
} else {
|
|
236
|
-
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)
|
|
263
|
+
rows.value = data.data?.map((row: any) => {
|
|
264
|
+
if (coreStore.resource?.columns?.find(c => c.primaryKey)?.foreignResource) {
|
|
265
|
+
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)!.name].pk;
|
|
266
|
+
} else if (coreStore.resource) {
|
|
267
|
+
row._primaryKeyValue = row[coreStore.resource.columns.find(c => c.primaryKey)!.name];
|
|
237
268
|
}
|
|
238
269
|
return row;
|
|
239
270
|
});
|
|
@@ -245,6 +276,10 @@ async function getList() {
|
|
|
245
276
|
return {}
|
|
246
277
|
}
|
|
247
278
|
|
|
279
|
+
function clearCheckboxes() {
|
|
280
|
+
checkboxes.value = [];
|
|
281
|
+
}
|
|
282
|
+
|
|
248
283
|
async function refreshExistingList(pk?: any) {
|
|
249
284
|
const currentData = rows.value;
|
|
250
285
|
if (!currentData) {
|
|
@@ -297,9 +332,9 @@ async function refreshExistingList(pk?: any) {
|
|
|
297
332
|
}
|
|
298
333
|
|
|
299
334
|
|
|
300
|
-
async function startBulkAction(actionId) {
|
|
301
|
-
const action = coreStore.resource
|
|
302
|
-
if (action
|
|
335
|
+
async function startBulkAction(actionId: string) {
|
|
336
|
+
const action = coreStore.resource?.options?.bulkActions?.find(a => a.id === actionId);
|
|
337
|
+
if (action?.confirm) {
|
|
303
338
|
const confirmed = await adminforth.confirm({
|
|
304
339
|
message: action.confirm,
|
|
305
340
|
});
|
|
@@ -339,10 +374,10 @@ async function startBulkAction(actionId) {
|
|
|
339
374
|
|
|
340
375
|
|
|
341
376
|
class SortQuerySerializer {
|
|
342
|
-
static serialize(sort) {
|
|
377
|
+
static serialize(sort: {field: string, direction: 'asc' | 'desc'}[]) {
|
|
343
378
|
return sort.map(s => `${s.field}__${s.direction}`).join(',');
|
|
344
379
|
}
|
|
345
|
-
static deserialize(str) {
|
|
380
|
+
static deserialize(str: string) {
|
|
346
381
|
return str.split(',').map(s => {
|
|
347
382
|
const [field, direction] = s.split('__');
|
|
348
383
|
return { field, direction };
|
|
@@ -355,7 +390,7 @@ let listAutorefresher: any = null;
|
|
|
355
390
|
async function init() {
|
|
356
391
|
|
|
357
392
|
await coreStore.fetchResourceFull({
|
|
358
|
-
resourceId: route.params.resourceId
|
|
393
|
+
resourceId: route.params.resourceId as string
|
|
359
394
|
});
|
|
360
395
|
isPageLoaded.value = true;
|
|
361
396
|
// !!! clear filters should be in same tick with sort assignment so that watch can catch it as one change
|
|
@@ -366,7 +401,7 @@ async function init() {
|
|
|
366
401
|
return {
|
|
367
402
|
field,
|
|
368
403
|
operator,
|
|
369
|
-
value: JSON.parse(decodeURIComponent(route.query[k]))
|
|
404
|
+
value: JSON.parse(decodeURIComponent(route.query[k] as string))
|
|
370
405
|
}
|
|
371
406
|
});
|
|
372
407
|
if (filters.length) {
|
|
@@ -376,8 +411,8 @@ async function init() {
|
|
|
376
411
|
}
|
|
377
412
|
|
|
378
413
|
if (route.query.sort) {
|
|
379
|
-
sort.value = SortQuerySerializer.deserialize(route.query.sort);
|
|
380
|
-
} else if (coreStore
|
|
414
|
+
sort.value = SortQuerySerializer.deserialize(route.query.sort as string);
|
|
415
|
+
} else if (coreStore?.resource?.options?.defaultSort) {
|
|
381
416
|
sort.value = [{
|
|
382
417
|
field: coreStore.resource.options.defaultSort.columnName,
|
|
383
418
|
direction: coreStore.resource.options.defaultSort.direction
|
|
@@ -387,7 +422,7 @@ async function init() {
|
|
|
387
422
|
}
|
|
388
423
|
// page init should be also in same tick
|
|
389
424
|
if (route.query.page) {
|
|
390
|
-
page.value = parseInt(route.query.page);
|
|
425
|
+
page.value = parseInt(route.query.page as string);
|
|
391
426
|
}
|
|
392
427
|
|
|
393
428
|
// getList(); - Not needed here, watch will trigger it
|
|
@@ -416,8 +451,18 @@ watch([page, sort, () => filtersStore.filters], async () => {
|
|
|
416
451
|
}, { deep: true });
|
|
417
452
|
|
|
418
453
|
adminforth.list.refresh = async () => {
|
|
419
|
-
|
|
420
|
-
|
|
454
|
+
const result = await getList();
|
|
455
|
+
|
|
456
|
+
if (!result) {
|
|
457
|
+
return {};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if ('error' in result && result.error != null) {
|
|
461
|
+
return { error: String(result.error) };
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return {};
|
|
465
|
+
};
|
|
421
466
|
|
|
422
467
|
adminforth.list.silentRefresh = async () => {
|
|
423
468
|
return await refreshExistingList();
|
|
@@ -437,10 +482,10 @@ watch(() => filtersStore.filters, async (to, from) => {
|
|
|
437
482
|
page.value = 1;
|
|
438
483
|
checkboxes.value = []; // TODO: not sure absolutely needed here
|
|
439
484
|
// update query param for each filter as filter_<column_name>=value
|
|
440
|
-
const query = {};
|
|
485
|
+
const query: Record<string, string | undefined> = {};
|
|
441
486
|
const currentQ = currentQuery();
|
|
442
487
|
filtersStore.filters.forEach(f => {
|
|
443
|
-
if (f.value) {
|
|
488
|
+
if (f.value !== undefined && f.value !== null && f.value !== '') {
|
|
444
489
|
query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(JSON.stringify(f.value));
|
|
445
490
|
}
|
|
446
491
|
});
|
|
@@ -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
|
|
|
@@ -27,19 +27,19 @@
|
|
|
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-
|
|
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="af-login-modal-header 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>
|
|
@@ -47,28 +47,28 @@
|
|
|
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-
|
|
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
|
+
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
59
|
class="w-full"
|
|
60
60
|
placeholder="name@company.com" required />
|
|
61
61
|
</div>
|
|
62
62
|
<div class="">
|
|
63
|
-
<label for="password" class="block mb-2 text-sm font-medium text-
|
|
63
|
+
<label for="password" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your password') }}</label>
|
|
64
64
|
<Input
|
|
65
|
+
v-model="password"
|
|
65
66
|
ref="passwordInput"
|
|
66
67
|
autocomplete="current-password"
|
|
67
|
-
oninput="setCustomValidity('')"
|
|
68
68
|
@keydown.enter="login"
|
|
69
69
|
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="w-full" required>
|
|
70
70
|
<template #rightIcon>
|
|
71
|
-
<button type="button" @click="showPw = !showPw" class="text-
|
|
71
|
+
<button type="button" @click="showPw = !showPw" class="text-lightLoginViewSubTextColor dark:text-darkLoginViewSubTextColor">
|
|
72
72
|
<IconEyeSolid class="w-5 h-5" v-if="!showPw" />
|
|
73
73
|
<IconEyeSlashSolid class="w-5 h-5" v-else />
|
|
74
74
|
</button>
|
|
@@ -92,24 +92,16 @@
|
|
|
92
92
|
:meta="c.meta"
|
|
93
93
|
/>
|
|
94
94
|
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<span class="sr-only">{{ $t('Info') }}</span>
|
|
100
|
-
<div>
|
|
101
|
-
{{ error }}
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div v-if="coreStore.config?.loginPromptHTML"
|
|
106
|
-
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"
|
|
95
|
+
<ErrorMessage :error="error" />
|
|
96
|
+
|
|
97
|
+
<div v-if="loginPromptHTML"
|
|
98
|
+
class="flex items-center p-4 mb-4 text-sm text-lightLoginViewPromptText rounded-lg bg-lightLoginViewPromptBackground dark:bg-darkLoginViewPromptBackground dark:text-darkLoginViewPromptText" role="alert"
|
|
107
99
|
>
|
|
108
100
|
<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">
|
|
109
101
|
<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"/>
|
|
110
102
|
</svg>
|
|
111
103
|
<span class="sr-only">{{ $t('Info') }}</span>
|
|
112
|
-
<div v-html="
|
|
104
|
+
<div v-html="loginPromptHTML"></div>
|
|
113
105
|
</div>
|
|
114
106
|
<Button @click="login" :loader="inProgress" :disabled="inProgress" class="w-full">
|
|
115
107
|
{{ $t('Login to your account') }}
|
|
@@ -136,17 +128,20 @@ import { callAdminForthApi, loadFile } from '@/utils';
|
|
|
136
128
|
import { useRoute, useRouter } from 'vue-router';
|
|
137
129
|
import { Button, Checkbox, Input } from '@/afcl';
|
|
138
130
|
import { useI18n } from 'vue-i18n';
|
|
131
|
+
import ErrorMessage from '@/components/ErrorMessage.vue';
|
|
139
132
|
|
|
140
133
|
const { t } = useI18n();
|
|
141
134
|
|
|
142
135
|
const passwordInput = ref(null);
|
|
143
136
|
const usernameInput = ref(null);
|
|
144
137
|
const rememberMeValue= ref(false);
|
|
138
|
+
const username = ref('');
|
|
139
|
+
const password = ref('');
|
|
145
140
|
|
|
146
141
|
const route = useRoute();
|
|
147
142
|
const router = useRouter();
|
|
148
143
|
const inProgress = ref(false);
|
|
149
|
-
|
|
144
|
+
const loginPromptHTML = ref()
|
|
150
145
|
const coreStore = useCoreStore();
|
|
151
146
|
const user = useUserStore();
|
|
152
147
|
|
|
@@ -158,6 +153,15 @@ const backgroundPosition = computed(() => {
|
|
|
158
153
|
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
159
154
|
});
|
|
160
155
|
|
|
156
|
+
|
|
157
|
+
async function getLoginFormConfig() {
|
|
158
|
+
const response = await callAdminForthApi({
|
|
159
|
+
path: '/get_login_form_config',
|
|
160
|
+
method: 'GET',
|
|
161
|
+
});
|
|
162
|
+
loginPromptHTML.value = response.loginPromptHTML;
|
|
163
|
+
}
|
|
164
|
+
|
|
161
165
|
onBeforeMount(() => {
|
|
162
166
|
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
163
167
|
// if route has next param, redirect
|
|
@@ -171,29 +175,17 @@ onBeforeMount(() => {
|
|
|
171
175
|
})
|
|
172
176
|
|
|
173
177
|
onMounted(async () => {
|
|
178
|
+
getLoginFormConfig();
|
|
174
179
|
if (coreStore.config?.demoCredentials) {
|
|
175
|
-
const [
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
const [demoUsername, demoPassword] = coreStore.config.demoCredentials.split(':');
|
|
181
|
+
username.value = demoUsername;
|
|
182
|
+
password.value = demoPassword;
|
|
178
183
|
}
|
|
179
184
|
usernameInput.value.focus();
|
|
180
185
|
});
|
|
181
186
|
|
|
182
187
|
|
|
183
188
|
async function login() {
|
|
184
|
-
|
|
185
|
-
const username = usernameInput.value.value;
|
|
186
|
-
const password = passwordInput.value.value;
|
|
187
|
-
|
|
188
|
-
if (!username) {
|
|
189
|
-
usernameInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
if (!password) {
|
|
193
|
-
passwordInput.value.setCustomValidity(t('Please fill out this field.'));
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
189
|
if (inProgress.value) {
|
|
198
190
|
return;
|
|
199
191
|
}
|
|
@@ -202,8 +194,8 @@ async function login() {
|
|
|
202
194
|
path: '/login',
|
|
203
195
|
method: 'POST',
|
|
204
196
|
body: {
|
|
205
|
-
username,
|
|
206
|
-
password,
|
|
197
|
+
username: username.value,
|
|
198
|
+
password: password.value,
|
|
207
199
|
rememberMe: rememberMeValue.value,
|
|
208
200
|
}
|
|
209
201
|
});
|
|
@@ -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/>
|
|
@@ -33,7 +33,7 @@ const limitHeightToPage = computed(() => {
|
|
|
33
33
|
}
|
|
34
34
|
const listPageInjects = coreStore.resource.options.pageInjections.list;
|
|
35
35
|
|
|
36
|
-
for (const pi of [listPageInjects.beforeBreadcrumbs, listPageInjects.afterBreadcrumbs, listPageInjects.bottom]) {
|
|
36
|
+
for (const pi of [listPageInjects.beforeBreadcrumbs, listPageInjects.beforeActionButtons, listPageInjects.afterBreadcrumbs, listPageInjects.bottom]) {
|
|
37
37
|
if (pi) {
|
|
38
38
|
for (const piItem of pi) {
|
|
39
39
|
if (!piItem.meta?.thinEnoughToShrinkTable) {
|