@dative-gpi/foundation-shared-components 0.0.58 → 0.0.60

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.
@@ -6,6 +6,7 @@
6
6
  :variant="$props.variant"
7
7
  :color="$props.color"
8
8
  :load="$props.load"
9
+ :href="$props.href"
9
10
  :padding="padding"
10
11
  :to="$props.to"
11
12
  :style="style"
@@ -60,6 +61,23 @@
60
61
  :color="loadColor"
61
62
  />
62
63
  </template>
64
+ <template v-else-if="$props.href">
65
+ <a
66
+ :href="$props.href"
67
+ >
68
+ <FSIcon
69
+ v-if="$props.icon"
70
+ size="l"
71
+ >
72
+ {{ $props.icon }}
73
+ </FSIcon>
74
+ <FSSpan
75
+ v-if="$props.label"
76
+ >
77
+ {{ $props.label }}
78
+ </FSSpan>
79
+ </a>
80
+ </template>
63
81
  <template v-else-if="$props.to">
64
82
  <router-link
65
83
  :to="$props.to"
@@ -115,7 +133,12 @@ export default defineComponent({
115
133
  },
116
134
  props: {
117
135
  to: {
118
- type: [String, Object] as PropType<string | RouteLocation>,
136
+ type: [String, Object] as PropType<string | RouteLocation | null>,
137
+ required: false,
138
+ default: null
139
+ },
140
+ href: {
141
+ type: String as PropType<string | null>,
119
142
  required: false,
120
143
  default: null
121
144
  },
@@ -232,7 +255,7 @@ export default defineComponent({
232
255
  });
233
256
 
234
257
  const onClick = (event: MouseEvent) => {
235
- if (!props.to && props.editable && !props.load) {
258
+ if (!props.to && !props.href && props.editable && !props.load) {
236
259
  emit("click", event);
237
260
  }
238
261
  };
@@ -1,9 +1,8 @@
1
1
  <template>
2
- <button
3
- v-if="!href"
4
- :type="$props.type"
2
+ <a
3
+ v-if="$props.href"
4
+ :href="$props.href"
5
5
  :style="style"
6
- @click.stop="onClick"
7
6
  >
8
7
  <FSCard
9
8
  :height="$props.height"
@@ -25,11 +24,11 @@
25
24
  :color="loadColor"
26
25
  />
27
26
  </template>
28
- </button>
27
+ </a>
29
28
  <router-link
30
- v-else
29
+ v-else-if="$props.to"
31
30
  :style="style"
32
- :to="href"
31
+ :to="$props.to"
33
32
  >
34
33
  <FSCard
35
34
  :height="$props.height"
@@ -52,6 +51,33 @@
52
51
  />
53
52
  </template>
54
53
  </router-link>
54
+ <button
55
+ v-else
56
+ :type="$props.type"
57
+ :style="style"
58
+ @click.stop="onClick"
59
+ >
60
+ <FSCard
61
+ :height="$props.height"
62
+ :width="$props.width"
63
+ :class="classes"
64
+ :style="style"
65
+ v-bind="$attrs"
66
+ >
67
+ <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
68
+ <slot :name="name" v-bind="slotData" />
69
+ </template>
70
+ </FSCard>
71
+ <template v-if="$props.load">
72
+ <v-progress-circular
73
+ class="fs-clickable-load"
74
+ width="2"
75
+ size="24"
76
+ :indeterminate="true"
77
+ :color="loadColor"
78
+ />
79
+ </template>
80
+ </button>
55
81
  </template>
56
82
 
57
83
  <script lang="ts">
@@ -81,7 +107,12 @@ export default defineComponent({
81
107
  default: null
82
108
  },
83
109
  to: {
84
- type: [String, Object] as PropType<string | RouteLocation>,
110
+ type: [String, Object] as PropType<string | RouteLocation | null>,
111
+ required: false,
112
+ default: null
113
+ },
114
+ href: {
115
+ type: String as PropType<string | null>,
85
116
  required: false,
86
117
  default: null
87
118
  },
@@ -93,7 +124,7 @@ export default defineComponent({
93
124
  type: {
94
125
  type: String as PropType<"button" | "submit">,
95
126
  required: false,
96
- default: "button"
127
+ default: "submit"
97
128
  },
98
129
  color: {
99
130
  type: String as PropType<ColorBase>,
@@ -200,18 +231,6 @@ export default defineComponent({
200
231
  return classNames;
201
232
  });
202
233
 
203
- const href = computed((): string | null => {
204
- if (!props.to || !props.editable || props.load) {
205
- return null;
206
- }
207
- if (typeof props.to === "string") {
208
- return props.to;
209
- }
210
- else {
211
- return router.resolve(props.to).href;
212
- }
213
- });
214
-
215
234
  const loadColor = computed((): string => {
216
235
  switch (props.color) {
217
236
  case ColorEnum.Primary:
@@ -223,7 +242,7 @@ export default defineComponent({
223
242
  });
224
243
 
225
244
  const onClick = (event: MouseEvent) => {
226
- if (!props.to && props.editable && !props.load) {
245
+ if (!props.to && !props.href && props.editable && !props.load) {
227
246
  emit("click", event);
228
247
  }
229
248
  };
@@ -232,7 +251,6 @@ export default defineComponent({
232
251
  loadColor,
233
252
  classes,
234
253
  style,
235
- href,
236
254
  onClick
237
255
  };
238
256
  }
@@ -1,8 +1,18 @@
1
1
  <template>
2
+ <a
3
+ v-if="$props.href"
4
+ :href="$props.href"
5
+ :style="style"
6
+ >
7
+ <slot>
8
+ {{ $props.label }}
9
+ </slot>
10
+ </a>
2
11
  <router-link
12
+ v-else-if="$props.to"
13
+ :to="$props.to"
3
14
  :class="classes"
4
15
  :style="style"
5
- :to="href"
6
16
  v-slot="props"
7
17
  v-bind="$attrs"
8
18
  >
@@ -28,9 +38,14 @@ export default defineComponent({
28
38
  default: null
29
39
  },
30
40
  to: {
31
- type: [String, Object] as PropType<string | RouteLocation>,
41
+ type: [String, Object] as PropType<string | RouteLocation | null>,
32
42
  required: false,
33
- default: "_blank"
43
+ default: null
44
+ },
45
+ href: {
46
+ type: String as PropType<string | null>,
47
+ required: false,
48
+ default: null
34
49
  },
35
50
  font: {
36
51
  type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline" | "text-underline">,
@@ -96,19 +111,9 @@ export default defineComponent({
96
111
  }
97
112
  });
98
113
 
99
- const href = computed((): string => {
100
- if (typeof props.to === "string") {
101
- return props.to;
102
- }
103
- else {
104
- return router.resolve(props.to).href;
105
- }
106
- });
107
-
108
114
  return {
109
115
  classes,
110
- style,
111
- href
116
+ style
112
117
  };
113
118
  }
114
119
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.58",
4
+ "version": "0.0.60",
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": "0.0.58",
14
- "@dative-gpi/foundation-shared-services": "0.0.58",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.60",
14
+ "@dative-gpi/foundation-shared-services": "0.0.60",
15
15
  "@fontsource/montserrat": "^5.0.16",
16
16
  "@lexical/clipboard": "^0.12.5",
17
17
  "@lexical/history": "^0.12.5",
@@ -32,5 +32,5 @@
32
32
  "sass": "^1.69.5",
33
33
  "sass-loader": "^13.3.2"
34
34
  },
35
- "gitHead": "13e01a0600c89855de090bcd7dd75bb768a96888"
35
+ "gitHead": "094e1265a607ecec7b13b0478c5fd0463b15c5d5"
36
36
  }