@dative-gpi/foundation-shared-components 0.0.51 → 0.0.52

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.
@@ -43,7 +43,7 @@
43
43
  <script lang="ts">
44
44
  import { computed, defineComponent, PropType, ref } from "vue";
45
45
 
46
- import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
46
+ import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
47
47
  import { FileImage } from "@dative-gpi/foundation-shared-components/models";
48
48
 
49
49
  import FSButtonRemoveIcon from "./buttons/FSButtonRemoveIcon.vue";
@@ -95,7 +95,7 @@ export default defineComponent({
95
95
  },
96
96
  emits: ["update:modelValue"],
97
97
  setup(props, { emit }) {
98
- const { read } = useFiles();
98
+ const { readFile } = useFiles();
99
99
 
100
100
  const fileSelected = ref<FileImage>({ fileName: "", fileContent: null });
101
101
 
@@ -106,12 +106,11 @@ export default defineComponent({
106
106
  return props.modelValue;
107
107
  });
108
108
 
109
- const onUpload = (payload: File) => {
110
- read(payload, (content: string) => {
111
- fileSelected.value.fileName = payload.name;
112
- fileSelected.value.fileContent = content;
113
- emit("update:modelValue", content);
114
- });
109
+ const onUpload = async (payload: File) => {
110
+ const content = await readFile(payload);
111
+ fileSelected.value.fileName = payload.name;
112
+ fileSelected.value.fileContent = content;
113
+ emit("update:modelValue", content);
115
114
  };
116
115
 
117
116
  const onRemove = () => {
@@ -30,7 +30,7 @@ export default defineComponent({
30
30
  },
31
31
  props: {
32
32
  label: {
33
- type: [String, null, undefined],
33
+ type: String as PropType<string | null>,
34
34
  required: false,
35
35
  default: null
36
36
  },
@@ -23,7 +23,7 @@ export default defineComponent({
23
23
  name: "FSLink",
24
24
  props: {
25
25
  label: {
26
- type: [String, null, undefined],
26
+ type: String as PropType<string | null>,
27
27
  required: false,
28
28
  default: null
29
29
  },
@@ -19,7 +19,7 @@ export default defineComponent({
19
19
  name: "FSSpan",
20
20
  props: {
21
21
  label: {
22
- type: [String, null, undefined],
22
+ type: String as PropType<string | null>,
23
23
  required: false,
24
24
  default: null
25
25
  },
@@ -20,7 +20,7 @@ export default defineComponent({
20
20
  name: "FSText",
21
21
  props: {
22
22
  label: {
23
- type: [String, null, undefined],
23
+ type: String as PropType<string | null>,
24
24
  required: false,
25
25
  default: null
26
26
  },
@@ -22,7 +22,7 @@
22
22
  <script lang="ts">
23
23
  import { defineComponent, ref } from "vue";
24
24
 
25
- import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
25
+ import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
26
26
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
27
27
 
28
28
  import FSButton from "../FSButton.vue";
@@ -46,23 +46,23 @@ export default defineComponent({
46
46
  },
47
47
  emits: ["update:modelValue"],
48
48
  setup(props, { emit }) {
49
- const { read } = useFiles();
49
+ const { readFile } = useFiles();
50
50
 
51
51
  const input = ref<HTMLFormElement | null>(null);
52
52
 
53
- const clear = () => {
53
+ const clear = (): void => {
54
54
  if (input.value) {
55
55
  input.value.form && input.value.form.reset();
56
56
  }
57
57
  };
58
58
 
59
- const onClick = () => {
59
+ const onClick = (): void => {
60
60
  if (input.value) {
61
61
  input.value.click();
62
62
  }
63
63
  }
64
64
 
65
- const onInput = () => {
65
+ const onInput = async (): Promise<void> => {
66
66
  if (!input.value) {
67
67
  return;
68
68
  }
@@ -75,9 +75,8 @@ export default defineComponent({
75
75
  clear();
76
76
  }
77
77
  else {
78
- read(file, (content: string) => {
79
- emit("update:modelValue", content);
80
- });
78
+ const content = await readFile(file);
79
+ emit("update:modelValue", content);
81
80
  }
82
81
  };
83
82
 
@@ -22,7 +22,7 @@
22
22
  <script lang="ts">
23
23
  import { defineComponent, ref } from "vue";
24
24
 
25
- import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
25
+ import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
26
26
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
27
27
 
28
28
  import FSButton from "../FSButton.vue";
@@ -46,23 +46,23 @@ export default defineComponent({
46
46
  },
47
47
  emits: ["update:modelValue"],
48
48
  setup(props, { emit }) {
49
- const { read } = useFiles();
49
+ const { readFile } = useFiles();
50
50
 
51
51
  const input = ref<HTMLFormElement | null>(null);
52
52
 
53
- const clear = () => {
53
+ const clear = (): void => {
54
54
  if (input.value) {
55
55
  input.value.form && input.value.form.reset();
56
56
  }
57
57
  };
58
58
 
59
- const onClick = () => {
59
+ const onClick = (): void => {
60
60
  if (input.value) {
61
61
  input.value.click();
62
62
  }
63
63
  }
64
64
 
65
- const onInput = () => {
65
+ const onInput = async (): Promise<void> => {
66
66
  if (!input.value) {
67
67
  return;
68
68
  }
@@ -75,9 +75,8 @@ export default defineComponent({
75
75
  clear();
76
76
  }
77
77
  else {
78
- read(file, (content: string) => {
79
- emit("update:modelValue", content);
80
- });
78
+ const content = await readFile(file);
79
+ emit("update:modelValue", content);
81
80
  }
82
81
  };
83
82
 
@@ -21,7 +21,7 @@
21
21
  <script lang="ts">
22
22
  import { defineComponent, ref } from "vue";
23
23
 
24
- import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
24
+ import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
25
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
26
 
27
27
  import FSButton from "../FSButton.vue";
@@ -45,23 +45,23 @@ export default defineComponent({
45
45
  },
46
46
  emits: ["update:modelValue"],
47
47
  setup(props, { emit }) {
48
- const { read } = useFiles();
48
+ const { readFile } = useFiles();
49
49
 
50
50
  const input = ref<HTMLFormElement | null>(null);
51
51
 
52
- const clear = () => {
52
+ const clear = (): void => {
53
53
  if (input.value) {
54
54
  input.value.form && input.value.form.reset();
55
55
  }
56
56
  };
57
57
 
58
- const onClick = () => {
58
+ const onClick = (): void => {
59
59
  if (input.value) {
60
60
  input.value.click();
61
61
  }
62
62
  }
63
63
 
64
- const onInput = () => {
64
+ const onInput = async (): Promise<void> => {
65
65
  if (!input.value) {
66
66
  return;
67
67
  }
@@ -74,9 +74,8 @@ export default defineComponent({
74
74
  clear();
75
75
  }
76
76
  else {
77
- read(file, (content: string) => {
78
- emit("update:modelValue", content);
79
- });
77
+ const content = await readFile(file);
78
+ emit("update:modelValue", content);
80
79
  }
81
80
  };
82
81
 
@@ -21,7 +21,7 @@
21
21
  <script lang="ts">
22
22
  import { defineComponent, ref } from "vue";
23
23
 
24
- import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
24
+ import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
25
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
26
 
27
27
  import FSButton from "../FSButton.vue";
@@ -45,23 +45,23 @@ export default defineComponent({
45
45
  },
46
46
  emits: ["update:modelValue"],
47
47
  setup(props, { emit }) {
48
- const { read } = useFiles();
48
+ const { readFile } = useFiles();
49
49
 
50
50
  const input = ref<HTMLFormElement | null>(null);
51
51
 
52
- const clear = () => {
52
+ const clear = (): void => {
53
53
  if (input.value) {
54
54
  input.value.form && input.value.form.reset();
55
55
  }
56
56
  };
57
57
 
58
- const onClick = () => {
58
+ const onClick = (): void => {
59
59
  if (input.value) {
60
60
  input.value.click();
61
61
  }
62
62
  }
63
63
 
64
- const onInput = () => {
64
+ const onInput = async (): Promise<void> => {
65
65
  if (!input.value) {
66
66
  return;
67
67
  }
@@ -74,9 +74,8 @@ export default defineComponent({
74
74
  clear();
75
75
  }
76
76
  else {
77
- read(file, (content: string) => {
78
- emit("update:modelValue", content);
79
- });
77
+ const content = await readFile(file);
78
+ emit("update:modelValue", content);
80
79
  }
81
80
  };
82
81
 
@@ -1,6 +1,5 @@
1
1
  export * from "./useBreakpoints";
2
2
  export * from "./useColors";
3
3
  export * from "./useDebounce";
4
- export * from "./useFiles";
5
4
  export * from "./useRules";
6
5
  export * from "./useSlots";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.51",
4
+ "version": "0.0.52",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "0.0.51",
14
- "@dative-gpi/foundation-shared-services": "0.0.51",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.52",
14
+ "@dative-gpi/foundation-shared-services": "0.0.52",
15
15
  "@fontsource/montserrat": "^5.0.16",
16
16
  "@lexical/clipboard": "^0.12.5",
17
17
  "@lexical/history": "^0.12.5",
@@ -32,5 +32,5 @@
32
32
  "sass": "^1.69.5",
33
33
  "sass-loader": "^13.3.2"
34
34
  },
35
- "gitHead": "13a8e0d4bd10a05a35c570412fa2024d33b0c115"
35
+ "gitHead": "1cea46f60262aceae3135923684ed4a5af60d0bb"
36
36
  }
@@ -1,13 +0,0 @@
1
- export const useFiles = () => {
2
- const read = (file: File, callback: Function): void => {
3
- const reader = new FileReader();
4
- reader.addEventListener("load", (fileEv) => {
5
- callback(fileEv.target && fileEv.target.result);
6
- });
7
- reader.readAsDataURL(file);
8
- };
9
-
10
- return {
11
- read
12
- };
13
- }