adminforth 1.3.54-next.3 → 1.3.54-next.30

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 (135) hide show
  1. package/dist/auth.js +42 -56
  2. package/dist/auth.js.map +1 -0
  3. package/dist/basePlugin.js +1 -0
  4. package/dist/basePlugin.js.map +1 -0
  5. package/dist/dataConnectors/baseConnector.js +108 -122
  6. package/dist/dataConnectors/baseConnector.js.map +1 -0
  7. package/dist/dataConnectors/clickhouse.js +132 -150
  8. package/dist/dataConnectors/clickhouse.js.map +1 -0
  9. package/dist/dataConnectors/mongo.js +75 -101
  10. package/dist/dataConnectors/mongo.js.map +1 -0
  11. package/dist/dataConnectors/postgres.js +124 -143
  12. package/dist/dataConnectors/postgres.js.map +1 -0
  13. package/dist/dataConnectors/sqlite.js +113 -130
  14. package/dist/dataConnectors/sqlite.js.map +1 -0
  15. package/dist/index.js +197 -217
  16. package/dist/index.js.map +1 -0
  17. package/dist/modules/codeInjector.js +480 -486
  18. package/dist/modules/codeInjector.js.map +1 -0
  19. package/dist/modules/configValidator.js +31 -22
  20. package/dist/modules/configValidator.js.map +1 -0
  21. package/dist/modules/operationalResource.js +50 -70
  22. package/dist/modules/operationalResource.js.map +1 -0
  23. package/dist/modules/restApi.js +104 -116
  24. package/dist/modules/restApi.js.map +1 -0
  25. package/dist/modules/styleGenerator.js +1 -0
  26. package/dist/modules/styleGenerator.js.map +1 -0
  27. package/dist/modules/styles.js +1 -0
  28. package/dist/modules/styles.js.map +1 -0
  29. package/dist/modules/utils.js +1 -0
  30. package/dist/modules/utils.js.map +1 -0
  31. package/dist/plugins/audit-log/types.js +2 -0
  32. package/dist/plugins/audit-log/types.js.map +1 -0
  33. package/dist/plugins/chat-gpt/types.js +2 -0
  34. package/dist/plugins/chat-gpt/types.js.map +1 -0
  35. package/dist/plugins/email-password-reset/types.js +2 -0
  36. package/dist/plugins/email-password-reset/types.js.map +1 -0
  37. package/dist/plugins/foreign-inline-list/types.js +2 -0
  38. package/dist/plugins/foreign-inline-list/types.js.map +1 -0
  39. package/dist/plugins/import-export/types.js +2 -0
  40. package/dist/plugins/import-export/types.js.map +1 -0
  41. package/dist/plugins/rich-editor/custom/async-queue.js +29 -0
  42. package/dist/plugins/rich-editor/custom/async-queue.js.map +1 -0
  43. package/dist/plugins/rich-editor/dist/async-queue.js +41 -0
  44. package/dist/plugins/rich-editor/dist/custom/async-queue.js +29 -0
  45. package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +1 -0
  46. package/dist/plugins/rich-editor/types.js +16 -0
  47. package/dist/plugins/rich-editor/types.js.map +1 -0
  48. package/dist/plugins/two-factors-auth/types.js +2 -0
  49. package/dist/plugins/two-factors-auth/types.js.map +1 -0
  50. package/dist/plugins/upload/types.js +2 -0
  51. package/dist/plugins/upload/types.js.map +1 -0
  52. package/dist/servers/express.js +30 -42
  53. package/dist/servers/express.js.map +1 -0
  54. package/dist/types/AdminForthConfig.js +1 -0
  55. package/dist/types/AdminForthConfig.js.map +1 -0
  56. package/dist/types/FrontendAPI.js +1 -0
  57. package/dist/types/FrontendAPI.js.map +1 -0
  58. package/package.json +7 -4
  59. package/auth.ts +0 -140
  60. package/basePlugin.ts +0 -70
  61. package/dataConnectors/baseConnector.ts +0 -216
  62. package/dataConnectors/clickhouse.ts +0 -341
  63. package/dataConnectors/mongo.ts +0 -202
  64. package/dataConnectors/postgres.ts +0 -306
  65. package/dataConnectors/sqlite.ts +0 -254
  66. package/index.ts +0 -428
  67. package/modules/codeInjector.ts +0 -736
  68. package/modules/configValidator.ts +0 -571
  69. package/modules/operationalResource.ts +0 -98
  70. package/modules/restApi.ts +0 -718
  71. package/modules/styleGenerator.ts +0 -55
  72. package/modules/styles.ts +0 -126
  73. package/modules/utils.ts +0 -472
  74. package/servers/express.ts +0 -259
  75. package/spa/.eslintrc.cjs +0 -14
  76. package/spa/README.md +0 -39
  77. package/spa/env.d.ts +0 -1
  78. package/spa/index.html +0 -23
  79. package/spa/package-lock.json +0 -4573
  80. package/spa/package.json +0 -49
  81. package/spa/postcss.config.js +0 -6
  82. package/spa/public/assets/favicon.png +0 -0
  83. package/spa/src/App.vue +0 -418
  84. package/spa/src/assets/base.css +0 -2
  85. package/spa/src/assets/logo.svg +0 -19
  86. package/spa/src/components/AcceptModal.vue +0 -45
  87. package/spa/src/components/Breadcrumbs.vue +0 -41
  88. package/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  89. package/spa/src/components/CustomDatePicker.vue +0 -176
  90. package/spa/src/components/CustomDateRangePicker.vue +0 -218
  91. package/spa/src/components/CustomRangePicker.vue +0 -156
  92. package/spa/src/components/Dropdown.vue +0 -168
  93. package/spa/src/components/Filters.vue +0 -222
  94. package/spa/src/components/HelloWorld.vue +0 -17
  95. package/spa/src/components/MenuLink.vue +0 -27
  96. package/spa/src/components/ResourceForm.vue +0 -290
  97. package/spa/src/components/ResourceListTable.vue +0 -460
  98. package/spa/src/components/SingleSkeletLoader.vue +0 -13
  99. package/spa/src/components/SkeleteLoader.vue +0 -23
  100. package/spa/src/components/ThreeDotsMenu.vue +0 -43
  101. package/spa/src/components/Toast.vue +0 -78
  102. package/spa/src/components/ValueRenderer.vue +0 -114
  103. package/spa/src/components/icons/IconCalendar.vue +0 -5
  104. package/spa/src/components/icons/IconCommunity.vue +0 -7
  105. package/spa/src/components/icons/IconDocumentation.vue +0 -7
  106. package/spa/src/components/icons/IconEcosystem.vue +0 -7
  107. package/spa/src/components/icons/IconSupport.vue +0 -7
  108. package/spa/src/components/icons/IconTime.vue +0 -5
  109. package/spa/src/components/icons/IconTooling.vue +0 -19
  110. package/spa/src/composables/useFrontendApi.ts +0 -26
  111. package/spa/src/composables/useStores.ts +0 -131
  112. package/spa/src/index.scss +0 -31
  113. package/spa/src/main.ts +0 -18
  114. package/spa/src/router/index.ts +0 -59
  115. package/spa/src/spa_types/core.ts +0 -53
  116. package/spa/src/stores/core.ts +0 -148
  117. package/spa/src/stores/filters.ts +0 -27
  118. package/spa/src/stores/modal.ts +0 -48
  119. package/spa/src/stores/toast.ts +0 -31
  120. package/spa/src/stores/user.ts +0 -72
  121. package/spa/src/utils.ts +0 -149
  122. package/spa/src/views/CreateView.vue +0 -167
  123. package/spa/src/views/EditView.vue +0 -170
  124. package/spa/src/views/ListView.vue +0 -279
  125. package/spa/src/views/LoginView.vue +0 -192
  126. package/spa/src/views/ResourceParent.vue +0 -17
  127. package/spa/src/views/ShowView.vue +0 -186
  128. package/spa/tailwind.config.js +0 -17
  129. package/spa/tsconfig.app.json +0 -14
  130. package/spa/tsconfig.json +0 -11
  131. package/spa/tsconfig.node.json +0 -19
  132. package/spa/vite.config.ts +0 -56
  133. package/tsconfig.json +0 -112
  134. package/types/AdminForthConfig.ts +0 -1762
  135. package/types/FrontendAPI.ts +0 -143
@@ -1,290 +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
- <input
108
- v-else
109
- :type="!column.masked || unmasked[column.name] ? 'text' : 'password'"
110
- 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"
111
- placeholder="Text"
112
- :value="currentValues[column.name]"
113
- @input="setCurrentValue(column.name, $event.target.value)"
114
- autocomplete="false"
115
- data-lpignore="true"
116
- readonly
117
- onfocus="this.removeAttribute('readonly');"
118
- >
119
-
120
- <button
121
- v-if="column.masked"
122
- type="button"
123
- @click="unmasked[column.name] = !unmasked[column.name]"
124
- class="h-6 absolute inset-y-2 top-6 right-6 flex items-center pr-2 z-index-100 focus:outline-none"
125
- >
126
- <IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked[column.name]" />
127
- <IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
128
- </button>
129
- </template>
130
- <div v-if="columnError(column) && validating" class="mt-1 text-xs text-red-500 dark:text-red-400">{{ columnError(column) }}</div>
131
- <div v-if="column.editingNote && column.editingNote[mode]" class="mt-1 text-xs text-gray-400 dark:text-gray-500">{{ column.editingNote[mode] }}</div>
132
-
133
- </td>
134
- </tr>
135
-
136
- </tbody>
137
- </table>
138
- </form>
139
- </div>
140
- </div>
141
-
142
- </template>
143
-
144
- <script setup>
145
-
146
- import CustomDatePicker from "@/components/CustomDatePicker.vue";
147
- import Dropdown from '@/components/Dropdown.vue';
148
- import { applyRegexValidation, callAdminForthApi, getCustomComponent } from '@/utils';
149
- import { IconExclamationCircleSolid, IconEyeSlashSolid, IconEyeSolid } from '@iconify-prerendered/vue-flowbite';
150
- import { computedAsync } from '@vueuse/core';
151
- import { initFlowbite } from 'flowbite';
152
- import { computed, onMounted, ref, watch } from 'vue';
153
- import { useRouter, useRoute } from 'vue-router';
154
-
155
- const router = useRouter();
156
- const route = useRoute();
157
- const props = defineProps({
158
- loading: Boolean,
159
- resource: Object,
160
- record: Object,
161
- validating: Boolean,
162
- source: String,
163
- });
164
-
165
- const unmasked = ref({});
166
-
167
- const mode = computed(() => route.name === 'resource-create' ? 'create' : 'edit');
168
-
169
- const emit = defineEmits(['update:record', 'update:isValid']);
170
-
171
- const currentValues = ref(null);
172
-
173
- const customComponentsInValidity = ref({});
174
- const customComponentsEmptiness = ref({});
175
-
176
-
177
- const columnError = (column) => {
178
- const val = computed(() => {
179
- if (!currentValues.value) {
180
- return null;
181
- }
182
- if (customComponentsInValidity.value[column.name]) {
183
- return customComponentsInValidity.value[column.name];
184
- }
185
-
186
- if (
187
- column.required[mode.value] &&
188
- (currentValues.value[column.name] === undefined || currentValues.value[column.name] === null || currentValues.value[column.name] === '') &&
189
- // if component is custum it might tell other criteria for emptiness by emitting 'update:emptiness'
190
- // components which do not emit 'update:emptiness' will have undefined value in customComponentsEmptiness
191
- (customComponentsEmptiness.value[column.name] !== false)
192
-
193
- ) {
194
- return 'This field is required';
195
- }
196
- if ( column.type === 'string' || column.type === 'text' ) {
197
- if ( column.maxLength && currentValues.value[column.name]?.length > column.maxLength ) {
198
- return `This field must be shorter than ${column.maxLength} characters`;
199
- }
200
-
201
- if ( column.minLength && currentValues.value[column.name]?.length < column.minLength ) {
202
- // if column.required[mode.value] is false, then we check if the field is empty
203
- let needToCheckEmpty = column.required[mode.value] || currentValues.value[column.name]?.length > 0;
204
- if (!needToCheckEmpty) {
205
- return null;
206
- }
207
- return `This field must be longer than ${column.minLength} characters`;
208
- }
209
- }
210
- if ( ['integer', 'decimal', 'float'].includes(column.type) ) {
211
- if ( column.minValue !== undefined
212
- && currentValues.value[column.name] !== null
213
- && currentValues.value[column.name] < column.minValue
214
- ) {
215
- return `This field must be greater than ${column.minValue}`;
216
- }
217
- if ( column.maxValue !== undefined && currentValues.value[column.name] > column.maxValue ) {
218
- return `This field must be less than ${column.maxValue}`;
219
- }
220
- }
221
- if (currentValues.value[column.name] && column.validation) {
222
- const error = applyRegexValidation(currentValues.value[column.name], column.validation);
223
- if (error) {
224
- return error;
225
- }
226
- }
227
-
228
- return null;
229
- });
230
- return val.value;
231
- };
232
-
233
-
234
- const setCurrentValue = (key, value) => {
235
- const col = props.resource.columns.find((column) => column.name === key);
236
- if (['integer', 'float'].includes(col.type) && (value || value === 0)) {
237
- currentValues.value[key] = +value;
238
- } else {
239
- currentValues.value[key] = value;
240
- }
241
- if (['text', 'richtext', 'string'].includes(col.type) && col.enforceLowerCase) {
242
- currentValues.value[key] = currentValues.value[key].toLowerCase();
243
- }
244
-
245
- currentValues.value = { ...currentValues.value };
246
- emit('update:record', currentValues.value);
247
- };
248
-
249
- onMounted(() => {
250
- currentValues.value = Object.assign({}, props.record);
251
- initFlowbite();
252
- emit('update:isValid', isValid.value);
253
- });
254
-
255
- const columnOptions = computedAsync(async () => {
256
- return (await Promise.all(
257
- Object.values(props.resource.columns).map(async (column) => {
258
- if (column.foreignResource) {
259
- const list = await callAdminForthApi({
260
- method: 'POST',
261
- path: `/get_resource_foreign_data`,
262
- body: {
263
- resourceId: router.currentRoute.value.params.resourceId,
264
- column: column.name,
265
- limit: 1000,
266
- offset: 0,
267
- },
268
- });
269
- return { [column.name]: list.items };
270
- }
271
- })
272
- )).reduce((acc, val) => Object.assign(acc, val), {})
273
-
274
- }, {});
275
-
276
-
277
- const editableColumns = computed(() => {
278
- const mode = props.record ? 'edit' : 'create';
279
- return props.resource?.columns?.filter(column => column.showIn.includes(mode));
280
- });
281
-
282
- const isValid = computed(() => {
283
- return editableColumns.value?.every(column => !columnError(column));
284
- });
285
-
286
- watch(() => isValid.value, (value) => {
287
- emit('update:isValid', value);
288
- });
289
-
290
- </script>