@adminforth/upload 1.3.0 → 1.4.1

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/README.md CHANGED
@@ -1,2 +1,7 @@
1
+ # AdminForth Upload Plugin
1
2
 
2
- Ussage guide and documentation: https://adminforth.dev/docs/tutorial/Plugins/upload/
3
+ <img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /> <img src="https://woodpecker.devforth.io/api/badges/3848/status.svg" alt="Build Status" /> <a href="https://www.npmjs.com/package/@adminforth/upload"> <img src="https://img.shields.io/npm/dt/@adminforth/upload" alt="npm downloads" /></a> <a href="https://www.npmjs.com/package/@adminforth/upload"><img src="https://img.shields.io/npm/v/@adminforth/upload" alt="npm version" /></a> <a href="https://www.npmjs.com/package/@adminforth/upload">
4
+
5
+ Allows to upload files to Amazon S3 bucket from adminforth application.
6
+
7
+ ## For usage, see [AdminForth Upload Documentation](https://adminforth.dev/docs/tutorial/Plugins/upload/)
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 38,128 bytes received 134 bytes 76,524.00 bytes/sec
15
- total size is 37,639 speedup is 0.98
14
+ sent 38,412 bytes received 134 bytes 77,092.00 bytes/sec
15
+ total size is 37,930 speedup is 0.98
@@ -5,7 +5,7 @@
5
5
  v-if="contentType && contentType.startsWith('image')"
6
6
  :src="url"
7
7
  class="rounded-md"
8
- :style="maxWidth"
8
+ :style="[maxWidth, minWidth]"
9
9
  ref="img"
10
10
  data-zoomable
11
11
  @click.stop="zoom.open()"
@@ -51,12 +51,12 @@
51
51
  </style>
52
52
 
53
53
  <style scoped>
54
- img {
54
+ /* img {
55
55
  min-width: 150px;
56
56
  }
57
57
  video {
58
58
  min-width: 200px;
59
- }
59
+ } */
60
60
  </style>
61
61
  <script setup>
62
62
  import { ref, computed , onMounted, watch} from 'vue'
@@ -86,6 +86,14 @@ const maxWidth = computed(() => {
86
86
  return width ? { maxWidth: width } : {};
87
87
  });
88
88
 
89
+ const minWidth = computed(() => {
90
+ const isShowPage = route.path.includes('/show/');
91
+ const width = isShowPage
92
+ ? (props.meta.minShowWidth || props.meta.minWidth)
93
+ : (props.meta.minListWidth || props.meta.minWidth);
94
+
95
+ return width ? { minWidth: width } : {};
96
+ });
89
97
  // since we have no way to know the content type of the file, we will try to guess it from extension
90
98
  // for better experience probably we should check whether user saves content type in the database and use it here
91
99
  const contentType = computed(() => {
@@ -5,7 +5,7 @@
5
5
  v-if="contentType && contentType.startsWith('image')"
6
6
  :src="url"
7
7
  class="rounded-md"
8
- :style="maxWidth"
8
+ :style="[maxWidth, minWidth]"
9
9
  ref="img"
10
10
  data-zoomable
11
11
  @click.stop="zoom.open()"
@@ -51,12 +51,12 @@
51
51
  </style>
52
52
 
53
53
  <style scoped>
54
- img {
54
+ /* img {
55
55
  min-width: 150px;
56
56
  }
57
57
  video {
58
58
  min-width: 200px;
59
- }
59
+ } */
60
60
  </style>
61
61
  <script setup>
62
62
  import { ref, computed , onMounted, watch} from 'vue'
@@ -86,6 +86,14 @@ const maxWidth = computed(() => {
86
86
  return width ? { maxWidth: width } : {};
87
87
  });
88
88
 
89
+ const minWidth = computed(() => {
90
+ const isShowPage = route.path.includes('/show/');
91
+ const width = isShowPage
92
+ ? (props.meta.minShowWidth || props.meta.minWidth)
93
+ : (props.meta.minListWidth || props.meta.minWidth);
94
+
95
+ return width ? { minWidth: width } : {};
96
+ });
89
97
  // since we have no way to know the content type of the file, we will try to guess it from extension
90
98
  // for better experience probably we should check whether user saves content type in the database and use it here
91
99
  const contentType = computed(() => {
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, _e, _f;
102
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
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
@@ -129,6 +129,9 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
129
129
  maxWidth: (_d = this.options.preview) === null || _d === void 0 ? void 0 : _d.maxWidth,
130
130
  maxListWidth: (_e = this.options.preview) === null || _e === void 0 ? void 0 : _e.maxListWidth,
131
131
  maxShowWidth: (_f = this.options.preview) === null || _f === void 0 ? void 0 : _f.maxShowWidth,
132
+ minWidth: (_g = this.options.preview) === null || _g === void 0 ? void 0 : _g.minWidth,
133
+ minListWidth: (_h = this.options.preview) === null || _h === void 0 ? void 0 : _h.minListWidth,
134
+ minShowWidth: (_j = this.options.preview) === null || _j === void 0 ? void 0 : _j.minShowWidth,
132
135
  };
133
136
  // define components which will be imported from other components
134
137
  this.componentPath('imageGenerator.vue');
package/index.ts CHANGED
@@ -129,6 +129,9 @@ getBucketLifecycleConfiguration on bucket ${this.options.s3Bucket} in region ${t
129
129
  maxWidth: this.options.preview?.maxWidth,
130
130
  maxListWidth: this.options.preview?.maxListWidth,
131
131
  maxShowWidth: this.options.preview?.maxShowWidth,
132
+ minWidth: this.options.preview?.minWidth,
133
+ minListWidth: this.options.preview?.minListWidth,
134
+ minShowWidth: this.options.preview?.minShowWidth,
132
135
  };
133
136
  // define components which will be imported from other components
134
137
  this.componentPath('imageGenerator.vue');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/upload",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
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
@@ -62,7 +62,7 @@ export type PluginOptions = {
62
62
  }) => string,
63
63
 
64
64
 
65
- preview: {
65
+ preview?: {
66
66
 
67
67
  /**
68
68
  * Maximum width of the preview image
@@ -78,6 +78,22 @@ export type PluginOptions = {
78
78
  * Maximum width of the preview image in show view
79
79
  */
80
80
  maxShowWidth?: string,
81
+
82
+
83
+ /**
84
+ * Minimum width of the preview image
85
+ */
86
+ minWidth?: string,
87
+
88
+ /**
89
+ * Minimum width of the preview image in list view
90
+ */
91
+ minListWidth?: string,
92
+
93
+ /**
94
+ * Minimum width of the preview image in show view
95
+ */
96
+ minShowWidth?: string,
81
97
 
82
98
  /**
83
99
  * Used to display preview (if it is image) in list and show views.