@dative-gpi/foundation-shared-components 0.0.87 → 0.0.89

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 +61 -72
  14. package/components/FSOptionItem.vue +22 -7
  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 +433 -181
  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,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"
@@ -1,8 +1,14 @@
1
1
  <template>
2
2
  <FSCol>
3
- <FSRow v-if="!readonly">
4
- <slot name="label">
5
- <FSRow :wrap="false">
3
+ <FSRow
4
+ v-if="!readonly"
5
+ >
6
+ <slot
7
+ name="label"
8
+ >
9
+ <FSRow
10
+ :wrap="false"
11
+ >
6
12
  <FSSpan
7
13
  v-if="$props.label"
8
14
  class="fs-rich-text-field-label"
@@ -24,7 +30,9 @@
24
30
  </FSRow>
25
31
  </slot>
26
32
  <v-spacer />
27
- <template v-if="$props.editable">
33
+ <template
34
+ v-if="$props.editable"
35
+ >
28
36
  <FSIcon
29
37
  class="fs-rich-text-field-icon"
30
38
  :color="toolbarColors.undo"
@@ -33,7 +41,9 @@
33
41
  >
34
42
  mdi-undo-variant
35
43
  </FSIcon>
36
- <v-divider vertical />
44
+ <v-divider
45
+ vertical
46
+ />
37
47
  <FSIcon
38
48
  class="fs-rich-text-field-icon"
39
49
  :style="style"
@@ -62,7 +72,9 @@
62
72
  >
63
73
  mdi-format-paragraph
64
74
  </FSIcon>
65
- <v-divider vertical />
75
+ <v-divider
76
+ vertical
77
+ />
66
78
  <FSIcon
67
79
  class="fs-rich-text-field-icon"
68
80
  :color="toolbarColors.bold"
@@ -103,7 +115,9 @@
103
115
  >
104
116
  mdi-link
105
117
  </FSIcon>
106
- <v-divider vertical />
118
+ <v-divider
119
+ vertical
120
+ />
107
121
  <FSIcon
108
122
  class="fs-rich-text-field-icon"
109
123
  :style="style"
@@ -146,7 +160,9 @@
146
160
  @keypress.enter.stop="toggleLink"
147
161
  v-model="linkUrl"
148
162
  />
149
- <slot name="description">
163
+ <slot
164
+ name="description"
165
+ >
150
166
  <FSSpan
151
167
  v-if="!readonly && $props.description"
152
168
  class="fs-rich-text-field-description"
@@ -211,9 +227,9 @@ export default defineComponent({
211
227
  default: false
212
228
  },
213
229
  rows: {
214
- type: Number,
215
- required: false,
216
- default: 5
230
+ type: Number,
231
+ required: false,
232
+ default: 5
217
233
  },
218
234
  variant: {
219
235
  type: String as PropType<"standard" | "readonly">,
@@ -326,7 +342,7 @@ export default defineComponent({
326
342
  }
327
343
  else {
328
344
  return {
329
- "--fs-rich-text-field-undo-cursor" : canUndo ? "pointer" : "default",
345
+ "--fs-rich-text-field-undo-cursor" : canUndo.value ? "pointer" : "default",
330
346
  "--fs-rich-text-field-icon-cursor" : "pointer",
331
347
  "--fs-rich-text-field-border-color" : lights.dark,
332
348
  "--fs-rich-text-field-color" : darks.base,
@@ -335,13 +351,13 @@ export default defineComponent({
335
351
  "--fs-rich-text-field-min-height" : minHeight
336
352
  };
337
353
  }
338
- };
354
+ }
339
355
  case "readonly": return {
340
- "--fs-rich-text-field-border-color" : "transparent",
341
- "--fs-rich-text-field-color" : darks.base,
342
- "--fs-rich-text-field-active-border-color": "transparent",
343
- "--fs-rich-text-field-link-color" : linkColors.value.dark,
344
- "--fs-rich-text-field-min-height" : minHeight
356
+ "--fs-rich-text-field-border-color" : "transparent",
357
+ "--fs-rich-text-field-color" : darks.base,
358
+ "--fs-rich-text-field-active-border-color": "transparent",
359
+ "--fs-rich-text-field-link-color" : linkColors.value.dark,
360
+ "--fs-rich-text-field-min-height" : minHeight
345
361
  }
346
362
  }
347
363
  });
@@ -11,8 +11,13 @@
11
11
  v-model="innerValue"
12
12
  v-bind="$attrs"
13
13
  >
14
- <template v-if="$props.prependInnerIcon" #prepend-inner>
15
- <slot name="prepend-inner">
14
+ <template
15
+ v-if="$props.prependInnerIcon"
16
+ #prepend-inner
17
+ >
18
+ <slot
19
+ name="prepend-inner"
20
+ >
16
21
  <FSButton
17
22
  variant="icon"
18
23
  :icon="$props.prependInnerIcon"
@@ -22,8 +27,13 @@
22
27
  />
23
28
  </slot>
24
29
  </template>
25
- <template v-if="!['instant'].includes($props.variant)" #append>
26
- <slot name="append">
30
+ <template
31
+ v-if="!['instant'].includes($props.variant)"
32
+ #append
33
+ >
34
+ <slot
35
+ name="append"
36
+ >
27
37
  <FSButton
28
38
  :prependIcon="$props.buttonPrependIcon"
29
39
  :label="buttonLabel"
@@ -35,8 +45,14 @@
35
45
  />
36
46
  </slot>
37
47
  </template>
38
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
39
- <slot :name="name" v-bind="slotData" />
48
+ <template
49
+ v-for="(_, name) in $slots"
50
+ v-slot:[name]="slotData"
51
+ >
52
+ <slot
53
+ :name="name"
54
+ v-bind="slotData"
55
+ />
40
56
  </template>
41
57
  </FSTextField>
42
58
  </template>
@@ -154,10 +170,10 @@ export default defineComponent({
154
170
  });
155
171
 
156
172
  return {
157
- ColorEnum,
158
173
  placeholder,
159
174
  buttonLabel,
160
- innerValue
175
+ innerValue,
176
+ ColorEnum
161
177
  };
162
178
  }
163
179
  });