@adminforth/clone-row 1.2.15 → 1.2.16

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/build.log CHANGED
@@ -8,5 +8,5 @@ custom/CloneRowButton.vue
8
8
  custom/CloneRowThreeDots.vue
9
9
  custom/tsconfig.json
10
10
 
11
- sent 3,616 bytes received 77 bytes 7,386.00 bytes/sec
12
- total size is 3,322 speedup is 0.90
11
+ sent 3,761 bytes received 77 bytes 7,676.00 bytes/sec
12
+ total size is 3,467 speedup is 0.90
@@ -4,9 +4,7 @@
4
4
  :to="{
5
5
  name: `resource-create`,
6
6
  params: { resourceId: props.meta.resourceId },
7
- query: {
8
- values: save_btoa(JSON.stringify(redirectToCreatePage())),
9
- }
7
+ query: cloneQuery
10
8
  }">
11
9
  <IconFileCloneSolid class="w-5 h-5 me-2 text-lightPrimary dark:text-darkPrimary"/>
12
10
  {{ $t('Clone record') }}
@@ -15,7 +13,9 @@
15
13
 
16
14
  <script lang="ts" setup>
17
15
  import { Tooltip } from '@/afcl';
16
+ import { computed } from 'vue';
18
17
  import { AdminUser, type AdminForthResourceCommon } from '@/types';
18
+ import { btoa_function } from '@/utils';
19
19
  import { IconFileCloneSolid } from '@iconify-prerendered/vue-flowbite';
20
20
  import { useI18n } from 'vue-i18n';
21
21
 
@@ -40,10 +40,14 @@ function redirectToCreatePage() {
40
40
  dataToFill[field.name] = props.record[field.name];
41
41
  }
42
42
  return dataToFill;
43
- }
44
-
45
- function save_btoa(str) {
46
- const cleaned = str.replace(/\uFEFF/g, '');
47
- return btoa(cleaned);
48
43
  }
44
+
45
+ const cloneQuery = computed(() => {
46
+ try {
47
+ return { values: btoa_function(JSON.stringify(redirectToCreatePage())) };
48
+ } catch (error) {
49
+ console.error('Failed to build clone query', error);
50
+ return {};
51
+ }
52
+ });
49
53
  </script>
@@ -4,9 +4,7 @@
4
4
  :to="{
5
5
  name: `resource-create`,
6
6
  params: { resourceId: props.meta.resourceId },
7
- query: {
8
- values: save_btoa(JSON.stringify(redirectToCreatePage())),
9
- }
7
+ query: cloneQuery
10
8
  }">
11
9
  <IconFileCloneSolid class="w-5 h-5 me-2 text-lightPrimary dark:text-darkPrimary"/>
12
10
  {{ $t('Clone record') }}
@@ -15,7 +13,9 @@
15
13
 
16
14
  <script lang="ts" setup>
17
15
  import { Tooltip } from '@/afcl';
16
+ import { computed } from 'vue';
18
17
  import { AdminUser, type AdminForthResourceCommon } from '@/types';
18
+ import { btoa_function } from '@/utils';
19
19
  import { IconFileCloneSolid } from '@iconify-prerendered/vue-flowbite';
20
20
  import { useI18n } from 'vue-i18n';
21
21
 
@@ -40,10 +40,14 @@ function redirectToCreatePage() {
40
40
  dataToFill[field.name] = props.record[field.name];
41
41
  }
42
42
  return dataToFill;
43
- }
44
-
45
- function save_btoa(str) {
46
- const cleaned = str.replace(/\uFEFF/g, '');
47
- return btoa(cleaned);
48
43
  }
44
+
45
+ const cloneQuery = computed(() => {
46
+ try {
47
+ return { values: btoa_function(JSON.stringify(redirectToCreatePage())) };
48
+ } catch (error) {
49
+ console.error('Failed to build clone query', error);
50
+ return {};
51
+ }
52
+ });
49
53
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/clone-row",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",