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

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.
Files changed (92) hide show
  1. package/components/FSAccordion.vue +3 -3
  2. package/components/FSAccordionPanel.vue +5 -5
  3. package/components/FSBadge.vue +1 -1
  4. package/components/FSBreadcrumbs.vue +1 -1
  5. package/components/FSButton.vue +5 -5
  6. package/components/FSCalendar.vue +22 -12
  7. package/components/FSCalendarTwin.vue +16 -12
  8. package/components/FSCard.vue +11 -2
  9. package/components/FSCarousel.vue +1 -1
  10. package/components/FSCheckbox.vue +4 -4
  11. package/components/FSChip.vue +4 -4
  12. package/components/FSClickable.vue +1 -1
  13. package/components/FSClock.vue +40 -48
  14. package/components/FSCol.vue +1 -1
  15. package/components/FSColor.vue +9 -7
  16. package/components/FSColorIcon.vue +1 -1
  17. package/components/FSDivider.vue +2 -2
  18. package/components/FSEditImage.vue +131 -0
  19. package/components/FSErrorToast.vue +1 -1
  20. package/components/FSFadeOut.vue +1 -1
  21. package/components/FSForm.vue +4 -4
  22. package/components/FSGrid.vue +1 -1
  23. package/components/FSImage.vue +50 -12
  24. package/components/FSLabel.vue +1 -1
  25. package/components/FSLink.vue +1 -1
  26. package/components/FSLoader.vue +1 -1
  27. package/components/FSOptionGroup.vue +3 -3
  28. package/components/FSOptionItem.vue +4 -4
  29. package/components/FSPagination.vue +1 -1
  30. package/components/FSRadio.vue +4 -4
  31. package/components/FSRadioGroup.vue +3 -3
  32. package/components/FSRow.vue +1 -1
  33. package/components/FSSlideGroup.vue +11 -11
  34. package/components/FSSlider.vue +4 -4
  35. package/components/FSSpan.vue +1 -1
  36. package/components/FSSubmitDialog.vue +8 -8
  37. package/components/FSSwitch.vue +4 -4
  38. package/components/FSTab.vue +4 -4
  39. package/components/FSTabs.vue +2 -2
  40. package/components/FSTag.vue +2 -2
  41. package/components/FSText.vue +1 -1
  42. package/components/FSToggleSet.vue +4 -4
  43. package/components/FSWindow.vue +1 -1
  44. package/components/FSWrapGroup.vue +2 -2
  45. package/components/buttons/FSButtonFile.vue +17 -10
  46. package/components/buttons/FSButtonFileIcon.vue +17 -10
  47. package/components/buttons/FSButtonFileLabel.vue +17 -10
  48. package/components/buttons/FSButtonFileMini.vue +17 -10
  49. package/components/deviceOrganisations/FSConnectivityCard.vue +2 -2
  50. package/components/deviceOrganisations/FSStatusCard.vue +2 -2
  51. package/components/deviceOrganisations/FSStatusesCarousel.vue +2 -3
  52. package/components/deviceOrganisations/FSStatusesRow.vue +2 -3
  53. package/components/deviceOrganisations/FSWorstAlertCard.vue +2 -2
  54. package/components/fields/FSAutocompleteField.vue +5 -5
  55. package/components/fields/FSColorField.vue +3 -3
  56. package/components/fields/FSDateField.vue +10 -9
  57. package/components/fields/FSDateRangeField.vue +8 -8
  58. package/components/fields/FSDateTimeField.vue +16 -14
  59. package/components/fields/FSDateTimeRangeField.vue +12 -14
  60. package/components/fields/FSIconField.vue +10 -10
  61. package/components/fields/FSNumberField.vue +2 -2
  62. package/components/fields/FSPasswordField.vue +4 -4
  63. package/components/fields/FSRichTextField.vue +82 -92
  64. package/components/fields/FSSearchField.vue +8 -8
  65. package/components/fields/FSSelectField.vue +6 -6
  66. package/components/fields/FSTagField.vue +4 -4
  67. package/components/fields/FSTextArea.vue +5 -5
  68. package/components/fields/FSTextField.vue +5 -5
  69. package/components/fields/FSTimeField.vue +15 -9
  70. package/components/fields/FSTimeSlotField.vue +49 -21
  71. package/components/lists/FSDataTableUI.vue +24 -12
  72. package/components/lists/FSDraggable.vue +12 -6
  73. package/components/lists/FSFilterButton.vue +11 -8
  74. package/components/lists/FSLoadDataTable.vue +1 -1
  75. package/components/selects/FSSelectTimeZone.vue +7 -11
  76. package/components/tiles/FSDeviceOrganisationTileUI.vue +3 -3
  77. package/components/tiles/FSGroupTileUI.vue +3 -3
  78. package/components/tiles/FSLoadTile.vue +1 -1
  79. package/components/tiles/FSTile.vue +1 -1
  80. package/composables/index.ts +1 -0
  81. package/composables/useFiles.ts +13 -0
  82. package/composables/useRules.ts +1 -1
  83. package/models/colors.ts +1 -1
  84. package/models/deviceStatuses.ts +1 -1
  85. package/models/images.ts +4 -0
  86. package/models/index.ts +1 -0
  87. package/models/rules.ts +2 -2
  88. package/package.json +4 -4
  89. package/styles/components/fs_clock.scss +3 -2
  90. package/styles/components/fs_edit_image.scss +3 -0
  91. package/styles/components/index.scss +1 -0
  92. package/styles/globals/overrides.scss +1 -1
@@ -65,12 +65,12 @@ export default defineComponent({
65
65
  },
66
66
  props: {
67
67
  label: {
68
- type: String,
68
+ type: String as PropType<string | null>,
69
69
  required: false,
70
70
  default: null
71
71
  },
72
72
  description: {
73
- type: String,
73
+ type: String as PropType<string | null>,
74
74
  required: false,
75
75
  default: null
76
76
  },
@@ -100,7 +100,7 @@ export default defineComponent({
100
100
  default: false
101
101
  },
102
102
  rules: {
103
- type: Array as PropType<Function[]>,
103
+ type: Array as PropType<any[]>,
104
104
  required: false,
105
105
  default: () => []
106
106
  },
@@ -121,7 +121,7 @@ export default defineComponent({
121
121
 
122
122
  const innerValue = ref("");
123
123
 
124
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
124
+ const style = computed((): { [key: string] : string | undefined } => {
125
125
  if (!props.editable) {
126
126
  return {
127
127
  "--fs-tag-field-color": lights.dark
@@ -87,17 +87,17 @@ export default defineComponent({
87
87
  },
88
88
  props: {
89
89
  label: {
90
- type: String,
90
+ type: String as PropType<string | null>,
91
91
  required: false,
92
92
  default: null
93
93
  },
94
94
  description: {
95
- type: String,
95
+ type: String as PropType<string | null>,
96
96
  required: false,
97
97
  default: null
98
98
  },
99
99
  modelValue: {
100
- type: String,
100
+ type: String as PropType<string | null>,
101
101
  required: false,
102
102
  default: null
103
103
  },
@@ -127,7 +127,7 @@ export default defineComponent({
127
127
  default: false
128
128
  },
129
129
  rules: {
130
- type: Array as PropType<Function[]>,
130
+ type: Array as PropType<any[]>,
131
131
  required: false,
132
132
  default: () => []
133
133
  },
@@ -152,7 +152,7 @@ export default defineComponent({
152
152
  const lights = getColors(ColorEnum.Light);
153
153
  const darks = getColors(ColorEnum.Dark);
154
154
 
155
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
155
+ const style = computed((): { [key: string] : string | undefined } => {
156
156
  let height: string | undefined = undefined;
157
157
  let minHeight: string | undefined = undefined;
158
158
  if (!props.autoGrow) {
@@ -86,12 +86,12 @@ export default defineComponent({
86
86
  },
87
87
  props: {
88
88
  label: {
89
- type: String,
89
+ type: String as PropType<string | null>,
90
90
  required: false,
91
91
  default: null
92
92
  },
93
93
  description: {
94
- type: String,
94
+ type: String as PropType<string | null>,
95
95
  required: false,
96
96
  default: null
97
97
  },
@@ -101,7 +101,7 @@ export default defineComponent({
101
101
  default: "text"
102
102
  },
103
103
  modelValue: {
104
- type: String,
104
+ type: String as PropType<string | null>,
105
105
  required: false,
106
106
  default: null
107
107
  },
@@ -116,7 +116,7 @@ export default defineComponent({
116
116
  default: false
117
117
  },
118
118
  rules: {
119
- type: Array as PropType<Function[]>,
119
+ type: Array as PropType<any[]>,
120
120
  required: false,
121
121
  default: () => []
122
122
  },
@@ -144,7 +144,7 @@ export default defineComponent({
144
144
  const lights = getColors(ColorEnum.Light);
145
145
  const darks = getColors(ColorEnum.Dark);
146
146
 
147
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
147
+ const style = computed((): { [key: string] : string | undefined } => {
148
148
  if (!props.editable) {
149
149
  return {
150
150
  "--fs-text-field-cursor" : "default",
@@ -94,17 +94,17 @@ export default defineComponent({
94
94
  },
95
95
  props: {
96
96
  label: {
97
- type: String,
97
+ type: String as PropType<string | null>,
98
98
  required: false,
99
99
  default: null
100
100
  },
101
101
  description: {
102
- type: String,
102
+ type: String as PropType<string | null>,
103
103
  required: false,
104
104
  default: null
105
105
  },
106
106
  modelValue: {
107
- type: Number,
107
+ type: Number as PropType<number | null>,
108
108
  required: false,
109
109
  default: null
110
110
  },
@@ -119,7 +119,7 @@ export default defineComponent({
119
119
  default: false
120
120
  },
121
121
  rules: {
122
- type: Array as PropType<Function[]>,
122
+ type: Array as PropType<any[]>,
123
123
  required: false,
124
124
  default: () => []
125
125
  },
@@ -147,15 +147,20 @@ export default defineComponent({
147
147
  const lights = getColors(ColorEnum.Light);
148
148
  const darks = getColors(ColorEnum.Dark);
149
149
 
150
- const innerTime = ref(props.modelValue);
150
+ const innerTime = ref(0);
151
151
  const selectedUnit = ref(timeScale[0]);
152
152
 
153
- if (getTimeScaleIndex(props.modelValue) !== 0) {
154
- selectedUnit.value = timeScale[getTimeScaleIndex(props.modelValue)];
155
- innerTime.value = props.modelValue / selectedUnit.value.id;
153
+ if (props.modelValue) {
154
+ if (getTimeScaleIndex(props.modelValue) !== 0) {
155
+ selectedUnit.value = timeScale[getTimeScaleIndex(props.modelValue)];
156
+ innerTime.value = props.modelValue / selectedUnit.value.id;
157
+ }
158
+ else {
159
+ innerTime.value = props.modelValue;
160
+ }
156
161
  }
157
162
 
158
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
163
+ const style = computed((): { [key: string] : string | undefined } => {
159
164
  if (!props.editable) {
160
165
  return {
161
166
  "--fs-time-field-cursor" : "default",
@@ -193,6 +198,7 @@ export default defineComponent({
193
198
  timeScale,
194
199
  messages,
195
200
  blurred,
201
+ slots,
196
202
  style,
197
203
  onSubmitTimeScale,
198
204
  onSubmitValue
@@ -56,7 +56,6 @@
56
56
  class="fs-time-slot-field-number"
57
57
  :editable="$props.editable"
58
58
  :color="ColorEnum.Light"
59
- :reminder="false"
60
59
  :slider="false"
61
60
  :style="style"
62
61
  :modelValue="$props.modelValue[0][1]"
@@ -80,7 +79,6 @@
80
79
  class="fs-time-slot-field-number"
81
80
  :editable="$props.editable"
82
81
  :color="ColorEnum.Light"
83
- :reminder="false"
84
82
  :slider="false"
85
83
  :style="style"
86
84
  :modelValue="$props.modelValue[1][1]"
@@ -125,17 +123,17 @@ export default defineComponent({
125
123
  },
126
124
  props: {
127
125
  label: {
128
- type: String,
126
+ type: String as PropType<string | null>,
129
127
  required: false,
130
128
  default: null
131
129
  },
132
130
  description: {
133
- type: String,
131
+ type: String as PropType<string | null>,
134
132
  required: false,
135
133
  default: null
136
134
  },
137
135
  modelValue: {
138
- type: Array as PropType<number[][]>,
136
+ type: Array as PropType<number[][] | null>,
139
137
  required: true,
140
138
  default: null
141
139
  },
@@ -150,7 +148,7 @@ export default defineComponent({
150
148
  default: false
151
149
  },
152
150
  rules: {
153
- type: Array as PropType<Function[]>,
151
+ type: Array as PropType<any[]>,
154
152
  required: false,
155
153
  default: () => []
156
154
  },
@@ -179,16 +177,16 @@ export default defineComponent({
179
177
  const darks = getColors(ColorEnum.Dark);
180
178
 
181
179
  const daysObject: { id: number; label: string }[] = Object.keys(Days).reduce((acc, key) => {
182
- if(isNaN(Number(key))){
180
+ if (isNaN(Number(key))) {
183
181
  acc.push({
184
182
  id: Days[key],
185
183
  label: key
186
184
  });
187
185
  }
188
186
  return acc;
189
- }, []);
187
+ }, [] as { id: number, label: string }[]);
190
188
 
191
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
189
+ const style = computed((): { [key: string] : string | undefined } => {
192
190
  if (!props.editable) {
193
191
  return {
194
192
  "--fs-time-slot-field-cursor" : "default",
@@ -208,45 +206,75 @@ export default defineComponent({
208
206
  });
209
207
 
210
208
  const dayStart = computed((): number => {
211
- return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
209
+ if (props.modelValue) {
210
+ return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
211
+ }
212
+ return 0;
212
213
  });
213
214
 
214
215
  const dayEnd = computed((): number => {
215
- return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
216
+ if (props.modelValue) {
217
+ return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
218
+ }
219
+ return 0;
216
220
  });
217
221
 
218
222
  const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
219
223
 
220
224
  const onChangeDayStart = (value: number) => {
221
225
  if (value === 7) {
222
- emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
226
+ if (props.modelValue) {
227
+ emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
228
+ return;
229
+ }
230
+ emit("update:modelValue", [[7, 0], [7, 0]]);
223
231
  return;
224
232
  }
225
- if (props.modelValue[1][0] === 7) {
226
- emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
233
+ if (props.modelValue) {
234
+ if (props.modelValue[1][0] === 7) {
235
+ emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
236
+ return;
237
+ }
238
+ emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
227
239
  return;
228
240
  }
229
- emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
241
+ emit("update:modelValue", [[value, 0], [value, 0]]);
230
242
  };
231
243
 
232
244
  const onChangeHourStart = (value: number) => {
233
- emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
245
+ if (props.modelValue) {
246
+ emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
247
+ return;
248
+ }
249
+ emit("update:modelValue", [[0, value], [0, 0]]);
234
250
  };
235
251
 
236
252
  const onChangeDayEnd = (value: number) => {
237
253
  if (value === 7) {
238
- emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
254
+ if (props.modelValue) {
255
+ emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
256
+ return;
257
+ }
258
+ emit("update:modelValue", [[7, 0], [7, 0]]);
239
259
  return;
240
260
  }
241
- if (props.modelValue[0][0] === 7) {
242
- emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
261
+ if (props.modelValue) {
262
+ if (props.modelValue[0][0] === 7) {
263
+ emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
264
+ return;
265
+ }
266
+ emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
243
267
  return;
244
268
  }
245
- emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
269
+ emit("update:modelValue", [[value, 0], [value, 0]]);
246
270
  };
247
271
 
248
272
  const onChangeHourEnd = (value: number) => {
249
- emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
273
+ if (props.modelValue) {
274
+ emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
275
+ return;
276
+ }
277
+ emit("update:modelValue", [[0, 0], [0, value]]);
250
278
  };
251
279
 
252
280
  return {
@@ -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
@@ -628,6 +630,11 @@ export default defineComponent({
628
630
  required: false,
629
631
  default: true
630
632
  },
633
+ showSearch: {
634
+ type: Boolean,
635
+ required: false,
636
+ default: true
637
+ },
631
638
  singleSelect: {
632
639
  type: Boolean,
633
640
  required: false,
@@ -703,6 +710,10 @@ export default defineComponent({
703
710
  { id: -1, label: $tr("ui.data-table.all-rows", "All") }
704
711
  ];
705
712
 
713
+ const showFiltersRow = computed((): boolean => {
714
+ return (props.showSearch && showFilters.value && filterableHeaders.value.length > 0) || hiddenHeaders.value.length > 0;
715
+ });
716
+
706
717
  const innerSlots = computed((): { [label: string]: Slot<any> } => {
707
718
  const slots = { ...useSlots().slots };
708
719
  delete slots["toolbar"];
@@ -732,7 +743,7 @@ export default defineComponent({
732
743
  return slots;
733
744
  });
734
745
 
735
- const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
746
+ const style = computed((): { [key: string] : string | undefined } => {
736
747
  return {
737
748
  "--fs-data-table-background-color": backgrounds.base,
738
749
  "--fs-data-table-border-color": lights.base
@@ -1203,6 +1214,7 @@ export default defineComponent({
1203
1214
  innerPage,
1204
1215
  pageOptions,
1205
1216
  showFilters,
1217
+ showFiltersRow,
1206
1218
  extraHeaders,
1207
1219
  innerHeaders,
1208
1220
  hiddenHeaders,
@@ -80,9 +80,11 @@ export default defineComponent({
80
80
  touchEndX.value = touch.clientX;
81
81
  touchEndY.value = touch.clientY;
82
82
 
83
- draggedElementCopy.value.style.left = `${touchEndX.value - 25}px`;
84
- draggedElementCopy.value.style.top = `${touchEndY.value - 25}px`;
85
- document.body.appendChild(draggedElementCopy.value);
83
+ if (draggedElementCopy.value) {
84
+ draggedElementCopy.value.style.left = `${touchEndX.value - 25}px`;
85
+ draggedElementCopy.value.style.top = `${touchEndY.value - 25}px`;
86
+ document.body.appendChild(draggedElementCopy.value);
87
+ }
86
88
  const dragOverTarget = document.elementFromPoint(touchEndX.value, touchEndY.value)?.closest(props.elementSelector);
87
89
 
88
90
  if (dragOverTarget) {
@@ -116,8 +118,10 @@ export default defineComponent({
116
118
  }
117
119
  event.preventDefault();
118
120
  const dragged = (event.target as HTMLElement)?.closest(props.elementSelector);
119
- draggedElementCopy.value.remove();
120
- draggedElementCopy.value = null;
121
+ if (draggedElementCopy.value) {
122
+ draggedElementCopy.value.remove();
123
+ draggedElementCopy.value = null;
124
+ }
121
125
 
122
126
  const dropTarget = document.elementFromPoint(touchEndX.value, touchEndY.value);
123
127
  const dragEndEvent = new Event("dragend");
@@ -137,7 +141,9 @@ export default defineComponent({
137
141
  touchStartY.value = 0;
138
142
  touchEndX.value = 0;
139
143
  touchEndY.value = 0;
140
- dragged.classList.remove("fs-draggable-dragging");
144
+ if (dragged) {
145
+ dragged.classList.remove("fs-draggable-dragging");
146
+ }
141
147
  };
142
148
 
143
149
  const onDragStart = (event: DragEvent) => {
@@ -113,21 +113,24 @@ export default defineComponent({
113
113
 
114
114
  const singlePick = ref(false);
115
115
  const expanded = ref(false);
116
- const search = ref(null);
116
+ const search = ref<string | null>(null);
117
117
 
118
- const label = computed(() => {
119
- if (props.filters) {
120
- const hidden = props.filters.filter(f => f.hidden).length;
121
- if (hidden > 0) {
122
- return $tr("ui.data-table.some-filters-visible", "{0}: {1} visible", props.header.text, (props.filters.length - hidden).toString());
118
+ const label = computed((): string | null => {
119
+ if (props.header.text) {
120
+ if (props.filters) {
121
+ const hidden = props.filters.filter(f => f.hidden).length;
122
+ if (hidden > 0) {
123
+ return $tr("ui.data-table.some-filters-visible", "{0}: {1} visible", props.header.text, (props.filters.length - hidden).toString());
124
+ }
123
125
  }
126
+ return $tr("ui.data-table.all-filters-visible", "{0}: All visible", props.header.text);
124
127
  }
125
- return $tr("ui.data-table.all-filters-visible", "{0}: All visible", props.header.text);
128
+ return null;
126
129
  });
127
130
 
128
131
  const searchedFilters = computed((): FSDataTableFilter[] => {
129
132
  if (search.value) {
130
- return props.filters.filter(f => (f.text + f.value).includes(search.value));
133
+ return props.filters.filter(f => (f.text + f.value).includes(search.value!));
131
134
  }
132
135
  return props.filters;
133
136
  });
@@ -81,7 +81,7 @@ export default defineComponent({
81
81
 
82
82
  const backgroundColors = getColors(ColorEnum.Background);
83
83
 
84
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
84
+ const style = computed((): { [key: string] : string | undefined } => {
85
85
  return {
86
86
  "--fs-load-data-table-background-color": backgroundColors.base
87
87
  };
@@ -1,26 +1,22 @@
1
1
  <template>
2
- <FSSelectField
3
- itemTitle="id"
2
+ <FSSelectField itemTitle="id"
4
3
  :items="timeZones"
5
4
  :modelValue="$props.modelValue"
6
5
  @update:modelValue="$emit('update:modelValue', $event)"
7
- v-bind="$attrs"
8
- >
6
+ v-bind="$attrs">
9
7
  <template #append-inner>
10
8
  <slot name="append-inner">
11
- <FSChip
12
- v-if="offset"
9
+ <FSChip v-if="offset"
13
10
  variant="standard"
14
11
  :color="ColorEnum.Dark"
15
- :label="offset"
16
- />
12
+ :label="offset" />
17
13
  </slot>
18
14
  </template>
19
15
  </FSSelectField>
20
16
  </template>
21
17
 
22
18
  <script lang="ts">
23
- import { computed, defineComponent, onMounted } from "vue";
19
+ import { computed, defineComponent, onMounted, PropType } from "vue";
24
20
 
25
21
  import { useTimeZones } from "@dative-gpi/foundation-shared-services/composables";
26
22
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -36,7 +32,7 @@ export default defineComponent({
36
32
  },
37
33
  props: {
38
34
  modelValue: {
39
- type: String,
35
+ type: String as PropType<string | null>,
40
36
  required: false,
41
37
  default: null
42
38
  },
@@ -45,7 +41,7 @@ export default defineComponent({
45
41
  setup(props) {
46
42
  const { getMany: getTimeZones, entities: timeZones } = useTimeZones();
47
43
 
48
- const offset = computed((): string => {
44
+ const offset = computed((): string | undefined => {
49
45
  return timeZones.value.find((entity) => entity.id === props.modelValue)?.offset;
50
46
  });
51
47
 
@@ -103,17 +103,17 @@ export default defineComponent({
103
103
  },
104
104
  props: {
105
105
  imageId: {
106
- type: String,
106
+ type: String as PropType<string | null>,
107
107
  required: false,
108
108
  default: null
109
109
  },
110
110
  label: {
111
- type: String,
111
+ type: String as PropType<string | null>,
112
112
  required: false,
113
113
  default: null
114
114
  },
115
115
  code: {
116
- type: String,
116
+ type: String as PropType<string | null>,
117
117
  required: false,
118
118
  default: null
119
119
  },
@@ -125,17 +125,17 @@ export default defineComponent({
125
125
  },
126
126
  props: {
127
127
  imageId: {
128
- type: String,
128
+ type: String as PropType<string | null>,
129
129
  required: false,
130
130
  default: null
131
131
  },
132
132
  label: {
133
- type: String,
133
+ type: String as PropType<string | null>,
134
134
  required: false,
135
135
  default: null
136
136
  },
137
137
  code: {
138
- type: String,
138
+ type: String as PropType<string | null>,
139
139
  required: false,
140
140
  default: null
141
141
  },
@@ -108,7 +108,7 @@ export default defineComponent({
108
108
  }
109
109
  });
110
110
 
111
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
111
+ const style = computed((): { [key: string] : string | undefined } => {
112
112
  return {
113
113
  "--fs-load-tile-background-color": backgroundColors.base
114
114
  };
@@ -64,7 +64,7 @@ export default defineComponent({
64
64
 
65
65
  const bottomColors = computed(() => getGradients(props.bottomColor));
66
66
 
67
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
67
+ const style = computed((): { [key: string] : string | undefined } => {
68
68
  return {
69
69
  "--fs-tile-border-color": bottomColors.value.base
70
70
  };
@@ -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
+ }
@@ -6,7 +6,7 @@ export const useRules = () => {
6
6
 
7
7
  const blurred = ref(false);
8
8
 
9
- const validateOn = computed((): string => {
9
+ const validateOn = computed((): "input" | "submit" | "blur" => {
10
10
  switch (innerValidateOn.value) {
11
11
  case "submit": return submitted.value ? "input" : "submit";
12
12
  case "blur": return blurred.value ? "input" : "blur";
package/models/colors.ts CHANGED
@@ -19,4 +19,4 @@ export interface ColorVariations {
19
19
  darkContrast?: string;
20
20
  };
21
21
 
22
- export type ColorBase = (String | ColorEnum);
22
+ export type ColorBase = (string | ColorEnum);
@@ -6,7 +6,7 @@ export interface FSDeviceStatus {
6
6
  export interface FSDeviceStatusGroup {
7
7
  label: string;
8
8
  groupByValue?: string;
9
- value: string;
9
+ value?: string;
10
10
  unit?: string;
11
11
  icon: string;
12
12
  color: string;
@@ -0,0 +1,4 @@
1
+ export interface FileImage {
2
+ fileName: string;
3
+ fileContent: string | ArrayBuffer | null;
4
+ }