@adminforth/upload 1.2.0-next.1 → 1.3.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.
package/build.log CHANGED
@@ -11,5 +11,5 @@ custom/preview.vue
11
11
  custom/tsconfig.json
12
12
  custom/uploader.vue
13
13
 
14
- sent 37,780 bytes received 134 bytes 75,828.00 bytes/sec
15
- total size is 37,291 speedup is 0.98
14
+ sent 38,128 bytes received 134 bytes 76,524.00 bytes/sec
15
+ total size is 37,639 speedup is 0.98
@@ -39,7 +39,11 @@
39
39
  background: rgba(0, 0, 0, 0.8);
40
40
  }
41
41
  .medium-zoom-overlay {
42
- background: rgba(255, 255, 255, 0.8) !important
42
+ z-index: 99;
43
+ background: rgba(255, 255, 255, 0.8) !important;
44
+ }
45
+ html.dark .medium-zoom-overlay {
46
+ background: rgba(17, 24, 39, 0.7) !important;
43
47
  }
44
48
  body.medium-zoom--opened aside {
45
49
  filter: grayscale(1)
@@ -57,6 +61,7 @@
57
61
  <script setup>
58
62
  import { ref, computed , onMounted, watch} from 'vue'
59
63
  import mediumZoom from 'medium-zoom'
64
+ import { useRoute } from 'vue-router'
60
65
 
61
66
  const img = ref(null);
62
67
  const zoom = ref(null);
@@ -67,12 +72,19 @@ const props = defineProps({
67
72
  meta: Object,
68
73
  })
69
74
 
75
+ const route = useRoute();
70
76
  const url = computed(() => {
71
77
  return props.record[`previewUrl_${props.meta.pluginInstanceId}`];
72
78
  });
73
79
 
74
- const maxWidth = computed(() => props.meta.maxWidth ? { maxWidth: props.meta.maxWidth } : {});
80
+ const maxWidth = computed(() => {
81
+ const isShowPage = route.path.includes('/show/');
82
+ const width = isShowPage
83
+ ? (props.meta.maxShowWidth || props.meta.maxWidth)
84
+ : (props.meta.maxListWidth || props.meta.maxWidth);
75
85
 
86
+ return width ? { maxWidth: width } : {};
87
+ });
76
88
 
77
89
  // since we have no way to know the content type of the file, we will try to guess it from extension
78
90
  // for better experience probably we should check whether user saves content type in the database and use it here
@@ -39,7 +39,11 @@
39
39
  background: rgba(0, 0, 0, 0.8);
40
40
  }
41
41
  .medium-zoom-overlay {
42
- background: rgba(255, 255, 255, 0.8) !important
42
+ z-index: 99;
43
+ background: rgba(255, 255, 255, 0.8) !important;
44
+ }
45
+ html.dark .medium-zoom-overlay {
46
+ background: rgba(17, 24, 39, 0.7) !important;
43
47
  }
44
48
  body.medium-zoom--opened aside {
45
49
  filter: grayscale(1)
@@ -57,6 +61,7 @@
57
61
  <script setup>
58
62
  import { ref, computed , onMounted, watch} from 'vue'
59
63
  import mediumZoom from 'medium-zoom'
64
+ import { useRoute } from 'vue-router'
60
65
 
61
66
  const img = ref(null);
62
67
  const zoom = ref(null);
@@ -67,12 +72,19 @@ const props = defineProps({
67
72
  meta: Object,
68
73
  })
69
74
 
75
+ const route = useRoute();
70
76
  const url = computed(() => {
71
77
  return props.record[`previewUrl_${props.meta.pluginInstanceId}`];
72
78
  });
73
79
 
74
- const maxWidth = computed(() => props.meta.maxWidth ? { maxWidth: props.meta.maxWidth } : {});
80
+ const maxWidth = computed(() => {
81
+ const isShowPage = route.path.includes('/show/');
82
+ const width = isShowPage
83
+ ? (props.meta.maxShowWidth || props.meta.maxWidth)
84
+ : (props.meta.maxListWidth || props.meta.maxWidth);
75
85
 
86
+ return width ? { maxWidth: width } : {};
87
+ });
76
88
 
77
89
  // since we have no way to know the content type of the file, we will try to guess it from extension
78
90
  // for better experience probably we should check whether user saves content type in the database and use it here
package/dist/index.js CHANGED
@@ -99,7 +99,7 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
99
99
  modifyResourceConfig: { get: () => super.modifyResourceConfig }
100
100
  });
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
- var _a, _b, _c, _d;
102
+ var _a, _b, _c, _d, _e, _f;
103
103
  _super.modifyResourceConfig.call(this, adminforth, resourceConfig);
104
104
  // after column to store the path of the uploaded file, add new VirtualColumn,
105
105
  // show only in edit and create views
@@ -127,6 +127,8 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
127
127
  pathColumnLabel: resourceConfig.columns[pathColumnIndex].label,
128
128
  fieldsForContext: (_c = this.options.generation) === null || _c === void 0 ? void 0 : _c.fieldsForContext,
129
129
  maxWidth: (_d = this.options.preview) === null || _d === void 0 ? void 0 : _d.maxWidth,
130
+ maxListWidth: (_e = this.options.preview) === null || _e === void 0 ? void 0 : _e.maxListWidth,
131
+ maxShowWidth: (_f = this.options.preview) === null || _f === void 0 ? void 0 : _f.maxShowWidth,
130
132
  };
131
133
  // define components which will be imported from other components
132
134
  this.componentPath('imageGenerator.vue');
package/index.ts CHANGED
@@ -127,6 +127,8 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
127
127
  pathColumnLabel: resourceConfig.columns[pathColumnIndex].label,
128
128
  fieldsForContext: this.options.generation?.fieldsForContext,
129
129
  maxWidth: this.options.preview?.maxWidth,
130
+ maxListWidth: this.options.preview?.maxListWidth,
131
+ maxShowWidth: this.options.preview?.maxShowWidth,
130
132
  };
131
133
  // define components which will be imported from other components
132
134
  this.componentPath('imageGenerator.vue');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/upload",
3
- "version": "1.2.0-next.1",
3
+ "version": "1.3.0",
4
4
  "description": "Plugin for uploading files for adminforth",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/types.ts CHANGED
@@ -69,6 +69,16 @@ export type PluginOptions = {
69
69
  */
70
70
  maxWidth?: string,
71
71
 
72
+ /**
73
+ * Maximum width of the preview image in list view
74
+ */
75
+ maxListWidth?: string,
76
+
77
+ /**
78
+ * Maximum width of the preview image in show view
79
+ */
80
+ maxShowWidth?: string,
81
+
72
82
  /**
73
83
  * Used to display preview (if it is image) in list and show views.
74
84
  * Defaulted to the AWS S3 presigned URL if resource is private or public URL if resource is public.