adminforth 1.3.54-next.9 → 1.3.55-next.2
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/spa/index.html +2 -2
- package/dist/spa/package-lock.json +87 -1
- package/dist/spa/package.json +4 -1
- package/dist/spa/src/App.vue +154 -50
- package/dist/spa/src/components/AcceptModal.vue +1 -1
- package/dist/spa/src/components/Breadcrumbs.vue +1 -1
- package/dist/spa/src/components/CustomDatePicker.vue +1 -1
- package/dist/spa/src/components/CustomDateRangePicker.vue +1 -1
- package/dist/spa/src/components/CustomRangePicker.vue +9 -5
- package/dist/spa/src/components/Dropdown.vue +4 -4
- package/dist/spa/src/components/Filters.vue +2 -2
- package/dist/spa/src/components/MenuLink.vue +3 -0
- package/dist/spa/src/components/ResourceForm.vue +67 -36
- package/dist/spa/src/components/ResourceListTable.vue +216 -144
- package/dist/spa/src/components/SkeleteLoader.vue +4 -4
- package/dist/spa/src/components/Toast.vue +3 -2
- package/dist/spa/src/components/ValueRenderer.vue +81 -6
- package/dist/spa/src/composables/useFrontendApi.ts +1 -1
- package/dist/spa/src/composables/useStores.ts +18 -14
- package/dist/spa/src/index.scss +4 -0
- package/{spa → dist/spa}/src/renderers/CompactUUID.vue +4 -4
- package/{spa → dist/spa}/src/renderers/CountryFlag.vue +2 -2
- package/dist/spa/src/router/index.ts +4 -8
- package/dist/spa/src/spa_types/core.ts +2 -0
- package/dist/spa/src/stores/core.ts +6 -2
- package/dist/spa/src/stores/filters.ts +15 -10
- package/dist/spa/src/stores/toast.ts +22 -6
- package/dist/spa/src/types/AdminForthConfig.ts +340 -55
- package/dist/spa/src/types/FrontendAPI.ts +52 -30
- package/dist/spa/src/utils.ts +59 -2
- package/dist/spa/src/views/CreateView.vue +15 -4
- package/dist/spa/src/views/EditView.vue +20 -7
- package/dist/spa/src/views/ListView.vue +132 -38
- package/dist/spa/src/views/LoginView.vue +50 -18
- package/dist/spa/src/views/ShowView.vue +25 -15
- 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 +16 -6
- 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/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/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/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
- /package/{spa → dist/spa}/src/components/ThreeDotsMenu.vue +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<span @click="(e)=>{e.stopPropagation()}" v-if="column.foreignResource">
|
|
4
|
-
<RouterLink v-if="record[column.name]" class="font-medium text-
|
|
4
|
+
<RouterLink v-if="record[column.name]" class="font-medium text-lightPrimary dark:text-darkPrimary hover:brightness-110 whitespace-nowrap"
|
|
5
5
|
:to="{ name: 'resource-show', params: { resourceId: column.foreignResource.resourceId, primaryKey: record[column.name].pk } }">
|
|
6
6
|
{{ record[column.name].label }}
|
|
7
7
|
</RouterLink>
|
|
@@ -15,13 +15,22 @@
|
|
|
15
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
16
|
</span>
|
|
17
17
|
<span v-else-if="column.enum">
|
|
18
|
-
{{ checkEmptyValues(column.enum.find(e => e.value === record[column.name])?.label,route.meta.type) }}
|
|
18
|
+
{{ checkEmptyValues(column.enum.find(e => e.value === record[column.name])?.label || record[column.name], route.meta.type) }}
|
|
19
19
|
</span>
|
|
20
20
|
<span v-else-if="column.type === 'datetime'" class="whitespace-nowrap">
|
|
21
|
+
{{ checkEmptyValues(formatDateTime(record[column.name]),route.meta.type) }}
|
|
22
|
+
</span>
|
|
23
|
+
<span v-else-if="column.type === 'date'" class="whitespace-nowrap">
|
|
21
24
|
{{ checkEmptyValues(formatDate(record[column.name]),route.meta.type) }}
|
|
22
25
|
</span>
|
|
26
|
+
<span v-else-if="column.type === 'time'" class="whitespace-nowrap">
|
|
27
|
+
{{ checkEmptyValues(formatTime(record[column.name]),route.meta.type) }}
|
|
28
|
+
</span>
|
|
23
29
|
<span v-else-if="column.type === 'richtext'">
|
|
24
|
-
<div v-html="protectAgainstXSS(record[column.name])"></div>
|
|
30
|
+
<div v-html="protectAgainstXSS(record[column.name])" class="allow-lists"></div>
|
|
31
|
+
</span>
|
|
32
|
+
<span v-else-if="column.type === 'json'">
|
|
33
|
+
<JsonViewer :value="record[column.name]" copyable sort :theme="theme" />
|
|
25
34
|
</span>
|
|
26
35
|
<span v-else>
|
|
27
36
|
{{ checkEmptyValues(record[column.name],route.meta.type) }}
|
|
@@ -38,13 +47,19 @@ import timezone from 'dayjs/plugin/timezone';
|
|
|
38
47
|
import {checkEmptyValues} from '@/utils';
|
|
39
48
|
import { useRoute, useRouter } from 'vue-router';
|
|
40
49
|
import sanitizeHtml from 'sanitize-html';
|
|
50
|
+
import { JsonViewer } from "vue3-json-viewer";
|
|
51
|
+
import "vue3-json-viewer/dist/index.css";
|
|
41
52
|
|
|
42
53
|
|
|
43
54
|
import { useCoreStore } from '@/stores/core';
|
|
55
|
+
import { computed } from 'vue';
|
|
44
56
|
|
|
45
57
|
const coreStore = useCoreStore();
|
|
46
58
|
const route = useRoute();
|
|
47
59
|
|
|
60
|
+
const theme = computed(() => {
|
|
61
|
+
return window.localStorage.getItem('af__theme') || 'light';
|
|
62
|
+
});
|
|
48
63
|
|
|
49
64
|
dayjs.extend(utc);
|
|
50
65
|
dayjs.extend(timezone);
|
|
@@ -55,12 +70,72 @@ const props = defineProps({
|
|
|
55
70
|
});
|
|
56
71
|
|
|
57
72
|
function protectAgainstXSS(value) {
|
|
58
|
-
return sanitizeHtml(value
|
|
73
|
+
return sanitizeHtml(value, {
|
|
74
|
+
allowedTags: [
|
|
75
|
+
"address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4",
|
|
76
|
+
"h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div",
|
|
77
|
+
"dl", "dt", "figcaption", "figure", "hr", "li", "main", "ol", "p", "pre",
|
|
78
|
+
"ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn",
|
|
79
|
+
"em", "i", "kbd", "mark", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp",
|
|
80
|
+
"small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "caption",
|
|
81
|
+
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", 'img'
|
|
82
|
+
],
|
|
83
|
+
allowedAttributes: {
|
|
84
|
+
'li': [ 'data-list' ],
|
|
85
|
+
'img': [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]
|
|
86
|
+
}
|
|
87
|
+
});
|
|
59
88
|
}
|
|
60
89
|
|
|
61
90
|
|
|
91
|
+
function formatDateTime(date) {
|
|
92
|
+
if (!date) return '';
|
|
93
|
+
return dayjs.utc(date).local().format(`${coreStore.config?.datesFormat} ${coreStore.config?.timeFormat}` || 'YYYY-MM-DD HH:mm:ss');
|
|
94
|
+
}
|
|
95
|
+
|
|
62
96
|
function formatDate(date) {
|
|
63
97
|
if (!date) return '';
|
|
64
|
-
return dayjs.utc(date).local().format(coreStore.config?.datesFormat || 'YYYY-MM-DD
|
|
98
|
+
return dayjs.utc(date).local().format(coreStore.config?.datesFormat || 'YYYY-MM-DD');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function formatTime(time) {
|
|
102
|
+
if (!time) return '';
|
|
103
|
+
return dayjs(`0000-00-00 ${time}`).format(coreStore.config?.timeFormat || 'HH:mm:ss');
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style lang="scss">
|
|
108
|
+
|
|
109
|
+
.allow-lists {
|
|
110
|
+
ol {
|
|
111
|
+
list-style-type: decimal;
|
|
112
|
+
padding-left: 1.5em;
|
|
113
|
+
|
|
114
|
+
li[data-list="bullet"] {
|
|
115
|
+
list-style-type: disc;
|
|
116
|
+
}
|
|
117
|
+
li[data-list="ordered"] {
|
|
118
|
+
list-style-type: decimal;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
|
|
125
|
+
<style lang="scss" >
|
|
126
|
+
|
|
127
|
+
.jv-container .jv-code {
|
|
128
|
+
padding: 10px 10px;
|
|
65
129
|
}
|
|
66
|
-
|
|
130
|
+
|
|
131
|
+
.jv-container .jv-button[class] {
|
|
132
|
+
@apply text-lightPrimary;
|
|
133
|
+
@apply dark:text-darkPrimary;
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.jv-container.jv-dark {
|
|
138
|
+
background: transparent;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
</style>
|
|
@@ -9,7 +9,7 @@ export function showWarningTost(message: string) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function showErrorTost(message: string, timeout?: number) {
|
|
12
|
-
window.adminforth.alert({ message, variant: 'danger', timeout: timeout ||
|
|
12
|
+
window.adminforth.alert({ message, variant: 'danger', timeout: timeout || 30});
|
|
13
13
|
return message;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -24,17 +24,11 @@ import type { AdminForthResourceColumn } from '@/types/AdminForthConfig';
|
|
|
24
24
|
|
|
25
25
|
declare global {
|
|
26
26
|
interface Window {
|
|
27
|
-
adminforth:
|
|
28
|
-
confirm: (params: ConfirmParams) => Promise<void>;
|
|
29
|
-
alert: (params: AlertParams) => void;
|
|
30
|
-
setListFilter: (filter: any) => void;
|
|
31
|
-
updateListFilter: (filter: any) => void;
|
|
32
|
-
clearListFilters: () => void;
|
|
33
|
-
};
|
|
27
|
+
adminforth: FrontendAPIInterface;
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
30
|
|
|
37
|
-
export class FrontendAPI
|
|
31
|
+
export class FrontendAPI {
|
|
38
32
|
private toastStore:any
|
|
39
33
|
private modalStore:any
|
|
40
34
|
private filtersStore:any
|
|
@@ -45,19 +39,29 @@ export class FrontendAPI implements FrontendAPIInterface {
|
|
|
45
39
|
}
|
|
46
40
|
this.toastStore = useToastStore();
|
|
47
41
|
this.modalStore = useModalStore();
|
|
48
|
-
|
|
42
|
+
|
|
49
43
|
window.adminforth = {
|
|
50
44
|
confirm: this.confirm.bind(this),
|
|
51
45
|
alert: this.alert.bind(this),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
|
|
47
|
+
list: {
|
|
48
|
+
refresh: () => {/* will be redefined in list*/},
|
|
49
|
+
closeThreeDotsDropdown: () => {/* will be redefined in list*/},
|
|
50
|
+
closeUserMenuDropdown: () => {/* will be redefined in list*/},
|
|
51
|
+
setFilter: () => this.setListFilter.bind(this),
|
|
52
|
+
updateFilter: () => this.updateListFilter.bind(this),
|
|
53
|
+
clearFilters: () => this.clearListFilters.bind(this),
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
confirm(params: ConfirmParams): Promise<void> {
|
|
59
59
|
return new Promise((resolve, reject) => {
|
|
60
|
-
this.modalStore.setModalContent({
|
|
60
|
+
this.modalStore.setModalContent({
|
|
61
|
+
content: params.message,
|
|
62
|
+
acceptText: params.yes || 'Yes',
|
|
63
|
+
cancelText: params.no || 'Cancel'
|
|
64
|
+
})
|
|
61
65
|
this.modalStore.onAcceptFunction = resolve
|
|
62
66
|
this.modalStore.onCancelFunction = reject
|
|
63
67
|
this.modalStore.togleModal()
|
package/dist/spa/src/index.scss
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="flex items-center"
|
|
3
|
-
:data-tooltip-target="`tooltip-${id}`"
|
|
3
|
+
:data-tooltip-target="val && `tooltip-${id}`"
|
|
4
4
|
data-tooltip-placement="top"
|
|
5
5
|
>
|
|
6
|
-
{{ visualValue }} <IconFileCopyAltSolid @click.stop="copyToCB" class="w-5 h-5 text-lightPrimary dark:text-darkPrimary"/>
|
|
6
|
+
{{ visualValue }} <IconFileCopyAltSolid @click.stop="copyToCB" class="w-5 h-5 text-lightPrimary dark:text-darkPrimary" v-if="val"/>
|
|
7
7
|
|
|
8
|
-
<div :id="`tooltip-${id}`" role="tooltip"
|
|
8
|
+
<div :id="`tooltip-${id}`" role="tooltip" v-if="val"
|
|
9
9
|
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">
|
|
10
10
|
{{ props.record[props.column.name] }}
|
|
11
11
|
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
@@ -21,7 +21,7 @@ import { initFlowbite } from 'flowbite';
|
|
|
21
21
|
const visualValue = computed(() => {
|
|
22
22
|
// if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
|
|
23
23
|
const val = props.record[props.column.name];
|
|
24
|
-
if (val.length > 8) {
|
|
24
|
+
if (val && val.length > 8) {
|
|
25
25
|
return `${val.substr(0, 4)}...${val.substr(val.length - 4)}`;
|
|
26
26
|
}
|
|
27
27
|
return val;
|
|
@@ -61,9 +61,9 @@ const countryName = computed(() => {
|
|
|
61
61
|
flex-shrink: 0;
|
|
62
62
|
|
|
63
63
|
// border radius for background
|
|
64
|
-
border-radius:
|
|
64
|
+
border-radius: 2px;
|
|
65
65
|
// add some silkiness to the flag
|
|
66
|
-
box-shadow: inset -1px -1px
|
|
66
|
+
box-shadow: inset -1px -1px 0.5px 0px rgba(0 0 0 / 0.2), inset 1px 1px 0.5px 0px rgba(255 255 255 / 0.2);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
-
import ResourceParent from '@/views/ResourceParent.vue'
|
|
3
|
-
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
+
import ResourceParent from '@/views/ResourceParent.vue';
|
|
3
|
+
|
|
4
4
|
/* IMPORTANT:ADMINFORTH ROUTES IMPORTS */
|
|
5
5
|
|
|
6
6
|
const router = createRouter({
|
|
@@ -51,13 +51,9 @@ const router = createRouter({
|
|
|
51
51
|
|
|
52
52
|
},
|
|
53
53
|
]
|
|
54
|
-
},
|
|
54
|
+
},
|
|
55
55
|
/* IMPORTANT:ADMINFORTH ROUTES */
|
|
56
56
|
]
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
59
|
export default router
|
|
@@ -24,6 +24,7 @@ export type CoreConfig = {
|
|
|
24
24
|
brandLogo: string,
|
|
25
25
|
title: string,
|
|
26
26
|
datesFormat: string,
|
|
27
|
+
timeFormat: string,
|
|
27
28
|
usernameField: string,
|
|
28
29
|
usernameFieldName?: string,
|
|
29
30
|
deleteConfirmation?: boolean,
|
|
@@ -32,6 +33,7 @@ export type CoreConfig = {
|
|
|
32
33
|
usernameField: string,
|
|
33
34
|
passwordHashField: string,
|
|
34
35
|
loginBackgroundImage: string,
|
|
36
|
+
loginBackgroundPosition: string,
|
|
35
37
|
userFullnameField: string,
|
|
36
38
|
},
|
|
37
39
|
emptyFieldPlaceholder?: {
|
|
@@ -47,6 +47,10 @@ export const useCoreStore = defineStore('core', () => {
|
|
|
47
47
|
if (!resource.value) {
|
|
48
48
|
throw new Error('Columns not fetched yet');
|
|
49
49
|
}
|
|
50
|
+
const col = resource.value.columns.find((col: AdminForthResourceColumn) => col.primaryKey);
|
|
51
|
+
if (!col) {
|
|
52
|
+
throw new Error(`Primary key not found in resource ${resourceId}`);
|
|
53
|
+
}
|
|
50
54
|
|
|
51
55
|
const respData = await callAdminForthApi({
|
|
52
56
|
path: '/get_resource_data',
|
|
@@ -56,7 +60,7 @@ export const useCoreStore = defineStore('core', () => {
|
|
|
56
60
|
resourceId: resourceId,
|
|
57
61
|
filters: [
|
|
58
62
|
{
|
|
59
|
-
field:
|
|
63
|
+
field: col.name,
|
|
60
64
|
operator: 'eq',
|
|
61
65
|
value: primaryKey
|
|
62
66
|
}
|
|
@@ -71,7 +75,7 @@ export const useCoreStore = defineStore('core', () => {
|
|
|
71
75
|
window.adminforth.alert({
|
|
72
76
|
message: respData.error,
|
|
73
77
|
variant: 'danger',
|
|
74
|
-
timeout:
|
|
78
|
+
timeout: 30,
|
|
75
79
|
});
|
|
76
80
|
record.value = {};
|
|
77
81
|
} else {
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { ref } from 'vue'
|
|
2
|
-
import { defineStore } from 'pinia'
|
|
3
|
-
import { callAdminForthApi } from '@/utils';
|
|
1
|
+
import { ref, type Ref } from 'vue';
|
|
2
|
+
import { defineStore } from 'pinia';
|
|
4
3
|
|
|
5
4
|
export const useFiltersStore = defineStore('filters', () => {
|
|
6
|
-
const filters = ref([]);
|
|
5
|
+
const filters: Ref<any[]> = ref([]);
|
|
6
|
+
const sort: Ref<any> = ref({});
|
|
7
|
+
|
|
8
|
+
const setSort = (s: any) => {
|
|
9
|
+
sort.value = s;
|
|
10
|
+
}
|
|
11
|
+
const getSort = () => {
|
|
12
|
+
return sort.value;
|
|
13
|
+
}
|
|
7
14
|
const setFilter = (filter: any) => {
|
|
8
|
-
filters.value
|
|
15
|
+
filters.value.push(filter);
|
|
9
16
|
}
|
|
10
17
|
const setFilters = (f: any) => {
|
|
11
|
-
filters.value =
|
|
18
|
+
filters.value = f;
|
|
12
19
|
}
|
|
13
20
|
const getFilters = () => {
|
|
14
21
|
return filters.value;
|
|
@@ -16,7 +23,5 @@ export const useFiltersStore = defineStore('filters', () => {
|
|
|
16
23
|
const clearFilters = () => {
|
|
17
24
|
filters.value = [];
|
|
18
25
|
}
|
|
19
|
-
return {setFilter, getFilters,clearFilters, filters,setFilters}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
return {setFilter, getFilters, clearFilters, filters, setFilters, setSort, getSort}
|
|
27
|
+
})
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
-
import { ref,
|
|
1
|
+
import { ref, watch, type Ref } from 'vue'
|
|
2
2
|
import { defineStore } from 'pinia'
|
|
3
|
-
import { callAdminForthApi } from '@/utils';
|
|
4
3
|
import { v1 as uuid } from 'uuid';
|
|
4
|
+
import { useRoute } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
export const useToastStore = defineStore('toast', () => {
|
|
7
|
-
const toasts = ref([]);
|
|
8
|
-
const
|
|
9
|
-
|
|
9
|
+
const toasts: Ref<any[]> = ref([]);
|
|
10
|
+
const route = useRoute();
|
|
11
|
+
|
|
12
|
+
watch(route, () => {
|
|
13
|
+
console.log('route changed 121');
|
|
14
|
+
// on route change clear all toasts older then 5 seconds
|
|
15
|
+
const now = +new Date();
|
|
16
|
+
toasts.value = toasts.value.filter((t) => now - t.createdAt < 5000);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const addToast = (toast: { message: string; variant: string }) => {
|
|
20
|
+
const toastId = uuid();
|
|
21
|
+
toasts.value.push({
|
|
22
|
+
...toast,
|
|
23
|
+
id: toastId,
|
|
24
|
+
createdAt: +new Date(),
|
|
25
|
+
});
|
|
10
26
|
};
|
|
11
|
-
const removeToast = (toast) => {
|
|
27
|
+
const removeToast = (toast: { id: string }) => {
|
|
12
28
|
toasts.value = toasts.value.filter((t) => t.id !== toast.id);
|
|
13
29
|
};
|
|
14
30
|
return { toasts, addToast, removeToast };
|