@dative-gpi/foundation-shared-components 0.0.48 → 0.0.50

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.
@@ -62,7 +62,7 @@
62
62
  <script lang="ts">
63
63
  import { computed, defineComponent, PropType, ref } from "vue";
64
64
 
65
- import { useTimeZone, useLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
65
+ import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
66
66
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
67
67
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
68
68
 
@@ -103,8 +103,8 @@ export default defineComponent({
103
103
  },
104
104
  emits: ["update:modelValue"],
105
105
  setup(props) {
106
- const { epochToPicker, pickerToEpoch, todayToEpoch } = useTimeZone();
107
- const { languageCode } = useLanguageCode();
106
+ const { epochToPicker, pickerToEpoch, todayToEpoch } = useAppTimeZone();
107
+ const { languageCode } = useAppLanguageCode();
108
108
  const { getColors } = useColors();
109
109
 
110
110
  const colors = computed(() => getColors(props.color));
@@ -102,7 +102,7 @@
102
102
  <script lang="ts">
103
103
  import { computed, defineComponent, onMounted, PropType, ref } from "vue";
104
104
 
105
- import { useTimeZone, useLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
105
+ import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
106
106
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
107
107
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
108
108
 
@@ -143,8 +143,8 @@ export default defineComponent({
143
143
  },
144
144
  emits: ["update:modelValue"],
145
145
  setup(props, { emit }) {
146
- const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useTimeZone();
147
- const { languageCode } = useLanguageCode();
146
+ const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useAppTimeZone();
147
+ const { languageCode } = useAppLanguageCode();
148
148
  const { getColors } = useColors();
149
149
 
150
150
  const colors = computed(() => getColors(props.color));
@@ -1,11 +1,13 @@
1
1
  <template>
2
2
  <button
3
3
  v-if="!href"
4
- :class="wrapperClasses"
5
4
  :type="$props.type"
5
+ :style="style"
6
6
  @click.stop="onClick"
7
7
  >
8
8
  <FSCard
9
+ :height="$props.height"
10
+ :width="$props.width"
9
11
  :class="classes"
10
12
  :style="style"
11
13
  v-bind="$attrs"
@@ -26,10 +28,12 @@
26
28
  </button>
27
29
  <router-link
28
30
  v-else
29
- :class="wrapperClasses"
31
+ :style="style"
30
32
  :to="href"
31
33
  >
32
34
  <FSCard
35
+ :height="$props.height"
36
+ :width="$props.width"
33
37
  :class="classes"
34
38
  :style="style"
35
39
  v-bind="$attrs"
@@ -96,10 +100,15 @@ export default defineComponent({
96
100
  required: false,
97
101
  default: ColorEnum.Light
98
102
  },
99
- fullWidth: {
100
- type: Boolean,
103
+ width: {
104
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
101
105
  required: false,
102
- default: false
106
+ default: null
107
+ },
108
+ height: {
109
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
110
+ required: false,
111
+ default: null
103
112
  },
104
113
  load: {
105
114
  type: Boolean,
@@ -128,7 +137,9 @@ export default defineComponent({
128
137
  "--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
129
138
  "--fs-clickable-background-color": lights.light,
130
139
  "--fs-clickable-border-color" : lights.dark,
131
- "--fs-clickable-color" : lights.dark
140
+ "--fs-clickable-color" : lights.dark,
141
+ "--fs-clickable-height" : sizeToVar(props.height),
142
+ "--fs-clickable-width" : sizeToVar(props.width)
132
143
  };
133
144
  }
134
145
  switch (props.variant) {
@@ -143,7 +154,9 @@ export default defineComponent({
143
154
  "--fs-clickable-hover-color" : colors.value.baseContrast,
144
155
  "--fs-clickable-active-background-color": colors.value.dark,
145
156
  "--fs-clickable-active-border-color" : colors.value.darkContrast,
146
- "--fs-clickable-active-color" : colors.value.darkContrast
157
+ "--fs-clickable-active-color" : colors.value.darkContrast,
158
+ "--fs-clickable-height" : sizeToVar(props.height),
159
+ "--fs-clickable-width" : sizeToVar(props.width)
147
160
  };
148
161
  case "full": return {
149
162
  "--fs-clickable-border-size" : props.border ? "1px" : "0",
@@ -156,7 +169,9 @@ export default defineComponent({
156
169
  "--fs-clickable-hover-color" : colors.value.baseContrast,
157
170
  "--fs-clickable-active-background-color": colors.value.dark,
158
171
  "--fs-clickable-active-border-color" : colors.value.dark,
159
- "--fs-clickable-active-color" : colors.value.darkContrast
172
+ "--fs-clickable-active-color" : colors.value.darkContrast,
173
+ "--fs-clickable-height" : sizeToVar(props.height),
174
+ "--fs-clickable-width" : sizeToVar(props.width)
160
175
  };
161
176
  }
162
177
  });
@@ -169,14 +184,6 @@ export default defineComponent({
169
184
  return classNames;
170
185
  });
171
186
 
172
- const wrapperClasses = computed((): string[] => {
173
- const classNames: string[] = [];
174
- if (props.fullWidth) {
175
- classNames.push("fs-clickable-wrapper-full-width");
176
- }
177
- return classNames;
178
- });
179
-
180
187
  const href = computed((): string | null => {
181
188
  if (!props.to || !props.editable || props.load) {
182
189
  return null;
@@ -206,7 +213,6 @@ export default defineComponent({
206
213
  };
207
214
 
208
215
  return {
209
- wrapperClasses,
210
216
  loadColor,
211
217
  classes,
212
218
  style,
@@ -73,7 +73,7 @@
73
73
  import { computed, defineComponent, PropType, ref, watch } from "vue";
74
74
 
75
75
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
76
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
76
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
77
77
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
78
78
 
79
79
  import FSSlider from "./FSSlider.vue";
@@ -123,7 +123,7 @@ export default defineComponent({
123
123
  },
124
124
  emits: ["update:modelValue"],
125
125
  setup(props, { emit }) {
126
- const { epochToLongDateFormat } = useTimeZone();
126
+ const { epochToLongDateFormat } = useAppTimeZone();
127
127
  const { getColors } = useColors();
128
128
 
129
129
  const colors = computed(() => getColors(props.color));
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSRow
3
+ width="fill"
4
+ gap="24px"
5
+ >
6
+ <FSCard
7
+ class="fs-edit-image"
8
+ :borderRadius="$props.borderRadius"
9
+ :padding="$props.padding"
10
+ >
11
+ <FSImage
12
+ :borderRadius="$props.borderRadius"
13
+ :aspectRatio="$props.aspectRatio"
14
+ :height="$props.height"
15
+ :imageB64="realSource"
16
+ :width="$props.width"
17
+ />
18
+ </FSCard>
19
+ <FSCol
20
+ height="fill"
21
+ align="bottom-left"
22
+ >
23
+ <FSText
24
+ v-if="fileSelected"
25
+ font="text-body"
26
+ >
27
+ {{ fileSelected.fileName }}
28
+ </FSText>
29
+ <FSRow>
30
+ <FSButtonFileIcon
31
+ accept="image/*"
32
+ :readFile="false"
33
+ @update:modelValue="onUpload"
34
+ />
35
+ <FSButtonRemoveIcon
36
+ @click="onRemove"
37
+ />
38
+ </FSRow>
39
+ </FSCol>
40
+ </FSRow>
41
+ </template>
42
+
43
+ <script lang="ts">
44
+ import { computed, defineComponent, PropType, ref } from "vue";
45
+
46
+ import { useFiles } from "@dative-gpi/foundation-shared-components/composables";
47
+ import { FileImage } from "@dative-gpi/foundation-shared-components/models";
48
+
49
+ import FSButtonRemoveIcon from "./buttons/FSButtonRemoveIcon.vue";
50
+ import FSButtonFileIcon from "./buttons/FSButtonFileIcon.vue";
51
+ import FSImage from "./FSImage.vue";
52
+ import FSCard from "./FSCard.vue";
53
+ import FSText from "./FSText.vue";
54
+
55
+ export default defineComponent({
56
+ name: "FSEditImage",
57
+ components: {
58
+ FSButtonRemoveIcon,
59
+ FSButtonFileIcon,
60
+ FSImage,
61
+ FSCard,
62
+ FSText
63
+ },
64
+ props: {
65
+ padding: {
66
+ type: [String, Number],
67
+ required: false,
68
+ default: "8px"
69
+ },
70
+ width: {
71
+ type: [String, Number],
72
+ required: false,
73
+ default: null
74
+ },
75
+ height: {
76
+ type: [String, Number],
77
+ required: false,
78
+ default: null
79
+ },
80
+ aspectRatio: {
81
+ type: String,
82
+ required: false,
83
+ default: null
84
+ },
85
+ borderRadius: {
86
+ type: [String, Number],
87
+ required: false,
88
+ default: "4px"
89
+ },
90
+ modelValue: {
91
+ type: String as PropType<string>,
92
+ required: false,
93
+ default: null
94
+ }
95
+ },
96
+ emits: ["update:modelValue"],
97
+ setup(props, { emit }) {
98
+ const { read } = useFiles();
99
+
100
+ const fileSelected = ref<FileImage>({ fileName: "", fileContent: null });
101
+
102
+ const realSource = computed(() => {
103
+ return fileSelected.value && fileSelected.value.fileName ? fileSelected.value.fileContent : props.modelValue;
104
+ });
105
+
106
+ const onUpload = (payload: File) => {
107
+ read(payload, (content: string) => {
108
+ fileSelected.value.fileName = payload.name;
109
+ fileSelected.value.fileContent = content;
110
+ emit("update:modelValue", content);
111
+ });
112
+ };
113
+
114
+ const onRemove = () => {
115
+ fileSelected.value.fileName = "";
116
+ fileSelected.value.fileContent = null;
117
+ emit("update:modelValue", null);
118
+ };
119
+
120
+ return {
121
+ fileSelected,
122
+ realSource,
123
+ onUpload,
124
+ onRemove
125
+ };
126
+ }
127
+ });
128
+ </script>
@@ -54,6 +54,11 @@ export default defineComponent({
54
54
  required: false,
55
55
  default: null
56
56
  },
57
+ imageB64: {
58
+ type: String,
59
+ required: false,
60
+ default: null
61
+ },
57
62
  cover: {
58
63
  type: Boolean,
59
64
  required: false,
@@ -86,6 +91,14 @@ export default defineComponent({
86
91
  const imageRef = ref(null);
87
92
  const canvasRef = ref(null);
88
93
 
94
+ const signatures = ref<{ [key: string]: string }>({
95
+ JVBERi0 : "application/pdf",
96
+ R0lGODdh : "image/gif",
97
+ R0lGODlh : "image/gif",
98
+ iVBORw0KGgo: "image/png",
99
+ "/9j/" : "image/jpg",
100
+ });
101
+
89
102
  const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
90
103
  return {
91
104
  "--fs-image-border-radius" : sizeToVar(props.borderRadius),
@@ -98,7 +111,7 @@ export default defineComponent({
98
111
  return props.height;
99
112
  }
100
113
  if (props.width) {
101
- if (typeof(props.width) === "string") {
114
+ if (typeof (props.width) === "string") {
102
115
  return undefined;
103
116
  }
104
117
  if (props.aspectRatio) {
@@ -117,7 +130,7 @@ export default defineComponent({
117
130
  return props.width;
118
131
  }
119
132
  if (props.height) {
120
- if (typeof(props.height) === "string") {
133
+ if (typeof (props.height) === "string") {
121
134
  return undefined;
122
135
  }
123
136
  if (props.aspectRatio) {
@@ -135,12 +148,38 @@ export default defineComponent({
135
148
  if (props.imageId) {
136
149
  return IMAGE_RAW_URL(props.imageId);
137
150
  }
151
+ else if (props.imageB64) {
152
+ if (imageType.value && imageData.value) {
153
+ return `${imageType.value},${imageData.value}`;
154
+ }
155
+ }
138
156
  return null;
139
157
  });
140
158
 
159
+ const imageData = computed((): string => {
160
+ if (props.imageB64 && props.imageB64.includes(",")) {
161
+ return props.imageB64.split(",")[1];
162
+ }
163
+ return props.imageB64;
164
+ });
165
+
166
+ const imageType = computed((): string => {
167
+ if (props.imageB64 && props.imageB64.includes(",")) {
168
+ return props.imageB64.split(",")[0];
169
+ }
170
+ if (props.imageB64) {
171
+ for (const s in signatures.value) {
172
+ if (props.imageB64.startsWith(s)) {
173
+ return `data:${signatures.value[s]};base64`;
174
+ }
175
+ }
176
+ }
177
+ return "";
178
+ });
179
+
141
180
  const onError = (): void => {
142
181
  if (props.imageId) {
143
- fetchBlurHash(props.imageId);
182
+ fetchBlurHash(props.imageId);
144
183
  }
145
184
  };
146
185
 
@@ -3,9 +3,10 @@
3
3
  :class="classes"
4
4
  :style="style"
5
5
  :to="href"
6
+ v-slot="props"
6
7
  v-bind="$attrs"
7
8
  >
8
- <slot>
9
+ <slot v-bind="props">
9
10
  {{ $props.label }}
10
11
  </slot>
11
12
  </router-link>
@@ -22,6 +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
26
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
27
 
27
28
  import FSButton from "../FSButton.vue";
@@ -44,7 +45,9 @@ export default defineComponent({
44
45
  }
45
46
  },
46
47
  emits: ["update:modelValue"],
47
- setup(props, { emit }) {
48
+ setup(props, { emit }) {
49
+ const { read } = useFiles();
50
+
48
51
  const input = ref(null);
49
52
 
50
53
  const clear = () => {
@@ -65,12 +68,9 @@ export default defineComponent({
65
68
  clear();
66
69
  }
67
70
  else {
68
- const reader = new FileReader();
69
- reader.addEventListener("load", (fileEv) => {
70
- emit("update:modelValue", fileEv.target && fileEv.target.result);
71
- clear();
71
+ read(file, (content: string) => {
72
+ emit("update:modelValue", content);
72
73
  });
73
- reader.readAsDataURL(file);
74
74
  }
75
75
  };
76
76
 
@@ -22,6 +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
26
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
27
 
27
28
  import FSButton from "../FSButton.vue";
@@ -44,7 +45,9 @@ export default defineComponent({
44
45
  }
45
46
  },
46
47
  emits: ["update:modelValue"],
47
- setup(props, { emit }) {
48
+ setup(props, { emit }) {
49
+ const { read } = useFiles();
50
+
48
51
  const input = ref(null);
49
52
 
50
53
  const clear = () => {
@@ -65,12 +68,9 @@ export default defineComponent({
65
68
  clear();
66
69
  }
67
70
  else {
68
- const reader = new FileReader();
69
- reader.addEventListener("load", (fileEv) => {
70
- emit("update:modelValue", fileEv.target && fileEv.target.result);
71
- clear();
71
+ read(file, (content: string) => {
72
+ emit("update:modelValue", content);
72
73
  });
73
- reader.readAsDataURL(file);
74
74
  }
75
75
  };
76
76
 
@@ -21,6 +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
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
25
26
 
26
27
  import FSButton from "../FSButton.vue";
@@ -43,7 +44,9 @@ export default defineComponent({
43
44
  }
44
45
  },
45
46
  emits: ["update:modelValue"],
46
- setup(props, { emit }) {
47
+ setup(props, { emit }) {
48
+ const { read } = useFiles();
49
+
47
50
  const input = ref(null);
48
51
 
49
52
  const clear = () => {
@@ -64,12 +67,9 @@ export default defineComponent({
64
67
  clear();
65
68
  }
66
69
  else {
67
- const reader = new FileReader();
68
- reader.addEventListener("load", (fileEv) => {
69
- emit("update:modelValue", fileEv.target && fileEv.target.result);
70
- clear();
70
+ read(file, (content: string) => {
71
+ emit("update:modelValue", content);
71
72
  });
72
- reader.readAsDataURL(file);
73
73
  }
74
74
  };
75
75
 
@@ -21,6 +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
25
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
25
26
 
26
27
  import FSButton from "../FSButton.vue";
@@ -43,7 +44,9 @@ export default defineComponent({
43
44
  }
44
45
  },
45
46
  emits: ["update:modelValue"],
46
- setup(props, { emit }) {
47
+ setup(props, { emit }) {
48
+ const { read } = useFiles();
49
+
47
50
  const input = ref(null);
48
51
 
49
52
  const clear = () => {
@@ -64,12 +67,9 @@ export default defineComponent({
64
67
  clear();
65
68
  }
66
69
  else {
67
- const reader = new FileReader();
68
- reader.addEventListener("load", (fileEv) => {
69
- emit("update:modelValue", fileEv.target && fileEv.target.result);
70
- clear();
70
+ read(file, (content: string) => {
71
+ emit("update:modelValue", content);
71
72
  });
72
- reader.readAsDataURL(file);
73
73
  }
74
74
  };
75
75
 
@@ -44,7 +44,7 @@ import { computed, defineComponent, PropType } from "vue";
44
44
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
45
45
  import { FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
46
46
  import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/models";
47
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
47
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
48
48
 
49
49
  import FSCard from "../FSCard.vue";
50
50
  import FSChip from "../FSChip.vue";
@@ -70,7 +70,7 @@ export default defineComponent({
70
70
  }
71
71
  },
72
72
  setup(props) {
73
- const { epochToLongTimeFormat } = useTimeZone();
73
+ const { epochToLongTimeFormat } = useAppTimeZone();
74
74
  const { $tr } = useTranslationsProvider();
75
75
 
76
76
  const connectivityLabel = computed((): string => {
@@ -54,7 +54,7 @@
54
54
  import { computed, defineComponent, PropType } from "vue";
55
55
 
56
56
  import { FSDeviceStatusGroup, FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
57
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
57
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
58
58
 
59
59
  import FSCard from "../FSCard.vue";
60
60
  import FSChip from "../FSChip.vue";
@@ -84,7 +84,7 @@ export default defineComponent({
84
84
  }
85
85
  },
86
86
  setup(props) {
87
- const { epochToLongTimeFormat } = useTimeZone();
87
+ const { epochToLongTimeFormat } = useAppTimeZone();
88
88
 
89
89
  const deviceTimestamp = computed((): string => {
90
90
  if (props.statusGroup.sourceTimestamp) {
@@ -43,7 +43,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
43
43
 
44
44
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
45
45
  import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/models";
46
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
46
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
47
47
  import { FSDeviceAlert } from "@dative-gpi/foundation-shared-components/models";
48
48
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
49
49
 
@@ -71,7 +71,7 @@ export default defineComponent({
71
71
  }
72
72
  },
73
73
  setup(props) {
74
- const { epochToLongTimeFormat } = useTimeZone();
74
+ const { epochToLongTimeFormat } = useAppTimeZone();
75
75
  const { $tr } = useTranslationsProvider();
76
76
 
77
77
  const criticityColor = computed(() => {
@@ -45,6 +45,7 @@
45
45
  :itemValue="$props.itemValue"
46
46
  :readonly="!$props.editable"
47
47
  :clearable="$props.editable && !!$props.modelValue"
48
+ :returnObject="$props.returnObject"
48
49
  :rules="$props.rules"
49
50
  :validateOn="validateOn"
50
51
  :modelValue="$props.modelValue"
@@ -127,6 +128,11 @@ export default defineComponent({
127
128
  required: false,
128
129
  default: false
129
130
  },
131
+ returnObject: {
132
+ type: Boolean,
133
+ required: false,
134
+ default: false
135
+ },
130
136
  required: {
131
137
  type: Boolean,
132
138
  required: false,
@@ -64,7 +64,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
64
64
 
65
65
  import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
66
66
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
67
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
67
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
68
68
 
69
69
  import FSTextField from "./FSTextField.vue";
70
70
  import FSCalendar from "../FSCalendar.vue";
@@ -126,7 +126,7 @@ export default defineComponent({
126
126
  emits: ["update:modelValue"],
127
127
  setup(props, { emit }) {
128
128
  const {validateOn, blurred, getMessages} = useRules();
129
- const { epochToLongDateFormat } = useTimeZone();
129
+ const { epochToLongDateFormat } = useAppTimeZone();
130
130
  const { getColors } = useColors();
131
131
 
132
132
  const errors = getColors(ColorEnum.Error);
@@ -51,7 +51,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
51
51
 
52
52
  import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
53
53
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
54
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
54
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
55
55
 
56
56
  import FSSubmitDialog from "../FSSubmitDialog.vue";
57
57
  import FSCalendarTwin from "../FSCalendarTwin.vue";
@@ -111,7 +111,7 @@ export default defineComponent({
111
111
  emits: ["update:modelValue"],
112
112
  setup(props, { emit }) {
113
113
  const { validateOn, blurred, getMessages } = useRules();
114
- const { epochToShortDateFormat } = useTimeZone();
114
+ const { epochToShortDateFormat } = useAppTimeZone();
115
115
  const { getColors } = useColors();
116
116
 
117
117
  const errors = getColors(ColorEnum.Error);
@@ -88,7 +88,7 @@ import { computed, defineComponent, PropType, ref, watch } from "vue";
88
88
 
89
89
  import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
90
90
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
91
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
91
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
92
92
 
93
93
  import FSTextField from "./FSTextField.vue";
94
94
  import FSCalendar from "../FSCalendar.vue";
@@ -153,7 +153,7 @@ export default defineComponent({
153
153
  },
154
154
  emits: ["update:modelValue"],
155
155
  setup(props, { emit }) {
156
- const { getUserOffsetMillis, epochToLongTimeFormat } = useTimeZone();
156
+ const { getUserOffsetMillis, epochToLongTimeFormat } = useAppTimeZone();
157
157
  const { validateOn, blurred, getMessages } = useRules();
158
158
  const { getColors } = useColors();
159
159
 
@@ -77,7 +77,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
77
77
 
78
78
  import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
79
79
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
80
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
80
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
81
81
 
82
82
  import FSSubmitDialog from "../FSSubmitDialog.vue";
83
83
  import FSCalendarTwin from "../FSCalendarTwin.vue";
@@ -142,7 +142,7 @@ export default defineComponent({
142
142
  },
143
143
  emits: ["update:modelValue"],
144
144
  setup(props, { emit }) {
145
- const { getUserOffsetMillis, epochToShortTimeFormat } = useTimeZone();
145
+ const { getUserOffsetMillis, epochToShortTimeFormat } = useAppTimeZone();
146
146
  const { validateOn, blurred, getMessages } = useRules();
147
147
  const { getColors } = useColors();
148
148
 
@@ -43,6 +43,7 @@
43
43
  :itemValue="$props.itemValue"
44
44
  :readonly="!$props.editable"
45
45
  :clearable="$props.editable && $props.clearable"
46
+ :returnObject="$props.returnObject"
46
47
  :rules="$props.rules"
47
48
  :validateOn="validateOn"
48
49
  :modelValue="$props.modelValue"
@@ -119,6 +120,11 @@ export default defineComponent({
119
120
  required: false,
120
121
  default: false
121
122
  },
123
+ returnObject: {
124
+ type: Boolean,
125
+ required: false,
126
+ default: false
127
+ },
122
128
  required: {
123
129
  type: Boolean,
124
130
  required: false,
@@ -5,16 +5,18 @@
5
5
  <FSRow
6
6
  align="bottom-center"
7
7
  >
8
- <FSSearchField
9
- prependInnerIcon="mdi-magnify"
10
- :hideHeader="true"
11
- v-model="innerSearch"
12
- />
13
- <FSButton
14
- prependIcon="mdi-filter-variant"
15
- :variant="showFilters ? 'full' : 'standard'"
16
- @click="showFilters = !showFilters"
17
- />
8
+ <template v-if="$props.showSearch">
9
+ <FSSearchField
10
+ prependInnerIcon="mdi-magnify"
11
+ :hideHeader="true"
12
+ v-model="innerSearch"
13
+ />
14
+ <FSButton
15
+ prependIcon="mdi-filter-variant"
16
+ :variant="showFilters ? 'full' : 'standard'"
17
+ @click="showFilters = !showFilters"
18
+ />
19
+ </template>
18
20
  <slot name="toolbar" />
19
21
  <v-spacer />
20
22
  <FSOptionGroup
@@ -25,7 +27,7 @@
25
27
  />
26
28
  </FSRow>
27
29
  <FSRow
28
- v-if="(showFilters && filterableHeaders.length > 0) || hiddenHeaders.length > 0"
30
+ v-if="showFiltersRow"
29
31
  >
30
32
  <template v-if="showFilters">
31
33
  <FSFilterButton
@@ -423,6 +425,7 @@
423
425
  width="120px"
424
426
  >
425
427
  <FSSelectField
428
+ class="fs-data-table-rows-per-page"
426
429
  :clearable="false"
427
430
  :hideHeader="true"
428
431
  :items="rowsPerPageOptions"
@@ -627,6 +630,11 @@ export default defineComponent({
627
630
  required: false,
628
631
  default: true
629
632
  },
633
+ showSearch: {
634
+ type: Boolean,
635
+ required: false,
636
+ default: true
637
+ },
630
638
  singleSelect: {
631
639
  type: Boolean,
632
640
  required: false,
@@ -702,6 +710,10 @@ export default defineComponent({
702
710
  { id: -1, label: $tr("ui.data-table.all-rows", "All") }
703
711
  ];
704
712
 
713
+ const showFiltersRow = computed((): boolean => {
714
+ return (props.showSearch && showFilters.value && filterableHeaders.value.length > 0) || hiddenHeaders.value.length > 0;
715
+ });
716
+
705
717
  const innerSlots = computed((): { [label: string]: Slot<any> } => {
706
718
  const slots = { ...useSlots().slots };
707
719
  delete slots["toolbar"];
@@ -1202,6 +1214,7 @@ export default defineComponent({
1202
1214
  innerPage,
1203
1215
  pageOptions,
1204
1216
  showFilters,
1217
+ showFiltersRow,
1205
1218
  extraHeaders,
1206
1219
  innerHeaders,
1207
1220
  hiddenHeaders,
@@ -1,32 +1,34 @@
1
1
  <template>
2
- <FSSelectField
3
- itemTitle="id"
4
- :items="entities"
2
+ <FSSelectField itemTitle="id"
3
+ :items="timeZones"
5
4
  :modelValue="$props.modelValue"
6
5
  @update:modelValue="$emit('update:modelValue', $event)"
7
- v-bind="$attrs"
8
- >
9
- <template #selection>
10
- <FSRow>
11
- <FSSpan font="text-underline" :style="style">
12
- {{ entities.find((entity) => entity.id === $props.modelValue)?.id }}
13
- </FSSpan>
14
- </FSRow>
6
+ v-bind="$attrs">
7
+ <template #append-inner>
8
+ <slot name="append-inner">
9
+ <FSChip v-if="offset"
10
+ variant="standard"
11
+ :color="ColorEnum.Dark"
12
+ :label="offset" />
13
+ </slot>
15
14
  </template>
16
15
  </FSSelectField>
17
16
  </template>
18
17
 
19
18
  <script lang="ts">
20
- import { defineComponent, onMounted } from "vue";
19
+ import { computed, defineComponent, onMounted } from "vue";
21
20
 
22
21
  import { useTimeZones } from "@dative-gpi/foundation-shared-services/composables";
22
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
23
23
 
24
24
  import FSSelectField from "../fields/FSSelectField.vue";
25
+ import FSChip from "../FSChip.vue";
25
26
 
26
27
  export default defineComponent({
27
28
  name: "FSSelectTimeZone",
28
29
  components: {
29
- FSSelectField
30
+ FSSelectField,
31
+ FSChip
30
32
  },
31
33
  props: {
32
34
  modelValue: {
@@ -36,15 +38,21 @@ export default defineComponent({
36
38
  },
37
39
  },
38
40
  emits: ["update:modelValue"],
39
- setup() {
40
- const { getMany, entities } = useTimeZones();
41
+ setup(props) {
42
+ const { getMany: getTimeZones, entities: timeZones } = useTimeZones();
43
+
44
+ const offset = computed((): string | undefined => {
45
+ return timeZones.value.find((entity) => entity.id === props.modelValue)?.offset;
46
+ });
41
47
 
42
48
  onMounted(() => {
43
- getMany();
49
+ getTimeZones();
44
50
  });
45
51
 
46
52
  return {
47
- entities
53
+ ColorEnum,
54
+ timeZones,
55
+ offset
48
56
  };
49
57
  }
50
58
  });
@@ -1,5 +1,6 @@
1
1
  export * from "./useBreakpoints";
2
2
  export * from "./useColors";
3
3
  export * from "./useDebounce";
4
+ export * from "./useFiles";
4
5
  export * from "./useRules";
5
6
  export * from "./useSlots";
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,4 @@
1
+ export interface FileImage {
2
+ fileName: string;
3
+ fileContent: string | ArrayBuffer | null;
4
+ }
package/models/index.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./deviceConnectivities";
5
5
  export * from "./deviceStatuses";
6
6
  export * from "./errors";
7
7
  export * from "./grids";
8
+ export * from "./images";
8
9
  export * from "./modelStatuses";
9
10
  export * from "./rules";
10
11
  export * from "./tables";
package/models/rules.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
2
- import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
2
+ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
3
3
 
4
4
  import { getTimeBestString } from "../utils";
5
5
 
6
- const { epochToLongDateFormat } = useTimeZone()!;
6
+ const { epochToLongDateFormat } = useAppTimeZone()!;
7
7
  const { $tr } = useTranslationsProvider();
8
8
 
9
9
  export const TextRules = {
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.48",
4
+ "version": "0.0.50",
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.48",
14
- "@dative-gpi/foundation-shared-services": "0.0.48",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.50",
14
+ "@dative-gpi/foundation-shared-services": "0.0.50",
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": "0029f53ff50ea72e704647e64d3419266ae680fa"
35
+ "gitHead": "be18a14ae47c91c1f3ccd22a196593050f06aae8"
36
36
  }
@@ -26,19 +26,17 @@
26
26
  }
27
27
 
28
28
  a:has(.fs-clickable) {
29
+ position: relative !important;
29
30
  text-decoration: none;
30
31
  padding: 0 !important;
31
- position: relative !important;
32
- width: fit-content;
32
+ height: var(--fs-clickable-height);
33
+ width: var(--fs-clickable-width);
33
34
  }
34
35
 
35
36
  button:has(.fs-clickable) {
36
37
  position: relative !important;
37
- width: fit-content;
38
- }
39
-
40
- .fs-clickable-wrapper-full-width {
41
- width: 100% !important;
38
+ height: var(--fs-clickable-height);
39
+ width: var(--fs-clickable-width);
42
40
  }
43
41
 
44
42
  .fs-clickable-load {
@@ -0,0 +1,3 @@
1
+ .fs-edit-image {
2
+ border-style: dashed;
3
+ }
@@ -19,6 +19,7 @@
19
19
  @import "fs_dialog.scss";
20
20
  @import "fs_divider.scss";
21
21
  @import "fs_draggable.scss";
22
+ @import "fs_edit_image.scss";
22
23
  @import "fs_error_toast.scss";
23
24
  @import "fs_fade_out.scss";
24
25
  @import "fs_filter_button.scss";