adminforth 1.3.54-next.6 → 1.3.54-next.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.3.54-next.6",
3
+ "version": "1.3.54-next.7",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,15 +1,47 @@
1
1
  <template>
2
- {{ visualValue }}
2
+ <span class="flex items-center"
3
+ :data-tooltip-target="`tooltip-${id}`"
4
+ data-tooltip-placement="bottom">
5
+ {{ visualValue }} <IconFileCopyAltSolid @click.stop="copyToCB" class="w-5 h-5 text-lightPrimary dark:text-darkPrimary"/>
6
+
7
+ <div :id="`tooltip-${id}`" role="tooltip"
8
+ 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">
9
+ {{ props.record[props.column.name] }}
10
+ <div class="tooltip-arrow" data-popper-arrow></div>
11
+ </div>
12
+ </span>
3
13
  </template>
4
14
 
5
15
  <script setup>
6
-
16
+ import { computed, ref, onMounted } from 'vue';
7
17
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
18
+ import { initFlowbite } from 'flowbite';
8
19
 
9
20
  const visualValue = computed(() => {
10
- return record[column.name];
21
+ // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
22
+ const val = props.record[props.column.name];
23
+ if (val.length > 8) {
24
+ return `${val.substr(0, 4)}...${val.substr(val.length - 4)}`;
25
+ }
26
+ return val;
11
27
  });
12
28
 
13
29
  const props = defineProps(['column', 'record', 'meta']);
14
30
 
31
+ const id = ref();
32
+
33
+ function copyToCB() {
34
+ navigator.clipboard.writeText(props.record[props.column.name]);
35
+ window.adminforth.alert({
36
+ message: 'ID copied to clipboard',
37
+ variant: 'success',
38
+ })
39
+ }
40
+
41
+ onMounted(async () => {
42
+ id.value = Math.random().toString(36).substring(7);
43
+ await new Promise(resolve => setTimeout(resolve, 0));
44
+ initFlowbite();
45
+ });
46
+
15
47
  </script>
@@ -257,7 +257,7 @@ async function init() {
257
257
  return {
258
258
  field,
259
259
  operator,
260
- value: decodeURIComponent(route.query[k])
260
+ value: JSON.parse(decodeURIComponent(route.query[k]))
261
261
  }
262
262
  });
263
263
  if (filters.length) {
@@ -314,7 +314,9 @@ watch(() => filtersStore.filters, async (to, from) => {
314
314
  const query = {};
315
315
  const currentQ = currentQuery();
316
316
  filtersStore.filters.forEach(f => {
317
- query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(f.value);
317
+ if (f.value) {
318
+ query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(JSON.stringify(f.value));
319
+ }
318
320
  });
319
321
  // set every key in currentQ which starts with filter_ to undefined if it is not in query
320
322
  Object.keys(currentQ).forEach(k => {