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
|
@@ -6,21 +6,20 @@
|
|
|
6
6
|
<form autocomplete="off" @submit.prevent>
|
|
7
7
|
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
|
|
8
8
|
<thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400 block md:table-row-group">
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</tr>
|
|
9
|
+
<tr>
|
|
10
|
+
<th scope="col" class="px-6 py-3 hidden md:table-cell">
|
|
11
|
+
Field
|
|
12
|
+
</th>
|
|
13
|
+
<th scope="col" class="px-6 py-3 w-5/6 hidden md:table-cell">
|
|
14
|
+
Value
|
|
15
|
+
</th>
|
|
16
|
+
</tr>
|
|
19
17
|
</thead>
|
|
20
18
|
<tbody>
|
|
21
19
|
<tr v-for="column, i in editableColumns" :key="column.name"
|
|
22
20
|
v-if="currentValues !== null"
|
|
23
|
-
class="bg-ligftForm dark:bg-gray-800
|
|
21
|
+
class="bg-ligftForm dark:bg-gray-800 dark:border-gray-700 block md:table-row"
|
|
22
|
+
:class="{ 'border-b': i !== editableColumns.length - 1 }"
|
|
24
23
|
>
|
|
25
24
|
<td class="px-6 py-4 sm:pb-0 whitespace-nowrap flex items-center block md:table-cell"> <!--align-top-->
|
|
26
25
|
{{ column.label }}
|
|
@@ -105,6 +104,14 @@
|
|
|
105
104
|
@input="setCurrentValue(column.name, $event.target.value)"
|
|
106
105
|
>
|
|
107
106
|
</textarea>
|
|
107
|
+
<textarea
|
|
108
|
+
v-else-if="['json'].includes(column.type)"
|
|
109
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
110
|
+
placeholder="Text"
|
|
111
|
+
:value="currentValues[column.name]"
|
|
112
|
+
@input="setCurrentValue(column.name, $event.target.value)"
|
|
113
|
+
>
|
|
114
|
+
</textarea>
|
|
108
115
|
<input
|
|
109
116
|
v-else
|
|
110
117
|
:type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
|
|
@@ -129,7 +136,6 @@
|
|
|
129
136
|
</button>
|
|
130
137
|
</template>
|
|
131
138
|
<div v-if="columnError(column) && validating" class="mt-1 text-xs text-red-500 dark:text-red-400">{{ columnError(column) }}</div>
|
|
132
|
-
|
|
133
139
|
<div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-gray-400 dark:text-gray-500">{{ column.editingNote[mode] }}</div>
|
|
134
140
|
|
|
135
141
|
</td>
|
|
@@ -147,18 +153,16 @@
|
|
|
147
153
|
|
|
148
154
|
import CustomDatePicker from "@/components/CustomDatePicker.vue";
|
|
149
155
|
import Dropdown from '@/components/Dropdown.vue';
|
|
150
|
-
import {
|
|
151
|
-
import { callAdminForthApi, getCustomComponent } from '@/utils';
|
|
156
|
+
import { applyRegexValidation, callAdminForthApi, getCustomComponent } from '@/utils';
|
|
152
157
|
import { IconExclamationCircleSolid, IconEyeSlashSolid, IconEyeSolid } from '@iconify-prerendered/vue-flowbite';
|
|
153
158
|
import { computedAsync } from '@vueuse/core';
|
|
154
159
|
import { initFlowbite } from 'flowbite';
|
|
155
160
|
import { computed, onMounted, ref, watch } from 'vue';
|
|
156
|
-
import { useRouter } from 'vue-router';
|
|
161
|
+
import { useRouter, useRoute } from 'vue-router';
|
|
157
162
|
|
|
158
163
|
const router = useRouter();
|
|
159
|
-
|
|
164
|
+
const route = useRoute();
|
|
160
165
|
const props = defineProps({
|
|
161
|
-
loading: Boolean,
|
|
162
166
|
resource: Object,
|
|
163
167
|
record: Object,
|
|
164
168
|
validating: Boolean,
|
|
@@ -167,7 +171,7 @@ const props = defineProps({
|
|
|
167
171
|
|
|
168
172
|
const unmasked = ref({});
|
|
169
173
|
|
|
170
|
-
const mode = computed(() =>
|
|
174
|
+
const mode = computed(() => route.name === 'resource-create' ? 'create' : 'edit');
|
|
171
175
|
|
|
172
176
|
const emit = defineEmits(['update:record', 'update:isValid']);
|
|
173
177
|
|
|
@@ -175,7 +179,7 @@ const currentValues = ref(null);
|
|
|
175
179
|
|
|
176
180
|
const customComponentsInValidity = ref({});
|
|
177
181
|
const customComponentsEmptiness = ref({});
|
|
178
|
-
|
|
182
|
+
|
|
179
183
|
|
|
180
184
|
const columnError = (column) => {
|
|
181
185
|
const val = computed(() => {
|
|
@@ -196,11 +200,24 @@ const columnError = (column) => {
|
|
|
196
200
|
) {
|
|
197
201
|
return 'This field is required';
|
|
198
202
|
}
|
|
203
|
+
if (column.type === 'json' && currentValues.value[column.name]) {
|
|
204
|
+
try {
|
|
205
|
+
JSON.parse(currentValues.value[column.name]);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
return 'Invalid JSON';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
199
210
|
if ( column.type === 'string' || column.type === 'text' ) {
|
|
200
211
|
if ( column.maxLength && currentValues.value[column.name]?.length > column.maxLength ) {
|
|
201
212
|
return `This field must be shorter than ${column.maxLength} characters`;
|
|
202
213
|
}
|
|
214
|
+
|
|
203
215
|
if ( column.minLength && currentValues.value[column.name]?.length < column.minLength ) {
|
|
216
|
+
// if column.required[mode.value] is false, then we check if the field is empty
|
|
217
|
+
let needToCheckEmpty = column.required[mode.value] || currentValues.value[column.name]?.length > 0;
|
|
218
|
+
if (!needToCheckEmpty) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
204
221
|
return `This field must be longer than ${column.minLength} characters`;
|
|
205
222
|
}
|
|
206
223
|
}
|
|
@@ -215,22 +232,13 @@ const columnError = (column) => {
|
|
|
215
232
|
return `This field must be less than ${column.maxValue}`;
|
|
216
233
|
}
|
|
217
234
|
}
|
|
218
|
-
if (
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const regExp = new RegExp(validationArray[i].regExp);
|
|
223
|
-
let value = currentValues.value[column.name];
|
|
224
|
-
if (value === undefined || value === null) {
|
|
225
|
-
value = '';
|
|
226
|
-
}
|
|
227
|
-
if (!regExp.test(value)) {
|
|
228
|
-
return validationArray[i].message;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
235
|
+
if (currentValues.value[column.name] && column.validation) {
|
|
236
|
+
const error = applyRegexValidation(currentValues.value[column.name], column.validation);
|
|
237
|
+
if (error) {
|
|
238
|
+
return error;
|
|
231
239
|
}
|
|
232
|
-
|
|
233
240
|
}
|
|
241
|
+
|
|
234
242
|
return null;
|
|
235
243
|
});
|
|
236
244
|
return val.value;
|
|
@@ -244,14 +252,37 @@ const setCurrentValue = (key, value) => {
|
|
|
244
252
|
} else {
|
|
245
253
|
currentValues.value[key] = value;
|
|
246
254
|
}
|
|
255
|
+
if (['text', 'richtext', 'string'].includes(col.type) && col.enforceLowerCase) {
|
|
256
|
+
currentValues.value[key] = currentValues.value[key].toLowerCase();
|
|
257
|
+
}
|
|
258
|
+
|
|
247
259
|
currentValues.value = { ...currentValues.value };
|
|
248
|
-
|
|
249
|
-
|
|
260
|
+
|
|
261
|
+
//json fields should transform to object
|
|
262
|
+
const up = {...currentValues.value};
|
|
263
|
+
props.resource.columns.forEach((column) => {
|
|
264
|
+
if (column.type === 'json' && up[column.name]) {
|
|
265
|
+
try {
|
|
266
|
+
up[column.name] = JSON.parse(up[column.name]);
|
|
267
|
+
} catch (e) {
|
|
268
|
+
// do nothing
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
emit('update:record', up);
|
|
250
273
|
};
|
|
251
274
|
|
|
252
275
|
onMounted(() => {
|
|
276
|
+
|
|
253
277
|
currentValues.value = Object.assign({}, props.record);
|
|
254
|
-
|
|
278
|
+
// json values should transform to string
|
|
279
|
+
props.resource.columns.forEach((column) => {
|
|
280
|
+
if (column.type === 'json' && currentValues.value[column.name]) {
|
|
281
|
+
currentValues.value[column.name] = JSON.stringify(currentValues.value[column.name], null, 2);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
console.log('currentValues', currentValues.value);
|
|
285
|
+
|
|
255
286
|
initFlowbite();
|
|
256
287
|
emit('update:isValid', isValid.value);
|
|
257
288
|
});
|