sprintify-ui 0.1.6 → 0.1.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.
@@ -13,12 +13,16 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
13
13
  countries?: Country[] | undefined;
14
14
  regions?: Region[] | undefined;
15
15
  restrictCountry?: boolean | undefined;
16
+ hideRegion?: boolean | undefined;
17
+ hideCountry?: boolean | undefined;
16
18
  }>, {
17
19
  modelValue(): {};
18
20
  prefix: null;
19
21
  countries(): never[];
20
22
  regions(): never[];
21
23
  restrictCountry: boolean;
24
+ hideRegion: boolean;
25
+ hideCountry: boolean;
22
26
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:model-value"[], "update:model-value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
23
27
  modelValue: {
24
28
  address_1?: string | null | undefined;
@@ -32,12 +36,16 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
32
36
  countries?: Country[] | undefined;
33
37
  regions?: Region[] | undefined;
34
38
  restrictCountry?: boolean | undefined;
39
+ hideRegion?: boolean | undefined;
40
+ hideCountry?: boolean | undefined;
35
41
  }>, {
36
42
  modelValue(): {};
37
43
  prefix: null;
38
44
  countries(): never[];
39
45
  regions(): never[];
40
46
  restrictCountry: boolean;
47
+ hideRegion: boolean;
48
+ hideCountry: boolean;
41
49
  }>>> & {
42
50
  "onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
43
51
  }, {
@@ -53,6 +61,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
53
61
  } | null | undefined;
54
62
  prefix: string | null;
55
63
  restrictCountry: boolean;
64
+ hideRegion: boolean;
65
+ hideCountry: boolean;
56
66
  }>;
57
67
  export default _default;
58
68
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -55,6 +55,7 @@
55
55
  </div>
56
56
  <div class="sm:flex sm:space-x-3">
57
57
  <BaseField
58
+ v-if="!props.hideCountry"
58
59
  :label="$t('sui.country')"
59
60
  :name="`${namePrefix}country`"
60
61
  required
@@ -72,6 +73,7 @@
72
73
  </BaseSelect>
73
74
  </BaseField>
74
75
  <BaseField
76
+ v-if="!props.hideRegion"
75
77
  :label="$t('sui.region')"
76
78
  :name="`${namePrefix}region`"
77
79
  required
@@ -119,6 +121,8 @@ const props = withDefaults(
119
121
  countries?: Country[];
120
122
  regions?: Region[];
121
123
  restrictCountry?: boolean;
124
+ hideRegion?: boolean;
125
+ hideCountry?: boolean;
122
126
  }>(),
123
127
  {
124
128
  modelValue() {
@@ -132,6 +136,8 @@ const props = withDefaults(
132
136
  return [];
133
137
  },
134
138
  restrictCountry: false,
139
+ hideRegion: false,
140
+ hideCountry: false,
135
141
  }
136
142
  );
137
143
 
@@ -312,8 +312,6 @@ async function save(
312
312
  circle: false,
313
313
  };
314
314
 
315
- console.log(resultConfig);
316
-
317
315
  const r = await cropper.result(resultConfig);
318
316
 
319
317
  saving.value = false;
@@ -52,6 +52,7 @@ const emit = defineEmits(['select']);
52
52
 
53
53
  const showCropperModal = ref(false);
54
54
  const cropperSource = ref('');
55
+ let filename = '';
55
56
 
56
57
  const cropperInternal = computed<BaseCropperConfig | null>(() => {
57
58
  if (!cropperSource.value) {
@@ -75,6 +76,8 @@ async function launchCropper(file: File) {
75
76
  return;
76
77
  }
77
78
 
79
+ filename = file.name;
80
+
78
81
  showCropperModal.value = false;
79
82
  cropperSource.value = await blobToBase64(file);
80
83
 
@@ -87,7 +90,7 @@ async function launchCropper(file: File) {
87
90
 
88
91
  async function onCropped(cropped: HTMLCanvasElement | string | Blob) {
89
92
  if (cropped instanceof Blob) {
90
- emit('select', cropped);
93
+ emitUpdate(cropped);
91
94
  return;
92
95
  }
93
96
 
@@ -102,15 +105,23 @@ async function onCropped(cropped: HTMLCanvasElement | string | Blob) {
102
105
  });
103
106
  });
104
107
 
105
- emit('select', blob);
108
+ emitUpdate(blob);
106
109
 
107
110
  return;
108
111
  }
109
112
 
110
113
  if (typeof cropped === 'string') {
111
114
  const blob = await fetch(cropped).then((r) => r.blob());
112
- emit('select', blob);
115
+ emitUpdate(blob);
113
116
  return;
114
117
  }
115
118
  }
119
+
120
+ function emitUpdate(blob: Blob) {
121
+ const file = new File([blob], filename, {
122
+ type: blob.type,
123
+ });
124
+
125
+ emit('select', file);
126
+ }
116
127
  </script>