adminforth 1.3.54-next.8 → 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.
Files changed (250) hide show
  1. package/dist/auth.d.ts +31 -0
  2. package/dist/auth.d.ts.map +1 -0
  3. package/dist/auth.js +42 -56
  4. package/dist/auth.js.map +1 -0
  5. package/dist/basePlugin.d.ts +18 -0
  6. package/dist/basePlugin.d.ts.map +1 -0
  7. package/dist/basePlugin.js +1 -0
  8. package/dist/basePlugin.js.map +1 -0
  9. package/dist/dataConnectors/baseConnector.d.ts +94 -0
  10. package/dist/dataConnectors/baseConnector.d.ts.map +1 -0
  11. package/dist/dataConnectors/baseConnector.js +108 -122
  12. package/dist/dataConnectors/baseConnector.js.map +1 -0
  13. package/dist/dataConnectors/clickhouse.d.ts +92 -0
  14. package/dist/dataConnectors/clickhouse.d.ts.map +1 -0
  15. package/dist/dataConnectors/clickhouse.js +132 -149
  16. package/dist/dataConnectors/clickhouse.js.map +1 -0
  17. package/dist/dataConnectors/mongo.d.ts +93 -0
  18. package/dist/dataConnectors/mongo.d.ts.map +1 -0
  19. package/dist/dataConnectors/mongo.js +75 -101
  20. package/dist/dataConnectors/mongo.js.map +1 -0
  21. package/dist/dataConnectors/postgres.d.ts +71 -0
  22. package/dist/dataConnectors/postgres.d.ts.map +1 -0
  23. package/dist/dataConnectors/postgres.js +124 -143
  24. package/dist/dataConnectors/postgres.js.map +1 -0
  25. package/dist/dataConnectors/sqlite.d.ts +67 -0
  26. package/dist/dataConnectors/sqlite.d.ts.map +1 -0
  27. package/dist/dataConnectors/sqlite.js +113 -130
  28. package/dist/dataConnectors/sqlite.js.map +1 -0
  29. package/dist/index.d.ts +92 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +197 -217
  32. package/dist/index.js.map +1 -0
  33. package/dist/modules/codeInjector.d.ts +35 -0
  34. package/dist/modules/codeInjector.d.ts.map +1 -0
  35. package/dist/modules/codeInjector.js +480 -486
  36. package/dist/modules/codeInjector.js.map +1 -0
  37. package/dist/modules/configValidator.d.ts +12 -0
  38. package/dist/modules/configValidator.d.ts.map +1 -0
  39. package/dist/modules/configValidator.js +31 -22
  40. package/dist/modules/configValidator.js.map +1 -0
  41. package/dist/modules/operationalResource.d.ts +17 -0
  42. package/dist/modules/operationalResource.d.ts.map +1 -0
  43. package/dist/modules/operationalResource.js +50 -70
  44. package/dist/modules/operationalResource.js.map +1 -0
  45. package/dist/modules/restApi.d.ts +10 -0
  46. package/dist/modules/restApi.d.ts.map +1 -0
  47. package/dist/modules/restApi.js +104 -116
  48. package/dist/modules/restApi.js.map +1 -0
  49. package/dist/modules/styleGenerator.d.ts +9 -0
  50. package/dist/modules/styleGenerator.d.ts.map +1 -0
  51. package/dist/modules/styleGenerator.js +1 -0
  52. package/dist/modules/styleGenerator.js.map +1 -0
  53. package/dist/modules/styles.d.ts +96 -0
  54. package/dist/modules/styles.d.ts.map +1 -0
  55. package/dist/modules/styles.js +1 -0
  56. package/dist/modules/styles.js.map +1 -0
  57. package/dist/modules/utils.d.ts +39 -0
  58. package/dist/modules/utils.d.ts.map +1 -0
  59. package/dist/modules/utils.js +1 -0
  60. package/dist/modules/utils.js.map +1 -0
  61. package/dist/plugins/audit-log/types.d.ts +35 -0
  62. package/dist/plugins/audit-log/types.d.ts.map +1 -0
  63. package/dist/plugins/audit-log/types.js +2 -0
  64. package/dist/plugins/audit-log/types.js.map +1 -0
  65. package/dist/plugins/chat-gpt/types.d.ts +82 -0
  66. package/dist/plugins/chat-gpt/types.d.ts.map +1 -0
  67. package/dist/plugins/chat-gpt/types.js +2 -0
  68. package/dist/plugins/chat-gpt/types.js.map +1 -0
  69. package/dist/plugins/email-password-reset/types.d.ts +28 -0
  70. package/dist/plugins/email-password-reset/types.d.ts.map +1 -0
  71. package/dist/plugins/email-password-reset/types.js +2 -0
  72. package/dist/plugins/email-password-reset/types.js.map +1 -0
  73. package/dist/plugins/foreign-inline-list/types.d.ts +19 -0
  74. package/dist/plugins/foreign-inline-list/types.d.ts.map +1 -0
  75. package/dist/plugins/foreign-inline-list/types.js +2 -0
  76. package/dist/plugins/foreign-inline-list/types.js.map +1 -0
  77. package/dist/plugins/import-export/types.d.ts +3 -0
  78. package/dist/plugins/import-export/types.d.ts.map +1 -0
  79. package/dist/plugins/import-export/types.js +2 -0
  80. package/dist/plugins/import-export/types.js.map +1 -0
  81. package/dist/plugins/rich-editor/custom/async-queue.d.ts +8 -0
  82. package/dist/plugins/rich-editor/custom/async-queue.d.ts.map +1 -0
  83. package/dist/plugins/rich-editor/custom/async-queue.js +29 -0
  84. package/dist/plugins/rich-editor/custom/async-queue.js.map +1 -0
  85. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts +8 -0
  86. package/dist/plugins/rich-editor/dist/custom/async-queue.d.ts.map +1 -0
  87. package/dist/plugins/rich-editor/dist/custom/async-queue.js +29 -0
  88. package/dist/plugins/rich-editor/dist/custom/async-queue.js.map +1 -0
  89. package/dist/plugins/rich-editor/types.d.ts +153 -0
  90. package/dist/plugins/rich-editor/types.d.ts.map +1 -0
  91. package/dist/plugins/rich-editor/types.js +16 -0
  92. package/dist/plugins/rich-editor/types.js.map +1 -0
  93. package/dist/plugins/two-factors-auth/types.d.ts +18 -0
  94. package/dist/plugins/two-factors-auth/types.d.ts.map +1 -0
  95. package/dist/plugins/two-factors-auth/types.js +2 -0
  96. package/dist/plugins/two-factors-auth/types.js.map +1 -0
  97. package/dist/plugins/upload/types.d.ts +132 -0
  98. package/dist/plugins/upload/types.d.ts.map +1 -0
  99. package/dist/plugins/upload/types.js +2 -0
  100. package/dist/plugins/upload/types.js.map +1 -0
  101. package/dist/servers/express.d.ts +18 -0
  102. package/dist/servers/express.d.ts.map +1 -0
  103. package/dist/servers/express.js +30 -42
  104. package/dist/servers/express.js.map +1 -0
  105. package/dist/types/AdminForthConfig.d.ts +1619 -0
  106. package/dist/types/AdminForthConfig.d.ts.map +1 -0
  107. package/dist/types/AdminForthConfig.js +1 -0
  108. package/dist/types/AdminForthConfig.js.map +1 -0
  109. package/{types/FrontendAPI.ts → dist/types/FrontendAPI.d.ts} +27 -52
  110. package/dist/types/FrontendAPI.d.ts.map +1 -0
  111. package/dist/types/FrontendAPI.js +1 -0
  112. package/dist/types/FrontendAPI.js.map +1 -0
  113. package/package.json +15 -5
  114. package/auth.ts +0 -140
  115. package/basePlugin.ts +0 -70
  116. package/dataConnectors/baseConnector.ts +0 -216
  117. package/dataConnectors/clickhouse.ts +0 -338
  118. package/dataConnectors/mongo.ts +0 -202
  119. package/dataConnectors/postgres.ts +0 -306
  120. package/dataConnectors/sqlite.ts +0 -254
  121. package/dist/spa/.eslintrc.cjs +0 -14
  122. package/dist/spa/README.md +0 -39
  123. package/dist/spa/env.d.ts +0 -1
  124. package/dist/spa/index.html +0 -23
  125. package/dist/spa/package-lock.json +0 -4573
  126. package/dist/spa/package.json +0 -49
  127. package/dist/spa/postcss.config.js +0 -6
  128. package/dist/spa/public/assets/favicon.png +0 -0
  129. package/dist/spa/src/App.vue +0 -314
  130. package/dist/spa/src/assets/base.css +0 -2
  131. package/dist/spa/src/assets/logo.svg +0 -19
  132. package/dist/spa/src/components/AcceptModal.vue +0 -45
  133. package/dist/spa/src/components/Breadcrumbs.vue +0 -41
  134. package/dist/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  135. package/dist/spa/src/components/CustomDatePicker.vue +0 -176
  136. package/dist/spa/src/components/CustomDateRangePicker.vue +0 -218
  137. package/dist/spa/src/components/CustomRangePicker.vue +0 -152
  138. package/dist/spa/src/components/Dropdown.vue +0 -168
  139. package/dist/spa/src/components/Filters.vue +0 -222
  140. package/dist/spa/src/components/HelloWorld.vue +0 -17
  141. package/dist/spa/src/components/MenuLink.vue +0 -24
  142. package/dist/spa/src/components/ResourceForm.vue +0 -294
  143. package/dist/spa/src/components/ResourceListTable.vue +0 -394
  144. package/dist/spa/src/components/SingleSkeletLoader.vue +0 -13
  145. package/dist/spa/src/components/SkeleteLoader.vue +0 -23
  146. package/dist/spa/src/components/Toast.vue +0 -77
  147. package/dist/spa/src/components/ValueRenderer.vue +0 -66
  148. package/dist/spa/src/components/icons/IconCalendar.vue +0 -5
  149. package/dist/spa/src/components/icons/IconCommunity.vue +0 -7
  150. package/dist/spa/src/components/icons/IconDocumentation.vue +0 -7
  151. package/dist/spa/src/components/icons/IconEcosystem.vue +0 -7
  152. package/dist/spa/src/components/icons/IconSupport.vue +0 -7
  153. package/dist/spa/src/components/icons/IconTime.vue +0 -5
  154. package/dist/spa/src/components/icons/IconTooling.vue +0 -19
  155. package/dist/spa/src/composables/useFrontendApi.ts +0 -26
  156. package/dist/spa/src/composables/useStores.ts +0 -127
  157. package/dist/spa/src/index.scss +0 -27
  158. package/dist/spa/src/main.ts +0 -18
  159. package/dist/spa/src/router/index.ts +0 -63
  160. package/dist/spa/src/spa_types/core.ts +0 -51
  161. package/dist/spa/src/stores/core.ts +0 -144
  162. package/dist/spa/src/stores/filters.ts +0 -22
  163. package/dist/spa/src/stores/modal.ts +0 -48
  164. package/dist/spa/src/stores/toast.ts +0 -15
  165. package/dist/spa/src/stores/user.ts +0 -72
  166. package/dist/spa/src/types/AdminForthConfig.ts +0 -1477
  167. package/dist/spa/src/types/FrontendAPI.ts +0 -121
  168. package/dist/spa/src/utils.ts +0 -103
  169. package/dist/spa/src/views/CreateView.vue +0 -156
  170. package/dist/spa/src/views/EditView.vue +0 -157
  171. package/dist/spa/src/views/ListView.vue +0 -258
  172. package/dist/spa/src/views/LoginView.vue +0 -160
  173. package/dist/spa/src/views/ResourceParent.vue +0 -17
  174. package/dist/spa/src/views/ShowView.vue +0 -184
  175. package/dist/spa/tailwind.config.js +0 -17
  176. package/dist/spa/tsconfig.app.json +0 -14
  177. package/dist/spa/tsconfig.json +0 -11
  178. package/dist/spa/tsconfig.node.json +0 -19
  179. package/dist/spa/vite.config.ts +0 -56
  180. package/index.ts +0 -428
  181. package/modules/codeInjector.ts +0 -736
  182. package/modules/configValidator.ts +0 -571
  183. package/modules/operationalResource.ts +0 -98
  184. package/modules/restApi.ts +0 -718
  185. package/modules/styleGenerator.ts +0 -55
  186. package/modules/styles.ts +0 -126
  187. package/modules/utils.ts +0 -472
  188. package/servers/express.ts +0 -259
  189. package/spa/.eslintrc.cjs +0 -14
  190. package/spa/README.md +0 -39
  191. package/spa/env.d.ts +0 -1
  192. package/spa/index.html +0 -23
  193. package/spa/package-lock.json +0 -4602
  194. package/spa/package.json +0 -51
  195. package/spa/postcss.config.js +0 -6
  196. package/spa/public/assets/favicon.png +0 -0
  197. package/spa/src/App.vue +0 -418
  198. package/spa/src/assets/base.css +0 -2
  199. package/spa/src/assets/logo.svg +0 -19
  200. package/spa/src/components/AcceptModal.vue +0 -45
  201. package/spa/src/components/Breadcrumbs.vue +0 -41
  202. package/spa/src/components/BreadcrumbsWithButtons.vue +0 -26
  203. package/spa/src/components/CustomDatePicker.vue +0 -176
  204. package/spa/src/components/CustomDateRangePicker.vue +0 -218
  205. package/spa/src/components/CustomRangePicker.vue +0 -156
  206. package/spa/src/components/Dropdown.vue +0 -168
  207. package/spa/src/components/Filters.vue +0 -222
  208. package/spa/src/components/HelloWorld.vue +0 -17
  209. package/spa/src/components/MenuLink.vue +0 -27
  210. package/spa/src/components/ResourceForm.vue +0 -290
  211. package/spa/src/components/ResourceListTable.vue +0 -466
  212. package/spa/src/components/SingleSkeletLoader.vue +0 -13
  213. package/spa/src/components/SkeleteLoader.vue +0 -23
  214. package/spa/src/components/ThreeDotsMenu.vue +0 -43
  215. package/spa/src/components/Toast.vue +0 -78
  216. package/spa/src/components/ValueRenderer.vue +0 -114
  217. package/spa/src/components/icons/IconCalendar.vue +0 -5
  218. package/spa/src/components/icons/IconCommunity.vue +0 -7
  219. package/spa/src/components/icons/IconDocumentation.vue +0 -7
  220. package/spa/src/components/icons/IconEcosystem.vue +0 -7
  221. package/spa/src/components/icons/IconSupport.vue +0 -7
  222. package/spa/src/components/icons/IconTime.vue +0 -5
  223. package/spa/src/components/icons/IconTooling.vue +0 -19
  224. package/spa/src/composables/useFrontendApi.ts +0 -26
  225. package/spa/src/composables/useStores.ts +0 -131
  226. package/spa/src/index.scss +0 -31
  227. package/spa/src/main.ts +0 -18
  228. package/spa/src/renderers/CompactUUID.vue +0 -48
  229. package/spa/src/renderers/CountryFlag.vue +0 -69
  230. package/spa/src/router/index.ts +0 -59
  231. package/spa/src/spa_types/core.ts +0 -53
  232. package/spa/src/stores/core.ts +0 -148
  233. package/spa/src/stores/filters.ts +0 -27
  234. package/spa/src/stores/modal.ts +0 -48
  235. package/spa/src/stores/toast.ts +0 -31
  236. package/spa/src/stores/user.ts +0 -72
  237. package/spa/src/utils.ts +0 -160
  238. package/spa/src/views/CreateView.vue +0 -167
  239. package/spa/src/views/EditView.vue +0 -170
  240. package/spa/src/views/ListView.vue +0 -352
  241. package/spa/src/views/LoginView.vue +0 -192
  242. package/spa/src/views/ResourceParent.vue +0 -17
  243. package/spa/src/views/ShowView.vue +0 -186
  244. package/spa/tailwind.config.js +0 -17
  245. package/spa/tsconfig.app.json +0 -14
  246. package/spa/tsconfig.json +0 -11
  247. package/spa/tsconfig.node.json +0 -19
  248. package/spa/vite.config.ts +0 -56
  249. package/tsconfig.json +0 -112
  250. package/types/AdminForthConfig.ts +0 -1762
@@ -1,466 +0,0 @@
1
- <template>
2
- <!-- table -->
3
- <div class="relative overflow-x-auto shadow-listTableShadow dark:shadow-darkListTableShadow overflow-y-hidden"
4
- :class="{'rounded-default': !noRoundings}"
5
- >
6
- <!-- skelet loader -->
7
- <div role="status" v-if="!resource || !resource.columns"
8
- 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">
9
-
10
- <div role="status" class="max-w-sm animate-pulse">
11
- <div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 max-w-[360px]"></div>
12
- </div>
13
- </div>
14
-
15
- <table v-else class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 rounded-default">
16
- <thead class="text-xs text-view-table-heading-text bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400">
17
- <tr>
18
- <th scope="col" class="p-4">
19
- <div v-if="rows && rows.length" class="flex items-center">
20
- <input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
21
- 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">
22
- <label for="checkbox-all-search" class="sr-only">checkbox</label>
23
- </div>
24
- </th>
25
-
26
- <th v-for="c in columnsListed" scope="col" class="px-2 md:px-3 lg:px-6 py-3">
27
-
28
- <div @click="(evt) => c.sortable && onSortButtonClick(evt, c.name)"
29
- class="flex items-center " :class="{'cursor-pointer':c.sortable}">
30
- {{ c.label }}
31
-
32
- <div v-if="c.sortable"
33
- :style="{ 'color':ascArr.includes(c.name)?'green':descArr.includes(c.name)?'red':'currentColor'}">
34
- <svg v-if="ascArr.includes(c.name) || descArr.includes(c.name)" class="w-3 h-3 ms-1.5"
35
- :class="{'rotate-180':descArr.includes(c.name)}" viewBox="0 0 24 24">
36
- <path
37
- 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"/>
38
- </svg>
39
- <svg v-else class="w-3 h-3 ms-1.5 opacity-30" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
40
- fill='currentColor'
41
- viewBox="0 0 24 24">
42
- <path
43
- 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"/>
44
- </svg>
45
- </div>
46
- <span
47
- 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"
48
- v-if="sort.findIndex((s) => s.field === c.name) !== -1 && sort?.length > 1">
49
- {{ sort.findIndex((s) => s.field === c.name) + 1 }}
50
- </span>
51
-
52
- </div>
53
- </th>
54
-
55
- <th scope="col" class="px-6 py-3">
56
- Actions
57
- </th>
58
- </tr>
59
- </thead>
60
- <tbody>
61
- <SkeleteLoader
62
- v-if="!rows"
63
- :columns="resource?.columns.filter(c => c.showIn.includes('list')).length + 2"
64
- :rows="3"
65
- />
66
- <tr v-else-if="rows.length === 0" class="bg-lightListTable dark:bg-darkListTable dark:border-darkListTableBorder">
67
- <td :colspan="resource?.columns.length + 2">
68
-
69
- <div id="toast-simple"
70
- 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"
71
- role="alert">
72
- <IconInboxOutline class="w-6 h-6 text-gray-500 dark:text-gray-400"/>
73
- <div class="ps-4 text-sm font-normal">No items here yet</div>
74
- </div>
75
-
76
- </td>
77
- </tr>
78
-
79
- <tr @click="onClick($event,row)"
80
- v-else v-for="(row, rowI) in rows" :key="`row_${row._primaryKeyValue}`"
81
- class="bg-lightListTable dark:bg-darkListTable border-lightListBorder dark:border-gray-700 hover:bg-lightListTableRowHover dark:hover:bg-darkListTableRowHover"
82
-
83
- :class="{'border-b': rowI !== rows.length - 1, 'cursor-pointer': row._clickUrl !== null}"
84
- >
85
- <td class="w-4 p-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
86
- <div class="flex items center ">
87
- <input
88
- @click="(e)=>{e.stopPropagation()}"
89
- id="checkbox-table-search-1"
90
- type="checkbox"
91
- :checked="checkboxesInternal.includes(row._primaryKeyValue)"
92
- @change="(e)=>{addToCheckedValues(row._primaryKeyValue)}"
93
- 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">
94
- <label for="checkbox-table-search-1" class="sr-only">checkbox</label>
95
- </div>
96
- </td>
97
- <td v-for="c in columnsListed" class="px-2 md:px-3 lg:px-6 py-4">
98
- <!-- if c.name in listComponentsPerColumn, render it. If not, render ValueRenderer -->
99
- <component
100
- :is="c?.components?.list ? getCustomComponent(c.components.list) : ValueRenderer"
101
- :meta="c?.components?.list?.meta"
102
- :column="c"
103
- :record="row"
104
- :adminUser="coreStore.adminUser"
105
- :resource="resource"
106
- />
107
- </td>
108
- <td class=" items-center px-2 md:px-3 lg:px-6 py-4 cursor-default" @click="(e)=>{e.stopPropagation()}">
109
- <div class="flex">
110
- <RouterLink
111
- v-if="resource.options?.allowedActions.show"
112
- :to="{
113
- name: 'resource-show',
114
- params: {
115
- resourceId: resource.resourceId,
116
- primaryKey: row._primaryKeyValue,
117
- }
118
- }"
119
- class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline"
120
- :data-tooltip-target="`tooltip-show-${rowI}`"
121
- >
122
- <IconEyeSolid class="w-5 h-5 me-2"/>
123
- </RouterLink>
124
-
125
- <div :id="`tooltip-show-${rowI}`"
126
- role="tooltip"
127
- 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">
128
- Show item
129
- <div class="tooltip-arrow" data-popper-arrow></div>
130
- </div>
131
-
132
- <RouterLink v-if="resource.options?.allowedActions.edit"
133
- :to="{
134
- name: 'resource-edit',
135
- params: {
136
- resourceId: resource.resourceId,
137
- primaryKey: row._primaryKeyValue
138
- }
139
- }"
140
- class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
141
- :data-tooltip-target="`tooltip-edit-${rowI}`"
142
- >
143
- <IconPenSolid class="w-5 h-5 me-2"/>
144
- </RouterLink>
145
-
146
- <div :id="`tooltip-edit-${rowI}`"
147
- role="tooltip"
148
- 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">
149
- Edit
150
- <div class="tooltip-arrow" data-popper-arrow></div>
151
- </div>
152
-
153
- <button v-if="resource.options?.allowedActions.delete"
154
- class="font-medium text-lightPrimary dark:text-darkPrimary hover:underline ms-3"
155
- :data-tooltip-target="`tooltip-delete-${rowI}`"
156
- @click="deleteRecord(row)"
157
- >
158
- <IconTrashBinSolid class="w-5 h-5 me-2"/>
159
- </button>
160
-
161
- <div :id="`tooltip-delete-${rowI}`"
162
- role="tooltip"
163
- 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">
164
- Delete
165
- <div class="tooltip-arrow" data-popper-arrow></div>
166
- </div>
167
-
168
-
169
- <template v-if="coreStore.resourceOptions?.pageInjections?.list?.customActionIcons">
170
- <component
171
- v-for="c in coreStore.resourceOptions?.pageInjections?.list?.customActionIcons"
172
- :is="getCustomComponent(c)"
173
- :meta="c.meta"
174
- :resource="coreStore.resource"
175
- :adminUser="coreStore.adminUser"
176
- :record="row"
177
- />
178
- </template>
179
- </div>
180
- </td>
181
- </tr>
182
- </tbody>
183
- </table>
184
- </div>
185
- <!-- pagination
186
- totalRows in v-if is used to not hide page input during loading when user puts cursor into it and edit directly (rows gets null there during edit)
187
- -->
188
- <div class="flex flex-col items-center mt-4 mb-4 xs:flex-row xs:justify-between xs:items-center"
189
- v-if="(rows || totalRows) && totalRows >= pageSize && totalRows > 0"
190
- >
191
- <!-- Help text -->
192
- <span class="text-sm text-gray-700 dark:text-gray-400">
193
- Showing <span class="font-semibold text-gray-900 dark:text-white">
194
- {{ ((page || 1) - 1) * pageSize + 1 }}
195
- </span> to <span class="font-semibold text-gray-900 dark:text-white">
196
- {{ Math.min((page || 1) * pageSize, totalRows) }}
197
- </span> of <span class="font-semibold text-gray-900 dark:text-white">{{
198
- totalRows
199
- }}</span> Entries
200
- </span>
201
- <div class="inline-flex mt-2 xs:mt-0">
202
- <!-- Buttons -->
203
- <button
204
- 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-lightPrimary 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"
205
- @click="page--" :disabled="page <= 1">
206
- <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"
207
- viewBox="0 0 14 10">
208
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
209
- d="M13 5H1m0 0 4 4M1 5l4-4"/>
210
- </svg>
211
- Prev
212
- </button>
213
- <button
214
- 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-lightPrimary 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"
215
- @click="page = 1" :disabled="page <= 1">
216
- <!-- <IconChevronDoubleLeftOutline class="w-4 h-4" /> -->
217
- 1
218
- </button>
219
- <div
220
- contenteditable="true"
221
- class="min-w-10 outline-none inline-block w-auto min-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"
222
- @input="page = parseInt($event.target.innerText) || ''"
223
- >
224
- {{ page }}
225
- </div>
226
-
227
- <button
228
- 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-lightPrimary 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"
229
- @click="page = totalPages" :disabled="page >= totalPages">
230
- {{ totalPages }}
231
-
232
- <!-- <IconChevronDoubleRightOutline class="w-4 h-4" /> -->
233
- </button>
234
- <button
235
- 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-lightPrimary 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"
236
-
237
- @click="page++" :disabled="page >= totalPages">
238
- Next
239
- <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"
240
- viewBox="0 0 14 10">
241
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
242
- d="M1 5h12m0 0L9 1m4 4L9 9"/>
243
- </svg>
244
- </button>
245
- </div>
246
-
247
- </div>
248
- </template>
249
-
250
- <script setup>
251
-
252
-
253
- import { computed, onMounted, ref, watch } from 'vue';
254
- import { callAdminForthApi } from '@/utils';
255
-
256
- import ValueRenderer from '@/components/ValueRenderer.vue';
257
- import { getCustomComponent } from '@/utils';
258
- import { useCoreStore } from '@/stores/core';
259
- import { showSuccesTost, showErrorTost } from '@/composables/useFrontendApi';
260
- import SkeleteLoader from '@/components/SkeleteLoader.vue';
261
-
262
- import {
263
- IconInboxOutline,
264
- } from '@iconify-prerendered/vue-flowbite';
265
-
266
- import {
267
- IconEyeSolid,
268
- IconPenSolid,
269
- IconTrashBinSolid
270
- } from '@iconify-prerendered/vue-flowbite';
271
- import router from '@/router';
272
-
273
- const coreStore = useCoreStore();
274
-
275
- const props = defineProps([
276
- 'page',
277
- 'resource',
278
- 'rows',
279
- 'totalRows',
280
- 'pageSize',
281
- 'checkboxes',
282
- 'sort',
283
- 'noRoundings'
284
- ])
285
-
286
- // emits, update page
287
- const emits = defineEmits([
288
- 'update:page',
289
- 'update:sort',
290
- 'update:checkboxes',
291
- 'update:records'
292
-
293
- ]);
294
-
295
- const checkboxesInternal = ref([]);
296
- const page = ref(1);
297
- const sort = ref([]);
298
-
299
-
300
-
301
- watch(() => page.value, (newPage) => {
302
- emits('update:page', newPage);
303
- });
304
-
305
- watch(() => sort.value, (newSort) => {
306
- emits('update:sort', newSort);
307
- });
308
-
309
- watch(() => checkboxesInternal.value, (newCheckboxes) => {
310
- console.log('checkboxesInternal ch changed, emiting', newCheckboxes)
311
-
312
- emits('update:checkboxes', newCheckboxes);
313
- });
314
-
315
- watch(() => props.checkboxes, (newCheckboxes) => {
316
- console.log('Props ch changed', newCheckboxes)
317
- checkboxesInternal.value = newCheckboxes;
318
- });
319
-
320
- watch(() => props.sort, (newSort) => {
321
- sort.value = newSort;
322
- });
323
-
324
- watch(() => props.page, (newPage) => {
325
- page.value = newPage;
326
- });
327
-
328
- function addToCheckedValues(id) {
329
- console.log('checking', checkboxesInternal.value, 'id', id)
330
- if (checkboxesInternal.value.includes(id)) {
331
- checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== id);
332
- } else {
333
- checkboxesInternal.value.push(id);
334
- }
335
- checkboxesInternal.value = [ ...checkboxesInternal.value ]
336
- }
337
-
338
- const columnsListed = computed(() => props.resource?.columns?.filter(c => c.showIn.includes('list')));
339
-
340
- async function selectAll(value) {
341
- if (!allFromThisPageChecked.value) {
342
- props.rows.forEach((r) => {
343
- if (!checkboxesInternal.value.includes(r._primaryKeyValue)) {
344
- checkboxesInternal.value.push(r._primaryKeyValue)
345
- }
346
- });
347
- } else {
348
- props.rows.forEach((r) => {
349
- checkboxesInternal.value = checkboxesInternal.value.filter((item) => item !== r._primaryKeyValue);
350
- });
351
- }
352
- checkboxesInternal.value = [ ...checkboxesInternal.value ];
353
- }
354
-
355
- const totalPages = computed(() => Math.ceil(props.totalRows / props.pageSize));
356
-
357
- const allFromThisPageChecked = computed(() => {
358
- if (!props.rows) return false;
359
- return props.rows.every((r) => checkboxesInternal.value.includes(r._primaryKeyValue));
360
- });
361
- const ascArr = computed(() => sort.value.filter((s) => s.direction === 'asc').map((s) => s.field));
362
- const descArr = computed(() => sort.value.filter((s) => s.direction === 'desc').map((s) => s.field));
363
-
364
-
365
- function onSortButtonClick(event, field) {
366
- // if ctrl key is pressed, add to sort otherwise sort by this field
367
- // in any case if field is already in sort, toggle direction
368
-
369
- const sortIndex = sort.value.findIndex((s) => s.field === field);
370
- if (sortIndex === -1) {
371
- // field is not in sort, add it
372
- if (event.ctrlKey) {
373
- sort.value = [...sort.value,{field, direction: 'asc'}];
374
- } else {
375
- sort.value = [{field, direction: 'asc'}];
376
- }
377
- } else {
378
- const sortField = sort.value[sortIndex];
379
- if (sortField.direction === 'asc') {
380
- sort.value[sortIndex].direction = 'desc';
381
- } else {
382
- sort.value.splice(sortIndex, 1);
383
- }
384
- }
385
- }
386
-
387
-
388
- const clickTarget = ref(null);
389
-
390
- async function onClick(e,row) {
391
- if(clickTarget.value === e.target) return;
392
- clickTarget.value = e.target;
393
- await new Promise((resolve) => setTimeout(resolve, 100));
394
- if (window.getSelection().toString()) return;
395
- else {
396
- if (row._clickUrl === null) {
397
- // user asked to nothing on click
398
- return;
399
- }
400
- if (e.ctrlKey || e.metaKey || row._clickUrl?.includes('target=_blank')) {
401
-
402
- if (row._clickUrl) {
403
- window.open(row._clickUrl, '_blank');
404
- } else {
405
- window.open(
406
- router.resolve({
407
- name: 'resource-show',
408
- params: {
409
- resourceId: props.resource.resourceId,
410
- primaryKey: row._primaryKeyValue,
411
- },
412
- }).fullPath,
413
- '_blank'
414
- );
415
- }
416
- } else {
417
- if (row._clickUrl) {
418
- if (row._clickUrl.startsWith('http')) {
419
- document.location.href = row._clickUrl;
420
- } else {
421
- router.push(row._clickUrl);
422
- }
423
- } else {
424
- router.push({
425
- name: 'resource-show',
426
- params: {
427
- resourceId: props.resource.resourceId,
428
- primaryKey: row._primaryKeyValue,
429
- },
430
- });
431
- }
432
- }
433
- }
434
- }
435
-
436
- async function deleteRecord(row) {
437
- const data = await window.adminforth.confirm({
438
- message: 'Are you sure you want to delete this item?',
439
- yes: 'Delete',
440
- no: 'Cancel',
441
- });
442
- if (data) {
443
- try {
444
- const res = await callAdminForthApi({
445
- path: '/delete_record',
446
- method: 'POST',
447
- body: {
448
- resourceId: props.resource.resourceId,
449
- primaryKey: row._primaryKeyValue,
450
- }
451
- });
452
- console.log('safsa', res)
453
- if (!res.error){
454
- emits('update:records', true)
455
- showSuccesTost('Record deleted successfully')
456
- } else {
457
- showErrorTost(res.error)
458
- }
459
-
460
- } catch (e) {
461
- showErrorTost(`Something went wrong, please try again later`);
462
- console.error(e);
463
- };
464
- }
465
- }
466
- </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.rows)" class="bg-lightListTable border-b dark:bg-darkListTable dark:border-darkListBorder">
3
- <td v-for="r in new Array(props.columns)" 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,43 +0,0 @@
1
- <template >
2
- <template v-if="threeDotsDropdownItems?.length">
3
- <button
4
- data-dropdown-toggle="listThreeDotsDropdown"
5
- class="flex items-center py-2 px-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary 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 rounded-default"
6
- >
7
- <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 4 15">
8
- <path d="M3.5 1.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6.041a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 5.959a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z"/>
9
- </svg>
10
- </button>
11
-
12
- <!-- Dropdown menu -->
13
- <div
14
- id="listThreeDotsDropdown"
15
- class="z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 dark:divide-gray-600">
16
- <ul class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdownMenuIconButton">
17
- <li v-for="item in threeDotsDropdownItems" :key="`dropdown-item-${item.label}`">
18
- <a href="#" class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
19
- <component :is="getCustomComponent(item)"
20
- :meta="item.meta"
21
- :resource="coreStore.resource"
22
- :adminUser="coreStore.adminUser"
23
- />
24
- </a>
25
- </li>
26
- </ul>
27
- </div>
28
- </template>
29
- </template>
30
-
31
-
32
- <script setup lang="ts">
33
-
34
- import { getCustomComponent } from '@/utils';
35
- import { useCoreStore } from '@/stores/core'
36
-
37
- const coreStore = useCoreStore()
38
-
39
- const props = defineProps<{
40
- threeDotsDropdownItems: any[] | undefined
41
- }>()
42
-
43
- </script>
@@ -1,78 +0,0 @@
1
- <template>
2
-
3
-
4
- <div class="flex items-center w-full p-4 text-gray-500 rounded-lg shadow-lg dark:text-gray-400 dark:bg-gray-800 bg-white"
5
- role="alert"
6
- :class="
7
- {
8
- 'danger': 'bg-red-100',
9
- }[toast.variant]
10
- "
11
- >
12
- <div v-if="toast.variant == 'info'" class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-lightPrimary dark:text-darkPrimary bg-lightPrimaryOpacity rounded-lg dark:bg-blue-800 dark:text-blue-200">
13
- <svg class="w-4 h-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 20">
14
- <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"/>
15
- </svg>
16
- <span class="sr-only">Fire icon</span>
17
- </div>
18
- <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">
19
- <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
20
- <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"/>
21
- </svg>
22
- <span class="sr-only">Error icon</span>
23
- </div>
24
- <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">
25
- <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
26
- <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"/>
27
- </svg>
28
- <span class="sr-only">Warning icon</span>
29
- </div>
30
- <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">
31
- <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
32
- <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"/>
33
- </svg>
34
- <span class="sr-only">Check icon</span>
35
- </div>
36
-
37
- <div class="ms-3 text-sm font-normal max-w-xs pr-2" v-if="toast.messageHtml" v-html="toast.messageHtml"></div>
38
- <div class="ms-3 text-sm font-normal max-w-xs pr-2" v-else>{{toast.message}}</div>
39
- <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" >
40
- <svg class="w-3 h-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
41
- <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"/>
42
- </svg>
43
- </button>
44
- </div>
45
-
46
-
47
- </template>
48
-
49
- <script setup lang="ts">
50
- import { onMounted } from 'vue';
51
- import { useToastStore } from '@/stores/toast';
52
- const toastStore = useToastStore();
53
- const emit = defineEmits(['close']);
54
- const props = defineProps<{
55
- toast: {
56
- message?: string;
57
- messageHtml?: string;
58
- variant: string;
59
- id: string;
60
- timeout?: number|'unlimited';
61
- }
62
- }>();
63
- function closeToast() {
64
- emit('close');
65
- }
66
-
67
- onMounted(() => {
68
- if (props.toast.timeout === 'unlimited') return;
69
- else {
70
- setTimeout(() => {emit('close');}, (props.toast.timeout || 10) * 1e3 );
71
- }
72
- });
73
-
74
- </script>
75
-
76
- <style lang="scss" scoped>
77
-
78
- </style>