adminforth 1.3.56-next.26 → 1.3.56-next.27

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.
@@ -15,6 +15,7 @@
15
15
  "debounce": "^2.1.0",
16
16
  "flowbite": "^2.3.0",
17
17
  "flowbite-datepicker": "^1.2.6",
18
+ "javascript-time-ago": "^2.5.11",
18
19
  "pinia": "^2.1.7",
19
20
  "sanitize-html": "^2.13.0",
20
21
  "unhead": "^1.9.12",
@@ -2841,6 +2842,15 @@
2841
2842
  "@pkgjs/parseargs": "^0.11.0"
2842
2843
  }
2843
2844
  },
2845
+ "node_modules/javascript-time-ago": {
2846
+ "version": "2.5.11",
2847
+ "resolved": "https://registry.npmjs.org/javascript-time-ago/-/javascript-time-ago-2.5.11.tgz",
2848
+ "integrity": "sha512-Zeyf5R7oM1fSMW9zsU3YgAYwE0bimEeF54Udn2ixGd8PUwu+z1Yc5t4Y8YScJDMHD6uCx6giLt3VJR5K4CMwbg==",
2849
+ "license": "MIT",
2850
+ "dependencies": {
2851
+ "relative-time-format": "^1.1.6"
2852
+ }
2853
+ },
2844
2854
  "node_modules/jiti": {
2845
2855
  "version": "1.21.0",
2846
2856
  "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz",
@@ -3633,6 +3643,12 @@
3633
3643
  "node": ">=8.10.0"
3634
3644
  }
3635
3645
  },
3646
+ "node_modules/relative-time-format": {
3647
+ "version": "1.1.6",
3648
+ "resolved": "https://registry.npmjs.org/relative-time-format/-/relative-time-format-1.1.6.tgz",
3649
+ "integrity": "sha512-aCv3juQw4hT1/P/OrVltKWLlp15eW1GRcwP1XdxHrPdZE9MtgqFpegjnTjLhi2m2WI9MT/hQQtE+tjEWG1hgkQ==",
3650
+ "license": "MIT"
3651
+ },
3636
3652
  "node_modules/resolve": {
3637
3653
  "version": "1.22.8",
3638
3654
  "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -19,6 +19,7 @@
19
19
  "debounce": "^2.1.0",
20
20
  "flowbite": "^2.3.0",
21
21
  "flowbite-datepicker": "^1.2.6",
22
+ "javascript-time-ago": "^2.5.11",
22
23
  "pinia": "^2.1.7",
23
24
  "sanitize-html": "^2.13.0",
24
25
  "unhead": "^1.9.12",
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  </template>
47
47
  <script setup>
48
- import {ref, computed, onMounted, watch, onBeforeUnmount} from 'vue';
48
+ import {ref, computed, onMounted, watch, onBeforeUnmount, nextTick} from 'vue';
49
49
  import dayjs from 'dayjs';
50
50
  import utc from 'dayjs/plugin/utc';
51
51
 
@@ -105,7 +105,7 @@ async function updateFromProps() {
105
105
  startTime.value = '';
106
106
  } else {
107
107
  // wait ref to initialize
108
- await (new Promise(resolve => setTimeout(resolve, 0)));
108
+ await nextTick();
109
109
  datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
110
110
  startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
111
111
  }
@@ -6,10 +6,10 @@
6
6
  <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
7
7
  <thead class="text-xs text-gray-700 uppercase dark:text-gray-400 bg-lightFormHeading dark:bg-gray-700 block md:table-row-group ">
8
8
  <tr>
9
- <th scope="col" class="px-6 py-3 hidden md:table-cell">
9
+ <th scope="col" class="px-6 py-3 hidden md:w-52 md:table-cell">
10
10
  Field
11
11
  </th>
12
- <th scope="col" class="px-6 py-3 w-5/6 hidden md:table-cell">
12
+ <th scope="col" class="px-6 py-3 hidden md:table-cell">
13
13
  Value
14
14
  </th>
15
15
  </tr>
@@ -22,7 +22,8 @@
22
22
  class="bg-ligftForm dark:bg-gray-800 dark:border-gray-700 block md:table-row"
23
23
  :class="{ 'border-b': i !== group.columns.length - 1 }"
24
24
  >
25
- <td class="px-6 py-4 whitespace-nowrap flex items-center block md:table-cell" :class="{'rounded-bl-lg border-b-none': i === group.columns.length - 1}"> <!--align-top-->
25
+ <td class="px-6 py-4 flex items-center block md:table-cell pb-0 md:pb-4"
26
+ :class="{'rounded-bl-lg border-b-none': i === group.columns.length - 1}"> <!--align-top-->
26
27
  <span class="flex items-center gap-1">
27
28
  {{ column.label }}
28
29
  <AfTooltip v-if="column.required[mode]">
@@ -39,7 +40,8 @@
39
40
 
40
41
 
41
42
  </td>
42
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative block md:table-cell rounded-br-lg" :class="{'rounded-br-lg': i === group.columns.length - 1}">
43
+ <td class="px-6 py-4 whitespace-pre-wrap relative block md:table-cell rounded-br-lg "
44
+ :class="{'rounded-br-lg': i === group.columns.length - 1}">
43
45
  <template v-if="column?.components?.[props.source]?.file">
44
46
  <component
45
47
  :is="getCustomComponent(column.components[props.source])"
@@ -16,7 +16,7 @@
16
16
  <tbody>
17
17
 
18
18
  <!-- table header -->
19
- <tr class="t-header sticky z-1 top-0 text-xs bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400">
19
+ <tr class="t-header sticky z-10 top-0 text-xs bg-lightListTableHeading dark:bg-darkListTableHeading dark:text-gray-400">
20
20
  <td scope="col" class="p-4">
21
21
  <div v-if="rows && rows.length" class="flex items-center">
22
22
  <input id="checkbox-all-search" type="checkbox" :checked="allFromThisPageChecked" @change="selectAll()"
@@ -11,10 +11,11 @@
11
11
  </template>
12
12
 
13
13
  <script setup>
14
- import { computed, ref, onMounted } from 'vue';
14
+ import { computed, ref, onMounted, nextTick } from 'vue';
15
15
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
16
16
  import AfTooltip from '@/components/AfTooltip.vue';
17
17
 
18
+
18
19
  const visualValue = computed(() => {
19
20
  // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
20
21
  const val = props.record[props.column.name];
@@ -38,7 +39,7 @@ function copyToCB() {
38
39
 
39
40
  onMounted(async () => {
40
41
  id.value = Math.random().toString(36).substring(7);
41
- await new Promise(resolve => setTimeout(resolve, 0));
42
+ await nextTick();
42
43
  });
43
44
 
44
45
  </script>
@@ -11,10 +11,11 @@
11
11
  </template>
12
12
 
13
13
  <script setup>
14
- import { computed, ref, onMounted } from 'vue';
14
+ import { computed, ref, onMounted, nextTick } from 'vue';
15
15
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
16
16
  import AfTooltip from '@/components/AfTooltip.vue';
17
17
 
18
+
18
19
  const visualValue = computed(() => {
19
20
  // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
20
21
  const val = props.record[props.column.name];
@@ -38,7 +39,7 @@ function copyToCB() {
38
39
 
39
40
  onMounted(async () => {
40
41
  id.value = Math.random().toString(36).substring(7);
41
- await new Promise(resolve => setTimeout(resolve, 0));
42
+ await nextTick();
42
43
  });
43
44
 
44
45
  </script>
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script setup>
11
- import { computed, ref, onMounted } from 'vue';
11
+ import { computed, ref, onMounted, nextTick } from 'vue';
12
12
  import AfTooltip from '@/components/AfTooltip.vue';
13
13
 
14
14
  const props = defineProps(['column', 'record']);
@@ -46,12 +46,12 @@
46
46
  return new Intl.NumberFormat(locale).format(num);
47
47
  }
48
48
 
49
- function formatNumberUsingIntl(num, locale) {
50
- return new Intl.NumberFormat(locale).format(num);
51
- }
49
+ function formatNumberUsingIntl(num, locale) {
50
+ return new Intl.NumberFormat(locale).format(num);
51
+ }
52
52
 
53
53
  onMounted(async () => {
54
54
  id.value = Math.random().toString(36).substring(7);
55
- await new Promise(resolve => setTimeout(resolve, 0));
55
+ await nextTick();
56
56
  });
57
- </script>
57
+ </script>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <AfTooltip class="flex items-center">
3
+ {{ relativeTime }}
4
+ <template #tooltip v-if="relativeTime">
5
+ {{ fullTime }}
6
+ </template>
7
+ </AfTooltip>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { computed, ref, onMounted } from 'vue';
12
+ import AfTooltip from '@/components/AfTooltip.vue';
13
+ import en from 'javascript-time-ago/locale/en';
14
+ import TimeAgo from 'javascript-time-ago';
15
+ import dayjs from 'dayjs';
16
+
17
+ const id = ref();
18
+
19
+ TimeAgo.addLocale(en);
20
+
21
+ const props = defineProps(['column', 'record']);
22
+
23
+ const userLocale = ref(navigator.language || 'en-US');
24
+ const timeAgoFormatter = new TimeAgo(userLocale.value);
25
+ const relativeTime = computed(() => {
26
+ const value = props.record[props.column.name];
27
+ const date = new Date(value);
28
+ return timeAgoFormatter.format(date);
29
+ });
30
+
31
+ const fullTime = computed(() => {
32
+ const value = props.record[props.column.name];
33
+ const date = dayjs(new Date(value));
34
+ return date.format('DD MMM HH:mm');
35
+ });
36
+
37
+ onMounted(async () => {
38
+ id.value = Math.random().toString(36).substring(7);
39
+ });
40
+
41
+ </script>
@@ -116,7 +116,7 @@ import ResourceListTable from '@/components/ResourceListTable.vue';
116
116
  import { useCoreStore } from '@/stores/core';
117
117
  import { useFiltersStore } from '@/stores/filters';
118
118
  import { callAdminForthApi, currentQuery, getIcon, setQuery } from '@/utils';
119
- import { computed, onMounted, ref, watch } from 'vue';
119
+ import { computed, onMounted, ref, watch, nextTick } from 'vue';
120
120
  import { useRoute } from 'vue-router';
121
121
  import { showErrorTost } from '@/composables/useFrontendApi'
122
122
  import { getCustomComponent, initThreeDotsDropdown } from '@/utils';
@@ -182,7 +182,7 @@ async function getList() {
182
182
  return row;
183
183
  });
184
184
  totalRows.value = data.total;
185
- await new Promise(resolve => setTimeout(resolve, 0));
185
+ await nextTick();
186
186
  }
187
187
 
188
188
  async function startBulkAction(actionId) {
@@ -63,10 +63,10 @@
63
63
  <!-- table fixed layour used to prevent double scroll in inline list plugins -->
64
64
  <thead class="text-xs text-gray-700 uppercase dark:text-gray-400 bg-lightFormHeading dark:bg-gray-700 block md:table-row-group ">
65
65
  <tr>
66
- <th scope="col" class="px-6 py-3 hidden md:table-cell">
66
+ <th scope="col" class="px-6 py-3 hidden md:w-52 md:table-cell">
67
67
  Field
68
68
  </th>
69
- <th scope="col" class="px-6 py-3 w-5/6 hidden md:table-cell">
69
+ <th scope="col" class="px-6 py-3 hidden md:table-cell">
70
70
  Value
71
71
  </th>
72
72
  </tr>
@@ -85,10 +85,10 @@
85
85
  :record="coreStore.record"
86
86
  />
87
87
  <template v-else>
88
- <td class="px-6 py-4 whitespace-nowrap relative block md:table-cell"> <!--align-top-->
88
+ <td class="px-6 py-4 relative block md:table-cell font-bold md:font-normal pb-0 md:pb-4"> <!--align-top-->
89
89
  {{ column.label }}
90
90
  </td>
91
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap" :data-af-column="column.name">
91
+ <td class="px-6 py-4 whitespace-pre-wrap" :data-af-column="column.name">
92
92
  <component
93
93
  v-if="column?.components?.show"
94
94
  :is="getCustomComponent(column?.components?.show)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.3.56-next.26",
3
+ "version": "1.3.56-next.27",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",