sprintify-ui 0.0.136 → 0.0.137

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.
@@ -15,7 +15,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
15
15
  default: undefined;
16
16
  };
17
17
  max: {
18
- default: number;
18
+ default: undefined;
19
19
  type: NumberConstructor;
20
20
  };
21
21
  maxSize: {
@@ -60,7 +60,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
60
60
  default: undefined;
61
61
  };
62
62
  max: {
63
- default: number;
63
+ default: undefined;
64
64
  type: NumberConstructor;
65
65
  };
66
66
  maxSize: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.136",
3
+ "version": "0.0.137",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -14,7 +14,7 @@ export default {
14
14
  title: 'Form/BaseMediaLibrary',
15
15
  component: BaseMediaLibrary,
16
16
  args: {
17
- max: 6,
17
+ max: null,
18
18
  min: 2,
19
19
  acceptedExtensions: ['jpg', 'png'],
20
20
  uploadUrl: 'https://api.com/upload',
@@ -18,7 +18,7 @@
18
18
  name="default"
19
19
  v-bind="baseFileUploaderProps"
20
20
  :max-size="maxSize"
21
- :max="max"
21
+ :max="normalizedMax"
22
22
  >
23
23
  <div
24
24
  class="rounded border border-dashed p-6 duration-150"
@@ -119,7 +119,7 @@ const props = defineProps({
119
119
  default: undefined,
120
120
  },
121
121
  max: {
122
- default: 100,
122
+ default: undefined,
123
123
  type: Number,
124
124
  },
125
125
  maxSize: {
@@ -170,6 +170,14 @@ const { emitUpdate, enableForm, disableForm } = useField({
170
170
  errorType: 'alert',
171
171
  });
172
172
 
173
+ const normalizedMax = computed(() => {
174
+ if (props.max == null) {
175
+ return 100;
176
+ }
177
+
178
+ return props.max;
179
+ });
180
+
173
181
  const currentMediaInternal = ref(cloneDeep(props.currentMedia));
174
182
 
175
183
  const normalizedModelValue = computed(() => {
@@ -203,10 +211,12 @@ function onUploadSuccess(file: UploadedFile) {
203
211
  return;
204
212
  }
205
213
 
206
- if (numberOfFiles.value >= props.max && props.max > 1) {
214
+ if (numberOfFiles.value >= normalizedMax.value && normalizedMax.value > 1) {
207
215
  notifications.push({
208
216
  title: i18n.t('sui.whoops'),
209
- text: i18n.t('sui.you_can_upload_up_to_n_files', { count: props.max }),
217
+ text: i18n.t('sui.you_can_upload_up_to_n_files', {
218
+ count: normalizedMax.value,
219
+ }),
210
220
  color: 'danger',
211
221
  });
212
222
  return;
@@ -214,7 +224,7 @@ function onUploadSuccess(file: UploadedFile) {
214
224
 
215
225
  const modelValue = cloneDeep(normalizedModelValue.value);
216
226
 
217
- if (props.max == 1) {
227
+ if (normalizedMax.value == 1) {
218
228
  // Remove everything...
219
229
  modelValue.to_remove.push(...currentMediaInternal.value.map((m) => m.id));
220
230
  modelValue.to_add = [];
@@ -277,7 +287,9 @@ function sync(modelValue: MediaLibraryPayload) {
277
287
  }
278
288
 
279
289
  const maxFileText = computed(() => {
280
- return i18n.t('sui.you_can_upload_up_to_n_files', { count: props.max });
290
+ return i18n.t('sui.you_can_upload_up_to_n_files', {
291
+ count: normalizedMax.value,
292
+ });
281
293
  });
282
294
 
283
295
  const maxFileSize = computed(() => {