adminforth 1.3.54-next.9 → 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,176 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="grid w-40 gap-4 mb-2">
4
- <div>
5
- <label for="start-time" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ label }}</label>
6
-
7
- <div class="relative">
8
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
9
- <IconCalendar class="w-4 h-4 text-gray-500 dark:text-gray-400"/>
10
- </div>
11
-
12
- <input ref="datepickerStartEl" type="text"
13
- class="bg-gray-50 border leading-none 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"
14
- placeholder="Select date">
15
- </div>
16
- </div>
17
- </div>
18
-
19
- <div>
20
- <div class="grid w-40 gap-4 mb-2" :class="{hidden: !showTimeInputs}">
21
- <div>
22
- <div class="relative">
23
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
24
- <IconTime class="w-4 h-4 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-700"/>
25
- </div>
26
-
27
- <input v-model="startTime" type="time" id="start-time" onfocus="this.showPicker()" onclick="this.showPicker()" step="1"
28
- class="bg-gray-50 border leading-none 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"
29
- value="00:00" required/>
30
- </div>
31
- </div>
32
- </div>
33
-
34
- <button type="button"
35
- class="text-blue-700 dark:text-blue-500 text-base font-medium hover:underline p-0 inline-flex items-center mb-2"
36
- @click="toggleTimeInputs">{{ showTimeInputs ? 'Hide time' : 'Show time' }}
37
- <svg class="w-8 h-8 ms-0.5" :class="{'rotate-180': showTimeInputs}" aria-hidden="true"
38
- xmlns="http://www.w3.org/2000/svg" width="24" height="24"
39
- fill="none" viewBox="0 0 24 24">
40
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
41
- d="m8 10 4 4 4-4"/>
42
- </svg>
43
- </button>
44
- </div>
45
- </div>
46
- </template>
47
- <script setup>
48
- import {ref, computed, onMounted, watch, onBeforeUnmount} from 'vue';
49
- import dayjs from 'dayjs';
50
- import utc from 'dayjs/plugin/utc';
51
-
52
- import {useCoreStore} from '@/stores/core';
53
-
54
- import Datepicker from "flowbite-datepicker/Datepicker";
55
- import IconCalendar from "@/components/icons/IconCalendar.vue";
56
- import IconTime from "@/components/icons/IconTime.vue";
57
-
58
- const coreStore = useCoreStore();
59
- dayjs.extend(utc)
60
-
61
- const props = defineProps({
62
- valueStart: {
63
- default: undefined
64
- },
65
- column: {
66
- type: Object,
67
- },
68
- label: {
69
- type: String,
70
- },
71
- autoHide: {
72
- type: Boolean,
73
- }
74
- });
75
-
76
- const emit = defineEmits(['update:valueStart']);
77
-
78
- const datepickerStartEl = ref();
79
-
80
- const showTimeInputs = ref(false);
81
-
82
- const startDate = ref('');
83
-
84
- const startTime = ref('');
85
-
86
- const datepickerObject = ref('')
87
-
88
- const start = computed(() => {
89
- if (!startDate.value) {
90
- return;
91
- }
92
-
93
- let date = dayjs(startDate.value);
94
-
95
- if (startTime.value) {
96
- date = addTimeToDate(formatTime(startTime.value), date)
97
- }
98
-
99
- return date.utc().toISOString();
100
- })
101
-
102
- async function updateFromProps() {
103
- if (!props.valueStart) {
104
- datepickerStartEl.value.value = '';
105
- startTime.value = '';
106
- } else {
107
- // wait ref to initialize
108
- await (new Promise(resolve => setTimeout(resolve, 0)));
109
- datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
110
- startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
111
- }
112
- }
113
-
114
- onMounted(() => {
115
- updateFromProps();
116
-
117
- watch(() => [props.valueStart], (value) => {
118
- updateFromProps();
119
- });
120
- })
121
-
122
- watch(start, () => {
123
- //console.log('⚡ emit', start.value)
124
- emit('update:valueStart', start.value)
125
- })
126
-
127
- function initDatepickers() {
128
- const options = {format: 'dd M yyyy'};
129
-
130
- if (props.autoHide) {
131
- options.autohide = true;
132
- }
133
-
134
- datepickerObject.value = new Datepicker(datepickerStartEl.value, options);
135
-
136
- addChangeDateListener();
137
- }
138
-
139
- function addChangeDateListener() {
140
- datepickerStartEl.value.addEventListener('changeDate', setStartDate)
141
- }
142
-
143
- function removeChangeDateListener() {
144
- datepickerStartEl.value.removeEventListener('changeDate', setStartDate);
145
- }
146
-
147
- function destroyDatepickerElement() {
148
- datepickerObject.value.destroy();
149
- }
150
-
151
- function setStartDate(event) {
152
- startDate.value = event.detail.date
153
- }
154
-
155
- function formatTime(time) {
156
- return time.split(':').map(Number).length === 2 ? time + ':00' : time;
157
- }
158
-
159
- function addTimeToDate(time, date) {
160
- const [hours, minutes, seconds] = time.split(':').map(Number)
161
- return date.hour(hours).minute(minutes).second(seconds)
162
- }
163
-
164
- const toggleTimeInputs = () => {
165
- showTimeInputs.value = !showTimeInputs.value
166
- }
167
-
168
- onMounted(() => {
169
- initDatepickers();
170
- });
171
-
172
- onBeforeUnmount(() => {
173
- removeChangeDateListener();
174
- destroyDatepickerElement();
175
- });
176
- </script>
@@ -1,218 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="mx-auto grid grid-cols-2 gap-4 mb-2">
4
- <div class="relative">
5
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
6
- <IconCalendar class="w-4 h-4 text-gray-500 dark:text-gray-400"/>
7
- </div>
8
-
9
- <input ref="datepickerStartEl" type="text"
10
- class="bg-gray-50 border leading-none 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"
11
- placeholder="From">
12
- </div>
13
-
14
- <div class="relative">
15
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
16
- <IconCalendar class="w-4 h-4 text-gray-500 dark:text-gray-400"/>
17
- </div>
18
-
19
- <input ref="datepickerEndEl" type="text"
20
- class="bg-gray-50 border leading-none 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"
21
- placeholder="To">
22
- </div>
23
- </div>
24
-
25
- <div>
26
- <div class="mx-auto grid grid-cols-2 gap-4 mb-2" :class="{hidden: !showTimeInputs}">
27
- <div>
28
- <div class="relative">
29
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
30
- <IconTime class="w-4 h-4 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-700"/>
31
- </div>
32
-
33
- <input v-model="startTime" type="time" id="start-time"
34
- class="bg-gray-50 border leading-none 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"
35
- value="00:00" required/>
36
- </div>
37
- </div>
38
-
39
- <div>
40
- <div class="relative">
41
- <div class="absolute inset-y-0 end-0 top-0 flex items-center pe-3.5 pointer-events-none">
42
- <IconTime class="w-4 h-4 text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-700"/>
43
- </div>
44
-
45
- <input v-model="endTime" type="time" id="end-time"
46
- class="bg-gray-50 border leading-none 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"
47
- value="00:00" required/>
48
- </div>
49
- </div>
50
- </div>
51
-
52
- <button type="button"
53
- class="text-blue-700 dark:text-blue-500 text-base font-medium hover:underline p-0 inline-flex items-center mb-2"
54
- @click="toggleTimeInputs">{{ showTimeInputs ? 'Hide time' : 'Show time' }}
55
- <svg class="w-8 h-8 ms-0.5 relative top-px" :class="{'rotate-180': showTimeInputs}" aria-hidden="true"
56
- xmlns="http://www.w3.org/2000/svg" width="24" height="24"
57
- fill="none" viewBox="0 0 24 24">
58
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
59
- d="m8 10 4 4 4-4"/>
60
- </svg>
61
- </button>
62
- </div>
63
- </div>
64
- </template>
65
- <script setup>
66
- import {ref, computed, onMounted, watch, onBeforeUnmount} from 'vue';
67
- import dayjs from 'dayjs';
68
- import utc from 'dayjs/plugin/utc';
69
-
70
- import {useCoreStore} from '@/stores/core';
71
-
72
- import Datepicker from "flowbite-datepicker/Datepicker";
73
- import IconCalendar from "@/components/icons/IconCalendar.vue";
74
- import IconTime from "@/components/icons/IconTime.vue";
75
-
76
- const coreStore = useCoreStore();
77
- dayjs.extend(utc)
78
-
79
- const props = defineProps({
80
- valueStart: {
81
- default: undefined
82
- },
83
- valueEnd: {
84
- default: undefined
85
- },
86
- column: {
87
- type: Object,
88
- },
89
- });
90
-
91
- const emit = defineEmits(['update:valueStart', 'update:valueEnd']);
92
-
93
- const datepickerStartEl = ref();
94
- const datepickerEndEl = ref();
95
-
96
- const showTimeInputs = ref(false);
97
-
98
- const startDate = ref('');
99
- const endDate = ref('');
100
-
101
- const startTime = ref('');
102
- const endTime = ref('');
103
-
104
- const datepickerStartObject = ref('')
105
- const datepickerEndObject = ref('')
106
-
107
- const start = computed(() => {
108
- if (!startDate.value) {
109
- return;
110
- }
111
-
112
- let date = dayjs(startDate.value);
113
-
114
- if (startTime.value) {
115
- date = addTimeToDate(formatTime(startTime.value), date)
116
- }
117
-
118
- return date.utc().toISOString();
119
- })
120
-
121
- const end = computed(() => {
122
- if (!endDate.value) {
123
- return;
124
- }
125
-
126
- let date = dayjs(endDate.value);
127
-
128
- if (endTime.value) {
129
- date = addTimeToDate(formatTime(endTime.value), date)
130
- } else {
131
- date = addTimeToDate('23:59:59', date)
132
- }
133
-
134
- return date.utc().toISOString();
135
- })
136
-
137
- function updateFromProps() {
138
- if (!props.valueStart) {
139
- datepickerStartEl.value.value = '';
140
- startTime.value = '';
141
- }
142
- if (!props.valueEnd) {
143
- datepickerEndEl.value.value = '';
144
- endTime.value = '';
145
- }
146
- }
147
-
148
- onMounted(() => {
149
- updateFromProps();
150
-
151
- watch(() => [props.valueStart, props.valueEnd], (value) => {
152
- updateFromProps();
153
- });
154
- })
155
-
156
- watch(start, () => {
157
- //console.log('⚡ emit', start.value)
158
- emit('update:valueStart', start.value)
159
- })
160
-
161
- watch(end, () => {
162
- //console.log('⚡ emit', end.value)
163
- emit('update:valueEnd', end.value)
164
- })
165
-
166
- function initDatepickers() {
167
-
168
- datepickerStartObject.value = new Datepicker(datepickerStartEl.value, {format: 'dd M yyyy'});
169
-
170
- datepickerEndObject.value = new Datepicker(datepickerEndEl.value, {format: 'dd M yyyy'});
171
- addChangeDateListener();
172
- }
173
-
174
- function addChangeDateListener() {
175
- datepickerStartEl.value.addEventListener('changeDate', setStartDate)
176
- datepickerEndEl.value.addEventListener('changeDate', setEndDate)
177
- }
178
-
179
- function removeChangeDateListener() {
180
- datepickerStartEl.value.removeEventListener('changeDate', setStartDate);
181
- datepickerEndEl.value.removeEventListener('changeDate', setEndDate);
182
- }
183
-
184
- function destroyDatepickerElement() {
185
- datepickerStartObject.value.destroy();
186
- datepickerEndObject.value.destroy();
187
- }
188
-
189
- function setStartDate(event) {
190
- startDate.value = event.detail.date
191
- }
192
-
193
- function setEndDate(event) {
194
- endDate.value = event.detail.date
195
- }
196
-
197
- function formatTime(time) {
198
- return time.split(':').map(Number).length === 2 ? time + ':00' : time;
199
- }
200
-
201
- function addTimeToDate(time, date) {
202
- const [hours, minutes, seconds] = time.split(':').map(Number)
203
- return date.hour(hours).minute(minutes).second(seconds)
204
- }
205
-
206
- const toggleTimeInputs = () => {
207
- showTimeInputs.value = !showTimeInputs.value
208
- }
209
-
210
- onMounted(() => {
211
- initDatepickers();
212
- });
213
-
214
- onBeforeUnmount(() => {
215
- removeChangeDateListener();
216
- destroyDatepickerElement();
217
- })
218
- </script>
@@ -1,152 +0,0 @@
1
- <template>
2
- <div class="flex flex-wrap gap-2">
3
- <input
4
- :min="minFormatted"
5
- :max="maxFormatted"
6
- type="number" aria-describedby="helper-text-explanation"
7
- 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-20 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"
8
- placeholder="From"
9
- v-model="start"
10
- >
11
-
12
- <input
13
- :min="minFormatted"
14
- :max="maxFormatted"
15
- type="number" aria-describedby="helper-text-explanation"
16
- 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-20 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"
17
- placeholder="To"
18
- v-model="end"
19
- >
20
-
21
- <button
22
- v-if="isChanged"
23
- type="button"
24
- class="flex items-center p-0.5 ml-auto px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-blue-700 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 disabled:cursor-not-allowed"
25
- @click="clear">Clear
26
- </button>
27
-
28
- <div v-if="min && max" class="w-full px-2.5">
29
- <vue-slider
30
- class="custom-slider"
31
- :dot-size="20"
32
- height="7.99px"
33
- :min="minFormatted"
34
- :max="maxFormatted"
35
- v-model="sliderValue"
36
- @update:model-value="updateFromSlider($event)"
37
- />
38
- </div>
39
- </div>
40
- </template>
41
- <script setup lang="ts">
42
- import VueSlider from 'vue-slider-component';
43
- import 'vue-slider-component/theme/antd.css'
44
- import {computed, onMounted, ref, watch} from "vue";
45
- import debounce from 'debounce'
46
-
47
- const props = defineProps({
48
- valueStart: {
49
- default: '',
50
- },
51
- valueEnd: {
52
- default: '',
53
- },
54
- min: {},
55
- max: {},
56
- });
57
-
58
- const emit = defineEmits(['update:valueStart', 'update:valueEnd']);
59
-
60
- const minFormatted = computed(() => Math.floor(props.min));
61
- const maxFormatted = computed(() => Math.ceil(props.max));
62
-
63
- const isChanged = computed(() => {
64
- return start.value && start.value !== minFormatted.value || end.value && end.value !== maxFormatted.value;
65
- });
66
-
67
- const start = ref(props.valueStart);
68
- const end = ref(props.valueEnd);
69
-
70
- const sliderValue = ref([minFormatted.value, maxFormatted.value]);
71
-
72
- const updateFromSlider =
73
- debounce((value: [number, number]) => {
74
- start.value = value[0] === minFormatted.value ? '': value[0];
75
- end.value = value[1] === maxFormatted.value ? '': value[1];
76
- }, 500);
77
-
78
- onMounted(() => {
79
- updateStartFromProps();
80
- updateEndFromProps();
81
-
82
- watch(() => props.valueStart, (value) => {
83
- updateStartFromProps();
84
- });
85
-
86
- watch(() => props.valueEnd, (value) => {
87
- updateEndFromProps();
88
- });
89
- })
90
-
91
- function updateStartFromProps() {
92
- start.value = props.valueStart;
93
- setSliderValues(start.value, end.value)
94
- }
95
-
96
- function updateEndFromProps() {
97
- end.value = props.valueEnd;
98
- setSliderValues(start.value, end.value)
99
- }
100
-
101
- watch(start, () => {
102
- console.log('⚡ emit', start.value)
103
- emit('update:valueStart', start.value)
104
- })
105
-
106
- watch(end, () => {
107
- console.log('⚡ emit', end.value)
108
- emit('update:valueEnd', end.value);
109
- })
110
-
111
- watch([minFormatted,maxFormatted], () => {
112
- setSliderValues(minFormatted.value, maxFormatted.value)
113
- })
114
-
115
- const clear = () => {
116
- start.value = ''
117
- end.value = ''
118
- setSliderValues('', '')
119
- }
120
-
121
- function setSliderValues(start, end) {
122
- sliderValue.value = [start || minFormatted.value, end || maxFormatted.value];
123
- }
124
- </script>
125
-
126
- <style lang="scss" scoped>
127
- .custom-slider {
128
- &:deep(.vue-slider-rail) {
129
- background-color: rgb(229 231 235);
130
- }
131
-
132
- &:deep(.vue-slider-dot-handle) {
133
- background-color: #1c64f2;
134
- border: none;
135
- box-shadow: none;
136
- }
137
-
138
- &:deep(.vue-slider-dot-handle:hover) {
139
- background-color: #1c64f2;
140
- border: none;
141
- box-shadow: none;
142
- }
143
-
144
- &:deep(.vue-slider-process) {
145
- background-color: rgb(225 239 254);
146
- }
147
-
148
- &:deep(.vue-slider-process:hover) {
149
- background-color: rgb(225 239 254);
150
- }
151
- }
152
- </style>