@dative-gpi/foundation-shared-components 1.0.158-sankey2 → 1.0.159-notification

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.
@@ -97,9 +97,9 @@ import FSCol from '@dative-gpi/foundation-shared-components/components/FSCol.vue
97
97
  import FSSpan from '@dative-gpi/foundation-shared-components/components/FSSpan.vue';
98
98
  import FSText from '@dative-gpi/foundation-shared-components/components/FSText.vue';
99
99
  import FSSlider from '@dative-gpi/foundation-shared-components/components/FSSlider.vue';
100
- import FSPlayButtons from '@dative-gpi/foundation-shared-components/components/FSPlayButtons.vue';
101
100
  import FSBaseField from '@dative-gpi/foundation-shared-components/components/fields/FSBaseField.vue';
102
101
  import FSTermField from '@dative-gpi/foundation-shared-components/components/fields/FSTermField.vue';
102
+ import FSPlayButtons from '@dative-gpi/foundation-shared-components/components/FSPlayButtons.vue';
103
103
 
104
104
  export default defineComponent({
105
105
  name: "FSInstantPicker",
@@ -110,7 +110,7 @@ export default defineComponent({
110
110
  FSSlider,
111
111
  FSTermField,
112
112
  FSBaseField,
113
- FSPlayButtons,
113
+ FSPlayButtons
114
114
  },
115
115
  props: {
116
116
  label: {
@@ -119,7 +119,8 @@ export default defineComponent({
119
119
  },
120
120
  modelValue: {
121
121
  type: Number,
122
- required: false
122
+ required: false,
123
+ default: 0,
123
124
  },
124
125
  startDate: {
125
126
  type: String,
@@ -230,12 +231,6 @@ export default defineComponent({
230
231
  }
231
232
  }, { immediate: true });
232
233
 
233
- watch(() => props.modelValue, (value) => {
234
- if(!value) {
235
- emit('update:modelValue', endTimestamp.value);
236
- }
237
- }, { immediate: true });
238
-
239
234
  watch(playing, (value) => {
240
235
  if(!value && playingInterval.value) {
241
236
  clearInterval(playingInterval.value);
@@ -389,8 +389,6 @@ export default defineComponent({
389
389
  if(!map.value || !props.bounds) {
390
390
  return;
391
391
  }
392
-
393
- //console.log("Bounds changed", props.bounds);
394
392
  fitBounds(props.bounds, { maxZoom: 14 });
395
393
  });
396
394
 
@@ -3,11 +3,13 @@
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
6
- import { inject, type PropType, type Ref, watch, ref, onUnmounted, onMounted } from 'vue';
6
+ import { inject, type PropType, type Ref, watch, ref, onUnmounted, computed } from 'vue';
7
+ import { type RouteLocation } from "vue-router";
7
8
 
8
- import { type Map, divIcon, type LatLng, marker, type Marker, type MarkerClusterGroup, type LeafletMouseEvent } from 'leaflet';
9
+ import { type Map, divIcon, type LatLng, marker, type Marker, type MarkerClusterGroup } from 'leaflet';
9
10
 
10
11
  import { useColors } from "../../composables";
12
+ import { useRouting } from '@dative-gpi/foundation-shared-services/composables';
11
13
 
12
14
  import { gpsMarkerHtml, locationMarkerHtml, pinMarkerHtml } from '../../utils/leafletMarkers';
13
15
  import { MAP, MARKERCLUSTERGROUP } from './keys';
@@ -41,14 +43,28 @@ export default {
41
43
  label: {
42
44
  type: String,
43
45
  required: false
46
+ },
47
+ to: {
48
+ type: Object as PropType<RouteLocation | null>,
49
+ required: false
44
50
  }
45
51
  },
46
- emits: ['click'],
52
+ emits: ['click', 'auxclick'],
47
53
  setup(props, { emit }) {
48
54
  const map = inject<Ref<Map | null>>(MAP);
49
55
  const markerClusterGroup = inject<Ref<MarkerClusterGroup | null>>(MARKERCLUSTERGROUP, ref(null));
50
-
56
+
51
57
  const { getColors } = useColors();
58
+ const { handleRoutingEvent } = useRouting();
59
+
60
+ if(!map) {
61
+ throw new Error('FSMapTileLayer must be used inside a FSMap component');
62
+ }
63
+
64
+ if(!map.value) {
65
+ throw new Error('FSMapTileLayer must be used inside a FSMap component with a map');
66
+ }
67
+
52
68
  const getMarkerIcon = () => {
53
69
  if(props.variant === 'gps') {
54
70
  const size = 16;
@@ -81,12 +97,32 @@ export default {
81
97
 
82
98
  const actualMarker = ref(marker(props.latlng ?? [0, 0], { icon: getMarkerIcon() }));
83
99
 
84
- if(!map) {
85
- throw new Error('FSMapTileLayer must be used inside a FSMap component');
100
+ const markerElement = computed(() => {
101
+ return actualMarker.value.getElement();
102
+ });
103
+
104
+ const onClick = (event: MouseEvent) => {
105
+ if(props.to) {
106
+ handleRoutingEvent(event, props.to, true);
107
+ return;
108
+ }
109
+
110
+ emit('click', {
111
+ ...event,
112
+ latlng: props.latlng
113
+ });
86
114
  }
87
115
 
88
- if(!map.value) {
89
- throw new Error('FSMapTileLayer must be used inside a FSMap component with a map');
116
+ const onAuxClick = (event: MouseEvent) => {
117
+ if(props.to) {
118
+ handleRoutingEvent(event, props.to);
119
+ return;
120
+ }
121
+
122
+ emit('auxclick', {
123
+ ...event,
124
+ latlng: props.latlng
125
+ });
90
126
  }
91
127
 
92
128
  watch(map, () => {
@@ -118,11 +154,14 @@ export default {
118
154
  actualMarker.value.setLatLng(props.latlng);
119
155
  });
120
156
 
121
- onMounted(() => {
122
- actualMarker.value.on('click', (event: LeafletMouseEvent) => {
123
- emit('click', event);
124
- });
125
- });
157
+ watch(markerElement, (newMarkerElement) => {
158
+ if(!newMarkerElement) {
159
+ return;
160
+ }
161
+
162
+ newMarkerElement.addEventListener('click', onClick);
163
+ newMarkerElement.addEventListener('auxclick', onAuxClick);
164
+ }, { immediate: true });
126
165
 
127
166
  onUnmounted(() => {
128
167
  if(actualMarker.value && map.value) {
@@ -13,7 +13,7 @@ export const useMapLayers = () => {
13
13
  {
14
14
  name: MapLayers.Map,
15
15
  label: $tr("ui.map-layer.map", "Map"),
16
- image: new URL("../../assets/images/map/map.png", import.meta.url).href,
16
+ image: new URL("../assets/images/map/map.png", import.meta.url).href,
17
17
  layers: [
18
18
  tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
19
19
  maxZoom: 22,
@@ -26,7 +26,7 @@ export const useMapLayers = () => {
26
26
  {
27
27
  name: MapLayers.Imagery,
28
28
  label: $tr("ui.map-layer.imagery", "Imagery"),
29
- image: new URL("../../assets/images/map/imagery.png", import.meta.url).href,
29
+ image: new URL("../assets/images/map/imagery.png", import.meta.url).href,
30
30
  layers: [
31
31
  tileLayer(`https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}&key=${apiKey}`, {
32
32
  maxZoom: 22,
@@ -39,7 +39,7 @@ export const useMapLayers = () => {
39
39
  {
40
40
  name: MapLayers.Snow,
41
41
  label: $tr("ui.map-layer.snow", "Snow ski map"),
42
- image: new URL("../../assets/images/map/snow.png", import.meta.url).href,
42
+ image: new URL("../assets/images/map/snow.png", import.meta.url).href,
43
43
  layers: [
44
44
  tileLayer(`https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=${apiKey}`, {
45
45
  maxZoom: 22,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.158-sankey2",
4
+ "version": "1.0.159-notification",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.158-sankey2",
14
- "@dative-gpi/foundation-shared-services": "1.0.158-sankey2"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.159-notification",
14
+ "@dative-gpi/foundation-shared-services": "1.0.159-notification"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "3bdd971b1260dda85c68b5c550521861a513c2f1"
38
+ "gitHead": "bd9f45c4be8554c7778b5388f3d60d25c9244054"
39
39
  }
@@ -48,7 +48,6 @@
48
48
  @import "fs_password_field.scss";
49
49
  @import "fs_progress_bar.scss";
50
50
  @import "fs_radio.scss";
51
- @import "fs_range_slider.scss";
52
51
  @import "fs_rich_text_field.scss";
53
52
  @import "fs_row.scss";
54
53
  @import "fs_select_field.scss";
@@ -74,9 +74,10 @@ export const AlertTools = {
74
74
  },
75
75
  criticityLabel(value: Criticity): string {
76
76
  switch (value) {
77
+ case Criticity.Information: return $tr('ui.common.information', 'Information');
77
78
  case Criticity.Warning: return $tr('ui.common.warning', 'Warning');
78
79
  case Criticity.Error: return $tr('ui.common.error', 'Error');
79
- default: return $tr('ui.common.information', 'Information');
80
+ default: return $tr("ui.common.none", "None");
80
81
  }
81
82
  },
82
83
  statusColor(status: AlertStatus): ColorEnum {
@@ -1,275 +0,0 @@
1
- <template>
2
- <FSBaseField
3
- :description="$props.description"
4
- :hideHeader="$props.hideHeader"
5
- :required="$props.required"
6
- :disabled="$props.disabled"
7
- :label="$props.label"
8
- >
9
- <FSRow
10
- align="bottom-center"
11
- gap="32px"
12
- >
13
- <FSTermField
14
- width="430px"
15
- :label="$tr('ui.instant-picker.analyze-period', 'Analyze Period')"
16
- :startDate="$props.startDate"
17
- :endDate="$props.endDate"
18
- :disabled="$props.disabled"
19
- @update:startDate="$emit('update:startDate', $event)"
20
- @update:endDate="$emit('update:endDate', $event)"
21
- />
22
- <FSRow
23
- padding="0 0 2px 0"
24
- align="center-center"
25
- >
26
- <FSCol
27
- width="fill"
28
- >
29
- <FSRangeSlider
30
- minWidth='min(300px, 90vw)'
31
- :disabled="$props.disabled"
32
- :color="ColorEnum.Light"
33
- :thumbColor="ColorEnum.Primary"
34
- :trackFillColor="ColorEnum.Primary"
35
- :trackSize="8"
36
- thumb-label="always"
37
- :step="$props.stepTime"
38
- :min="startTimestamp"
39
- :max="endTimestamp"
40
- :ticks="ticks"
41
- showTicks="always"
42
- :tick-size="0"
43
- :modelValue="$props.modelValue"
44
- @update:modelValue="$emit('update:modelValue', $event)"
45
- >
46
- <template
47
- #thumb-label="{ modelValue }"
48
- >
49
- <FSSpan
50
- font="text-overline"
51
- >
52
- {{ epochToMonthShortTimeFormat(modelValue) }}
53
- </FSSpan>
54
- </template>
55
- <template
56
- #tick-label="{ tick }"
57
- >
58
- <FSRow>
59
- <FSText
60
- :color="lightColors.dark"
61
- font="text-overline"
62
- >
63
- {{ intervalTime <= 3600000
64
- ?
65
- epochToShortTimeOnlyFormat(tick.value)
66
- :
67
- epochToDayMonthShortOnly(tick.value)
68
- }}
69
- </FSText>
70
- </FSRow>
71
- </template>
72
- </FSRangeSlider>
73
- </FSCol>
74
- <FSPlayButtons
75
- v-if="$props.playable"
76
- :disabled="$props.disabled"
77
- :modelValue="playing"
78
- @click:backward="onClickBackward"
79
- @click:forward="onClickForward"
80
- @update:modelValue="onPlayingChange"
81
- />
82
- </FSRow>
83
- </FSRow>
84
- </FSBaseField>
85
- </template>
86
-
87
- <script lang="ts">
88
- import { computed, defineComponent, ref, watch } from "vue";
89
-
90
- import { useDateFormat, useDateExpression } from "@dative-gpi/foundation-shared-services/composables";
91
-
92
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
93
- import { useBreakpoints, useColors } from '@dative-gpi/foundation-shared-components/composables';
94
-
95
- import FSCol from '@dative-gpi/foundation-shared-components/components/FSCol.vue';
96
- import FSSpan from '@dative-gpi/foundation-shared-components/components/FSSpan.vue';
97
- import FSText from '@dative-gpi/foundation-shared-components/components/FSText.vue';
98
- import FSPlayButtons from '@dative-gpi/foundation-shared-components/components/FSPlayButtons.vue';
99
- import FSRangeSlider from '@dative-gpi/foundation-shared-components/components/FSRangeSlider.vue';
100
- import FSBaseField from '@dative-gpi/foundation-shared-components/components/fields/FSBaseField.vue';
101
- import FSTermField from '@dative-gpi/foundation-shared-components/components/fields/FSTermField.vue';
102
-
103
- export default defineComponent({
104
- name: "FSRangePicker",
105
- components: {
106
- FSCol,
107
- FSSpan,
108
- FSText,
109
- FSTermField,
110
- FSBaseField,
111
- FSRangeSlider,
112
- FSPlayButtons,
113
- },
114
- props: {
115
- label: {
116
- type: String,
117
- required: false,
118
- },
119
- mode: {
120
- type: String as () => 'single' | 'range',
121
- required: false,
122
- default: 'single'
123
- },
124
- modelValue: {
125
- type: Object as () => [number, number],
126
- required: true
127
- },
128
- startDate: {
129
- type: String,
130
- required: true
131
- },
132
- endDate: {
133
- type: String,
134
- required: true
135
- },
136
- description: {
137
- type: String,
138
- required: false,
139
- default: null
140
- },
141
- hideHeader: {
142
- type: Boolean,
143
- required: false,
144
- default: false
145
- },
146
- required: {
147
- type: Boolean,
148
- required: false,
149
- default: false
150
- },
151
- disabled: {
152
- type: Boolean,
153
- required: false,
154
- default: false
155
- },
156
- playable: {
157
- type: Boolean,
158
- required: false,
159
- default: true
160
- },
161
- stepTime: {
162
- type: Number,
163
- required: false,
164
- default: 60000
165
- },
166
- playingStepDuration: {
167
- type: Number,
168
- required: false,
169
- default: 50
170
- }
171
- },
172
- emits: ['update:modelValue', 'update:startDate', 'update:endDate'],
173
- setup(props, { emit }) {
174
- const { epochToShortTimeOnlyFormat, epochToShortDateFormat, epochToDayMonthShortOnly, epochToISO, epochToMonthShortTimeFormat } = useDateFormat();
175
- const { convert : convertTermToEpoch } = useDateExpression();
176
- const { isMobileSized, isExtraSmall } = useBreakpoints();
177
- const { getColors } = useColors();
178
-
179
- const lightColors = getColors(ColorEnum.Light);
180
- const playing = ref(false);
181
- const playingInterval = ref();
182
-
183
- const startTimestamp = computed(() => convertTermToEpoch(props.startDate));
184
- const endTimestamp = computed(() => convertTermToEpoch(props.endDate));
185
-
186
- const intervalTime = computed(() => {
187
- const possibleIntervals = [60000, 3600000, 86400000];
188
-
189
- const interval = possibleIntervals.find(interval => {
190
- return (endTimestamp.value - startTimestamp.value) / interval < 100;
191
- });
192
-
193
- if (interval) {
194
- return interval;
195
- }
196
- return 86400000;
197
- });
198
-
199
- const ticks = computed(() => {
200
- const ticks: number[] = [];
201
-
202
- const rangeDuration = endTimestamp.value - startTimestamp.value;
203
- const interval = rangeDuration / maximumTickToShow.value;
204
-
205
- for (let i = 1; i < maximumTickToShow.value; i++) {
206
- ticks.push(startTimestamp.value + i * interval);
207
- }
208
- return ticks;
209
- });
210
-
211
- const maximumTickToShow = computed(() => {
212
- if (isExtraSmall.value) {
213
- return 4;
214
- }
215
- if (isMobileSized.value) {
216
- return 5;
217
- }
218
- return 6;
219
- });
220
-
221
- const onPlayingChange = (value: boolean) => {
222
- playing.value = value;
223
- };
224
-
225
- const onClickBackward = () => {
226
- const rangeDuration = props.modelValue[1] - props.modelValue[0];
227
- emit('update:modelValue', [startTimestamp.value, startTimestamp.value + rangeDuration]);
228
- };
229
-
230
- const onClickForward = () => {
231
- const rangeDuration = props.modelValue[1] - props.modelValue[0];
232
- emit('update:modelValue', [endTimestamp.value - rangeDuration, endTimestamp.value]);
233
- };
234
-
235
- watch(() => [props.startDate, props.endDate], () => {
236
- if((props.modelValue[0] < startTimestamp.value || props.modelValue[1] > endTimestamp.value)) {
237
- emit('update:modelValue', [startTimestamp.value, endTimestamp.value]);
238
- }
239
- }, { immediate: true });
240
-
241
- watch(playing, (value) => {
242
- if(!value && playingInterval.value) {
243
- clearInterval(playingInterval.value);
244
- } else {
245
- playingInterval.value = setInterval(() => {
246
- if(props.modelValue[0] + props.stepTime <= endTimestamp.value && props.modelValue[1] + props.stepTime <= endTimestamp.value) {
247
- emit('update:modelValue', [props.modelValue[0] + props.stepTime, props.modelValue[1] + props.stepTime]);
248
- } else {
249
- playing.value = false;
250
- }
251
- }, props.playingStepDuration);
252
- }
253
- });
254
-
255
- return {
256
- ticks,
257
- playing,
258
- ColorEnum,
259
- lightColors,
260
- intervalTime,
261
- endTimestamp,
262
- startTimestamp,
263
- maximumTickToShow,
264
- epochToISO,
265
- onPlayingChange,
266
- onClickForward,
267
- onClickBackward,
268
- epochToShortDateFormat,
269
- epochToShortTimeOnlyFormat,
270
- epochToDayMonthShortOnly,
271
- epochToMonthShortTimeFormat
272
- };
273
- },
274
- });
275
- </script>
@@ -1,112 +0,0 @@
1
- <template>
2
- <FSBaseField
3
- :label="$props.label"
4
- :description="$props.description"
5
- :required="$props.required"
6
- :disabled="$props.disabled"
7
- :style="style"
8
- >
9
- <v-range-slider
10
- class="fs-range-slider"
11
- hide-details
12
- :disabled="$props.disabled"
13
- :ripple="false"
14
- :style="style"
15
- :elevation="0"
16
- :tickSize="4"
17
- :modelValue="$props.modelValue ?? undefined"
18
- @update:modelValue="$emit('update:modelValue', $event)"
19
- v-bind="$attrs"
20
- >
21
- <template
22
- v-for="(_, name) in $slots"
23
- v-slot:[name]="slotData"
24
- >
25
- <slot
26
- :name="name"
27
- v-bind="slotData"
28
- />
29
- </template>
30
- </v-range-slider>
31
- </FSBaseField>
32
- </template>
33
-
34
- <script lang="ts">
35
- import { computed, defineComponent, type PropType, type StyleValue } from "vue";
36
-
37
- import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
38
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
39
-
40
- import FSBaseField from '@dative-gpi/foundation-shared-components/components/fields/FSBaseField.vue';
41
-
42
- export default defineComponent({
43
- name: "FSRangeSlider",
44
- components: {
45
- FSBaseField
46
- },
47
- props: {
48
- label: {
49
- type: String as PropType<string | null>,
50
- required: false,
51
- default: null
52
- },
53
- description: {
54
- type: String as PropType<string | null>,
55
- required: false,
56
- default: null
57
- },
58
- modelValue: {
59
- type: Object as PropType<[number, number] | null>,
60
- required: false,
61
- default: null
62
- },
63
- color: {
64
- type: String as PropType<ColorBase>,
65
- required: false,
66
- default: ColorEnum.Dark
67
- },
68
- required: {
69
- type: Boolean,
70
- required: false,
71
- default: false
72
- },
73
- disabled: {
74
- type: Boolean,
75
- required: false,
76
- default: false
77
- }
78
- },
79
- emits: ["update:modelValue"],
80
- setup(props) {
81
- const { getColors } = useColors();
82
-
83
- const colors = computed(() => getColors(props.color));
84
- const lights = getColors(ColorEnum.Light);
85
- const darks = getColors(ColorEnum.Dark);
86
-
87
- const style = computed((): StyleValue => {
88
- if (props.disabled) {
89
- return {
90
- "--fs-range-slider-cursor" : "default",
91
- "--fs-range-slider-track-color": lights.base,
92
- "--fs-range-slider-thumb-color": lights.dark,
93
- "--fs-range-slider-fill-color" : lights.dark,
94
- "--fs-range-slider-color" : lights.dark
95
- };
96
- }
97
- console.log(colors.value);
98
- return {
99
- "--fs-range-slider-cursor" : "pointer",
100
- "--fs-range-slider-track-color": colors.value.light,
101
- "--fs-range-slider-fill-color" : colors.value.base,
102
- "--fs-range-slider-thumb-color": colors.value.base,
103
- "--fs-range-slider-color" : darks.base
104
- };
105
- });
106
-
107
- return {
108
- style
109
- };
110
- }
111
- });
112
- </script>
@@ -1,51 +0,0 @@
1
- .fs-range-slider {
2
- padding: 0px !important;
3
- width: calc(100% - 16px);
4
-
5
- & .v-slider__container {
6
- cursor: var(--fs-range-slider-cursor);
7
- margin-left: 8px;
8
- margin-right: 8px;
9
- opacity: 1 !important;
10
- }
11
-
12
- & .v-slider-track__background {
13
- background-color: var(--fs-range-slider-track-color);
14
- height: 6px !important;
15
- opacity: 1;
16
- }
17
-
18
- & .v-slider-track__fill {
19
- background-color: var(--fs-range-slider-fill-color);
20
- opacity: 0.7 !important;
21
- }
22
-
23
- & .v-slider-track__tick {
24
- background-color: var(--fs-range-slider-thumb-color);
25
- border-radius: 50%;
26
- }
27
-
28
- & .v-slider-thumb {
29
- color: var(--fs-range-slider-thumb-color);
30
-
31
- &__surface:before {
32
- display: none !important;
33
- }
34
-
35
- &__surface:after {
36
- display: none !important;
37
- }
38
-
39
- &__ripple {
40
- display: none !important;
41
- }
42
- }
43
- }
44
-
45
- .fs-range-slider-label {
46
- color: var(--fs-range-slider-color);
47
- }
48
-
49
- .fs-range-slider-description {
50
- color: var(--fs-range-slider-color);
51
- }