sprintify-ui 0.0.43 → 0.0.45

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.
@@ -2,7 +2,7 @@ import { PropType } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  modelValue: {
4
4
  default: undefined;
5
- type: PropType<string | undefined>;
5
+ type: PropType<string | null | undefined>;
6
6
  };
7
7
  type: {
8
8
  type: StringConstructor;
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<{
43
43
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
44
44
  modelValue: {
45
45
  default: undefined;
46
- type: PropType<string | undefined>;
46
+ type: PropType<string | null | undefined>;
47
47
  };
48
48
  type: {
49
49
  type: StringConstructor;
@@ -87,7 +87,7 @@ declare const _default: import("vue").DefineComponent<{
87
87
  required: boolean;
88
88
  type: string;
89
89
  name: string;
90
- modelValue: string | undefined;
90
+ modelValue: string | null | undefined;
91
91
  placeholder: string;
92
92
  disabled: boolean;
93
93
  hasError: boolean;
@@ -13,5 +13,7 @@ export declare function useField(config: Config): {
13
13
  hasErrorInternal: import("vue").ComputedRef<boolean>;
14
14
  errorMessageInternal: import("vue").ComputedRef<string | null | undefined>;
15
15
  emitUpdate: (value: any) => void;
16
+ enableForm: () => void;
17
+ disableForm: () => void;
16
18
  };
17
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -8,8 +8,8 @@
8
8
  :accept="accept"
9
9
  :accepted-extensions="acceptedExtensions"
10
10
  :url="uploadUrl"
11
- @upload:start="$emit('upload:start', $event)"
12
- @upload:end="$emit('upload:end', $event)"
11
+ @upload:start="onUploadStart"
12
+ @upload:end="onUploadEnd"
13
13
  @upload:fail="$emit('upload:fail', $event)"
14
14
  @upload:success="onUploadSuccess"
15
15
  >
@@ -162,7 +162,7 @@ const emit = defineEmits([
162
162
  'upload:end',
163
163
  ]);
164
164
 
165
- const { emitUpdate } = useField({
165
+ const { emitUpdate, enableForm, disableForm } = useField({
166
166
  name: computed(() => props.name),
167
167
  required: computed(() => false),
168
168
  hasError: computed(() => props.hasError),
@@ -285,4 +285,14 @@ const maxFileSize = computed(() => {
285
285
  i18n.t('sui.up_to_x', { x: fileSizeFormat(props.maxSize) })
286
286
  );
287
287
  });
288
+
289
+ function onUploadStart(event: any) {
290
+ emit('upload:start', event);
291
+ disableForm();
292
+ }
293
+
294
+ function onUploadEnd(event: any) {
295
+ emit('upload:end', event);
296
+ enableForm();
297
+ }
288
298
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <textarea
3
- :value="modelValue"
3
+ :value="modelValue + ''"
4
4
  :type="type"
5
5
  :name="nameInternal"
6
6
  :placeholder="placeholder"
@@ -21,7 +21,7 @@ import { PropType } from 'vue';
21
21
  const props = defineProps({
22
22
  modelValue: {
23
23
  default: undefined,
24
- type: String as PropType<string | undefined>,
24
+ type: [String, null, undefined] as PropType<string | null | undefined>,
25
25
  },
26
26
  type: {
27
27
  type: String,
@@ -58,6 +58,14 @@ export function useField(config: Config) {
58
58
  setLabelClass(labelClass);
59
59
  }
60
60
 
61
+ const disableForm = inject('form:disable', () => {
62
+ return;
63
+ }) as () => void;
64
+
65
+ const enableForm = inject('form:enable', () => {
66
+ return;
67
+ }) as () => void;
68
+
61
69
  const requiredInternal = computed((): boolean => {
62
70
  if (required.value) {
63
71
  return required.value;
@@ -96,5 +104,7 @@ export function useField(config: Config) {
96
104
  hasErrorInternal,
97
105
  errorMessageInternal,
98
106
  emitUpdate,
107
+ enableForm,
108
+ disableForm,
99
109
  };
100
110
  }