adminforth 1.3.54-next.6 → 1.3.54-next.8

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.8",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,6 +34,8 @@
34
34
  "autoprefixer": "^10.4.19",
35
35
  "eslint": "^8.57.0",
36
36
  "eslint-plugin-vue": "^9.23.0",
37
+ "flag-icons": "^7.2.3",
38
+ "i18n-iso-countries": "^7.12.0",
37
39
  "npm-run-all2": "^6.1.2",
38
40
  "postcss": "^8.4.38",
39
41
  "sass": "^1.77.2",
@@ -1906,6 +1908,13 @@
1906
1908
  "node": ">=0.10.0"
1907
1909
  }
1908
1910
  },
1911
+ "node_modules/diacritics": {
1912
+ "version": "1.3.0",
1913
+ "resolved": "https://registry.npmjs.org/diacritics/-/diacritics-1.3.0.tgz",
1914
+ "integrity": "sha512-wlwEkqcsaxvPJML+rDh/2iS824jbREk6DUMUKkEaSlxdYHeS43cClJtsWglvw2RfeXGm6ohKDqsXteJ5sP5enA==",
1915
+ "dev": true,
1916
+ "license": "MIT"
1917
+ },
1909
1918
  "node_modules/didyoumean": {
1910
1919
  "version": "1.2.2",
1911
1920
  "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@@ -2371,6 +2380,13 @@
2371
2380
  "url": "https://github.com/sponsors/sindresorhus"
2372
2381
  }
2373
2382
  },
2383
+ "node_modules/flag-icons": {
2384
+ "version": "7.2.3",
2385
+ "resolved": "https://registry.npmjs.org/flag-icons/-/flag-icons-7.2.3.tgz",
2386
+ "integrity": "sha512-X2gUdteNuqdNqob2KKTJTS+ZCvyWeLCtDz9Ty8uJP17Y4o82Y+U/Vd4JNrdwTAjagYsRznOn9DZ+E/Q52qbmqg==",
2387
+ "dev": true,
2388
+ "license": "MIT"
2389
+ },
2374
2390
  "node_modules/flat-cache": {
2375
2391
  "version": "3.2.0",
2376
2392
  "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
@@ -2622,6 +2638,19 @@
2622
2638
  "entities": "^4.4.0"
2623
2639
  }
2624
2640
  },
2641
+ "node_modules/i18n-iso-countries": {
2642
+ "version": "7.12.0",
2643
+ "resolved": "https://registry.npmjs.org/i18n-iso-countries/-/i18n-iso-countries-7.12.0.tgz",
2644
+ "integrity": "sha512-NDFf5j/raA5JrcPT/NcHP3RUMH7TkdkxQKAKdvDlgb+MS296WJzzqvV0Y5uwavSm7A6oYvBeSV0AxoHdDiHIiw==",
2645
+ "dev": true,
2646
+ "license": "MIT",
2647
+ "dependencies": {
2648
+ "diacritics": "1.3.0"
2649
+ },
2650
+ "engines": {
2651
+ "node": ">= 12"
2652
+ }
2653
+ },
2625
2654
  "node_modules/ignore": {
2626
2655
  "version": "5.3.1",
2627
2656
  "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
package/spa/package.json CHANGED
@@ -38,6 +38,8 @@
38
38
  "autoprefixer": "^10.4.19",
39
39
  "eslint": "^8.57.0",
40
40
  "eslint-plugin-vue": "^9.23.0",
41
+ "flag-icons": "^7.2.3",
42
+ "i18n-iso-countries": "^7.12.0",
41
43
  "npm-run-all2": "^6.1.2",
42
44
  "postcss": "^8.4.38",
43
45
  "sass": "^1.77.2",
@@ -1,15 +1,48 @@
1
1
  <template>
2
- {{ visualValue }}
2
+ <span class="flex items-center"
3
+ :data-tooltip-target="`tooltip-${id}`"
4
+ data-tooltip-placement="top"
5
+ >
6
+ {{ visualValue }} <IconFileCopyAltSolid @click.stop="copyToCB" class="w-5 h-5 text-lightPrimary dark:text-darkPrimary"/>
7
+
8
+ <div :id="`tooltip-${id}`" role="tooltip"
9
+ 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">
10
+ {{ props.record[props.column.name] }}
11
+ <div class="tooltip-arrow" data-popper-arrow></div>
12
+ </div>
13
+ </span>
3
14
  </template>
4
15
 
5
16
  <script setup>
6
-
17
+ import { computed, ref, onMounted } from 'vue';
7
18
  import { IconFileCopyAltSolid } from '@iconify-prerendered/vue-flowbite';
19
+ import { initFlowbite } from 'flowbite';
8
20
 
9
21
  const visualValue = computed(() => {
10
- return record[column.name];
22
+ // if lenght is more then 8, show only first 4 and last 4 characters, ... in the middle
23
+ const val = props.record[props.column.name];
24
+ if (val.length > 8) {
25
+ return `${val.substr(0, 4)}...${val.substr(val.length - 4)}`;
26
+ }
27
+ return val;
11
28
  });
12
29
 
13
30
  const props = defineProps(['column', 'record', 'meta']);
14
31
 
32
+ const id = ref();
33
+
34
+ function copyToCB() {
35
+ navigator.clipboard.writeText(props.record[props.column.name]);
36
+ window.adminforth.alert({
37
+ message: 'ID copied to clipboard',
38
+ variant: 'success',
39
+ })
40
+ }
41
+
42
+ onMounted(async () => {
43
+ id.value = Math.random().toString(36).substring(7);
44
+ await new Promise(resolve => setTimeout(resolve, 0));
45
+ initFlowbite();
46
+ });
47
+
15
48
  </script>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <span class="flex items-center">
3
+ <span
4
+ :class="{[`fi-${countryIsoLow}`]: true, 'flag-icon': countryName}"
5
+ :data-tooltip-target="`tooltip-${id}`"
6
+ ></span>
7
+
8
+ <span v-if="meta.showCountryName" class="ms-2">{{ countryName }}</span>
9
+
10
+ <div
11
+ v-if="!meta.showCountryName && countryName"
12
+ :id="`tooltip-${id}`" role="tooltip"
13
+ 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"
14
+ >
15
+ {{ countryName }}
16
+ <div class="tooltip-arrow" data-popper-arrow></div>
17
+ </div>
18
+ </span>
19
+
20
+ </template>
21
+
22
+ <script setup>
23
+
24
+ import { computed, ref, onMounted } from 'vue';
25
+ import { initFlowbite } from 'flowbite';
26
+ import 'flag-icons/css/flag-icons.min.css';
27
+ import isoCountries from 'i18n-iso-countries';
28
+ import enLocal from 'i18n-iso-countries/langs/en.json';
29
+
30
+ isoCountries.registerLocale(enLocal);
31
+
32
+ const props = defineProps(['column', 'record', 'meta', 'resource', 'adminUser']);
33
+
34
+ const id = ref();
35
+
36
+
37
+ onMounted(async () => {
38
+ id.value = Math.random().toString(36).substring(7);
39
+ await new Promise(resolve => setTimeout(resolve, 0));
40
+ initFlowbite();
41
+ });
42
+
43
+ const countryIsoLow = computed(() => {
44
+ return props.record[props.column.name]?.toLowerCase();
45
+ });
46
+
47
+ const countryName = computed(() => {
48
+ if (!countryIsoLow.value) {
49
+ return '';
50
+ }
51
+ return isoCountries.getName(countryIsoLow.value, 'en');
52
+ });
53
+
54
+ </script>
55
+
56
+ <style scoped lang="scss">
57
+
58
+ .flag-icon {
59
+ width: 2rem;
60
+ height: 1.5rem;
61
+ flex-shrink: 0;
62
+
63
+ // border radius for background
64
+ border-radius: 3px;
65
+ // add some silkiness to the flag
66
+ box-shadow: inset -1px -1px 2px 0px rgba(50 50 50 / 0.3), inset 1px 1px 2px 0px rgba(255 255 255 / 0.3);
67
+ }
68
+
69
+ </style>
@@ -21,7 +21,6 @@
21
21
  @click="()=>{checkboxes = []}"
22
22
  v-if="checkboxes.length"
23
23
  data-tooltip-target="tooltip-remove-all"
24
- data-tooltip-placement="bottom"
25
24
  class="flex gap-1 items-center py-1 px-3 me-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-darkListTable dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
26
25
  >
27
26
  <IconBanOutline class="w-5 h-5 "/>
@@ -257,7 +256,7 @@ async function init() {
257
256
  return {
258
257
  field,
259
258
  operator,
260
- value: decodeURIComponent(route.query[k])
259
+ value: JSON.parse(decodeURIComponent(route.query[k]))
261
260
  }
262
261
  });
263
262
  if (filters.length) {
@@ -314,7 +313,9 @@ watch(() => filtersStore.filters, async (to, from) => {
314
313
  const query = {};
315
314
  const currentQ = currentQuery();
316
315
  filtersStore.filters.forEach(f => {
317
- query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(f.value);
316
+ if (f.value) {
317
+ query[`filter__${f.field}__${f.operator}`] = encodeURIComponent(JSON.stringify(f.value));
318
+ }
318
319
  });
319
320
  // set every key in currentQ which starts with filter_ to undefined if it is not in query
320
321
  Object.keys(currentQ).forEach(k => {