@dative-gpi/foundation-shared-components 0.0.205 → 0.0.207

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 (31) hide show
  1. package/assets/images/map/imagery.png +0 -0
  2. package/assets/images/map/osm.png +0 -0
  3. package/components/FSCalendar.vue +1 -0
  4. package/components/FSCalendarTwin.vue +2 -1
  5. package/components/FSClock.vue +18 -6
  6. package/components/FSImageCard.vue +72 -0
  7. package/components/autocompletes/FSAutoCompleteAddress.vue +6 -6
  8. package/components/autocompletes/FSAutocompleteLanguage.vue +4 -5
  9. package/components/autocompletes/FSAutocompleteTimeZone.vue +4 -5
  10. package/components/fields/FSColorField.vue +9 -11
  11. package/components/fields/FSDateField.vue +10 -4
  12. package/components/fields/FSDateRangeField.vue +10 -4
  13. package/components/fields/FSDateTimeField.vue +20 -11
  14. package/components/fields/FSDateTimeRangeField.vue +35 -25
  15. package/components/fields/FSRichTextField.vue +132 -54
  16. package/components/fields/FSTermField.vue +190 -186
  17. package/components/fields/FSTimeField.vue +17 -12
  18. package/components/fields/FSTranslateField.vue +7 -14
  19. package/components/fields/FSTranslateRichTextField.vue +185 -0
  20. package/components/map/FSMap.vue +129 -65
  21. package/components/map/FSMapEditPointAddressOverlay.vue +19 -18
  22. package/components/map/FSMapLayerButton.vue +71 -0
  23. package/models/map.ts +1 -0
  24. package/models/richTextVariable.ts +5 -0
  25. package/models/variableNode.ts +105 -0
  26. package/package.json +4 -4
  27. package/styles/components/fs_image_card.scss +18 -0
  28. package/styles/components/fs_map.scss +10 -14
  29. package/styles/components/fs_rich_text_field.scss +16 -4
  30. package/styles/components/index.scss +1 -0
  31. package/utils/lexical.ts +2 -0
Binary file
Binary file
@@ -13,6 +13,7 @@
13
13
  </FSRow>
14
14
  <FSCol
15
15
  class="fs-calendar"
16
+ :height="['380px', '375px']"
16
17
  :style="style"
17
18
  >
18
19
  <FSRow
@@ -14,8 +14,9 @@
14
14
  </FSRow>
15
15
  <FSRow
16
16
  class="fs-calendar-twin"
17
- align="center-center"
17
+ align="top-center"
18
18
  width="hug"
19
+ :height="['380px', '375px']"
19
20
  :style="style"
20
21
  >
21
22
  <FSCol
@@ -52,11 +52,9 @@
52
52
  </template>
53
53
 
54
54
  <script lang="ts">
55
- import type { PropType} from "vue";
56
- import { computed, defineComponent, ref, watch } from "vue";
55
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
57
56
 
58
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
59
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
57
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
60
58
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
61
59
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
62
60
 
@@ -108,8 +106,8 @@ export default defineComponent({
108
106
  const lights = getColors(ColorEnum.Light);
109
107
  const darks = getColors(ColorEnum.Dark);
110
108
 
111
- const innerHours = ref(props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0);
112
- const innerMinutes = ref(props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0);
109
+ const innerHours = ref(0);
110
+ const innerMinutes = ref(0);
113
111
 
114
112
  const style = computed((): { [key: string] : string | null | undefined } => {
115
113
  if (!props.editable) {
@@ -148,6 +146,20 @@ export default defineComponent({
148
146
  innerMinutes.value = number;
149
147
  };
150
148
 
149
+ const reset = (): void => {
150
+ innerHours.value = props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0;
151
+ innerMinutes.value = props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0;
152
+ };
153
+
154
+ watch(() => props.modelValue, () => {
155
+ if (
156
+ innerHours.value !== (props.modelValue ? Math.floor(props.modelValue / (60 * 60 * 1000)) : 0) ||
157
+ innerMinutes.value !== (props.modelValue ? Math.floor((props.modelValue % (60 * 60 * 1000)) / (60 * 1000)) : 0)
158
+ ) {
159
+ reset();
160
+ }
161
+ }, { immediate: true });
162
+
151
163
  watch([innerHours, innerMinutes], () => {
152
164
  emit("update:modelValue", (innerHours.value * 60 * 60 * 1000) + (innerMinutes.value * 60 * 1000));
153
165
  });
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <FSClickable
3
+ class="fs-image-card"
4
+ :height="height"
5
+ :width="width"
6
+ :style="style"
7
+ v-bind="$attrs"
8
+ >
9
+ <FSRow
10
+ align="bottom-left"
11
+ height="fill"
12
+ >
13
+ <FSRow
14
+ class="fs-image-card-label"
15
+ align="center-left"
16
+ padding="8px"
17
+ >
18
+ <FSSpan
19
+ font="text-overline"
20
+ >
21
+ {{ $props.label }}
22
+ </FSSpan>
23
+ </FSRow>
24
+ </FSRow>
25
+ </FSClickable>
26
+ </template>
27
+
28
+ <script lang="ts">
29
+ import { computed, defineComponent, type PropType } from "vue";
30
+
31
+ import FSClickable from "./FSClickable.vue";
32
+ import FSSpan from "./FSSpan.vue";
33
+ import FSRow from "./FSRow.vue";
34
+
35
+ export default defineComponent({
36
+ name: "FSImageCard",
37
+ components: {
38
+ FSClickable,
39
+ FSSpan,
40
+ FSRow
41
+ },
42
+ props: {
43
+ src: {
44
+ type: String,
45
+ required: true
46
+ },
47
+ label: {
48
+ type: String,
49
+ required: true
50
+ },
51
+ height: {
52
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
53
+ required: false,
54
+ default: '110px'
55
+ },
56
+ width: {
57
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
58
+ required: false,
59
+ default: '200px'
60
+ }
61
+ },
62
+ setup(props) {
63
+ const style = computed(() => ({
64
+ "--fs-image-card-background": `url(${props.src})`
65
+ }));
66
+
67
+ return {
68
+ style
69
+ };
70
+ }
71
+ });
72
+ </script>
@@ -14,10 +14,10 @@
14
14
  <script lang="ts">
15
15
  import { defineComponent, onMounted, ref, watch } from "vue";
16
16
 
17
+ import { type Address, type Place } from "@dative-gpi/foundation-shared-domain/models";
17
18
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
18
- import { useAddress } from "../../composables/useAddress";
19
19
 
20
- import type { Address, Place } from "@dative-gpi/foundation-shared-domain/models";
20
+ import { useAddress } from "../../composables/useAddress";
21
21
 
22
22
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
23
23
 
@@ -40,7 +40,7 @@ export default defineComponent({
40
40
  const places = ref<Place[]>([]);
41
41
  const modelValuePlace = ref<Place | null>(null);
42
42
 
43
- const innerFetch = async (search: string | null) => {
43
+ const fetch = async (search: string | null) => {
44
44
  if (search === null) {
45
45
  return Promise.resolve([]);
46
46
  }
@@ -48,7 +48,7 @@ export default defineComponent({
48
48
  return Promise.resolve([]);
49
49
  };
50
50
 
51
- const innerUpdate = async (value: { id: string; label: string; } | { id: string; label: string; }[] | null) => {
51
+ const update = async (value: { id: string; label: string; } | { id: string; label: string; }[] | null) => {
52
52
  if (value === null) {
53
53
  emit("update:modelValue", null);
54
54
  return;
@@ -64,8 +64,8 @@ export default defineComponent({
64
64
  places,
65
65
  [],
66
66
  emit,
67
- innerFetch,
68
- innerUpdate,
67
+ fetch,
68
+ update,
69
69
  (item) => (item).id,
70
70
  (item) => (item).label,
71
71
  true,
@@ -49,12 +49,11 @@
49
49
  </template>
50
50
 
51
51
  <script lang="ts">
52
- import type { PropType } from "vue";
53
- import { computed, defineComponent } from "vue"
52
+ import { computed, defineComponent, type PropType } from "vue"
54
53
 
55
54
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
55
+ import { type LanguageFilters } from "@dative-gpi/foundation-shared-domain/models";
56
56
  import { useLanguages } from "@dative-gpi/foundation-shared-services/composables";
57
- import type { LanguageFilters } from "@dative-gpi/foundation-shared-domain/models";
58
57
 
59
58
  import FSAutocompleteField from "../fields/FSAutocompleteField.vue";
60
59
  import FSIcon from "../FSIcon.vue";
@@ -99,7 +98,7 @@ export default defineComponent({
99
98
  return init.value && fetchingLanguages.value;
100
99
  });
101
100
 
102
- const innerFetch = (search: string | null) => {
101
+ const fetch = (search: string | null) => {
103
102
  return getManyLanguages({ ...props.languageFilters, search: search ?? undefined });
104
103
  };
105
104
 
@@ -107,7 +106,7 @@ export default defineComponent({
107
106
  languages,
108
107
  [() => props.languageFilters],
109
108
  emit,
110
- innerFetch
109
+ fetch
111
110
  );
112
111
 
113
112
  return {
@@ -65,10 +65,9 @@
65
65
  </template>
66
66
 
67
67
  <script lang="ts">
68
- import type { PropType } from "vue";
69
- import { computed, defineComponent } from "vue";
68
+ import { computed, defineComponent, type PropType } from "vue";
70
69
 
71
- import type { TimeZoneFilters, TimeZoneInfos } from "@dative-gpi/foundation-shared-domain/models";
70
+ import { type TimeZoneFilters, type TimeZoneInfos } from "@dative-gpi/foundation-shared-domain/models";
72
71
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
73
72
  import { useTimeZones } from "@dative-gpi/foundation-shared-services/composables";
74
73
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -118,7 +117,7 @@ export default defineComponent({
118
117
  return init.value && fetchingTimeZones.value;
119
118
  });
120
119
 
121
- const innerFetch = (search: string | null) => {
120
+ const fetch = (search: string | null) => {
122
121
  return getManyTimeZones({ ...props.timeZoneFilters, search: search ?? undefined });
123
122
  };
124
123
 
@@ -126,7 +125,7 @@ export default defineComponent({
126
125
  timeZones,
127
126
  [() => props.timeZoneFilters],
128
127
  emit,
129
- innerFetch,
128
+ fetch,
130
129
  null,
131
130
  (item: TimeZoneInfos) => item.id,
132
131
  (item: TimeZoneInfos) => item.id
@@ -77,19 +77,18 @@
77
77
  </template>
78
78
 
79
79
  <script lang="ts">
80
- import type { PropType } from "vue";
81
- import { computed, defineComponent, onMounted, ref, watch } from "vue";
80
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
82
81
 
83
82
  import { getPercentageFromHex, getHexFromPercentage } from "@dative-gpi/foundation-shared-components/utils";
84
83
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
85
84
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
86
85
 
86
+ import FSBaseField from "./FSBaseField.vue";
87
87
  import FSCard from "../FSCard.vue";
88
88
  import FSIcon from "../FSIcon.vue";
89
+ import FSText from "../FSText.vue";
89
90
  import FSRow from "../FSRow.vue";
90
91
  import FSCol from "../FSCol.vue";
91
- import FSBaseField from "./FSBaseField.vue";
92
- import FSText from "../FSText.vue";
93
92
 
94
93
  export default defineComponent({
95
94
  name: "FSColorField",
@@ -99,7 +98,7 @@ export default defineComponent({
99
98
  FSCard,
100
99
  FSIcon,
101
100
  FSCol,
102
- FSRow,
101
+ FSRow
103
102
  },
104
103
  props: {
105
104
  label: {
@@ -164,6 +163,7 @@ export default defineComponent({
164
163
  const darks = getColors(ColorEnum.Dark);
165
164
 
166
165
  const menu = ref(false);
166
+
167
167
  const innerColor = ref(props.modelValue.toString().substring(0, 7));
168
168
  const innerOpacity = ref(getHexFromPercentage(props.opacityValue));
169
169
  const fullColor = ref(innerColor.value + innerOpacity.value);
@@ -194,16 +194,14 @@ export default defineComponent({
194
194
  emit("update:opacity", getPercentageFromHex(innerOpacity.value));
195
195
  };
196
196
 
197
- onMounted(() => {
197
+ const reset = (): void => {
198
198
  innerColor.value = getColors(props.modelValue)['base'];
199
199
  innerOpacity.value = getHexFromPercentage(props.opacityValue);
200
200
  fullColor.value = innerColor.value + innerOpacity.value;
201
- });
201
+ };
202
202
 
203
- watch(() => props.modelValue, (value) => {
204
- innerColor.value = getColors(value)['base'];
205
- innerOpacity.value = getHexFromPercentage(props.opacityValue);
206
- fullColor.value = innerColor.value + innerOpacity.value;
203
+ watch(() => props.modelValue, () => {
204
+ reset();
207
205
  });
208
206
 
209
207
  return {
@@ -147,12 +147,11 @@
147
147
  </template>
148
148
 
149
149
  <script lang="ts">
150
- import type { PropType} from "vue";
151
- import { computed, defineComponent, ref } from "vue";
150
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
151
+ import _ from "lodash";
152
152
 
153
153
  import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
154
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
155
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
154
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
156
155
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
157
156
 
158
157
  import FSDialogMenu from "../FSDialogMenu.vue";
@@ -222,6 +221,7 @@ export default defineComponent({
222
221
 
223
222
  const dialog = ref(false);
224
223
  const menu = ref(false);
224
+
225
225
  const innerDate = ref<number | null>(props.modelValue);
226
226
 
227
227
  const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
@@ -244,6 +244,12 @@ export default defineComponent({
244
244
  menu.value = false;
245
245
  };
246
246
 
247
+ watch(() => props.modelValue, () => {
248
+ if (!_.isEqual(innerDate.value, props.modelValue)) {
249
+ innerDate.value = props.modelValue;
250
+ }
251
+ });
252
+
247
253
  return {
248
254
  isExtraSmall,
249
255
  validateOn,
@@ -58,11 +58,10 @@
58
58
  </template>
59
59
 
60
60
  <script lang="ts">
61
- import type { PropType} from "vue";
62
- import { computed, defineComponent, ref } from "vue";
61
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
62
+ import _ from "lodash";
63
63
 
64
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
65
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
64
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
66
65
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
67
66
  import { useRules } from "@dative-gpi/foundation-shared-components/composables";
68
67
 
@@ -127,6 +126,7 @@ export default defineComponent({
127
126
  const { epochToShortDateFormat } = useAppTimeZone();
128
127
 
129
128
  const dialog = ref(false);
129
+
130
130
  const innerDateRange = ref<number[] | null>(props.modelValue);
131
131
 
132
132
  const toShortDateFormat = computed((): string => {
@@ -154,6 +154,12 @@ export default defineComponent({
154
154
  dialog.value = false;
155
155
  };
156
156
 
157
+ watch(() => props.modelValue, () => {
158
+ if (!_.isEqual(innerDateRange.value, props.modelValue)) {
159
+ innerDateRange.value = props.modelValue;
160
+ }
161
+ });
162
+
157
163
  return {
158
164
  toShortDateFormat,
159
165
  innerDateRange,
@@ -193,12 +193,10 @@
193
193
  </template>
194
194
 
195
195
  <script lang="ts">
196
- import type { PropType} from "vue";
197
- import { computed, defineComponent, ref, watch } from "vue";
196
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
198
197
 
199
198
  import { useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
200
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
201
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
199
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
202
200
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
203
201
 
204
202
  import FSDialogMenu from "../FSDialogMenu.vue";
@@ -273,16 +271,10 @@ export default defineComponent({
273
271
  const dialog = ref(false);
274
272
  const menu = ref(false);
275
273
  const tabs = ref(0);
274
+
276
275
  const innerDate = ref<number | null>(null);
277
276
  const innerTime = ref(0);
278
277
 
279
- if (props.modelValue) {
280
- // FSClock just gives two numbers without consideration for the time zone
281
- // We must adjust the time to the user's time zone
282
- innerTime.value = Math.floor((props.modelValue + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
283
- innerDate.value = props.modelValue - innerTime.value;
284
- }
285
-
286
278
  const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
287
279
 
288
280
  const openMobileOverlay = () => {
@@ -304,6 +296,23 @@ export default defineComponent({
304
296
  menu.value = false;
305
297
  };
306
298
 
299
+ const reset = (): void => {
300
+ if (props.modelValue) {
301
+ // FSClock just gives two numbers without consideration for the time zone
302
+ // We must adjust the time to the user's time zone
303
+ innerTime.value = Math.floor((props.modelValue + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
304
+ innerDate.value = props.modelValue - innerTime.value;
305
+ }
306
+ else {
307
+ innerDate.value = null;
308
+ innerTime.value = 0;
309
+ }
310
+ };
311
+
312
+ watch(() => props.modelValue, () => {
313
+ reset();
314
+ }, { immediate: true });
315
+
307
316
  watch([menu, dialog], (): void => {
308
317
  if (!menu.value && !dialog.value) {
309
318
  setTimeout(() => tabs.value = 0, 290);
@@ -76,11 +76,9 @@
76
76
  </template>
77
77
 
78
78
  <script lang="ts">
79
- import type { PropType} from "vue";
80
- import { computed, defineComponent, ref } from "vue";
79
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
81
80
 
82
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
83
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
81
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
84
82
  import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
85
83
  import { useRules } from "@dative-gpi/foundation-shared-components/composables";
86
84
 
@@ -151,31 +149,11 @@ export default defineComponent({
151
149
  const { validateOn, getMessages } = useRules();
152
150
 
153
151
  const dialog = ref(false);
152
+
154
153
  const innerDateRange = ref<number[] | null>(null);
155
154
  const innerTimeRight = ref(0);
156
155
  const innerTimeLeft = ref(0);
157
156
 
158
- if (props.modelValue && Array.isArray(props.modelValue)) {
159
- // FSClock just gives two numbers without consideration for the time zone
160
- // We must adjust the time to the user's time zone
161
- switch (props.modelValue.length) {
162
- case 0: {
163
- break;
164
- }
165
- case 1: {
166
- innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
167
- innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value];
168
- break;
169
- }
170
- default: {
171
- innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
172
- innerTimeRight.value = Math.floor((props.modelValue[1] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
173
- innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value, props.modelValue[1] - innerTimeRight.value];
174
- break;
175
- }
176
- }
177
- }
178
-
179
157
  const toShortTimeFormat = computed((): string => {
180
158
  if (!props.modelValue || !Array.isArray(props.modelValue) || !props.modelValue.length) {
181
159
  return "";
@@ -219,6 +197,38 @@ export default defineComponent({
219
197
  dialog.value = false;
220
198
  };
221
199
 
200
+ const reset = (): void => {
201
+ if (props.modelValue && Array.isArray(props.modelValue)) {
202
+ // FSClock just gives two numbers without consideration for the time zone
203
+ // We must adjust the time to the user's time zone
204
+ switch (props.modelValue.length) {
205
+ case 0: {
206
+ break;
207
+ }
208
+ case 1: {
209
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
210
+ innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value];
211
+ break;
212
+ }
213
+ default: {
214
+ innerTimeLeft.value = Math.floor((props.modelValue[0] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
215
+ innerTimeRight.value = Math.floor((props.modelValue[1] + getUserOffsetMillis()) % (24 * 60 * 60 * 1000));
216
+ innerDateRange.value = [props.modelValue[0] - innerTimeLeft.value, props.modelValue[1] - innerTimeRight.value];
217
+ break;
218
+ }
219
+ }
220
+ }
221
+ else {
222
+ innerDateRange.value = null;
223
+ innerTimeLeft.value = 0;
224
+ innerTimeRight.value = 0;
225
+ }
226
+ };
227
+
228
+ watch(() => props.modelValue, () => {
229
+ reset();
230
+ }, { immediate: true });
231
+
222
232
  return {
223
233
  toShortTimeFormat,
224
234
  innerDateLeft,