@dative-gpi/foundation-shared-components 1.0.94 → 1.0.95

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.
@@ -236,9 +236,9 @@ export default defineComponent({
236
236
  const maxHeight = computed(() => {
237
237
  const other = 24 + 24 // Paddings
238
238
  + (isMobileSized.value ? 24 : 32) + 24 // Title
239
- + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
239
+ + (props.subtitle ? (isMobileSized.value ? 16 : 20) + 8 : 0) // Subtitle
240
240
  + (isMobileSized.value ? 36 : 40) + 24; // Footer
241
- return `calc(100vh - 40px - ${other}px)`;
241
+ return `calc(100vh - 42px - ${other}px)`;
242
242
  });
243
243
 
244
244
  const cancelLabel = computed(() => {
@@ -192,9 +192,10 @@ export default defineComponent({
192
192
  const maxHeight = computed(() => {
193
193
  const other = 24 + 24 // Paddings
194
194
  + (isMobileSized.value ? 24 : 32) + 24 // Title
195
- + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
195
+ + (props.subtitle ? (isMobileSized.value ? 16 : 20) + 8 : 0) // Subtitle
196
+ + (props.steps > 1 ? 24 + 4 : 0) // Pagination
196
197
  + (isMobileSized.value ? 36 : 40) + 24; // Footer
197
- return `calc(100vh - 40px - ${other}px)`;
198
+ return `calc(100vh - 42px - ${other}px)`;
198
199
  });
199
200
 
200
201
  const previousButtonLabel = computed(() => {
@@ -179,9 +179,9 @@ export default defineComponent({
179
179
  const maxHeight = computed(() => {
180
180
  const other = 24 + 24 // Paddings
181
181
  + (isMobileSized.value ? 24 : 32) + 24 // Title
182
- + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
182
+ + (props.subtitle ? (isMobileSized.value ? 16 : 20) + 8 : 0) // Subtitle
183
183
  + (isMobileSized.value ? 36 : 40) + 24; // Footer
184
- return `calc(100vh - 40px - ${other}px)`;
184
+ return `calc(100vh - 42px - ${other}px)`;
185
185
  });
186
186
 
187
187
  const cancelLabel = computed(() => {
@@ -243,7 +243,7 @@ export default defineComponent({
243
243
  default: false
244
244
  }
245
245
  },
246
- emits: ["update:modelValue", "update:source"],
246
+ emits: ["update", "update:modelValue", "update:source"],
247
247
  setup(props, { emit }) {
248
248
  const { isExtraSmall } = useBreakpoints();
249
249
  const { getColors } = useColors();
@@ -266,9 +266,15 @@ export default defineComponent({
266
266
  const content = (await readFile(payload)) as string;
267
267
  fileSelected.value.fileName = payload.name;
268
268
  fileSelected.value.fileContent = content;
269
- emit("update:modelValue", content.substring(content.indexOf(',') + 1));
269
+ const newModelValue = content.substring(content.indexOf(',') + 1);
270
270
  if (props.source) {
271
+ emit("update:modelValue", newModelValue);
271
272
  emit("update:source", null);
273
+ emit("update", { source: null, modelValue: newModelValue });
274
+ }
275
+ else {
276
+ emit("update:modelValue", newModelValue);
277
+ emit("update", { source: props.source, modelValue: newModelValue });
272
278
  }
273
279
  };
274
280
 
@@ -277,9 +283,11 @@ export default defineComponent({
277
283
  fileSelected.value.fileContent = null;
278
284
  if (props.modelValue) {
279
285
  emit("update:modelValue", null);
286
+ emit("update", { source: props.source, modelValue: null });
280
287
  }
281
288
  else {
282
289
  emit("update:source", null);
290
+ emit("update", { source: null, modelValue: props.modelValue });
283
291
  }
284
292
  };
285
293
 
@@ -141,7 +141,7 @@ export default defineComponent({
141
141
  required: false
142
142
  }
143
143
  },
144
- emits: ['update:mode', 'click:eventId', 'update:start', 'update:end'],
144
+ emits: ['update', 'update:mode', 'click:eventId', 'update:start', 'update:end'],
145
145
  setup(props, { emit }) {
146
146
  const { todayToEpoch, epochToLocalDayStart, epochToLocalDayEnd } = useDateFormat();
147
147
  const { isExtraSmall } = useBreakpoints();
@@ -167,18 +167,27 @@ export default defineComponent({
167
167
  return;
168
168
  }
169
169
  if (props.mode === AgendaMode.Week) {
170
- emit("update:start", epochToLocalDayStart(now.value - (new Date(now.value).getDay() - 1) * 24 * 60 * 60 * 1000));
171
- emit("update:end", epochToLocalDayEnd(now.value + (7 - new Date(now.value).getDay()) * 24 * 60 * 60 * 1000));
170
+ const newStart = epochToLocalDayStart(now.value - (new Date(now.value).getDay() - 1) * 24 * 60 * 60 * 1000);
171
+ const newEnd = epochToLocalDayEnd(now.value + (7 - new Date(now.value).getDay()) * 24 * 60 * 60 * 1000);
172
+ emit("update:start", newStart);
173
+ emit("update:end", newEnd);
174
+ emit("update", { start: newStart, end: newEnd, mode: props.mode });
172
175
  return;
173
176
  }
174
177
  if (props.mode === AgendaMode.Month) {
175
178
  const lastDayOfMonth = new Date(new Date(now.value).getFullYear(), new Date(now.value).getMonth() + 1, 0);
176
- emit("update:start", epochToLocalDayStart(new Date(now.value).setDate(1)));
177
- emit("update:end", lastDayOfMonth.getTime());
179
+ const newStart = epochToLocalDayStart(new Date(now.value).setDate(1));
180
+ const newEnd = lastDayOfMonth.getTime()
181
+ emit("update:start", newStart);
182
+ emit("update:end", newEnd );
183
+ emit("update", { start: newStart, end: newEnd, mode: props.mode });
178
184
  return;
179
185
  }
180
- emit("update:start", epochToLocalDayStart(now.value));
181
- emit("update:end", epochToLocalDayEnd(now.value));
186
+ const newStart = epochToLocalDayStart(now.value);
187
+ const newEnd = epochToLocalDayEnd(now.value);
188
+ emit("update:start", newStart);
189
+ emit("update:end", newEnd);
190
+ emit("update", { start: newStart, end: newEnd, mode: props.mode });
182
191
  });
183
192
 
184
193
  onUnmounted(() => {
@@ -188,8 +197,18 @@ export default defineComponent({
188
197
  watch(isExtraSmall, (value) => {
189
198
  if (value && props.mode !== AgendaMode.Day) {
190
199
  emit('update:mode', AgendaMode.Day);
200
+ emit("update", {
201
+ start: props.start,
202
+ end: props.end,
203
+ mode: AgendaMode.Day
204
+ });
191
205
  } else if (!value && defaultMode.value !== AgendaMode.Day) {
192
206
  emit('update:mode', defaultMode.value);
207
+ emit("update", {
208
+ start: props.start,
209
+ end: props.end,
210
+ mode: defaultMode.value
211
+ });
193
212
  }
194
213
  });
195
214
 
@@ -89,7 +89,7 @@
89
89
  </template>
90
90
 
91
91
  <script lang="ts">
92
- import { defineComponent, type PropType, ref } from 'vue';
92
+ import { defineComponent, type PropType, ref, watch } from 'vue';
93
93
 
94
94
  import { useDateFormat } from '@dative-gpi/foundation-shared-services/composables';
95
95
 
@@ -128,7 +128,7 @@ export default defineComponent({
128
128
  required: true
129
129
  }
130
130
  },
131
- emits: ['update:start', 'update:end', 'update:mode'],
131
+ emits: ['update', 'update:start', 'update:end', 'update:mode'],
132
132
  setup(props, { emit }) {
133
133
  const { epochToMonthYearOnlyFormat, epochToDayMonthLongOnly, epochToLocalDayStart, epochToLocalDayEnd } = useDateFormat();
134
134
 
@@ -137,18 +137,24 @@ export default defineComponent({
137
137
  const updateDateRange = (dayStart: number) => {
138
138
  const newStart = epochToLocalDayStart(dayStart);
139
139
  if (props.mode === AgendaMode.Week) {
140
+ const newEnd = epochToLocalDayEnd(newStart + (7 - new Date(newStart).getDay()) * 24 * 60 * 60 * 1000)
140
141
  emit('update:start', newStart);
141
- emit('update:end', epochToLocalDayEnd(newStart + (7 - new Date(newStart).getDay()) * 24 * 60 * 60 * 1000));
142
+ emit('update:end', newEnd);
143
+ emit('update', { start: newStart, end: newEnd, mode: props.mode })
142
144
  return;
143
145
  }
144
146
  if (props.mode === AgendaMode.Month) {
145
147
  emit('update:start', newStart);
146
148
  const lastDayOfMonth = new Date(new Date(newStart).getFullYear(), new Date(newStart).getMonth() + 1, 0);
147
- emit('update:end', epochToLocalDayEnd(lastDayOfMonth.getTime()));
149
+ const newEnd = epochToLocalDayEnd(lastDayOfMonth.getTime());
150
+ emit('update:end', newEnd);
151
+ emit('update', { start: newStart, end: newEnd, mode: props.mode })
148
152
  return;
149
153
  }
154
+ const newEnd = epochToLocalDayEnd(newStart);
150
155
  emit('update:start', newStart);
151
- emit('update:end', epochToLocalDayEnd(newStart));
156
+ emit('update:end', newEnd);
157
+ emit('update', { start: newStart, end: newEnd, mode: props.mode })
152
158
  }
153
159
 
154
160
  const onNext = () => {
@@ -175,6 +181,17 @@ export default defineComponent({
175
181
  }
176
182
  }
177
183
 
184
+ watch(() => props.mode, (newMode) => {
185
+ const dayBtwStartAndEnd = props.start + (props.end - props.start) / 2;
186
+ if (newMode === AgendaMode.Week) {
187
+ updateDateRange(dayBtwStartAndEnd - (new Date(dayBtwStartAndEnd).getDay() - 1) * 24 * 60 * 60 * 1000);
188
+ } else if (newMode === AgendaMode.Month) {
189
+ updateDateRange(new Date(dayBtwStartAndEnd).setDate(1));
190
+ } else if (newMode === AgendaMode.Day) {
191
+ updateDateRange(dayBtwStartAndEnd);
192
+ }
193
+ });
194
+
178
195
  return {
179
196
  AgendaMode,
180
197
  showCalendarDialog,
@@ -7,6 +7,7 @@
7
7
  :wrap="false"
8
8
  gap="0"
9
9
  align="center-center"
10
+ :style="style"
10
11
  >
11
12
  <FSRow
12
13
  v-for="hour in hours"
@@ -36,14 +37,14 @@
36
37
  </FSRow>
37
38
  </FSRow>
38
39
  <FSRow
39
- class="fs-agenda-hours-row"
40
+ class="fs-agenda-hours-row-markers"
40
41
  :wrap="false"
41
42
  gap="0"
42
43
  >
43
44
  <FSRow
44
- v-for="hour in hours"
45
- :key="hour"
46
- :style="getMarkerStyle(displayNow && hour === modelValue)"
45
+ v-for="hour in 24"
46
+ :key="hour-1"
47
+ :style="getMarkerStyle(displayNow && hour-1 === modelValue)"
47
48
  width="100%"
48
49
  height="0"
49
50
  align="center-center"
@@ -59,7 +60,7 @@
59
60
  <script lang="ts">
60
61
  import { defineComponent, computed, type StyleValue } from 'vue';
61
62
 
62
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
63
+ import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
63
64
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
64
65
 
65
66
  import FSText from '../FSText.vue';
@@ -90,13 +91,27 @@ export default defineComponent({
90
91
  },
91
92
  setup() {
92
93
  const { getColors } = useColors();
94
+ const { isMobileSized } = useBreakpoints();
93
95
 
94
96
  const lightColors = getColors(ColorEnum.Light);
95
97
  const primaryColors = getColors(ColorEnum.Primary);
96
98
  const fontColor = lightColors.dark;
97
99
 
100
+ const hoursToShow = computed(() => {
101
+ if(isMobileSized.value) {
102
+ return 12;
103
+ }
104
+ return 24;
105
+ });
106
+
98
107
  const hours = computed(() => {
99
- return Array.from({ length: 24 }, (_, i) => i);
108
+ return Array.from({ length: hoursToShow.value }, (_, i) => i * (24 / hoursToShow.value));
109
+ });
110
+
111
+ const style = computed((): StyleValue => {
112
+ return {
113
+ '--fs-agenda-hours-row-transform': `translateX(calc(-${2.4 * 24 / hoursToShow.value}%))`,
114
+ }
100
115
  });
101
116
 
102
117
  const getMarkerStyle = (isNowHour: boolean): StyleValue => {
@@ -113,8 +128,9 @@ export default defineComponent({
113
128
  const to2Digits = (value: number) => value.toString().padStart(2, '0');
114
129
 
115
130
  return {
116
- fontColor,
117
131
  hours,
132
+ style,
133
+ fontColor,
118
134
  getMarkerStyle,
119
135
  to2Digits
120
136
  };
@@ -152,7 +152,7 @@ export default defineComponent({
152
152
  default: "fill"
153
153
  }
154
154
  },
155
- emits: ["update:modelValue", "update:opacity"],
155
+ emits: ["update", "update:modelValue", "update:opacity"],
156
156
  setup(props, { emit }) {
157
157
  const { getColors, getBasePaletteColors } = useColors();
158
158
  const { slots } = useSlots();
@@ -192,6 +192,7 @@ export default defineComponent({
192
192
  fullColor.value = innerColor.value + innerOpacity.value;
193
193
  emit("update:modelValue", innerColor.value);
194
194
  emit("update:opacity", getPercentageFromHex(innerOpacity.value));
195
+ emit("update", { modelValue: innerColor.value, opacity: getPercentageFromHex(innerOpacity.value) });
195
196
  };
196
197
 
197
198
  const reset = (): void => {
@@ -165,7 +165,7 @@ export default defineComponent({
165
165
  default: true
166
166
  }
167
167
  },
168
- emits: ["update:startDate", "update:endDate"],
168
+ emits: ["update", "update:startDate", "update:endDate"],
169
169
  setup(props, { emit }) {
170
170
  const { parseForPicker, epochToISO, todayToPicker, yesterdayToPicker } = useDateFormat();
171
171
  const { getMessages } = useRules();
@@ -206,6 +206,7 @@ export default defineComponent({
206
206
  innerStartDate.value = value;
207
207
  if (valid.value) {
208
208
  emit("update:startDate", value);
209
+ emit("update", { startDate: innerStartDate.value, endDate: props.endDate });
209
210
  }
210
211
  };
211
212
 
@@ -219,6 +220,7 @@ export default defineComponent({
219
220
  innerEndDate.value = value;
220
221
  if (valid.value) {
221
222
  emit("update:endDate", value);
223
+ emit("update", { startDate: props.startDate, endDate: innerEndDate.value });
222
224
  }
223
225
  };
224
226
 
@@ -354,6 +356,7 @@ export default defineComponent({
354
356
  }
355
357
  emit("update:startDate", innerStartDate.value);
356
358
  emit("update:endDate", innerEndDate.value);
359
+ emit("update", { startDate: innerStartDate.value, endDate: innerEndDate.value });
357
360
  };
358
361
 
359
362
  const innerDateValueChange = (value: number) => {
@@ -417,6 +420,7 @@ export default defineComponent({
417
420
  }
418
421
  emit("update:startDate", innerStartDate.value);
419
422
  emit("update:endDate", innerEndDate.value);
423
+ emit("update", { startDate: innerStartDate.value, endDate: innerEndDate.value });
420
424
  };
421
425
 
422
426
  const onPickDates = (value: number[] | null) => {
@@ -426,6 +430,7 @@ export default defineComponent({
426
430
  if (valid.value) {
427
431
  emit("update:startDate", innerStartDate.value);
428
432
  emit("update:endDate", innerEndDate.value);
433
+ emit("update", { startDate: innerStartDate.value, endDate: innerEndDate.value });
429
434
  }
430
435
  }
431
436
  else {
@@ -433,12 +438,14 @@ export default defineComponent({
433
438
  innerStartDate.value = epochToISO(value[0]);
434
439
  if (valid.value) {
435
440
  emit("update:startDate", innerStartDate.value);
441
+ emit("update", { startDate: innerStartDate.value, endDate: props.endDate });
436
442
  }
437
443
  }
438
444
  if (value && value[1] != null && epochToISO(value[1]) !== innerEndDate.value) {
439
445
  innerEndDate.value = epochToISO(value[1]);
440
446
  if (valid.value) {
441
447
  emit("update:endDate", innerEndDate.value);
448
+ emit("update", { startDate: props.startDate, endDate: innerEndDate.value });
442
449
  }
443
450
  }
444
451
  }
@@ -1249,7 +1249,7 @@ export default defineComponent({
1249
1249
  return header.methodFilterRaw(ff.value, item);
1250
1250
  }
1251
1251
  const flat = property = [property].flat();
1252
- return Array.isArray(flat) ? flat.includes(ff.value) || (!ff.value && flat.length == 0) : (!ff.value && !flat) || ff.value == flat;
1252
+ return (!ff.value && flat.length == 0) || flat.some(f => f == ff.value);
1253
1253
  })
1254
1254
  }));
1255
1255
  filterDictionary[key] = value;
@@ -1272,7 +1272,7 @@ export default defineComponent({
1272
1272
  return header.methodFilterRaw(dv, item);
1273
1273
  }
1274
1274
  const flat = [property].flat().map(mapToInnerValue);
1275
- return Array.isArray(flat) ? flat.includes(dv) || (!dv && flat.length == 0) : (!dv && !flat) || dv == flat;
1275
+ return (!dv && flat.length == 0) || flat.some(f => f == dv);
1276
1276
  })
1277
1277
  }
1278
1278
  });
@@ -21,7 +21,7 @@
21
21
  :width="infoWidth"
22
22
  >
23
23
  <FSCol
24
- gap="6px"
24
+ gap="4px"
25
25
  >
26
26
  <FSSpan
27
27
  font="text-button"
@@ -37,59 +37,63 @@
37
37
  {{ $props.code }}
38
38
  </FSSpan>
39
39
  </FSCol>
40
- <FSRow
41
- v-if="$props.deviceCount"
42
- :wrap="false"
43
- align="center-left"
40
+ <FSCol
41
+ gap="8px"
44
42
  >
45
- <FSColor
46
- width="24px"
47
- height="24px"
48
- :color="ColorEnum.Light"
49
- :border="false"
43
+ <FSRow
44
+ v-if="$props.deviceCount"
45
+ :wrap="false"
46
+ align="center-left"
50
47
  >
51
- <FSRow
52
- align="center-center"
48
+ <FSColor
49
+ width="24px"
50
+ height="24px"
51
+ :color="ColorEnum.Light"
52
+ :border="false"
53
53
  >
54
- <FSSpan
55
- font="text-overline"
54
+ <FSRow
55
+ align="center-center"
56
56
  >
57
- {{ $props.deviceCount <= 99 ? $props.deviceCount : "99+" }}
58
- </FSSpan>
59
- </FSRow>
60
- </FSColor>
61
- <FSSpan
62
- font="text-overline"
63
- >
64
- {{ $tr("entity.location.devices", "Devices") }}
65
- </FSSpan>
66
- </FSRow>
67
- <FSRow
68
- v-if="$props.address"
69
- :wrap="false"
70
- align="center-left"
71
- >
72
- <FSColor
73
- width="24px"
74
- height="24px"
75
- :color="ColorEnum.Light"
76
- :border="false"
77
- >
78
- <FSRow
79
- align="center-center"
57
+ <FSSpan
58
+ font="text-overline"
59
+ >
60
+ {{ $props.deviceCount <= 99 ? $props.deviceCount : "99+" }}
61
+ </FSSpan>
62
+ </FSRow>
63
+ </FSColor>
64
+ <FSSpan
65
+ font="text-overline"
80
66
  >
81
- <FSIcon
82
- icon="mdi-map-marker"
83
- size="16px"
84
- />
85
- </FSRow>
86
- </FSColor>
87
- <FSSpan
88
- font="text-overline"
67
+ {{ $tr("entity.location.devices", "Devices") }}
68
+ </FSSpan>
69
+ </FSRow>
70
+ <FSRow
71
+ v-if="$props.address"
72
+ :wrap="false"
73
+ align="center-left"
89
74
  >
90
- {{ $props.address }}
91
- </FSSpan>
92
- </FSRow>
75
+ <FSColor
76
+ width="24px"
77
+ height="24px"
78
+ :color="ColorEnum.Light"
79
+ :border="false"
80
+ >
81
+ <FSRow
82
+ align="center-center"
83
+ >
84
+ <FSIcon
85
+ icon="mdi-map-marker"
86
+ size="16px"
87
+ />
88
+ </FSRow>
89
+ </FSColor>
90
+ <FSSpan
91
+ font="text-overline"
92
+ >
93
+ {{ $props.address }}
94
+ </FSSpan>
95
+ </FSRow>
96
+ </FSCol>
93
97
  </FSCol>
94
98
  <FSIconCard
95
99
  backgroundVariant="standard"
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.94",
4
+ "version": "1.0.95",
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.94",
14
- "@dative-gpi/foundation-shared-services": "1.0.94"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.95",
14
+ "@dative-gpi/foundation-shared-services": "1.0.95"
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": "be58c8299c1fc3d18c29089e157f248527da9234"
38
+ "gitHead": "b02891a3803f79720eeaf9d4e57054e763d4ba1b"
39
39
  }
@@ -1,9 +1,9 @@
1
1
  .fs-agenda-hours-row {
2
- transform: translateX(calc(-2.4% + 2px));
2
+ transform: var(--fs-agenda-hours-row-transform);
3
3
  }
4
4
 
5
- .fs-agenda-hours-row-text {
6
- padding: 0 2px;
5
+ .fs-agenda-hours-row-markers {
6
+ transform: translateX(calc(-2.4% + 1px)); // 1px is the border width
7
7
  }
8
8
 
9
9
  .fs-agenda-hours-row-marker {
@@ -2,10 +2,11 @@
2
2
  height: var(--fs-group-height);
3
3
  width: var(--fs-group-width);
4
4
  max-width: 100%;
5
- margin: -1px;
6
- padding: 1px;
5
+ margin: 0 -1px 0 0;
7
6
 
8
7
  & > .v-slide-group__container > .v-slide-group__content {
8
+ margin: 0 1px 0 0;
9
+
9
10
  padding: var(--fs-group-padding);
10
11
  gap: var(--fs-group-gap);
11
12