@dative-gpi/foundation-shared-components 0.0.88 → 0.0.90

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 (55) hide show
  1. package/components/FSButton.vue +23 -7
  2. package/components/FSCalendar.vue +3 -1
  3. package/components/FSCalendarTwin.vue +16 -6
  4. package/components/FSCard.vue +9 -3
  5. package/components/FSCheckbox.vue +6 -2
  6. package/components/FSClickable.vue +33 -9
  7. package/components/FSDialog.vue +9 -5
  8. package/components/FSDialogMenu.vue +80 -0
  9. package/components/FSDialogSubmit.vue +0 -1
  10. package/components/FSEditImage.vue +196 -34
  11. package/components/FSImage.vue +21 -7
  12. package/components/FSLink.vue +4 -2
  13. package/components/FSOptionGroup.vue +51 -69
  14. package/components/FSOptionItem.vue +15 -6
  15. package/components/FSRadioGroup.vue +11 -3
  16. package/components/FSToggleSet.vue +22 -60
  17. package/components/FSWindow.vue +2 -0
  18. package/components/autocompletes/FSAutocompleteLanguage.vue +28 -22
  19. package/components/autocompletes/FSAutocompleteTimeZone.vue +117 -17
  20. package/components/buttons/FSButtonFileMini.vue +6 -1
  21. package/components/fields/FSAutocompleteField.vue +139 -72
  22. package/components/fields/FSBaseField.vue +134 -0
  23. package/components/fields/FSColorField.vue +1 -1
  24. package/components/fields/FSDateField.vue +124 -35
  25. package/components/fields/FSDateTimeField.vue +171 -63
  26. package/components/fields/FSIconField.vue +4 -2
  27. package/components/fields/FSNumberField.vue +9 -3
  28. package/components/fields/FSPasswordField.vue +15 -5
  29. package/components/fields/FSRichTextField.vue +34 -18
  30. package/components/fields/FSSearchField.vue +24 -8
  31. package/components/fields/FSSelectField.vue +254 -93
  32. package/components/fields/FSTagField.vue +15 -9
  33. package/components/fields/FSTextArea.vue +31 -59
  34. package/components/fields/FSTextField.vue +22 -70
  35. package/components/fields/FSTimeField.vue +20 -55
  36. package/components/fields/FSTimeSlotField.vue +13 -59
  37. package/components/lists/FSDataIteratorItem.vue +16 -4
  38. package/components/lists/FSDataTableUI.vue +420 -184
  39. package/components/lists/FSDraggable.vue +26 -13
  40. package/components/lists/FSFilterButton.vue +10 -4
  41. package/components/lists/FSHeaderButton.vue +3 -1
  42. package/components/lists/FSHiddenButton.vue +3 -1
  43. package/composables/useAutocomplete.ts +6 -7
  44. package/composables/useSlots.ts +6 -18
  45. package/package.json +4 -4
  46. package/styles/components/fs_base_field.scss +12 -0
  47. package/styles/components/fs_dialog.scss +10 -2
  48. package/styles/components/fs_dialog_menu.scss +11 -0
  49. package/styles/components/fs_draggable.scss +12 -0
  50. package/styles/components/fs_edit_image.scss +29 -2
  51. package/styles/components/fs_text_area.scss +0 -13
  52. package/styles/components/fs_text_field.scss +1 -14
  53. package/styles/components/index.scss +2 -0
  54. package/styles/globals/overrides.scss +4 -0
  55. package/components/autocompletes/FSAutocompleteOrganisation.vue +0 -77
@@ -1,11 +1,7 @@
1
1
  <template>
2
- <v-menu
3
- :closeOnContentClick="false"
4
- :modelValue="menu && $props.editable"
5
- @update:modelValue="(value) => menu = value"
6
- >
2
+ <FSCol>
7
3
  <template
8
- #activator="{ props }"
4
+ v-if="isExtraSmall"
9
5
  >
10
6
  <FSTextField
11
7
  class="fs-date-field"
@@ -22,8 +18,8 @@
22
18
  :validationValue="$props.modelValue"
23
19
  :modelValue="epochToLongDateFormat($props.modelValue)"
24
20
  @update:modelValue="onClear"
21
+ @click="openMobileOverlay"
25
22
  @blur="blurred = true"
26
- v-bind="props"
27
23
  >
28
24
  <template
29
25
  #prepend-inner
@@ -36,6 +32,7 @@
36
32
  icon="mdi-calendar"
37
33
  :editable="$props.editable"
38
34
  :color="ColorEnum.Dark"
35
+ @click="openMobileOverlay"
39
36
  />
40
37
  </slot>
41
38
  </template>
@@ -49,38 +46,116 @@
49
46
  />
50
47
  </template>
51
48
  </FSTextField>
49
+ <FSDialogMenu
50
+ v-model="dialog"
51
+ >
52
+ <template
53
+ #body
54
+ >
55
+ <FSCol
56
+ width="hug"
57
+ >
58
+ <FSCalendar
59
+ :color="$props.color"
60
+ v-model="innerDate"
61
+ />
62
+ <FSButton
63
+ width="100%"
64
+ :color="$props.color"
65
+ :label="$tr('ui.common.validate', 'Validate')"
66
+ @click="onSubmit"
67
+ />
68
+ </FSCol>
69
+ </template>
70
+ </FSDialogMenu>
52
71
  </template>
53
- <FSCard
54
- padding="8px"
55
- width="346px"
56
- :elevation="true"
57
- :border="false"
72
+ <template
73
+ v-else
58
74
  >
59
- <FSCol
60
- width="fill"
75
+ <v-menu
76
+ :closeOnContentClick="false"
77
+ :modelValue="menu && $props.editable"
78
+ @update:modelValue="menu = $event"
61
79
  >
62
- <FSCalendar
63
- :color="$props.color"
64
- v-model="innerDate"
65
- />
66
- <FSButton
67
- width="100%"
68
- :color="$props.color"
69
- :label="$tr('ui.date-menu.validate', 'Validate')"
70
- @click="onSubmit"
71
- />
72
- </FSCol>
73
- </FSCard>
74
- </v-menu>
80
+ <template
81
+ #activator="{ props }"
82
+ >
83
+ <FSTextField
84
+ class="fs-date-field"
85
+ :label="$props.label"
86
+ :description="$props.description"
87
+ :color="$props.color"
88
+ :hideHeader="$props.hideHeader"
89
+ :required="$props.required"
90
+ :editable="$props.editable"
91
+ :readonly="true"
92
+ :rules="$props.rules"
93
+ :messages="messages"
94
+ :validateOn="validateOn"
95
+ :validationValue="$props.modelValue"
96
+ :modelValue="epochToLongDateFormat($props.modelValue)"
97
+ @update:modelValue="onClear"
98
+ @blur="blurred = true"
99
+ v-bind="props"
100
+ >
101
+ <template
102
+ #prepend-inner
103
+ >
104
+ <slot
105
+ name="prepend-inner"
106
+ >
107
+ <FSButton
108
+ variant="icon"
109
+ icon="mdi-calendar"
110
+ :editable="$props.editable"
111
+ :color="ColorEnum.Dark"
112
+ />
113
+ </slot>
114
+ </template>
115
+ <template
116
+ v-for="(_, name) in $slots"
117
+ v-slot:[name]="slotData"
118
+ >
119
+ <slot
120
+ :name="name"
121
+ v-bind="slotData"
122
+ />
123
+ </template>
124
+ </FSTextField>
125
+ </template>
126
+ <FSCard
127
+ padding="8px"
128
+ :elevation="true"
129
+ :border="false"
130
+ >
131
+ <FSCol
132
+ width="hug"
133
+ >
134
+ <FSCalendar
135
+ :color="$props.color"
136
+ v-model="innerDate"
137
+ />
138
+ <FSButton
139
+ width="100%"
140
+ :color="$props.color"
141
+ :label="$tr('ui.common.validate', 'Validate')"
142
+ @click="onSubmit"
143
+ />
144
+ </FSCol>
145
+ </FSCard>
146
+ </v-menu>
147
+ </template>
148
+ </FSCol>
75
149
  </template>
76
150
 
77
151
  <script lang="ts">
78
152
  import { computed, defineComponent, PropType, ref } from "vue";
79
153
 
80
- import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
154
+ import { useBreakpoints, useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
81
155
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
82
156
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
83
157
 
158
+ import FSDialogMenu from "../FSDialogMenu.vue";
84
159
  import FSTextField from "./FSTextField.vue";
85
160
  import FSCalendar from "../FSCalendar.vue";
86
161
  import FSButton from "../FSButton.vue";
@@ -90,6 +165,7 @@ import FSCol from "../FSCol.vue";
90
165
  export default defineComponent({
91
166
  name: "FSDateField",
92
167
  components: {
168
+ FSDialogMenu,
93
169
  FSTextField,
94
170
  FSCalendar,
95
171
  FSButton,
@@ -140,17 +216,19 @@ export default defineComponent({
140
216
  },
141
217
  emits: ["update:modelValue"],
142
218
  setup(props, { emit }) {
143
- const {validateOn, blurred, getMessages} = useRules();
219
+ const { validateOn, blurred, getMessages} = useRules();
144
220
  const { epochToLongDateFormat } = useAppTimeZone();
221
+ const { isExtraSmall } = useBreakpoints();
145
222
  const { getColors } = useColors();
146
223
 
224
+ const dialog = ref(false);
225
+ const menu = ref(false);
226
+ const innerDate = ref<number | null>(props.modelValue);
227
+
147
228
  const errors = getColors(ColorEnum.Error);
148
229
  const lights = getColors(ColorEnum.Light);
149
230
  const darks = getColors(ColorEnum.Dark);
150
231
 
151
- const menu = ref(false);
152
- const innerDate = ref<number | null>(props.modelValue);
153
-
154
232
  const style = computed((): { [key: string] : string | undefined } => {
155
233
  if (!props.editable) {
156
234
  return {
@@ -165,6 +243,13 @@ export default defineComponent({
165
243
 
166
244
  const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
167
245
 
246
+ const openMobileOverlay = () => {
247
+ if (!props.editable) {
248
+ return;
249
+ }
250
+ dialog.value = true;
251
+ };
252
+
168
253
  const onClear = (): void => {
169
254
  emit("update:modelValue", null);
170
255
  innerDate.value = null;
@@ -172,20 +257,24 @@ export default defineComponent({
172
257
 
173
258
  const onSubmit = (): void => {
174
259
  emit("update:modelValue", innerDate.value);
260
+ dialog.value = false;
175
261
  menu.value = false;
176
262
  };
177
263
 
178
264
  return {
265
+ isExtraSmall,
266
+ validateOn,
179
267
  ColorEnum,
180
268
  innerDate,
181
- validateOn,
182
269
  messages,
183
270
  blurred,
271
+ dialog,
184
272
  style,
185
273
  menu,
186
- onClear,
274
+ epochToLongDateFormat,
275
+ openMobileOverlay,
187
276
  onSubmit,
188
- epochToLongDateFormat
277
+ onClear
189
278
  };
190
279
  }
191
280
  });
@@ -1,12 +1,8 @@
1
1
  <template>
2
- <v-menu
3
- :closeOnContentClick="false"
4
- :modelValue="menu && $props.editable"
5
- @update:modelValue="(value) => menu = value"
6
- >
2
+ <FSCol>
7
3
  <template
8
- #activator="{ props }"
9
- >
4
+ v-if="isExtraSmall"
5
+ >
10
6
  <FSTextField
11
7
  class="fs-date-field"
12
8
  :label="$props.label"
@@ -22,8 +18,8 @@
22
18
  :validationValue="$props.modelValue"
23
19
  :modelValue="epochToLongTimeFormat($props.modelValue)"
24
20
  @update:modelValue="onClear"
21
+ @click="openMobileOverlay"
25
22
  @blur="blurred = true"
26
- v-bind="props"
27
23
  >
28
24
  <template
29
25
  #prepend-inner
@@ -36,6 +32,7 @@
36
32
  icon="mdi-calendar"
37
33
  :editable="$props.editable"
38
34
  :color="ColorEnum.Dark"
35
+ @click="openMobileOverlay"
39
36
  />
40
37
  </slot>
41
38
  </template>
@@ -49,65 +46,162 @@
49
46
  />
50
47
  </template>
51
48
  </FSTextField>
49
+ <FSDialogMenu
50
+ v-model="dialog"
51
+ >
52
+ <template
53
+ #body
54
+ >
55
+ <FSWindow
56
+ :modelValue="tabs"
57
+ >
58
+ <FSCol
59
+ width="hug"
60
+ :value="0"
61
+ >
62
+ <FSCalendar
63
+ :color="$props.color"
64
+ v-model="innerDate"
65
+ />
66
+ <FSButton
67
+ width="100%"
68
+ :color="$props.color"
69
+ :label="$tr('ui.common.validate', 'Validate')"
70
+ @click="tabs++"
71
+ />
72
+ </FSCol>
73
+ <FSCol
74
+ width="hug"
75
+ :value="1"
76
+ >
77
+ <FSClock
78
+ :color="$props.color"
79
+ v-model="innerTime"
80
+ />
81
+ <FSButton
82
+ width="100%"
83
+ :color="$props.color"
84
+ :label="$tr('ui.common.validate', 'Validate')"
85
+ @click="onSubmit"
86
+ />
87
+ </FSCol>
88
+ </FSWindow>
89
+ </template>
90
+ </FSDialogMenu>
52
91
  </template>
53
- <FSWindow
54
- :modelValue="tabs"
92
+ <template
93
+ v-else
55
94
  >
56
- <FSCard
57
- padding="8px"
58
- width="346px"
59
- :elevation="true"
60
- :border="false"
61
- :value="0"
95
+ <v-menu
96
+ :closeOnContentClick="false"
97
+ :modelValue="menu && $props.editable"
98
+ @update:modelValue="menu = $event"
62
99
  >
63
- <FSCol
64
- width="fill"
100
+ <template
101
+ #activator="{ props }"
65
102
  >
66
- <FSCalendar
67
- :color="$props.color"
68
- v-model="innerDate"
69
- />
70
- <FSButton
71
- width="100%"
103
+ <FSTextField
104
+ class="fs-date-field"
105
+ :label="$props.label"
106
+ :description="$props.description"
72
107
  :color="$props.color"
73
- :label="$tr('ui.date-menu.validate', 'Validate')"
74
- @click="tabs++"
75
- />
76
- </FSCol>
77
- </FSCard>
78
- <FSCard
79
- padding="8px"
80
- width="394px"
81
- :elevation="true"
82
- :border="false"
83
- :value="1"
84
- >
85
- <FSCol
86
- width="fill"
108
+ :hideHeader="$props.hideHeader"
109
+ :required="$props.required"
110
+ :editable="$props.editable"
111
+ :readonly="true"
112
+ :rules="$props.rules"
113
+ :messages="messages"
114
+ :validateOn="validateOn"
115
+ :validationValue="$props.modelValue"
116
+ :modelValue="epochToLongTimeFormat($props.modelValue)"
117
+ @update:modelValue="onClear"
118
+ @blur="blurred = true"
119
+ v-bind="props"
120
+ >
121
+ <template
122
+ #prepend-inner
123
+ >
124
+ <slot
125
+ name="prepend-inner"
126
+ >
127
+ <FSButton
128
+ variant="icon"
129
+ icon="mdi-calendar"
130
+ :editable="$props.editable"
131
+ :color="ColorEnum.Dark"
132
+ />
133
+ </slot>
134
+ </template>
135
+ <template
136
+ v-for="(_, name) in $slots"
137
+ v-slot:[name]="slotData"
138
+ >
139
+ <slot
140
+ :name="name"
141
+ v-bind="slotData"
142
+ />
143
+ </template>
144
+ </FSTextField>
145
+ </template>
146
+ <FSWindow
147
+ :modelValue="tabs"
87
148
  >
88
- <FSClock
89
- :color="$props.color"
90
- v-model="innerTime"
91
- />
92
- <FSButton
93
- width="100%"
94
- :color="$props.color"
95
- :label="$tr('ui.date-menu.validate', 'Validate')"
96
- @click="onSubmit"
97
- />
98
- </FSCol>
99
- </FSCard>
100
- </FSWindow>
101
- </v-menu>
149
+ <FSCard
150
+ padding="8px"
151
+ :elevation="true"
152
+ :border="false"
153
+ :value="0"
154
+ >
155
+ <FSCol
156
+ width="fill"
157
+ >
158
+ <FSCalendar
159
+ :color="$props.color"
160
+ v-model="innerDate"
161
+ />
162
+ <FSButton
163
+ width="100%"
164
+ :color="$props.color"
165
+ :label="$tr('ui.common.validate', 'Validate')"
166
+ @click="tabs++"
167
+ />
168
+ </FSCol>
169
+ </FSCard>
170
+ <FSCard
171
+ padding="8px"
172
+ :elevation="true"
173
+ :border="false"
174
+ :value="1"
175
+ >
176
+ <FSCol
177
+ width="hug"
178
+ >
179
+ <FSClock
180
+ :color="$props.color"
181
+ v-model="innerTime"
182
+ />
183
+ <FSButton
184
+ width="100%"
185
+ :color="$props.color"
186
+ :label="$tr('ui.common.validate', 'Validate')"
187
+ @click="onSubmit"
188
+ />
189
+ </FSCol>
190
+ </FSCard>
191
+ </FSWindow>
192
+ </v-menu>
193
+ </template>
194
+ </FSCol>
102
195
  </template>
103
196
 
104
197
  <script lang="ts">
105
198
  import { computed, defineComponent, PropType, ref, watch } from "vue";
106
199
 
107
- import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
200
+ import { useBreakpoints, useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
108
201
  import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
109
202
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
110
203
 
204
+ import FSDialogMenu from "../FSDialogMenu.vue";
111
205
  import FSTextField from "./FSTextField.vue";
112
206
  import FSCalendar from "../FSCalendar.vue";
113
207
  import FSWindow from "../FSWindow.vue";
@@ -119,6 +213,7 @@ import FSCol from "../FSCol.vue";
119
213
  export default defineComponent({
120
214
  name: "FSDateTimeField",
121
215
  components: {
216
+ FSDialogMenu,
122
217
  FSTextField,
123
218
  FSCalendar,
124
219
  FSWindow,
@@ -173,17 +268,19 @@ export default defineComponent({
173
268
  setup(props, { emit }) {
174
269
  const { getUserOffsetMillis, epochToLongTimeFormat } = useAppTimeZone();
175
270
  const { validateOn, blurred, getMessages } = useRules();
271
+ const { isExtraSmall } = useBreakpoints();
176
272
  const { getColors } = useColors();
177
273
 
178
- const errors = getColors(ColorEnum.Error);
179
- const lights = getColors(ColorEnum.Light);
180
- const darks = getColors(ColorEnum.Dark);
181
-
274
+ const dialog = ref(false);
182
275
  const menu = ref(false);
183
276
  const tabs = ref(0);
184
277
  const innerDate = ref<number | null>(null);
185
278
  const innerTime = ref(0);
186
279
 
280
+ const errors = getColors(ColorEnum.Error);
281
+ const lights = getColors(ColorEnum.Light);
282
+ const darks = getColors(ColorEnum.Dark);
283
+
187
284
  if (props.modelValue) {
188
285
  // FSClock just gives two numbers without consideration for the time zone
189
286
  // We must adjust the time to the user's time zone
@@ -205,6 +302,13 @@ export default defineComponent({
205
302
 
206
303
  const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
207
304
 
305
+ const openMobileOverlay = () => {
306
+ if (!props.editable) {
307
+ return;
308
+ }
309
+ dialog.value = true;
310
+ };
311
+
208
312
  const onClear = (): void => {
209
313
  emit("update:modelValue", null);
210
314
  innerDate.value = null;
@@ -213,28 +317,32 @@ export default defineComponent({
213
317
 
214
318
  const onSubmit = (): void => {
215
319
  emit("update:modelValue", (innerDate.value ?? 0) + innerTime.value);
320
+ dialog.value = false;
216
321
  menu.value = false;
217
322
  };
218
323
 
219
- watch(menu, (): void => {
220
- if (!menu.value) {
221
- setTimeout(() => tabs.value = 0, 100);
324
+ watch([menu, dialog], (): void => {
325
+ if (!menu.value && !dialog.value) {
326
+ setTimeout(() => tabs.value = 0, 290);
222
327
  }
223
328
  });
224
329
 
225
330
  return {
331
+ isExtraSmall,
332
+ validateOn,
226
333
  ColorEnum,
227
334
  innerDate,
228
335
  innerTime,
229
- validateOn,
230
336
  messages,
231
337
  blurred,
338
+ dialog,
232
339
  style,
233
340
  menu,
234
341
  tabs,
235
- onClear,
342
+ epochToLongTimeFormat,
343
+ openMobileOverlay,
236
344
  onSubmit,
237
- epochToLongTimeFormat
345
+ onClear
238
346
  };
239
347
  }
240
348
  });
@@ -14,7 +14,9 @@
14
14
  v-model="innerValue"
15
15
  v-bind="$attrs"
16
16
  >
17
- <template #append-inner>
17
+ <template
18
+ #append-inner
19
+ >
18
20
  <FSIcon
19
21
  v-if="$props.modelValue"
20
22
  size="l"
@@ -33,7 +35,7 @@
33
35
  :required="$props.required"
34
36
  :editable="$props.editable"
35
37
  :values="icons"
36
- @update:modelValue="(value) => $emit('update:modelValue', value)"
38
+ @update:modelValue="$emit('update:modelValue', $event)"
37
39
  />
38
40
  </FSCol>
39
41
  </template>
@@ -5,8 +5,14 @@
5
5
  @update:modelValue="onUpdate"
6
6
  v-bind="$attrs"
7
7
  >
8
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
9
- <slot :name="name" v-bind="slotData" />
8
+ <template
9
+ v-for="(_, name) in $slots"
10
+ v-slot:[name]="slotData"
11
+ >
12
+ <slot
13
+ :name="name"
14
+ v-bind="slotData"
15
+ />
10
16
  </template>
11
17
  </FSTextField>
12
18
  </template>
@@ -36,7 +42,7 @@ export default defineComponent({
36
42
  emits: ["update:modelValue"],
37
43
  setup(_, { emit }) {
38
44
  const onUpdate = (value: string) => {
39
- const match = /([0-9 ]*[,\.]?)?[0-9]+/.exec(value);
45
+ const match = /([0-9 ]*[,.]?)?[0-9]+/.exec(value);
40
46
  if (match && !isNaN(parseFloat(match[0].replace(",", ".").replace(" ", "")))) {
41
47
  emit("update:modelValue", parseFloat(match[0].replace(",", ".").replace(" ", "")));
42
48
  }
@@ -3,14 +3,24 @@
3
3
  :type="type"
4
4
  :editable="$props.editable"
5
5
  :modelValue="$props.modelValue"
6
- @update:modelValue="(value) => $emit('update:modelValue', value)"
6
+ @update:modelValue="$emit('update:modelValue', $event)"
7
7
  v-bind="$attrs"
8
8
  >
9
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
10
- <slot :name="name" v-bind="slotData" />
9
+ <template
10
+ v-for="(_, name) in $slots"
11
+ v-slot:[name]="slotData"
12
+ >
13
+ <slot
14
+ :name="name"
15
+ v-bind="slotData"
16
+ />
11
17
  </template>
12
- <template #append-inner>
13
- <slot name="append-inner">
18
+ <template
19
+ #append-inner
20
+ >
21
+ <slot
22
+ name="append-inner"
23
+ >
14
24
  <FSButton
15
25
  variant="icon"
16
26
  :editable="$props.editable"