@dative-gpi/foundation-shared-components 0.0.50 → 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 (82) 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 +19 -9
  7. package/components/FSCalendarTwin.vue +13 -9
  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 +38 -46
  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 +6 -3
  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 +13 -14
  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 +11 -4
  46. package/components/buttons/FSButtonFileIcon.vue +11 -4
  47. package/components/buttons/FSButtonFileLabel.vue +12 -5
  48. package/components/buttons/FSButtonFileMini.vue +12 -5
  49. package/components/deviceOrganisations/FSStatusesCarousel.vue +2 -3
  50. package/components/deviceOrganisations/FSStatusesRow.vue +2 -3
  51. package/components/fields/FSAutocompleteField.vue +5 -5
  52. package/components/fields/FSColorField.vue +3 -3
  53. package/components/fields/FSDateField.vue +8 -7
  54. package/components/fields/FSDateRangeField.vue +6 -6
  55. package/components/fields/FSDateTimeField.vue +14 -12
  56. package/components/fields/FSDateTimeRangeField.vue +10 -12
  57. package/components/fields/FSIconField.vue +10 -10
  58. package/components/fields/FSNumberField.vue +2 -2
  59. package/components/fields/FSPasswordField.vue +4 -4
  60. package/components/fields/FSRichTextField.vue +82 -92
  61. package/components/fields/FSSearchField.vue +8 -8
  62. package/components/fields/FSSelectField.vue +6 -6
  63. package/components/fields/FSTagField.vue +4 -4
  64. package/components/fields/FSTextArea.vue +5 -5
  65. package/components/fields/FSTextField.vue +5 -5
  66. package/components/fields/FSTimeField.vue +15 -9
  67. package/components/fields/FSTimeSlotField.vue +49 -21
  68. package/components/lists/FSDataTableUI.vue +1 -1
  69. package/components/lists/FSDraggable.vue +12 -6
  70. package/components/lists/FSFilterButton.vue +11 -8
  71. package/components/lists/FSLoadDataTable.vue +1 -1
  72. package/components/selects/FSSelectTimeZone.vue +2 -2
  73. package/components/tiles/FSDeviceOrganisationTileUI.vue +3 -3
  74. package/components/tiles/FSGroupTileUI.vue +3 -3
  75. package/components/tiles/FSLoadTile.vue +1 -1
  76. package/components/tiles/FSTile.vue +1 -1
  77. package/composables/useRules.ts +1 -1
  78. package/models/colors.ts +1 -1
  79. package/models/deviceStatuses.ts +1 -1
  80. package/package.json +4 -4
  81. package/styles/components/fs_clock.scss +3 -2
  82. package/styles/globals/overrides.scss +1 -1
@@ -46,19 +46,26 @@ export default defineComponent({
46
46
  emits: ["update:modelValue"],
47
47
  setup(props, { emit }) {
48
48
  const { read } = useFiles();
49
-
50
- const input = ref(null);
49
+
50
+ const input = ref<HTMLFormElement | null>(null);
51
51
 
52
52
  const clear = () => {
53
- input.value!.form && input.value!.form.reset();
53
+ if (input.value) {
54
+ input.value.form && input.value.form.reset();
55
+ }
54
56
  };
55
57
 
56
58
  const onClick = () => {
57
- input.value!.click();
59
+ if (input.value) {
60
+ input.value.click();
61
+ }
58
62
  }
59
63
 
60
64
  const onInput = () => {
61
- const file = input.value!.files && input.value!.files[0];
65
+ if (!input.value) {
66
+ return;
67
+ }
68
+ const file = input.value.files && input.value.files[0];
62
69
  if (!file) {
63
70
  return;
64
71
  }
@@ -46,19 +46,26 @@ export default defineComponent({
46
46
  emits: ["update:modelValue"],
47
47
  setup(props, { emit }) {
48
48
  const { read } = useFiles();
49
-
50
- const input = ref(null);
49
+
50
+ const input = ref<HTMLFormElement | null>(null);
51
51
 
52
52
  const clear = () => {
53
- input.value!.form && input.value!.form.reset();
53
+ if (input.value) {
54
+ input.value.form && input.value.form.reset();
55
+ }
54
56
  };
55
57
 
56
58
  const onClick = () => {
57
- input.value!.click();
59
+ if (input.value) {
60
+ input.value.click();
61
+ }
58
62
  }
59
63
 
60
64
  const onInput = () => {
61
- const file = input.value!.files && input.value!.files[0];
65
+ if (!input.value) {
66
+ return;
67
+ }
68
+ const file = input.value.files && input.value.files[0];
62
69
  if (!file) {
63
70
  return;
64
71
  }
@@ -79,9 +79,8 @@ export default defineComponent({
79
79
  if (modelStatus.showDefault) {
80
80
  return [{
81
81
  label: modelStatus.label,
82
- value: null,
83
- icon: modelStatus.iconDefault,
84
- color: modelStatus.colorDefault
82
+ icon: modelStatus.iconDefault!,
83
+ color: modelStatus.colorDefault!
85
84
  }];
86
85
  }
87
86
  return [];
@@ -50,9 +50,8 @@ export default defineComponent({
50
50
  if (modelStatus.showDefault) {
51
51
  return [{
52
52
  label: modelStatus.label,
53
- value: null,
54
- icon: modelStatus.iconDefault,
55
- color: modelStatus.colorDefault
53
+ icon: modelStatus.iconDefault!,
54
+ color: modelStatus.colorDefault!
56
55
  }];
57
56
  }
58
57
  return [];
@@ -90,12 +90,12 @@ export default defineComponent({
90
90
  },
91
91
  props: {
92
92
  label: {
93
- type: String,
93
+ type: String as PropType<string | null>,
94
94
  required: false,
95
95
  default: null
96
96
  },
97
97
  description: {
98
- type: String,
98
+ type: String as PropType<string | null>,
99
99
  required: false,
100
100
  default: null
101
101
  },
@@ -114,7 +114,7 @@ export default defineComponent({
114
114
  default: "label"
115
115
  },
116
116
  modelValue: {
117
- type: [Array, String] as PropType<string[] | string>,
117
+ type: [Array, String] as PropType<string[] | string | null>,
118
118
  required: false,
119
119
  default: null
120
120
  },
@@ -139,7 +139,7 @@ export default defineComponent({
139
139
  default: false
140
140
  },
141
141
  rules: {
142
- type: Array as PropType<Function[]>,
142
+ type: Array as PropType<any[]>,
143
143
  required: false,
144
144
  default: () => []
145
145
  },
@@ -169,7 +169,7 @@ export default defineComponent({
169
169
 
170
170
  const innerSearch = ref("");
171
171
 
172
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
172
+ const style = computed((): { [key: string] : string | undefined } => {
173
173
  if (!props.editable) {
174
174
  return {
175
175
  "--fs-autocomplete-field-cursor" : "default",
@@ -101,7 +101,7 @@
101
101
  </template>
102
102
 
103
103
  <script lang="ts">
104
- import { computed, defineComponent, ref } from "vue";
104
+ import { computed, defineComponent, PropType, ref } from "vue";
105
105
 
106
106
  import { getPercentageFromHex, getHexFromPercentage } from "@dative-gpi/foundation-shared-components/utils";
107
107
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
@@ -126,7 +126,7 @@ export default defineComponent({
126
126
  },
127
127
  props: {
128
128
  description: {
129
- type: String,
129
+ type: String as PropType<string | null>,
130
130
  required: false,
131
131
  default: null
132
132
  },
@@ -176,7 +176,7 @@ export default defineComponent({
176
176
  const innerOpacity = ref(getHexFromPercentage(props.opacityValue));
177
177
  const fullColor = ref(innerColor.value + innerOpacity.value);
178
178
 
179
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
179
+ const style = computed((): { [key: string] : string | undefined } => {
180
180
  if (!props.editable) {
181
181
  return {
182
182
  "--fs-color-field-color": lights.dark
@@ -39,6 +39,7 @@
39
39
  </FSTextField>
40
40
  </template>
41
41
  <FSCard
42
+ padding="8px"
42
43
  width="346px"
43
44
  :elevation="true"
44
45
  :border="false"
@@ -49,7 +50,7 @@
49
50
  v-model="innerDate"
50
51
  />
51
52
  <FSButton
52
- :fullWidth="true"
53
+ width="100%"
53
54
  :color="$props.color"
54
55
  :label="$tr('ui.date-menu.validate', 'Validate')"
55
56
  @click="onSubmit"
@@ -83,17 +84,17 @@ export default defineComponent({
83
84
  },
84
85
  props: {
85
86
  label: {
86
- type: String,
87
+ type: String as PropType<string | null>,
87
88
  required: false,
88
89
  default: null
89
90
  },
90
91
  description: {
91
- type: String,
92
+ type: String as PropType<string | null>,
92
93
  required: false,
93
94
  default: null
94
95
  },
95
96
  modelValue: {
96
- type: Number,
97
+ type: Number as PropType<number | null>,
97
98
  required: false,
98
99
  default: null
99
100
  },
@@ -113,7 +114,7 @@ export default defineComponent({
113
114
  default: false
114
115
  },
115
116
  rules: {
116
- type: Array as PropType<Function[]>,
117
+ type: Array as PropType<any[]>,
117
118
  required: false,
118
119
  default: () => []
119
120
  },
@@ -134,9 +135,9 @@ export default defineComponent({
134
135
  const darks = getColors(ColorEnum.Dark);
135
136
 
136
137
  const menu = ref(false);
137
- const innerDate = ref(props.modelValue);
138
+ const innerDate = ref<number | null>(props.modelValue);
138
139
 
139
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
140
+ const style = computed((): { [key: string] : string | undefined } => {
140
141
  if (!props.editable) {
141
142
  return {
142
143
  "--fs-date-field-color": lights.dark
@@ -68,17 +68,17 @@ export default defineComponent({
68
68
  },
69
69
  props: {
70
70
  label: {
71
- type: String,
71
+ type: String as PropType<string | null>,
72
72
  required: false,
73
73
  default: null
74
74
  },
75
75
  description: {
76
- type: String,
76
+ type: String as PropType<string | null>,
77
77
  required: false,
78
78
  default: null
79
79
  },
80
80
  modelValue: {
81
- type: Array as PropType<number[]>,
81
+ type: Array as PropType<number[] | null>,
82
82
  required: false,
83
83
  default: null
84
84
  },
@@ -98,7 +98,7 @@ export default defineComponent({
98
98
  default: false
99
99
  },
100
100
  rules: {
101
- type: Array as PropType<Function[]>,
101
+ type: Array as PropType<any[]>,
102
102
  required: false,
103
103
  default: () => []
104
104
  },
@@ -119,9 +119,9 @@ export default defineComponent({
119
119
  const darks = getColors(ColorEnum.Dark);
120
120
 
121
121
  const dialog = ref(false);
122
- const innerDateRange = ref(props.modelValue);
122
+ const innerDateRange = ref<number[] | null>(props.modelValue);
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-date-field-color": lights.dark
@@ -42,6 +42,7 @@
42
42
  :modelValue="tabs"
43
43
  >
44
44
  <FSCard
45
+ padding="8px"
45
46
  width="346px"
46
47
  :elevation="true"
47
48
  :border="false"
@@ -53,7 +54,7 @@
53
54
  v-model="innerDate"
54
55
  />
55
56
  <FSButton
56
- :fullWidth="true"
57
+ width="100%"
57
58
  :color="$props.color"
58
59
  :label="$tr('ui.date-menu.validate', 'Validate')"
59
60
  @click="tabs++"
@@ -61,6 +62,7 @@
61
62
  </FSCol>
62
63
  </FSCard>
63
64
  <FSCard
65
+ padding="8px"
64
66
  width="394px"
65
67
  :elevation="true"
66
68
  :border="false"
@@ -72,7 +74,7 @@
72
74
  v-model="innerTime"
73
75
  />
74
76
  <FSButton
75
- :fullWidth="true"
77
+ width="100%"
76
78
  :color="$props.color"
77
79
  :label="$tr('ui.date-menu.validate', 'Validate')"
78
80
  @click="onSubmit"
@@ -111,17 +113,17 @@ export default defineComponent({
111
113
  },
112
114
  props: {
113
115
  label: {
114
- type: String,
116
+ type: String as PropType<string | null>,
115
117
  required: false,
116
118
  default: null
117
119
  },
118
120
  description: {
119
- type: String,
121
+ type: String as PropType<string | null>,
120
122
  required: false,
121
123
  default: null
122
124
  },
123
125
  modelValue: {
124
- type: Number,
126
+ type: Number as PropType<number | null>,
125
127
  required: false,
126
128
  default: null
127
129
  },
@@ -141,7 +143,7 @@ export default defineComponent({
141
143
  default: false
142
144
  },
143
145
  rules: {
144
- type: Array as PropType<Function[]>,
146
+ type: Array as PropType<any[]>,
145
147
  required: false,
146
148
  default: () => []
147
149
  },
@@ -163,17 +165,17 @@ export default defineComponent({
163
165
 
164
166
  const menu = ref(false);
165
167
  const tabs = ref(0);
166
-
167
- // FSClock just gives two numbers without consideration for the time zone
168
- // We must adjust the time to the user's time zone
168
+ const innerDate = ref<number | null>(null);
169
169
  const innerTime = ref(0);
170
- const innerDate = ref(null);
170
+
171
171
  if (props.modelValue) {
172
+ // FSClock just gives two numbers without consideration for the time zone
173
+ // We must adjust the time to the user's time zone
172
174
  innerTime.value = Math.floor((props.modelValue + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
173
175
  innerDate.value = props.modelValue - innerTime.value;
174
176
  }
175
177
 
176
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
178
+ const style = computed((): { [key: string] : string | undefined } => {
177
179
  if (!props.editable) {
178
180
  return {
179
181
  "--fs-date-field-color": lights.dark
@@ -194,7 +196,7 @@ export default defineComponent({
194
196
  };
195
197
 
196
198
  const onSubmit = (): void => {
197
- emit("update:modelValue", innerDate.value + innerTime.value);
199
+ emit("update:modelValue", (innerDate.value ?? 0) + innerTime.value);
198
200
  menu.value = false;
199
201
  };
200
202
 
@@ -50,7 +50,6 @@
50
50
  width="calc(50% - 4px)"
51
51
  >
52
52
  <FSClock
53
- :reminder="true"
54
53
  :color="$props.color"
55
54
  :date="innerDateLeft"
56
55
  v-model="innerTimeLeft"
@@ -60,7 +59,6 @@
60
59
  width="calc(50% - 4px)"
61
60
  >
62
61
  <FSClock
63
- :reminder="true"
64
62
  :color="$props.color"
65
63
  :date="innerDateRight"
66
64
  v-model="innerTimeRight"
@@ -100,17 +98,17 @@ export default defineComponent({
100
98
  },
101
99
  props: {
102
100
  label: {
103
- type: String,
101
+ type: String as PropType<string | null>,
104
102
  required: false,
105
103
  default: null
106
104
  },
107
105
  description: {
108
- type: String,
106
+ type: String as PropType<string | null>,
109
107
  required: false,
110
108
  default: null
111
109
  },
112
110
  modelValue: {
113
- type: Array as PropType<number[]>,
111
+ type: Array as PropType<number[] | null>,
114
112
  required: false,
115
113
  default: null
116
114
  },
@@ -130,7 +128,7 @@ export default defineComponent({
130
128
  default: false
131
129
  },
132
130
  rules: {
133
- type: Array as PropType<Function[]>,
131
+ type: Array as PropType<any[]>,
134
132
  required: false,
135
133
  default: () => []
136
134
  },
@@ -151,13 +149,13 @@ export default defineComponent({
151
149
  const darks = getColors(ColorEnum.Dark);
152
150
 
153
151
  const dialog = ref(false);
154
-
155
- // FSClock just gives two numbers without consideration for the time zone
156
- // We must adjust the time to the user's time zone
157
- const innerTimeLeft = ref(0);
152
+ const innerDateRange = ref<number[] | null>(null);
158
153
  const innerTimeRight = ref(0);
159
- const innerDateRange = ref(null);
154
+ const innerTimeLeft = ref(0);
155
+
160
156
  if (props.modelValue && Array.isArray(props.modelValue)) {
157
+ // FSClock just gives two numbers without consideration for the time zone
158
+ // We must adjust the time to the user's time zone
161
159
  switch (props.modelValue.length) {
162
160
  case 0: {
163
161
  break;
@@ -174,7 +172,7 @@ export default defineComponent({
174
172
  }
175
173
  }
176
174
 
177
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
175
+ const style = computed((): { [key: string] : string | undefined } => {
178
176
  if (!props.editable) {
179
177
  return {
180
178
  "--fs-date-field-color": lights.dark
@@ -61,12 +61,12 @@ export default defineComponent({
61
61
  },
62
62
  props: {
63
63
  label: {
64
- type: String,
64
+ type: String as PropType<string | null>,
65
65
  required: false,
66
66
  default: null
67
67
  },
68
68
  description: {
69
- type: String,
69
+ type: String as PropType<string | null>,
70
70
  required: false,
71
71
  default: null
72
72
  },
@@ -86,7 +86,7 @@ export default defineComponent({
86
86
  default: "standard"
87
87
  },
88
88
  modelValue: {
89
- type: String,
89
+ type: String as PropType<string | null>,
90
90
  required: false,
91
91
  default: null
92
92
  },
@@ -111,7 +111,7 @@ export default defineComponent({
111
111
  default: false
112
112
  },
113
113
  rules: {
114
- type: Array as PropType<Function[]>,
114
+ type: Array as PropType<any[]>,
115
115
  required: false,
116
116
  default: () => []
117
117
  },
@@ -130,10 +130,10 @@ export default defineComponent({
130
130
  const lights = getColors(ColorEnum.Light);
131
131
  const darks = getColors(ColorEnum.Dark);
132
132
 
133
- const toggleSetRef = ref(null);
134
- const innerValue = ref(null);
133
+ const toggleSetRef = ref<HTMLElement | null>(null);
134
+ const innerValue = ref<string | null>(null);
135
135
 
136
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
136
+ const style = computed((): { [key: string] : string | undefined } => {
137
137
  if (!props.editable) {
138
138
  return {
139
139
  "--fs-icon-field-color": lights.dark
@@ -163,8 +163,8 @@ export default defineComponent({
163
163
  }
164
164
  else {
165
165
  const matchingIcons = Icons.filter((icon) => {
166
- return icon.fullText.toLowerCase().includes(innerValue.value.toLowerCase());
167
- }).sort((a, b) => sortByLevenshteinDistance(a.name, b.name, innerValue.value));
166
+ return icon.fullText.toLowerCase().includes(innerValue.value!.toLowerCase());
167
+ }).sort((a, b) => sortByLevenshteinDistance(a.name, b.name, innerValue.value!));
168
168
  innerIcons.push(...matchingIcons.slice(0, Math.min(32, matchingIcons.length)).map((icon) => ({
169
169
  id: icon.name,
170
170
  prependIcon: icon.name
@@ -190,7 +190,7 @@ export default defineComponent({
190
190
 
191
191
  watch(() => props.modelValue, () => {
192
192
  if (toggleSetRef.value) {
193
- toggleSetRef.value.goToStart();
193
+ (toggleSetRef.value as any).goToStart();
194
194
  }
195
195
  });
196
196
 
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script lang="ts">
15
- import { defineComponent } from "vue";
15
+ import { defineComponent, PropType } from "vue";
16
16
 
17
17
  import FSTextField from "./FSTextField.vue";
18
18
 
@@ -23,7 +23,7 @@ export default defineComponent({
23
23
  },
24
24
  props: {
25
25
  modelValue: {
26
- type: Number,
26
+ type: Number as PropType<number | null>,
27
27
  required: false,
28
28
  default: null
29
29
  },
@@ -24,7 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <script lang="ts">
27
- import { computed, defineComponent, ref } from "vue";
27
+ import { computed, defineComponent, PropType, ref } from "vue";
28
28
 
29
29
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
30
30
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -40,7 +40,7 @@ export default defineComponent({
40
40
  },
41
41
  props: {
42
42
  modelValue: {
43
- type: String,
43
+ type: String as PropType<string | null>,
44
44
  required: false,
45
45
  default: null
46
46
  },
@@ -59,7 +59,7 @@ export default defineComponent({
59
59
 
60
60
  const stars = ref(true);
61
61
 
62
- const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
62
+ const style = computed((): { [key: string] : string | undefined } => {
63
63
  if (!props.editable) {
64
64
  return {
65
65
  "--fs-password-field-cursor" : "default",
@@ -74,7 +74,7 @@ export default defineComponent({
74
74
  };
75
75
  });
76
76
 
77
- const type = computed((): string => stars.value ? "password" : "text");
77
+ const type = computed((): "password" | "text" => stars.value ? "password" : "text");
78
78
 
79
79
  const icon = computed((): string => stars.value ? "mdi-eye-off-outline" : "mdi-eye-outline");
80
80