adminforth 1.3.54-next.9 → 1.3.55-next.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.
- package/dist/auth.d.ts +31 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +42 -56
- package/dist/auth.js.map +1 -0
- package/dist/basePlugin.d.ts +18 -0
- package/dist/basePlugin.d.ts.map +1 -0
- package/dist/basePlugin.js +1 -0
- package/dist/basePlugin.js.map +1 -0
- package/dist/dataConnectors/baseConnector.d.ts +94 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -0
- package/dist/dataConnectors/baseConnector.js +108 -122
- package/dist/dataConnectors/baseConnector.js.map +1 -0
- package/dist/dataConnectors/clickhouse.d.ts +92 -0
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -0
- package/dist/dataConnectors/clickhouse.js +132 -149
- package/dist/dataConnectors/clickhouse.js.map +1 -0
- package/dist/dataConnectors/mongo.d.ts +93 -0
- package/dist/dataConnectors/mongo.d.ts.map +1 -0
- package/dist/dataConnectors/mongo.js +75 -101
- package/dist/dataConnectors/mongo.js.map +1 -0
- package/dist/dataConnectors/postgres.d.ts +71 -0
- package/dist/dataConnectors/postgres.d.ts.map +1 -0
- package/dist/dataConnectors/postgres.js +124 -143
- package/dist/dataConnectors/postgres.js.map +1 -0
- package/dist/dataConnectors/sqlite.d.ts +67 -0
- package/dist/dataConnectors/sqlite.d.ts.map +1 -0
- package/dist/dataConnectors/sqlite.js +113 -130
- package/dist/dataConnectors/sqlite.js.map +1 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +197 -217
- package/dist/index.js.map +1 -0
- package/dist/modules/codeInjector.d.ts +35 -0
- package/dist/modules/codeInjector.d.ts.map +1 -0
- package/dist/modules/codeInjector.js +480 -486
- package/dist/modules/codeInjector.js.map +1 -0
- package/dist/modules/configValidator.d.ts +12 -0
- package/dist/modules/configValidator.d.ts.map +1 -0
- package/dist/modules/configValidator.js +31 -22
- package/dist/modules/configValidator.js.map +1 -0
- package/dist/modules/operationalResource.d.ts +17 -0
- package/dist/modules/operationalResource.d.ts.map +1 -0
- package/dist/modules/operationalResource.js +50 -70
- package/dist/modules/operationalResource.js.map +1 -0
- package/dist/modules/restApi.d.ts +10 -0
- package/dist/modules/restApi.d.ts.map +1 -0
- package/dist/modules/restApi.js +104 -116
- package/dist/modules/restApi.js.map +1 -0
- package/dist/modules/styleGenerator.d.ts +9 -0
- package/dist/modules/styleGenerator.d.ts.map +1 -0
- package/dist/modules/styleGenerator.js +1 -0
- package/dist/modules/styleGenerator.js.map +1 -0
- package/dist/modules/styles.d.ts +96 -0
- package/dist/modules/styles.d.ts.map +1 -0
- package/dist/modules/styles.js +1 -0
- package/dist/modules/styles.js.map +1 -0
- package/dist/modules/utils.d.ts +39 -0
- package/dist/modules/utils.d.ts.map +1 -0
- package/dist/modules/utils.js +1 -0
- package/dist/modules/utils.js.map +1 -0
- package/dist/plugins/audit-log/types.d.ts +35 -0
- package/dist/plugins/audit-log/types.d.ts.map +1 -0
- package/dist/plugins/audit-log/types.js +2 -0
- package/dist/plugins/audit-log/types.js.map +1 -0
- package/dist/plugins/chat-gpt/types.d.ts +82 -0
- package/dist/plugins/chat-gpt/types.d.ts.map +1 -0
- package/dist/plugins/chat-gpt/types.js +2 -0
- package/dist/plugins/chat-gpt/types.js.map +1 -0
- package/dist/plugins/email-password-reset/types.d.ts +28 -0
- package/dist/plugins/email-password-reset/types.d.ts.map +1 -0
- package/dist/plugins/email-password-reset/types.js +2 -0
- package/dist/plugins/email-password-reset/types.js.map +1 -0
- package/dist/plugins/foreign-inline-list/types.d.ts +19 -0
- package/dist/plugins/foreign-inline-list/types.d.ts.map +1 -0
- package/dist/plugins/foreign-inline-list/types.js +2 -0
- package/dist/plugins/foreign-inline-list/types.js.map +1 -0
- package/dist/plugins/import-export/types.d.ts +3 -0
- package/dist/plugins/import-export/types.d.ts.map +1 -0
- package/dist/plugins/import-export/types.js +2 -0
- package/dist/plugins/import-export/types.js.map +1 -0
- package/dist/plugins/rich-editor/custom/async-queue.d.ts +8 -0
- package/dist/plugins/rich-editor/custom/async-queue.d.ts.map +1 -0
- package/dist/plugins/rich-editor/custom/async-queue.js +29 -0
- package/dist/plugins/rich-editor/custom/async-queue.js.map +1 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts +8 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts.map +1 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.js +29 -0
- package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +1 -0
- package/dist/plugins/rich-editor/types.d.ts +153 -0
- package/dist/plugins/rich-editor/types.d.ts.map +1 -0
- package/dist/plugins/rich-editor/types.js +16 -0
- package/dist/plugins/rich-editor/types.js.map +1 -0
- package/dist/plugins/two-factors-auth/types.d.ts +18 -0
- package/dist/plugins/two-factors-auth/types.d.ts.map +1 -0
- package/dist/plugins/two-factors-auth/types.js +2 -0
- package/dist/plugins/two-factors-auth/types.js.map +1 -0
- package/dist/plugins/upload/types.d.ts +132 -0
- package/dist/plugins/upload/types.d.ts.map +1 -0
- package/dist/plugins/upload/types.js +2 -0
- package/dist/plugins/upload/types.js.map +1 -0
- package/dist/servers/express.d.ts +18 -0
- package/dist/servers/express.d.ts.map +1 -0
- package/dist/servers/express.js +30 -42
- package/dist/servers/express.js.map +1 -0
- package/dist/types/AdminForthConfig.d.ts +1619 -0
- package/dist/types/AdminForthConfig.d.ts.map +1 -0
- package/dist/types/AdminForthConfig.js +1 -0
- package/dist/types/AdminForthConfig.js.map +1 -0
- package/{types/FrontendAPI.ts → dist/types/FrontendAPI.d.ts} +27 -52
- package/dist/types/FrontendAPI.d.ts.map +1 -0
- package/dist/types/FrontendAPI.js +1 -0
- package/dist/types/FrontendAPI.js.map +1 -0
- package/package.json +15 -5
- package/auth.ts +0 -140
- package/basePlugin.ts +0 -70
- package/dataConnectors/baseConnector.ts +0 -216
- package/dataConnectors/clickhouse.ts +0 -338
- package/dataConnectors/mongo.ts +0 -202
- package/dataConnectors/postgres.ts +0 -306
- package/dataConnectors/sqlite.ts +0 -254
- package/dist/spa/.eslintrc.cjs +0 -14
- package/dist/spa/README.md +0 -39
- package/dist/spa/env.d.ts +0 -1
- package/dist/spa/index.html +0 -23
- package/dist/spa/package-lock.json +0 -4573
- package/dist/spa/package.json +0 -49
- package/dist/spa/postcss.config.js +0 -6
- package/dist/spa/public/assets/favicon.png +0 -0
- package/dist/spa/src/App.vue +0 -314
- package/dist/spa/src/assets/base.css +0 -2
- package/dist/spa/src/assets/logo.svg +0 -19
- package/dist/spa/src/components/AcceptModal.vue +0 -45
- package/dist/spa/src/components/Breadcrumbs.vue +0 -41
- package/dist/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
- package/dist/spa/src/components/CustomDatePicker.vue +0 -176
- package/dist/spa/src/components/CustomDateRangePicker.vue +0 -218
- package/dist/spa/src/components/CustomRangePicker.vue +0 -152
- package/dist/spa/src/components/Dropdown.vue +0 -168
- package/dist/spa/src/components/Filters.vue +0 -222
- package/dist/spa/src/components/HelloWorld.vue +0 -17
- package/dist/spa/src/components/MenuLink.vue +0 -24
- package/dist/spa/src/components/ResourceForm.vue +0 -294
- package/dist/spa/src/components/ResourceListTable.vue +0 -394
- package/dist/spa/src/components/SingleSkeletLoader.vue +0 -13
- package/dist/spa/src/components/SkeleteLoader.vue +0 -23
- package/dist/spa/src/components/Toast.vue +0 -77
- package/dist/spa/src/components/ValueRenderer.vue +0 -66
- package/dist/spa/src/components/icons/IconCalendar.vue +0 -5
- package/dist/spa/src/components/icons/IconCommunity.vue +0 -7
- package/dist/spa/src/components/icons/IconDocumentation.vue +0 -7
- package/dist/spa/src/components/icons/IconEcosystem.vue +0 -7
- package/dist/spa/src/components/icons/IconSupport.vue +0 -7
- package/dist/spa/src/components/icons/IconTime.vue +0 -5
- package/dist/spa/src/components/icons/IconTooling.vue +0 -19
- package/dist/spa/src/composables/useFrontendApi.ts +0 -26
- package/dist/spa/src/composables/useStores.ts +0 -127
- package/dist/spa/src/index.scss +0 -27
- package/dist/spa/src/main.ts +0 -18
- package/dist/spa/src/router/index.ts +0 -63
- package/dist/spa/src/spa_types/core.ts +0 -51
- package/dist/spa/src/stores/core.ts +0 -144
- package/dist/spa/src/stores/filters.ts +0 -22
- package/dist/spa/src/stores/modal.ts +0 -48
- package/dist/spa/src/stores/toast.ts +0 -15
- package/dist/spa/src/stores/user.ts +0 -72
- package/dist/spa/src/types/AdminForthConfig.ts +0 -1477
- package/dist/spa/src/types/FrontendAPI.ts +0 -121
- package/dist/spa/src/utils.ts +0 -103
- package/dist/spa/src/views/CreateView.vue +0 -156
- package/dist/spa/src/views/EditView.vue +0 -157
- package/dist/spa/src/views/ListView.vue +0 -258
- package/dist/spa/src/views/LoginView.vue +0 -160
- package/dist/spa/src/views/ResourceParent.vue +0 -17
- package/dist/spa/src/views/ShowView.vue +0 -184
- package/dist/spa/tailwind.config.js +0 -17
- package/dist/spa/tsconfig.app.json +0 -14
- package/dist/spa/tsconfig.json +0 -11
- package/dist/spa/tsconfig.node.json +0 -19
- package/dist/spa/vite.config.ts +0 -56
- package/index.ts +0 -428
- package/modules/codeInjector.ts +0 -736
- package/modules/configValidator.ts +0 -571
- package/modules/operationalResource.ts +0 -98
- package/modules/restApi.ts +0 -718
- package/modules/styleGenerator.ts +0 -55
- package/modules/styles.ts +0 -126
- package/modules/utils.ts +0 -472
- package/servers/express.ts +0 -259
- package/spa/.eslintrc.cjs +0 -14
- package/spa/README.md +0 -39
- package/spa/env.d.ts +0 -1
- package/spa/index.html +0 -23
- package/spa/package-lock.json +0 -4602
- package/spa/package.json +0 -51
- package/spa/postcss.config.js +0 -6
- package/spa/public/assets/favicon.png +0 -0
- package/spa/src/App.vue +0 -418
- package/spa/src/assets/base.css +0 -2
- package/spa/src/assets/logo.svg +0 -19
- package/spa/src/components/AcceptModal.vue +0 -45
- package/spa/src/components/Breadcrumbs.vue +0 -41
- package/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
- package/spa/src/components/CustomDatePicker.vue +0 -176
- package/spa/src/components/CustomDateRangePicker.vue +0 -218
- package/spa/src/components/CustomRangePicker.vue +0 -156
- package/spa/src/components/Dropdown.vue +0 -168
- package/spa/src/components/Filters.vue +0 -222
- package/spa/src/components/HelloWorld.vue +0 -17
- package/spa/src/components/MenuLink.vue +0 -27
- package/spa/src/components/ResourceForm.vue +0 -290
- package/spa/src/components/ResourceListTable.vue +0 -466
- package/spa/src/components/SingleSkeletLoader.vue +0 -13
- package/spa/src/components/SkeleteLoader.vue +0 -23
- package/spa/src/components/ThreeDotsMenu.vue +0 -43
- package/spa/src/components/Toast.vue +0 -78
- package/spa/src/components/ValueRenderer.vue +0 -114
- package/spa/src/components/icons/IconCalendar.vue +0 -5
- package/spa/src/components/icons/IconCommunity.vue +0 -7
- package/spa/src/components/icons/IconDocumentation.vue +0 -7
- package/spa/src/components/icons/IconEcosystem.vue +0 -7
- package/spa/src/components/icons/IconSupport.vue +0 -7
- package/spa/src/components/icons/IconTime.vue +0 -5
- package/spa/src/components/icons/IconTooling.vue +0 -19
- package/spa/src/composables/useFrontendApi.ts +0 -26
- package/spa/src/composables/useStores.ts +0 -131
- package/spa/src/index.scss +0 -31
- package/spa/src/main.ts +0 -18
- package/spa/src/renderers/CompactUUID.vue +0 -48
- package/spa/src/renderers/CountryFlag.vue +0 -69
- package/spa/src/router/index.ts +0 -59
- package/spa/src/spa_types/core.ts +0 -53
- package/spa/src/stores/core.ts +0 -148
- package/spa/src/stores/filters.ts +0 -27
- package/spa/src/stores/modal.ts +0 -48
- package/spa/src/stores/toast.ts +0 -31
- package/spa/src/stores/user.ts +0 -72
- package/spa/src/utils.ts +0 -160
- package/spa/src/views/CreateView.vue +0 -167
- package/spa/src/views/EditView.vue +0 -170
- package/spa/src/views/ListView.vue +0 -352
- package/spa/src/views/LoginView.vue +0 -192
- package/spa/src/views/ResourceParent.vue +0 -17
- package/spa/src/views/ShowView.vue +0 -186
- package/spa/tailwind.config.js +0 -17
- package/spa/tsconfig.app.json +0 -14
- package/spa/tsconfig.json +0 -11
- package/spa/tsconfig.node.json +0 -19
- package/spa/vite.config.ts +0 -56
- package/tsconfig.json +0 -112
- package/types/AdminForthConfig.ts +0 -1762
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- table -->
|
|
3
|
-
<div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-darkListTableShadow overflow-y-hidden rounded-default">
|
|
4
|
-
|
|
5
|
-
<!-- skelet loader -->
|
|
6
|
-
<div role="status" v-if="!resource || !resource.columns"
|
|
7
|
-
class="max-w p-4 space-y-4 divide-y divide-gray-200 rounded shadow animate-pulse dark:divide-gray-700 md:p-6 dark:border-gray-700">
|
|
8
|
-
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<table v-else class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
|
|
12
|
-
<thead class="text-xs text-view-table-heading-text bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400">
|
|
13
|
-
<tr>
|
|
14
|
-
<th scope="col" class="p-4">
|
|
15
|
-
<div v-if="rows && rows.length" class="flex items-center">
|
|
16
|
-
<input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
|
|
17
|
-
class="w-4 h-4 cursor-pointer text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600">
|
|
18
|
-
<label for="checkbox-all-search" class="sr-only">checkbox</label>
|
|
19
|
-
</div>
|
|
20
|
-
</th>
|
|
21
|
-
|
|
22
|
-
<th v-for="c in columnsListed" scope="col" class="px-6 py-3">
|
|
23
|
-
|
|
24
|
-
<div @click="() => c.sortable && onSortButtonClick(c.name)" class="flex items-center " :class="{'cursor-pointer':c.sortable}">
|
|
25
|
-
{{ c.label }}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<div v-if="c.sortable"
|
|
29
|
-
:style="{ 'color':ascArr.includes(c.name)?'green':descArr.includes(c.name)?'red':'currentColor'}">
|
|
30
|
-
<svg v-if="ascArr.includes(c.name) || descArr.includes(c.name)" class="w-3 h-3 ms-1.5"
|
|
31
|
-
:class="{'rotate-180':descArr.includes(c.name)}" viewBox="0 0 24 24">
|
|
32
|
-
<path
|
|
33
|
-
d="M8.574 11.024h6.852a2.075 2.075 0 0 0 1.847-1.086 1.9 1.9 0 0 0-.11-1.986L13.736 2.9a2.122 2.122 0 0 0-3.472 0L6.837 7.952a1.9 1.9 0 0 0-.11 1.986 2.074 2.074 0 0 0 1.847"/>
|
|
34
|
-
</svg>
|
|
35
|
-
<svg v-else class="w-3 h-3 ms-1.5 opacity-30" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
|
|
36
|
-
fill='currentColor'
|
|
37
|
-
viewBox="0 0 24 24">
|
|
38
|
-
<path
|
|
39
|
-
d="M8.574 11.024h6.852a2.075 2.075 0 0 0 1.847-1.086 1.9 1.9 0 0 0-.11-1.986L13.736 2.9a2.122 2.122 0 0 0-3.472 0L6.837 7.952a1.9 1.9 0 0 0-.11 1.986 2.074 2.074 0 0 0 1.847 1.086Zm6.852 1.952H8.574a2.072 2.072 0 0 0-1.847 1.087 1.9 1.9 0 0 0 .11 1.985l3.426 5.05a2.123 2.123 0 0 0 3.472 0l3.427-5.05a1.9 1.9 0 0 0 .11-1.985 2.074 2.074 0 0 0-1.846-1.087Z"/>
|
|
40
|
-
</svg>
|
|
41
|
-
</div>
|
|
42
|
-
<span
|
|
43
|
-
class="bg-red-100 text-red-800 text-xs font-medium me-1 px-1 py-0.5 rounded dark:bg-gray-700 dark:text-red-400 border border-red-400"
|
|
44
|
-
v-if="sort.findIndex((s) => s.field === c.name) !== -1 && sort?.length > 1">
|
|
45
|
-
{{ sort.findIndex((s) => s.field === c.name) + 1 }}
|
|
46
|
-
</span>
|
|
47
|
-
|
|
48
|
-
</div>
|
|
49
|
-
</th>
|
|
50
|
-
|
|
51
|
-
<th scope="col" class="px-6 py-3">
|
|
52
|
-
Actions
|
|
53
|
-
</th>
|
|
54
|
-
</tr>
|
|
55
|
-
</thead>
|
|
56
|
-
<tbody>
|
|
57
|
-
<SkeleteLoader v-if="!rows" :columns="3" :rows="resource?.columns.length + 2"/>
|
|
58
|
-
<tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder">
|
|
59
|
-
<td :colspan="resource?.columns.length + 2">
|
|
60
|
-
|
|
61
|
-
<div id="toast-simple"
|
|
62
|
-
class=" mx-auto my-5 flex items-center w-full max-w-xs p-4 space-x-4 rtl:space-x-reverse text-gray-500 divide-x rtl:divide-x-reverse divide-gray-200 dark:text-gray-400 dark:divide-gray-700 space-x dark:bg-gray-800"
|
|
63
|
-
role="alert">
|
|
64
|
-
<IconInboxOutline class="w-6 h-6 text-gray-500 dark:text-gray-400"/>
|
|
65
|
-
<div class="ps-4 text-sm font-normal">No items here yet</div>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
</td>
|
|
69
|
-
</tr>
|
|
70
|
-
|
|
71
|
-
<tr @click="onClick($event,row)" v-else v-for="(row, rowI) in rows" :key="row.id"
|
|
72
|
-
class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover cursor-pointer"
|
|
73
|
-
:class="{'border-b': rowI !== rows.length - 1}"
|
|
74
|
-
>
|
|
75
|
-
<td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
76
|
-
<div class="flex items center ">
|
|
77
|
-
<input
|
|
78
|
-
@click="(e)=>{e.stopPropagation()}"
|
|
79
|
-
id="checkbox-table-search-1"
|
|
80
|
-
type="checkbox"
|
|
81
|
-
:checked="checkboxesInternal.includes(row.id)"
|
|
82
|
-
@change="(e)=>{addToCheckedValues(row.id)}"
|
|
83
|
-
class="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 cursor-pointer">
|
|
84
|
-
<label for="checkbox-table-search-1" class="sr-only">checkbox</label>
|
|
85
|
-
</div>
|
|
86
|
-
</td>
|
|
87
|
-
<td v-for="c in columnsListed" class="px-6 py-4">
|
|
88
|
-
<!-- if c.name in listComponentsPerColumn, render it. If not, render ValueRenderer -->
|
|
89
|
-
<component
|
|
90
|
-
:is="c?.components?.list ? getCustomComponent(c.components.list) : ValueRenderer"
|
|
91
|
-
:meta="c?.components?.list?.meta"
|
|
92
|
-
:column="c"
|
|
93
|
-
:record="row"
|
|
94
|
-
:adminUser="coreStore.adminUser"
|
|
95
|
-
:resource="resource"
|
|
96
|
-
/>
|
|
97
|
-
</td>
|
|
98
|
-
<td class=" items-center px-6 py-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
|
|
99
|
-
<div class="flex">
|
|
100
|
-
<RouterLink
|
|
101
|
-
v-if="resource.options?.allowedActions.show"
|
|
102
|
-
:to="{
|
|
103
|
-
name: 'resource-show',
|
|
104
|
-
params: {
|
|
105
|
-
resourceId: resource.resourceId,
|
|
106
|
-
primaryKey: row._primaryKeyValue,
|
|
107
|
-
}
|
|
108
|
-
}"
|
|
109
|
-
class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
|
|
110
|
-
:data-tooltip-target="`tooltip-show-${rowI}`"
|
|
111
|
-
>
|
|
112
|
-
<IconEyeSolid class="w-5 h-5 me-2"/>
|
|
113
|
-
</RouterLink>
|
|
114
|
-
|
|
115
|
-
<div :id="`tooltip-show-${rowI}`"
|
|
116
|
-
role="tooltip"
|
|
117
|
-
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">
|
|
118
|
-
Show item
|
|
119
|
-
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<RouterLink v-if="resource.options?.allowedActions.edit"
|
|
123
|
-
:to="{
|
|
124
|
-
name: 'resource-edit',
|
|
125
|
-
params: {
|
|
126
|
-
resourceId: resource.resourceId,
|
|
127
|
-
primaryKey: row._primaryKeyValue
|
|
128
|
-
}
|
|
129
|
-
}"
|
|
130
|
-
class="font-medium text-blue-600 dark:text-blue-500 hover:underline ms-3"
|
|
131
|
-
:data-tooltip-target="`tooltip-edit-${rowI}`"
|
|
132
|
-
>
|
|
133
|
-
<IconPenSolid class="w-5 h-5 me-2"/>
|
|
134
|
-
</RouterLink>
|
|
135
|
-
|
|
136
|
-
<div :id="`tooltip-edit-${rowI}`"
|
|
137
|
-
role="tooltip"
|
|
138
|
-
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">
|
|
139
|
-
Edit
|
|
140
|
-
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
141
|
-
</div>
|
|
142
|
-
|
|
143
|
-
<button v-if="resource.options?.allowedActions.delete"
|
|
144
|
-
class="font-medium text-red-600 dark:text-red-500 hover:underline ms-3"
|
|
145
|
-
:data-tooltip-target="`tooltip-delete-${rowI}`"
|
|
146
|
-
@click="deleteRecord(row)"
|
|
147
|
-
>
|
|
148
|
-
<IconTrashBinSolid class="w-5 h-5 me-2"/>
|
|
149
|
-
</button>
|
|
150
|
-
|
|
151
|
-
<div :id="`tooltip-delete-${rowI}`"
|
|
152
|
-
role="tooltip"
|
|
153
|
-
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">
|
|
154
|
-
Delete
|
|
155
|
-
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
</td>
|
|
159
|
-
</tr>
|
|
160
|
-
</tbody>
|
|
161
|
-
</table>
|
|
162
|
-
</div>
|
|
163
|
-
<!-- pagination -->
|
|
164
|
-
<div class="flex flex-col items-center mt-4 mb-4 xs:flex-row xs:justify-between xs:items-center"
|
|
165
|
-
v-if="rows && totalRows >= pageSize && totalRows > 0"
|
|
166
|
-
>
|
|
167
|
-
<!-- Help text -->
|
|
168
|
-
<span class="text-sm text-gray-700 dark:text-gray-400">
|
|
169
|
-
Showing <span class="font-semibold text-gray-900 dark:text-white">
|
|
170
|
-
{{ (page - 1) * pageSize + 1 }}
|
|
171
|
-
</span> to <span class="font-semibold text-gray-900 dark:text-white">
|
|
172
|
-
{{ Math.min(page * pageSize, totalRows) }}
|
|
173
|
-
</span> of <span class="font-semibold text-gray-900 dark:text-white">{{
|
|
174
|
-
totalRows
|
|
175
|
-
}}</span> Entries
|
|
176
|
-
</span>
|
|
177
|
-
<div class="inline-flex mt-2 xs:mt-0">
|
|
178
|
-
<!-- Buttons -->
|
|
179
|
-
<button
|
|
180
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-r-0 rounded-s border border-gray-300 hover:bg-gray-100 hover:text-blue-700 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 disabled:opacity-50"
|
|
181
|
-
@click="page--" :disabled="page <= 1">
|
|
182
|
-
<svg class="w-3.5 h-3.5 me-2 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
183
|
-
viewBox="0 0 14 10">
|
|
184
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
185
|
-
d="M13 5H1m0 0 4 4M1 5l4-4"/>
|
|
186
|
-
</svg>
|
|
187
|
-
Prev
|
|
188
|
-
</button>
|
|
189
|
-
<button
|
|
190
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-r-0 border border-gray-300 hover:bg-gray-100 hover:text-blue-700 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 disabled:opacity-50"
|
|
191
|
-
@click="page = 1" :disabled="page <= 1">
|
|
192
|
-
<!-- <IconChevronDoubleLeftOutline class="w-4 h-4" /> -->
|
|
193
|
-
1
|
|
194
|
-
</button>
|
|
195
|
-
<input type="text"
|
|
196
|
-
class="w-10 py-1.5 px-3 text-sm text-center text-gray-700 border border-gray-300 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800 z-10"
|
|
197
|
-
v-model="page"/>
|
|
198
|
-
|
|
199
|
-
<button
|
|
200
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-l-0 border border-gray-300 hover:bg-gray-100 hover:text-blue-700 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 disabled:opacity-50"
|
|
201
|
-
@click="page = totalPages" :disabled="page >= totalPages">
|
|
202
|
-
{{ totalPages }}
|
|
203
|
-
|
|
204
|
-
<!-- <IconChevronDoubleRightOutline class="w-4 h-4" /> -->
|
|
205
|
-
</button>
|
|
206
|
-
<button
|
|
207
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white border-l-0 rounded-e border border-gray-300 hover:bg-gray-100 hover:text-blue-700 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 disabled:opacity-50"
|
|
208
|
-
|
|
209
|
-
@click="page++" :disabled="page >= totalPages">
|
|
210
|
-
Next
|
|
211
|
-
<svg class="w-3.5 h-3.5 ms-2 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
212
|
-
viewBox="0 0 14 10">
|
|
213
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
|
214
|
-
d="M1 5h12m0 0L9 1m4 4L9 9"/>
|
|
215
|
-
</svg>
|
|
216
|
-
</button>
|
|
217
|
-
</div>
|
|
218
|
-
|
|
219
|
-
</div>
|
|
220
|
-
</template>
|
|
221
|
-
|
|
222
|
-
<script setup>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
import { initFlowbite } from 'flowbite';
|
|
226
|
-
import { computed, onMounted, ref, watch } from 'vue';
|
|
227
|
-
import { useRoute } from 'vue-router';
|
|
228
|
-
import { callAdminForthApi, getIcon } from '@/utils';
|
|
229
|
-
|
|
230
|
-
import ValueRenderer from '@/components/ValueRenderer.vue';
|
|
231
|
-
import { getCustomComponent } from '@/utils';
|
|
232
|
-
import { useCoreStore } from '@/stores/core';
|
|
233
|
-
import { showSuccesTost, showErrorTost } from '@/composables/useFrontendApi';
|
|
234
|
-
import SkeleteLoader from '@/components/SkeleteLoader.vue';
|
|
235
|
-
|
|
236
|
-
import {
|
|
237
|
-
IconInboxOutline,
|
|
238
|
-
IconPlusOutline
|
|
239
|
-
} from '@iconify-prerendered/vue-flowbite';
|
|
240
|
-
|
|
241
|
-
import {
|
|
242
|
-
IconBanOutline,
|
|
243
|
-
IconEyeSolid,
|
|
244
|
-
IconFilterOutline,
|
|
245
|
-
IconPenSolid,
|
|
246
|
-
IconTrashBinSolid
|
|
247
|
-
} from '@iconify-prerendered/vue-flowbite';
|
|
248
|
-
import router from '@/router';
|
|
249
|
-
|
|
250
|
-
const coreStore = useCoreStore();
|
|
251
|
-
|
|
252
|
-
const props = defineProps([
|
|
253
|
-
'resource',
|
|
254
|
-
'rows',
|
|
255
|
-
'totalRows',
|
|
256
|
-
'pageSize',
|
|
257
|
-
'checkboxes',
|
|
258
|
-
'sort'
|
|
259
|
-
])
|
|
260
|
-
|
|
261
|
-
// emits, update page
|
|
262
|
-
const emits = defineEmits([
|
|
263
|
-
'update:page',
|
|
264
|
-
'update:sort',
|
|
265
|
-
'update:checkboxes',
|
|
266
|
-
'update:records'
|
|
267
|
-
|
|
268
|
-
]);
|
|
269
|
-
|
|
270
|
-
const checkboxesInternal = ref([]);
|
|
271
|
-
const page = ref(1);
|
|
272
|
-
const sort = ref([]);
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
watch(() => page.value, (newPage) => {
|
|
276
|
-
emits('update:page', newPage);
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
watch(() => sort.value, (newSort) => {
|
|
280
|
-
emits('update:sort', newSort);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
watch(() => checkboxesInternal.value, (newCheckboxes) => {
|
|
284
|
-
console.log('checkboxesInternal ch changed, emiting', newCheckboxes)
|
|
285
|
-
|
|
286
|
-
emits('update:checkboxes', newCheckboxes);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
watch(() => props.checkboxes, (newCheckboxes) => {
|
|
290
|
-
console.log('Props ch changed', newCheckboxes)
|
|
291
|
-
checkboxesInternal.value = newCheckboxes;
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
watch(() => props.sort, (newSort) => {
|
|
295
|
-
sort.value = newSort;
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
function addToCheckedValues(id) {
|
|
299
|
-
if (checkboxesInternal.value.includes(id)) {
|
|
300
|
-
checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== id);
|
|
301
|
-
} else {
|
|
302
|
-
checkboxesInternal.value.push(id);
|
|
303
|
-
}
|
|
304
|
-
checkboxesInternal.value = [ ...checkboxesInternal.value ]
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const columnsListed = computed(() => props.resource?.columns?.filter(c => c.showIn.includes('list')));
|
|
308
|
-
|
|
309
|
-
async function selectAll(value) {
|
|
310
|
-
if (!allFromThisPageChecked.value) {
|
|
311
|
-
props.rows.forEach((r) => {
|
|
312
|
-
if (!checkboxesInternal.value.includes(r.id)) {
|
|
313
|
-
checkboxesInternal.value.push(r.id)
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
} else {
|
|
317
|
-
props.rows.forEach((r) => {
|
|
318
|
-
checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== r.id);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
checkboxesInternal.value = [ ...checkboxesInternal.value ];
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const totalPages = computed(() => Math.ceil(props.totalRows / props.pageSize));
|
|
325
|
-
|
|
326
|
-
const allFromThisPageChecked = computed(() => {
|
|
327
|
-
if (!props.rows) return false;
|
|
328
|
-
return props.rows.every((r) => checkboxesInternal.value.includes(r.id));
|
|
329
|
-
});
|
|
330
|
-
const ascArr = computed(() => sort.value.filter((s) => s.direction === 'asc').map((s) => s.field));
|
|
331
|
-
const descArr = computed(() => sort.value.filter((s) => s.direction === 'desc').map((s) => s.field));
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
function onSortButtonClick(field) {
|
|
335
|
-
const sortIndex = sort.value.findIndex((s) => s.field === field);
|
|
336
|
-
if (sortIndex === -1) {
|
|
337
|
-
sort.value = [...sort.value,{field, direction: 'asc'}];
|
|
338
|
-
} else {
|
|
339
|
-
const sortField = sort.value[sortIndex];
|
|
340
|
-
if (sortField.direction === 'asc') {
|
|
341
|
-
sort.value[sortIndex].direction = 'desc';
|
|
342
|
-
} else {
|
|
343
|
-
sort.value.splice(sortIndex, 1);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
const clickTarget = ref(null);
|
|
350
|
-
async function onClick(e,row) {
|
|
351
|
-
if(clickTarget.value === e.target) return;
|
|
352
|
-
clickTarget.value = e.target;
|
|
353
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
354
|
-
if (window.getSelection().toString()) return;
|
|
355
|
-
else {router.push({
|
|
356
|
-
name: 'resource-show',
|
|
357
|
-
params: {
|
|
358
|
-
resourceId: props.resource.resourceId,
|
|
359
|
-
primaryKey: row._primaryKeyValue,
|
|
360
|
-
},
|
|
361
|
-
})}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
async function deleteRecord(row) {
|
|
365
|
-
const data = await window.adminforth.confirm({
|
|
366
|
-
message: 'Are you sure you want to delete this item?',
|
|
367
|
-
yes: 'Delete',
|
|
368
|
-
no: 'Cancel',
|
|
369
|
-
});
|
|
370
|
-
if (data) {
|
|
371
|
-
try {
|
|
372
|
-
const res = await callAdminForthApi({
|
|
373
|
-
path: '/delete_record',
|
|
374
|
-
method: 'POST',
|
|
375
|
-
body: {
|
|
376
|
-
resourceId: props.resource.resourceId,
|
|
377
|
-
primaryKey: row._primaryKeyValue,
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
console.log('safsa', res)
|
|
381
|
-
if (!res.error){
|
|
382
|
-
emits('update:records', true)
|
|
383
|
-
showSuccesTost('Record deleted successfully')
|
|
384
|
-
} else {
|
|
385
|
-
showErrorTost(res.error)
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
} catch (e) {
|
|
389
|
-
showErrorTost(`Something went wrong, please try again later`);
|
|
390
|
-
console.error(e);
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
</script>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
role="status" class="max-w-sm animate-pulse"
|
|
4
|
-
>
|
|
5
|
-
<div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div>
|
|
6
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px] mb-2.5"></div>
|
|
7
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div>
|
|
8
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[330px] mb-2.5"></div>
|
|
9
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[300px] mb-2.5"></div>
|
|
10
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
|
|
11
|
-
<span class="sr-only">Loading...</span>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<tr v-for="c in new Array(props.columns)" class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListBorder">
|
|
3
|
-
<td v-for="r in new Array(props.rows)" class="items-center px-6 py-8 cursor-default" >
|
|
4
|
-
<div role="status" class="max-w-sm animate-pulse">
|
|
5
|
-
<div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
|
|
6
|
-
</div>
|
|
7
|
-
</td>
|
|
8
|
-
</tr>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup>
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
columns:Number,
|
|
15
|
-
rows:Number
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<style lang="scss" scoped>
|
|
22
|
-
|
|
23
|
-
</style>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<div id="toast-default" class="flex items-center w-full p-4 text-gray-500 rounded-lg shadow dark:text-gray-400 dark:bg-gray-800" role="alert"
|
|
5
|
-
:class="
|
|
6
|
-
{
|
|
7
|
-
'danger': 'bg-red-100',
|
|
8
|
-
}[toast.variant]
|
|
9
|
-
"
|
|
10
|
-
>
|
|
11
|
-
<div v-if="toast.variant == 'info'" class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-blue-500 bg-blue-100 rounded-lg dark:bg-blue-800 dark:text-blue-200">
|
|
12
|
-
<svg class="w-4 h-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
|
|
13
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.147 15.085a7.159 7.159 0 0 1-6.189 3.307A6.713 6.713 0 0 1 3.1 15.444c-2.679-4.513.287-8.737.888-9.548A4.373 4.373 0 0 0 5 1.608c1.287.953 6.445 3.218 5.537 10.5 1.5-1.122 2.706-3.01 2.853-6.14 1.433 1.049 3.993 5.395 1.757 9.117Z"/>
|
|
14
|
-
</svg>
|
|
15
|
-
<span class="sr-only">Fire icon</span>
|
|
16
|
-
</div>
|
|
17
|
-
<div v-else-if="toast.variant == 'danger'" class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-red-500 bg-red-100 rounded-lg dark:bg-red-800 dark:text-red-200">
|
|
18
|
-
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
19
|
-
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 11.793a1 1 0 1 1-1.414 1.414L10 11.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L8.586 10 6.293 7.707a1 1 0 0 1 1.414-1.414L10 8.586l2.293-2.293a1 1 0 0 1 1.414 1.414L11.414 10l2.293 2.293Z"/>
|
|
20
|
-
</svg>
|
|
21
|
-
<span class="sr-only">Error icon</span>
|
|
22
|
-
</div>
|
|
23
|
-
<div v-else-if="toast.variant == 'warning'"class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-orange-500 bg-orange-100 rounded-lg dark:bg-orange-700 dark:text-orange-200">
|
|
24
|
-
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
25
|
-
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM10 15a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-4a1 1 0 0 1-2 0V6a1 1 0 0 1 2 0v5Z"/>
|
|
26
|
-
</svg>
|
|
27
|
-
<span class="sr-only">Warning icon</span>
|
|
28
|
-
</div>
|
|
29
|
-
<div v-else class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200">
|
|
30
|
-
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
31
|
-
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"/>
|
|
32
|
-
</svg>
|
|
33
|
-
<span class="sr-only">Check icon</span>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-if="toast.messageHtml" v-html="toast.messageHtml"></div>
|
|
37
|
-
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-else>{{toast.message}}</div>
|
|
38
|
-
<button @click="closeToast" type="button" class="ms-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700" >
|
|
39
|
-
<svg class="w-3 h-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
|
|
40
|
-
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
|
|
41
|
-
</svg>
|
|
42
|
-
</button>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<script setup lang="ts">
|
|
49
|
-
import { onMounted } from 'vue';
|
|
50
|
-
import { useToastStore } from '@/stores/toast';
|
|
51
|
-
const toastStore = useToastStore();
|
|
52
|
-
const emit = defineEmits(['close']);
|
|
53
|
-
const props = defineProps<{
|
|
54
|
-
toast: {
|
|
55
|
-
message?: string;
|
|
56
|
-
messageHtml?: string;
|
|
57
|
-
variant: string;
|
|
58
|
-
id: string;
|
|
59
|
-
timeout?: number|'unlimited';
|
|
60
|
-
}
|
|
61
|
-
}>();
|
|
62
|
-
function closeToast() {
|
|
63
|
-
emit('close');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
onMounted(() => {
|
|
67
|
-
if (props.toast.timeout === 'unlimited') return;
|
|
68
|
-
else {
|
|
69
|
-
setTimeout(() => {emit('close');}, (props.toast.timeout || 10) * 1e3 );
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
</script>
|
|
74
|
-
|
|
75
|
-
<style lang="scss" scoped>
|
|
76
|
-
|
|
77
|
-
</style>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<span @click="(e)=>{e.stopPropagation()}" v-if="column.foreignResource">
|
|
4
|
-
<RouterLink v-if="record[column.name]" class="font-medium text-blue-600 dark:text-blue-500 hover:brightness-110"
|
|
5
|
-
:to="{ name: 'resource-show', params: { resourceId: column.foreignResource.resourceId, primaryKey: record[column.name].pk } }">
|
|
6
|
-
{{ record[column.name].label }}
|
|
7
|
-
</RouterLink>
|
|
8
|
-
<div v-else>
|
|
9
|
-
<span class="text-gray-400">-</span>
|
|
10
|
-
</div>
|
|
11
|
-
</span>
|
|
12
|
-
|
|
13
|
-
<span v-else-if="column.type === 'boolean'">
|
|
14
|
-
<span v-if="record[column.name]" class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-green-400 border border-green-400">Yes</span>
|
|
15
|
-
<span v-else 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">No</span>
|
|
16
|
-
</span>
|
|
17
|
-
<span v-else-if="column.enum">
|
|
18
|
-
{{ checkEmptyValues(column.enum.find(e => e.value === record[column.name])?.label,route.meta.type) }}
|
|
19
|
-
</span>
|
|
20
|
-
<span v-else-if="column.type === 'datetime'" class="whitespace-nowrap">
|
|
21
|
-
{{ checkEmptyValues(formatDate(record[column.name]),route.meta.type) }}
|
|
22
|
-
</span>
|
|
23
|
-
<span v-else-if="column.type === 'richtext'">
|
|
24
|
-
<div v-html="protectAgainstXSS(record[column.name])"></div>
|
|
25
|
-
</span>
|
|
26
|
-
<span v-else>
|
|
27
|
-
{{ checkEmptyValues(record[column.name],route.meta.type) }}
|
|
28
|
-
</span>
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<script setup>
|
|
34
|
-
|
|
35
|
-
import dayjs from 'dayjs';
|
|
36
|
-
import utc from 'dayjs/plugin/utc';
|
|
37
|
-
import timezone from 'dayjs/plugin/timezone';
|
|
38
|
-
import {checkEmptyValues} from '@/utils';
|
|
39
|
-
import { useRoute, useRouter } from 'vue-router';
|
|
40
|
-
import sanitizeHtml from 'sanitize-html';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
import { useCoreStore } from '@/stores/core';
|
|
44
|
-
|
|
45
|
-
const coreStore = useCoreStore();
|
|
46
|
-
const route = useRoute();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
dayjs.extend(utc);
|
|
50
|
-
dayjs.extend(timezone);
|
|
51
|
-
|
|
52
|
-
const props = defineProps({
|
|
53
|
-
column: Object,
|
|
54
|
-
record: Object
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
function protectAgainstXSS(value) {
|
|
58
|
-
return sanitizeHtml(value);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function formatDate(date) {
|
|
63
|
-
if (!date) return '';
|
|
64
|
-
return dayjs.utc(date).local().format(coreStore.config?.datesFormat || 'YYYY-MM-DD HH:mm:ss');
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
3
|
-
<path d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"/>
|
|
4
|
-
</svg>
|
|
5
|
-
</template>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
|
|
3
|
-
<path
|
|
4
|
-
d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z"
|
|
5
|
-
/>
|
|
6
|
-
</svg>
|
|
7
|
-
</template>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" fill="currentColor">
|
|
3
|
-
<path
|
|
4
|
-
d="M11 2.253a1 1 0 1 0-2 0h2zm-2 13a1 1 0 1 0 2 0H9zm.447-12.167a1 1 0 1 0 1.107-1.666L9.447 3.086zM1 2.253L.447 1.42A1 1 0 0 0 0 2.253h1zm0 13H0a1 1 0 0 0 1.553.833L1 15.253zm8.447.833a1 1 0 1 0 1.107-1.666l-1.107 1.666zm0-14.666a1 1 0 1 0 1.107 1.666L9.447 1.42zM19 2.253h1a1 1 0 0 0-.447-.833L19 2.253zm0 13l-.553.833A1 1 0 0 0 20 15.253h-1zm-9.553-.833a1 1 0 1 0 1.107 1.666L9.447 14.42zM9 2.253v13h2v-13H9zm1.553-.833C9.203.523 7.42 0 5.5 0v2c1.572 0 2.961.431 3.947 1.086l1.107-1.666zM5.5 0C3.58 0 1.797.523.447 1.42l1.107 1.666C2.539 2.431 3.928 2 5.5 2V0zM0 2.253v13h2v-13H0zm1.553 13.833C2.539 15.431 3.928 15 5.5 15v-2c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM5.5 15c1.572 0 2.961.431 3.947 1.086l1.107-1.666C9.203 13.523 7.42 13 5.5 13v2zm5.053-11.914C11.539 2.431 12.928 2 14.5 2V0c-1.92 0-3.703.523-5.053 1.42l1.107 1.666zM14.5 2c1.573 0 2.961.431 3.947 1.086l1.107-1.666C18.203.523 16.421 0 14.5 0v2zm3.5.253v13h2v-13h-2zm1.553 12.167C18.203 13.523 16.421 13 14.5 13v2c1.573 0 2.961.431 3.947 1.086l1.107-1.666zM14.5 13c-1.92 0-3.703.523-5.053 1.42l1.107 1.666C11.539 15.431 12.928 15 14.5 15v-2z"
|
|
5
|
-
/>
|
|
6
|
-
</svg>
|
|
7
|
-
</template>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="20" fill="currentColor">
|
|
3
|
-
<path
|
|
4
|
-
d="M11.447 8.894a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm0 1.789a1 1 0 1 0 .894-1.789l-.894 1.789zM7.447 7.106a1 1 0 1 0-.894 1.789l.894-1.789zM10 9a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0H8zm9.447-5.606a1 1 0 1 0-.894-1.789l.894 1.789zm-2.894-.789a1 1 0 1 0 .894 1.789l-.894-1.789zm2 .789a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zM18 5a1 1 0 1 0-2 0h2zm-2 2.5a1 1 0 1 0 2 0h-2zm-5.447-4.606a1 1 0 1 0 .894-1.789l-.894 1.789zM9 1l.447-.894a1 1 0 0 0-.894 0L9 1zm-2.447.106a1 1 0 1 0 .894 1.789l-.894-1.789zm-6 3a1 1 0 1 0 .894 1.789L.553 4.106zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zm-2-.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 2.789a1 1 0 1 0 .894-1.789l-.894 1.789zM2 5a1 1 0 1 0-2 0h2zM0 7.5a1 1 0 1 0 2 0H0zm8.553 12.394a1 1 0 1 0 .894-1.789l-.894 1.789zm-1.106-2.789a1 1 0 1 0-.894 1.789l.894-1.789zm1.106 1a1 1 0 1 0 .894 1.789l-.894-1.789zm2.894.789a1 1 0 1 0-.894-1.789l.894 1.789zM8 19a1 1 0 1 0 2 0H8zm2-2.5a1 1 0 1 0-2 0h2zm-7.447.394a1 1 0 1 0 .894-1.789l-.894 1.789zM1 15H0a1 1 0 0 0 .553.894L1 15zm1-2.5a1 1 0 1 0-2 0h2zm12.553 2.606a1 1 0 1 0 .894 1.789l-.894-1.789zM17 15l.447.894A1 1 0 0 0 18 15h-1zm1-2.5a1 1 0 1 0-2 0h2zm-7.447-5.394l-2 1 .894 1.789 2-1-.894-1.789zm-1.106 1l-2-1-.894 1.789 2 1 .894-1.789zM8 9v2.5h2V9H8zm8.553-4.894l-2 1 .894 1.789 2-1-.894-1.789zm.894 0l-2-1-.894 1.789 2 1 .894-1.789zM16 5v2.5h2V5h-2zm-4.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zm-2.894-1l-2 1 .894 1.789 2-1L8.553.106zM1.447 5.894l2-1-.894-1.789-2 1 .894 1.789zm-.894 0l2 1 .894-1.789-2-1-.894 1.789zM0 5v2.5h2V5H0zm9.447 13.106l-2-1-.894 1.789 2 1 .894-1.789zm0 1.789l2-1-.894-1.789-2 1 .894 1.789zM10 19v-2.5H8V19h2zm-6.553-3.894l-2-1-.894 1.789 2 1 .894-1.789zM2 15v-2.5H0V15h2zm13.447 1.894l2-1-.894-1.789-2 1 .894 1.789zM18 15v-2.5h-2V15h2z"
|
|
5
|
-
/>
|
|
6
|
-
</svg>
|
|
7
|
-
</template>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
|
|
3
|
-
<path
|
|
4
|
-
d="M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.666.105 5.5 5.5 0 0 0-.114 7.665L10 18.78l8.39-8.4a5.5 5.5 0 0 0-.114-7.665 5.5 5.5 0 0 0-7.666-.105l-.61.61z"
|
|
5
|
-
/>
|
|
6
|
-
</svg>
|
|
7
|
-
</template>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24">
|
|
3
|
-
<path fill-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm11-4a1 1 0 1 0-2 0v4a1 1 0 0 0 .293.707l3 3a1 1 0 0 0 1.414-1.414L13 11.586V8Z" clip-rule="evenodd"></path>
|
|
4
|
-
</svg>
|
|
5
|
-
</template>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!-- This icon is from <https://github.com/Templarian/MaterialDesign>, distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license-->
|
|
2
|
-
<template>
|
|
3
|
-
<svg
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
6
|
-
aria-hidden="true"
|
|
7
|
-
role="img"
|
|
8
|
-
class="iconify iconify--mdi"
|
|
9
|
-
width="24"
|
|
10
|
-
height="24"
|
|
11
|
-
preserveAspectRatio="xMidYMid meet"
|
|
12
|
-
viewBox="0 0 24 24"
|
|
13
|
-
>
|
|
14
|
-
<path
|
|
15
|
-
d="M20 18v-4h-3v1h-2v-1H9v1H7v-1H4v4h16M6.33 8l-1.74 4H7v-1h2v1h6v-1h2v1h2.41l-1.74-4H6.33M9 5v1h6V5H9m12.84 7.61c.1.22.16.48.16.8V18c0 .53-.21 1-.6 1.41c-.4.4-.85.59-1.4.59H4c-.55 0-1-.19-1.4-.59C2.21 19 2 18.53 2 18v-4.59c0-.32.06-.58.16-.8L4.5 7.22C4.84 6.41 5.45 6 6.33 6H7V5c0-.55.18-1 .57-1.41C7.96 3.2 8.44 3 9 3h6c.56 0 1.04.2 1.43.59c.39.41.57.86.57 1.41v1h.67c.88 0 1.49.41 1.83 1.22l2.34 5.39z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
></path>
|
|
18
|
-
</svg>
|
|
19
|
-
</template>
|