adminforth 1.3.54-next.23 → 1.3.54-next.24

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.
Files changed (101) hide show
  1. package/dist/plugins/audit-log/types.js +2 -0
  2. package/dist/plugins/audit-log/types.js.map +1 -0
  3. package/dist/plugins/chat-gpt/types.js +2 -0
  4. package/dist/plugins/chat-gpt/types.js.map +1 -0
  5. package/dist/plugins/email-password-reset/types.js +2 -0
  6. package/dist/plugins/email-password-reset/types.js.map +1 -0
  7. package/dist/plugins/foreign-inline-list/types.js +2 -0
  8. package/dist/plugins/foreign-inline-list/types.js.map +1 -0
  9. package/dist/plugins/import-export/types.js +2 -0
  10. package/dist/plugins/import-export/types.js.map +1 -0
  11. package/dist/plugins/rich-editor/custom/async-queue.js +29 -0
  12. package/dist/plugins/rich-editor/custom/async-queue.js.map +1 -0
  13. package/dist/plugins/rich-editor/dist/async-queue.js +41 -0
  14. package/dist/plugins/rich-editor/dist/custom/async-queue.js +29 -0
  15. package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +1 -0
  16. package/dist/plugins/rich-editor/types.js +16 -0
  17. package/dist/plugins/rich-editor/types.js.map +1 -0
  18. package/dist/plugins/two-factors-auth/types.js +2 -0
  19. package/dist/plugins/two-factors-auth/types.js.map +1 -0
  20. package/dist/plugins/upload/types.js +2 -0
  21. package/dist/plugins/upload/types.js.map +1 -0
  22. package/package.json +4 -1
  23. package/auth.ts +0 -140
  24. package/basePlugin.ts +0 -70
  25. package/dataConnectors/baseConnector.ts +0 -221
  26. package/dataConnectors/clickhouse.ts +0 -343
  27. package/dataConnectors/mongo.ts +0 -202
  28. package/dataConnectors/postgres.ts +0 -310
  29. package/dataConnectors/sqlite.ts +0 -258
  30. package/index.ts +0 -428
  31. package/modules/codeInjector.ts +0 -747
  32. package/modules/configValidator.ts +0 -588
  33. package/modules/operationalResource.ts +0 -98
  34. package/modules/restApi.ts +0 -718
  35. package/modules/styleGenerator.ts +0 -55
  36. package/modules/styles.ts +0 -126
  37. package/modules/utils.ts +0 -472
  38. package/servers/express.ts +0 -259
  39. package/spa/.eslintrc.cjs +0 -14
  40. package/spa/README.md +0 -39
  41. package/spa/env.d.ts +0 -1
  42. package/spa/index.html +0 -23
  43. package/spa/package-lock.json +0 -4659
  44. package/spa/package.json +0 -52
  45. package/spa/postcss.config.js +0 -6
  46. package/spa/public/assets/favicon.png +0 -0
  47. package/spa/src/App.vue +0 -418
  48. package/spa/src/assets/base.css +0 -2
  49. package/spa/src/assets/logo.svg +0 -19
  50. package/spa/src/components/AcceptModal.vue +0 -45
  51. package/spa/src/components/Breadcrumbs.vue +0 -41
  52. package/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  53. package/spa/src/components/CustomDatePicker.vue +0 -176
  54. package/spa/src/components/CustomDateRangePicker.vue +0 -218
  55. package/spa/src/components/CustomRangePicker.vue +0 -156
  56. package/spa/src/components/Dropdown.vue +0 -168
  57. package/spa/src/components/Filters.vue +0 -222
  58. package/spa/src/components/HelloWorld.vue +0 -17
  59. package/spa/src/components/MenuLink.vue +0 -27
  60. package/spa/src/components/ResourceForm.vue +0 -325
  61. package/spa/src/components/ResourceListTable.vue +0 -466
  62. package/spa/src/components/SingleSkeletLoader.vue +0 -13
  63. package/spa/src/components/SkeleteLoader.vue +0 -23
  64. package/spa/src/components/ThreeDotsMenu.vue +0 -43
  65. package/spa/src/components/Toast.vue +0 -78
  66. package/spa/src/components/ValueRenderer.vue +0 -141
  67. package/spa/src/components/icons/IconCalendar.vue +0 -5
  68. package/spa/src/components/icons/IconCommunity.vue +0 -7
  69. package/spa/src/components/icons/IconDocumentation.vue +0 -7
  70. package/spa/src/components/icons/IconEcosystem.vue +0 -7
  71. package/spa/src/components/icons/IconSupport.vue +0 -7
  72. package/spa/src/components/icons/IconTime.vue +0 -5
  73. package/spa/src/components/icons/IconTooling.vue +0 -19
  74. package/spa/src/composables/useFrontendApi.ts +0 -26
  75. package/spa/src/composables/useStores.ts +0 -131
  76. package/spa/src/index.scss +0 -31
  77. package/spa/src/main.ts +0 -18
  78. package/spa/src/renderers/CompactUUID.vue +0 -48
  79. package/spa/src/renderers/CountryFlag.vue +0 -69
  80. package/spa/src/router/index.ts +0 -59
  81. package/spa/src/spa_types/core.ts +0 -53
  82. package/spa/src/stores/core.ts +0 -148
  83. package/spa/src/stores/filters.ts +0 -27
  84. package/spa/src/stores/modal.ts +0 -48
  85. package/spa/src/stores/toast.ts +0 -31
  86. package/spa/src/stores/user.ts +0 -72
  87. package/spa/src/utils.ts +0 -160
  88. package/spa/src/views/CreateView.vue +0 -167
  89. package/spa/src/views/EditView.vue +0 -170
  90. package/spa/src/views/ListView.vue +0 -352
  91. package/spa/src/views/LoginView.vue +0 -192
  92. package/spa/src/views/ResourceParent.vue +0 -17
  93. package/spa/src/views/ShowView.vue +0 -194
  94. package/spa/tailwind.config.js +0 -17
  95. package/spa/tsconfig.app.json +0 -14
  96. package/spa/tsconfig.json +0 -11
  97. package/spa/tsconfig.node.json +0 -19
  98. package/spa/vite.config.ts +0 -56
  99. package/tsconfig.json +0 -112
  100. package/types/AdminForthConfig.ts +0 -1762
  101. package/types/FrontendAPI.ts +0 -143
@@ -1,325 +0,0 @@
1
- <template>
2
- <div class="rounded-default">
3
- <div
4
- class="relative shadow-resourseFormShadow dark:shadow-darkResourseFormShadow sm:rounded-lg dark:shadow-2xl rounded-default"
5
- >
6
- <form autocomplete="off" @submit.prevent>
7
- <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
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
- <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>
17
- </thead>
18
- <tbody>
19
- <tr v-for="column, i in editableColumns" :key="column.name"
20
- v-if="currentValues !== null"
21
- class="bg-ligftForm dark:bg-gray-800 dark:border-gray-700 block md:table-row"
22
- :class="{ 'border-b': i !== editableColumns.length - 1 }"
23
- >
24
- <td class="px-6 py-4 sm:pb-0 whitespace-nowrap flex items-center block md:table-cell"> <!--align-top-->
25
- {{ column.label }}
26
- <span :data-tooltip-target="`tooltip-show-${i}`" class="ml-1 relative inline-block">
27
- <IconExclamationCircleSolid v-if="column.required[mode]" class="w-4 h-4"
28
- :class="(columnError(column) && validating) ? 'text-red-500 dark:text-red-400' : 'text-gray-400 dark:text-gray-500'"
29
- />
30
- </span>
31
- <div :id="`tooltip-show-${i}`"
32
- role="tooltip"
33
- class="ml-1 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">
34
- Required field
35
- <div class="tooltip-arrow" data-popper-arrow></div>
36
- </div>
37
- </td>
38
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative block md:table-cell">
39
- <template v-if="column?.components?.[props.source]?.file">
40
- <component
41
- :is="getCustomComponent(column.components[props.source])"
42
- :column="column"
43
- :value="currentValues[column.name]"
44
- @update:value="setCurrentValue(column.name, $event)"
45
- :meta="column.components[props.source].meta"
46
- :record="currentValues"
47
- @update:inValidity="customComponentsInValidity[column.name] = $event"
48
- @update:emptiness="customComponentsEmptiness[column.name] = $event"
49
- />
50
- </template>
51
- <template v-else>
52
- <Dropdown
53
- single
54
- v-if="column.foreignResource"
55
- :options="columnOptions[column.name] || []"
56
- :placeholder = "columnOptions[column.name]?.length ?'Select...': 'There are no options available'"
57
- :modelValue="currentValues[column.name]"
58
- @update:modelValue="setCurrentValue(column.name, $event)"
59
- ></Dropdown>
60
- <Dropdown
61
- single
62
- v-else-if="column.enum"
63
- :options="column.enum"
64
- :modelValue="currentValues[column.name]"
65
- @update:modelValue="setCurrentValue(column.name, $event)"
66
- />
67
- <Dropdown
68
- single
69
- v-else-if="column.type === 'boolean'"
70
- :options="[{ label: 'Yes', value: true }, { label: 'No', value: false }, { label: 'Unset', value: null }]"
71
- :modelValue="currentValues[column.name]"
72
- @update:modelValue="setCurrentValue(column.name, $event)"
73
- />
74
- <input
75
- v-else-if="['integer'].includes(column.type)"
76
- type="number"
77
- step="1"
78
- 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-40 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"
79
- placeholder="0"
80
- :value="currentValues[column.name]"
81
- @input="setCurrentValue(column.name, $event.target.value)"
82
- >
83
- <CustomDatePicker
84
- v-else-if="['datetime'].includes(column.type)"
85
- :column="column"
86
- :valueStart="currentValues[column.name]"
87
- auto-hide
88
- @update:valueStart="setCurrentValue(column.name, $event)"
89
- />
90
- <input
91
- v-else-if="['decimal', 'float'].includes(column.type)"
92
- type="number"
93
- step="0.1"
94
- 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-40 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"
95
- placeholder="0.0"
96
- :value="currentValues[column.name]"
97
- @input="setCurrentValue(column.name, $event.target.value)"
98
- />
99
- <textarea
100
- v-else-if="['text', 'richtext'].includes(column.type)"
101
- 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"
102
- placeholder="Text"
103
- :value="currentValues[column.name]"
104
- @input="setCurrentValue(column.name, $event.target.value)"
105
- >
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>
115
- <input
116
- v-else
117
- :type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
118
- 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"
119
- placeholder="Text"
120
- :value="currentValues[column.name]"
121
- @input="setCurrentValue(column.name, $event.target.value)"
122
- autocomplete="false"
123
- data-lpignore="true"
124
- readonly
125
- onfocus="this.removeAttribute('readonly');"
126
- >
127
-
128
- <button
129
- v-if="column.masked"
130
- type="button"
131
- @click="unmasked[column.name] = !unmasked[column.name]"
132
- class="h-6 absolute inset-y-2 top-6 right-6 flex items-center pr-2 z-index-100 focus:outline-none"
133
- >
134
- <IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked[column.name]" />
135
- <IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
136
- </button>
137
- </template>
138
- <div v-if="columnError(column) && validating" class="mt-1 text-xs text-red-500 dark:text-red-400">{{ columnError(column) }}</div>
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>
140
-
141
- </td>
142
- </tr>
143
-
144
- </tbody>
145
- </table>
146
- </form>
147
- </div>
148
- </div>
149
-
150
- </template>
151
-
152
- <script setup>
153
-
154
- import CustomDatePicker from "@/components/CustomDatePicker.vue";
155
- import Dropdown from '@/components/Dropdown.vue';
156
- import { applyRegexValidation, callAdminForthApi, getCustomComponent } from '@/utils';
157
- import { IconExclamationCircleSolid, IconEyeSlashSolid, IconEyeSolid } from '@iconify-prerendered/vue-flowbite';
158
- import { computedAsync } from '@vueuse/core';
159
- import { initFlowbite } from 'flowbite';
160
- import { computed, onMounted, ref, watch } from 'vue';
161
- import { useRouter, useRoute } from 'vue-router';
162
-
163
- const router = useRouter();
164
- const route = useRoute();
165
- const props = defineProps({
166
- resource: Object,
167
- record: Object,
168
- validating: Boolean,
169
- source: String,
170
- });
171
-
172
- const unmasked = ref({});
173
-
174
- const mode = computed(() => route.name === 'resource-create' ? 'create' : 'edit');
175
-
176
- const emit = defineEmits(['update:record', 'update:isValid']);
177
-
178
- const currentValues = ref(null);
179
-
180
- const customComponentsInValidity = ref({});
181
- const customComponentsEmptiness = ref({});
182
-
183
-
184
- const columnError = (column) => {
185
- const val = computed(() => {
186
- if (!currentValues.value) {
187
- return null;
188
- }
189
- if (customComponentsInValidity.value[column.name]) {
190
- return customComponentsInValidity.value[column.name];
191
- }
192
-
193
- if (
194
- column.required[mode.value] &&
195
- (currentValues.value[column.name] === undefined || currentValues.value[column.name] === null || currentValues.value[column.name] === '') &&
196
- // if component is custum it might tell other criteria for emptiness by emitting 'update:emptiness'
197
- // components which do not emit 'update:emptiness' will have undefined value in customComponentsEmptiness
198
- (customComponentsEmptiness.value[column.name] !== false)
199
-
200
- ) {
201
- return 'This field is required';
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
- }
210
- if ( column.type === 'string' || column.type === 'text' ) {
211
- if ( column.maxLength && currentValues.value[column.name]?.length > column.maxLength ) {
212
- return `This field must be shorter than ${column.maxLength} characters`;
213
- }
214
-
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
- }
221
- return `This field must be longer than ${column.minLength} characters`;
222
- }
223
- }
224
- if ( ['integer', 'decimal', 'float'].includes(column.type) ) {
225
- if ( column.minValue !== undefined
226
- && currentValues.value[column.name] !== null
227
- && currentValues.value[column.name] < column.minValue
228
- ) {
229
- return `This field must be greater than ${column.minValue}`;
230
- }
231
- if ( column.maxValue !== undefined && currentValues.value[column.name] > column.maxValue ) {
232
- return `This field must be less than ${column.maxValue}`;
233
- }
234
- }
235
- if (currentValues.value[column.name] && column.validation) {
236
- const error = applyRegexValidation(currentValues.value[column.name], column.validation);
237
- if (error) {
238
- return error;
239
- }
240
- }
241
-
242
- return null;
243
- });
244
- return val.value;
245
- };
246
-
247
-
248
- const setCurrentValue = (key, value) => {
249
- const col = props.resource.columns.find((column) => column.name === key);
250
- if (['integer', 'float'].includes(col.type) && (value || value === 0)) {
251
- currentValues.value[key] = +value;
252
- } else {
253
- currentValues.value[key] = value;
254
- }
255
- if (['text', 'richtext', 'string'].includes(col.type) && col.enforceLowerCase) {
256
- currentValues.value[key] = currentValues.value[key].toLowerCase();
257
- }
258
-
259
- currentValues.value = { ...currentValues.value };
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);
273
- };
274
-
275
- onMounted(() => {
276
-
277
- currentValues.value = Object.assign({}, props.record);
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
-
286
- initFlowbite();
287
- emit('update:isValid', isValid.value);
288
- });
289
-
290
- const columnOptions = computedAsync(async () => {
291
- return (await Promise.all(
292
- Object.values(props.resource.columns).map(async (column) => {
293
- if (column.foreignResource) {
294
- const list = await callAdminForthApi({
295
- method: 'POST',
296
- path: `/get_resource_foreign_data`,
297
- body: {
298
- resourceId: router.currentRoute.value.params.resourceId,
299
- column: column.name,
300
- limit: 1000,
301
- offset: 0,
302
- },
303
- });
304
- return { [column.name]: list.items };
305
- }
306
- })
307
- )).reduce((acc, val) => Object.assign(acc, val), {})
308
-
309
- }, {});
310
-
311
-
312
- const editableColumns = computed(() => {
313
- const mode = props.record ? 'edit' : 'create';
314
- return props.resource?.columns?.filter(column => column.showIn.includes(mode));
315
- });
316
-
317
- const isValid = computed(() => {
318
- return editableColumns.value?.every(column => !columnError(column));
319
- });
320
-
321
- watch(() => isValid.value, (value) => {
322
- emit('update:isValid', value);
323
- });
324
-
325
- </script>