@dative-gpi/foundation-shared-components 1.0.125 → 1.0.126-fix-imports

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.
@@ -1,10 +1,53 @@
1
1
  <template>
2
+ <template
3
+ v-if="noMatch"
4
+ >
5
+ <slot
6
+ name="error"
7
+ >
8
+ <FSRow
9
+ padding="16px"
10
+ :width="$props.width"
11
+ >
12
+ <FSCol
13
+ align="center-center"
14
+ gap="16px"
15
+ >
16
+ <FSCol
17
+ align="center-center"
18
+ >
19
+ <FSIcon
20
+ size="42px"
21
+ :color="ColorEnum.Error"
22
+ >
23
+ mdi-alert-outline
24
+ </FSIcon>
25
+ <FSText
26
+ font="text-h3"
27
+ >
28
+ {{ $tr("window.no-access-title", "Nothing to see here") }}
29
+ </FSText>
30
+ </FSCol>
31
+ <FSText
32
+ :lineClamp="2"
33
+ >
34
+ {{ $tr("window.no-access-body", "It seems you either do not have access to this content, or there is nothing to display here") }}
35
+ </FSText>
36
+ <FSButton
37
+ :label="$tr('window.no-access-button', 'Go back')"
38
+ :color="ColorEnum.Primary"
39
+ @click="goBack"
40
+ />
41
+ </FSCol>
42
+ </FSRow>
43
+ </slot>
44
+ </template>
2
45
  <v-window
3
46
  class="fs-window"
47
+ ref="windowRef"
4
48
  :touch="false"
5
49
  :style="style"
6
50
  :modelValue="$props.modelValue"
7
- @update:modelValue="$emit('update:modelValue', $event)"
8
51
  v-bind="$attrs"
9
52
  >
10
53
  <template
@@ -35,8 +78,23 @@ import { computed, defineComponent, type PropType, ref, type StyleValue, type VN
35
78
  import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
36
79
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
37
80
 
81
+ import { ColorEnum } from "../models";
82
+
83
+ import FSButton from "./FSButton.vue";
84
+ import FSCard from "./FSCard.vue";
85
+ import FSIcon from "./FSIcon.vue";
86
+ import FSText from "./FSText.vue";
87
+ import FSRow from "./FSRow.vue";
88
+
38
89
  export default defineComponent({
39
90
  name: "FSWindow",
91
+ components: {
92
+ FSButton,
93
+ FSCard,
94
+ FSIcon,
95
+ FSText,
96
+ FSRow
97
+ },
40
98
  props: {
41
99
  width: {
42
100
  type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
@@ -54,11 +112,13 @@ export default defineComponent({
54
112
  default: 0
55
113
  }
56
114
  },
57
- emits: ["update:modelValue"],
58
- setup(props) {
115
+ emits: ["update:modelValue", "error"],
116
+ setup(props, { emit }) {
59
117
  const { slots, getChildren } = useSlots();
60
118
 
61
119
  delete slots.default;
120
+
121
+ const windowRef = ref<any | null>(null);
62
122
 
63
123
  const showOverflow = ref(true);
64
124
  const overflowTimeout = ref<NodeJS.Timeout | null>(null);
@@ -84,10 +144,39 @@ export default defineComponent({
84
144
  }, 560);
85
145
  });
86
146
 
147
+ const noMatch = computed(() => {
148
+ if (!windowRef.value) {
149
+ return;
150
+ }
151
+
152
+ // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VWindow/VWindow.tsx
153
+ // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/group.ts#L161
154
+ const group = windowRef.value.group;
155
+ return !group.items.value.find((item: any) => item.value === props.modelValue);
156
+ });
157
+
158
+ const goBack = (): void => {
159
+ if (!windowRef.value) {
160
+ emit("error");
161
+ return;
162
+ }
163
+
164
+ const group = windowRef.value.group;
165
+ if (!group.items.value.length) {
166
+ emit("error");
167
+ return;
168
+ }
169
+ emit("update:modelValue", group.items.value[0].value);
170
+ };
171
+
87
172
  return {
173
+ ColorEnum,
174
+ windowRef,
175
+ noMatch,
88
176
  slots,
89
177
  style,
90
178
  getChildren,
179
+ goBack,
91
180
  value
92
181
  };
93
182
  }
@@ -44,7 +44,7 @@
44
44
  name="default"
45
45
  :label="label"
46
46
  :icon="icon"
47
- :iconBis="iconBis"
47
+ :iconBis="endToday ? iconBis : null"
48
48
  :timeStart="epochToShortTimeOnlyFormat($props.start)"
49
49
  :timeEnd="epochToShortTimeOnlyFormat($props.end)"
50
50
  :variant="$props.variant"
@@ -120,12 +120,20 @@ export default defineComponent({
120
120
  return dayEnd.value - props.dayStart;
121
121
  });
122
122
 
123
+ const startToday = computed(() => {
124
+ return props.start >= props.dayStart;
125
+ });
126
+
127
+ const endToday = computed(() => {
128
+ return props.end <= dayEnd.value;
129
+ });
130
+
123
131
  const dayDurationOffset = computed(() => {
124
132
  return dayDuration.value - dayToMillisecond(1);
125
133
  });
126
134
 
127
135
  const leftPosition = computed(() => {
128
- if (props.start < props.dayStart) {
136
+ if (!startToday.value) {
129
137
  return 0;
130
138
  }
131
139
  return millisecondToDay(props.start - props.dayStart - dayDurationOffset.value) * 100;
@@ -136,10 +144,10 @@ export default defineComponent({
136
144
  let end = props.end - dayDurationOffset.value;
137
145
  if(props.variant === 'current' && dayEnd.value > props.now) {
138
146
  end = props.now;
139
- } else if (props.end > dayEnd.value) {
147
+ } else if (!endToday.value) {
140
148
  end = dayEnd.value - dayDurationOffset.value;
141
149
  }
142
- if (props.start < props.dayStart) {
150
+ if (!startToday.value) {
143
151
  start = props.dayStart;
144
152
  }
145
153
 
@@ -150,12 +158,14 @@ export default defineComponent({
150
158
  const style = computed((): StyleValue => {
151
159
  return {
152
160
  '--fs-agenda-event-left': `${leftPosition.value}%`,
161
+ '--fs-agenda-event-border-width': startToday.value ? '3px' : '0px',
153
162
  };
154
163
  });
155
164
 
156
165
  return {
157
166
  style,
158
167
  width,
168
+ endToday,
159
169
  epochToShortTimeOnlyFormat
160
170
  };
161
171
  }
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.125",
4
+ "version": "1.0.126-fix-imports",
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.125",
14
- "@dative-gpi/foundation-shared-services": "1.0.125"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.126-fix-imports",
14
+ "@dative-gpi/foundation-shared-services": "1.0.126-fix-imports"
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": "fe376a2d6846d6830925a36d0d7a54ec6e71a141"
38
+ "gitHead": "a33ad553014a5e4bec951107b73444080b2d7dd5"
39
39
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  >.fs-card {
11
- border-left: solid 3px var(--fs-clickable-border-color) !important;
11
+ border-left: solid var(--fs-agenda-event-border-width) var(--fs-clickable-border-color) !important;
12
12
  }
13
13
  }
14
14