@dative-gpi/foundation-shared-components 1.0.115 → 1.0.117

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.
@@ -11,12 +11,14 @@
11
11
  #body
12
12
  >
13
13
  <FSDialogFormBody
14
+ ref="bodyRef"
14
15
  v-bind="$attrs"
15
16
  :subtitle="$props.subtitle"
16
17
  :validation="$props.validation"
17
18
  @click:cancelButton="$emit('update:modelValue', false)"
18
19
  @click:submitButton="$emit('click:submitButton')"
19
20
  @click:validateButton="onValidate"
21
+ @update:isValidForm="isValidForm = $event"
20
22
  >
21
23
  <template
22
24
  v-for="(_, name) in $slots"
@@ -33,8 +35,8 @@
33
35
  </template>
34
36
 
35
37
  <script lang="ts">
36
- import type { PropType} from "vue";
37
- import { defineComponent } from "vue";
38
+ import type { PropType } from "vue";
39
+ import { defineComponent, ref } from "vue";
38
40
 
39
41
  import FSDialogFormBody from "./FSDialogFormBody.vue";
40
42
  import FSDialog from "./FSDialog.vue";
@@ -74,6 +76,8 @@ export default defineComponent({
74
76
  },
75
77
  emits: ["update:modelValue", "click:validateButton", "click:submitButton"],
76
78
  setup(props, { emit }) {
79
+ const bodyRef = ref<typeof FSDialogFormBody | null>(null);
80
+ const isValidForm = ref(false);
77
81
 
78
82
  const onClose = () => {
79
83
  if (props.validation) {
@@ -87,8 +91,24 @@ export default defineComponent({
87
91
  emit("update:modelValue", false);
88
92
  };
89
93
 
94
+ const resetFormValidation = () => {
95
+ if (bodyRef.value) {
96
+ bodyRef.value.resetFormValidation();
97
+ }
98
+ };
99
+
100
+ const validateForm = async () => {
101
+ if (bodyRef.value) {
102
+ return await bodyRef.value.validateForm();
103
+ }
104
+ };
105
+
90
106
  return {
107
+ resetFormValidation,
108
+ validateForm,
109
+ isValidForm,
91
110
  onValidate,
111
+ bodyRef,
92
112
  onClose
93
113
  };
94
114
  }
@@ -6,7 +6,7 @@
6
6
  ref="formRef"
7
7
  :variant="$props.variant"
8
8
  @submit="onSubmit"
9
- v-model="valid"
9
+ v-model="isValidForm"
10
10
  >
11
11
  <FSCol
12
12
  gap="24px"
@@ -89,7 +89,7 @@
89
89
  </template>
90
90
 
91
91
  <script lang="ts">
92
- import { computed, defineComponent, type PropType, ref } from "vue";
92
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
93
93
 
94
94
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
95
95
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -114,11 +114,6 @@ export default defineComponent({
114
114
  required: false,
115
115
  default: "submit"
116
116
  },
117
- modelValue: {
118
- type: Boolean,
119
- required: false,
120
- default: false
121
- },
122
117
  subtitle: {
123
118
  type: String as PropType<string | null>,
124
119
  required: false,
@@ -225,13 +220,13 @@ export default defineComponent({
225
220
  default: true
226
221
  }
227
222
  },
228
- emits: ["click:cancelButton", "click:submitButton", "click:validateButton"],
223
+ emits: ["click:cancelButton", "click:submitButton", "click:validateButton", "update:isValidForm"],
229
224
  setup(props, { emit }) {
230
225
  const { isMobileSized } = useBreakpoints();
231
226
  const { $tr } = useTranslationsProvider();
232
227
 
233
- const formRef = ref<HTMLElement | null>(null);
234
- const valid = ref(false);
228
+ const formRef = ref<typeof FSForm | null>(null);
229
+ const isValidForm = ref(null);
235
230
 
236
231
  const maxHeight = computed(() => {
237
232
  const other = 24 + 24 // Paddings
@@ -253,8 +248,20 @@ export default defineComponent({
253
248
  return props.validateButtonLabel ?? $tr("button.validate", "Done");
254
249
  });
255
250
 
251
+ const resetFormValidation = () => {
252
+ if (formRef.value) {
253
+ formRef.value.resetValidation();
254
+ }
255
+ };
256
+
257
+ const validateForm = async () => {
258
+ if (formRef.value) {
259
+ return await formRef.value.validate();
260
+ }
261
+ };
262
+
256
263
  const onSubmit = () => {
257
- if (valid.value) {
264
+ if (isValidForm.value) {
258
265
  emit("click:submitButton");
259
266
  }
260
267
  };
@@ -262,17 +269,23 @@ export default defineComponent({
262
269
  const onValidate = () => {
263
270
  emit("click:validateButton");
264
271
  };
272
+
273
+ watch(() => isValidForm.value, () => {
274
+ emit("update:isValidForm", isValidForm.value);
275
+ }, { immediate: true });
265
276
 
266
277
  return {
278
+ resetFormValidation,
267
279
  validateLabel,
280
+ validateForm,
281
+ isValidForm,
268
282
  cancelLabel,
269
283
  submitLabel,
284
+ onValidate,
270
285
  ColorEnum,
271
286
  maxHeight,
272
- formRef,
273
- valid,
274
- onValidate,
275
- onSubmit
287
+ onSubmit,
288
+ formRef
276
289
  };
277
290
  }
278
291
  });
@@ -12,6 +12,9 @@
12
12
 
13
13
  <script lang="ts">
14
14
  import type { PropType} from "vue";
15
+
16
+ import type VForm from "vuetify/lib/components/VForm";
17
+
15
18
  import { computed, defineComponent, provide, ref } from "vue";
16
19
 
17
20
  export default defineComponent({
@@ -30,7 +33,7 @@ export default defineComponent({
30
33
  },
31
34
  emits: ["update:modelValue", "submit"],
32
35
  setup(props, { emit }) {
33
- const formRef = ref<HTMLFormElement | null>(null);
36
+ const formRef = ref<typeof VForm | null>(null);
34
37
  const submitted = ref(false);
35
38
 
36
39
  const validateOn = computed((): "submit" | "input" => {
@@ -44,25 +47,24 @@ export default defineComponent({
44
47
  event.stopImmediatePropagation();
45
48
  event.preventDefault();
46
49
  submitted.value = true;
47
- await (formRef.value as any).validate();
48
- emit("update:modelValue", !!((formRef.value as any).isValid ?? true));
49
- emit("submit", !!((formRef.value as any).isValid ?? true));
50
+ await formRef.value.validate();
51
+ emit("update:modelValue", !!(formRef.value.isValid ?? true));
52
+ emit("submit", !!(formRef.value.isValid ?? true));
50
53
  };
51
54
 
52
55
  const validate = async () => {
53
56
  submitted.value = true;
54
- await (formRef.value as any).validate();
55
- emit("update:modelValue", !!((formRef.value as any).isValid ?? true));
57
+ return await formRef.value.validate();
56
58
  };
57
59
 
58
60
  const reset = () => {
59
61
  submitted.value = false;
60
- (formRef.value as any).reset();
62
+ formRef.value.reset();
61
63
  };
62
64
 
63
65
  const resetValidation = () => {
64
66
  submitted.value = false;
65
- (formRef.value as any).resetValidation();
67
+ formRef.value.resetValidation();
66
68
  };
67
69
 
68
70
  provide("validateOn", validateOn);
@@ -9,10 +9,10 @@
9
9
  <FSRow
10
10
  align="center-center"
11
11
  >
12
- <FSIcon
12
+ <FSIcon
13
13
  :variant="$props.iconVariant"
14
14
  :color="$props.iconColor"
15
- :size="$props.iconSize"
15
+ :size="actualIconSize"
16
16
  >
17
17
  {{ $props.icon }}
18
18
  </FSIcon>
@@ -21,10 +21,12 @@
21
21
  </template>
22
22
 
23
23
  <script lang="ts">
24
- import { defineComponent, type PropType } from "vue";
24
+ import { defineComponent, type PropType, computed } from "vue";
25
25
 
26
26
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
27
27
 
28
+ import { sizeToVar } from "../utils";
29
+
28
30
  import FSCard from "./FSCard.vue";
29
31
  import FSIcon from "./FSIcon.vue";
30
32
 
@@ -68,13 +70,28 @@ export default defineComponent({
68
70
  iconSize: {
69
71
  type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
70
72
  required: false,
71
- default: "42px"
73
+ default: null
72
74
  },
73
75
  border: {
74
76
  type: Boolean,
75
77
  required: false,
76
78
  default: true
77
79
  }
80
+ },
81
+ setup(props){
82
+ const actualIconSize = computed(() => {
83
+ if (props.iconSize){
84
+ return props.iconSize;
85
+ }
86
+ else if (props.size) {
87
+ return `calc(${sizeToVar(props.size)} * 0.42)`;
88
+ }
89
+ return "42px";
90
+ });
91
+
92
+ return {
93
+ actualIconSize
94
+ };
78
95
  }
79
96
  });
80
97
  </script>
@@ -45,20 +45,20 @@
45
45
  </template>
46
46
  </FSCol>
47
47
  </FSFadeOut>
48
- <FSRow
48
+ <template
49
49
  v-else-if="$props.direction == 'row'"
50
50
  >
51
- <template
51
+ <FSRow
52
52
  v-if="$props.loading"
53
53
  >
54
54
  <FSLoader
55
55
  v-for="i in 4"
56
56
  :key="i"
57
- width="100%"
57
+ width="100px"
58
58
  height="50px"
59
59
  />
60
- </template>
61
- <template
60
+ </FSRow>
61
+ <FSRow
62
62
  v-else
63
63
  >
64
64
  <FSSimpleListItem
@@ -76,8 +76,8 @@
76
76
  @click:edit="$emit('click:edit', $event)"
77
77
  @click:remove="$emit('click:remove', $event)"
78
78
  />
79
- </template>
80
- </FSRow>
79
+ </FSRow>
80
+ </template>
81
81
  <FSSlideGroup
82
82
  v-else
83
83
  >
@@ -15,7 +15,7 @@
15
15
 
16
16
  <FSRow
17
17
  padding="24px 16px 16px 24px"
18
- style="position: sticky; top: 0px; z-index: 1;"
18
+ style="position: sticky; top: 0px; z-index: 2;"
19
19
  :style="{ backgroundColor, marginTop: $props.stickyTitleTopOffset }"
20
20
  >
21
21
  <slot
@@ -46,7 +46,7 @@
46
46
  <FSRow
47
47
  v-if="$slots.toolbar"
48
48
  padding="0px 16px 8px 24px"
49
- :style="stickyToolbar ? `position: sticky; top: ${$props.toolbarTopOffset}; z-index: 1; background-color: ${backgroundColor}` : undefined"
49
+ :style="stickyToolbar ? `position: sticky; top: ${$props.toolbarTopOffset}; z-index: 2; background-color: ${backgroundColor}` : undefined"
50
50
  >
51
51
  <FSSlideGroup
52
52
  width="100%"
@@ -32,8 +32,8 @@
32
32
  :backgroundColor="$props.iconBackgroundColors"
33
33
  :iconColor="$props.iconColor"
34
34
  :border="$props.iconBorder"
35
- :icon="$props.icon"
36
35
  :size="actualImageSize"
36
+ :icon="$props.icon"
37
37
  />
38
38
  <FSCol
39
39
  align="center-left"
@@ -15,7 +15,7 @@
15
15
 
16
16
  <FSRow
17
17
  padding="24px 16px 16px 24px"
18
- style="position: sticky; top: 0px; z-index: 1;"
18
+ style="position: sticky; top: 0px; z-index: 2;"
19
19
  :style="{ backgroundColor, marginTop: $props.stickyTitleTopOffset }"
20
20
  >
21
21
  <slot
@@ -46,7 +46,7 @@
46
46
  <FSRow
47
47
  v-if="$slots.toolbar"
48
48
  padding="0px 16px 8px 24px"
49
- :style="stickyToolbar ? `position: sticky; top: ${$props.toolbarTopOffset}; z-index: 1; background-color: ${backgroundColor}` : undefined"
49
+ :style="stickyToolbar ? `position: sticky; top: ${$props.toolbarTopOffset}; z-index: 2; background-color: ${backgroundColor}` : undefined"
50
50
  >
51
51
  <FSSlideGroup>
52
52
  <slot
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.115",
4
+ "version": "1.0.117",
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.115",
14
- "@dative-gpi/foundation-shared-services": "1.0.115"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.117",
14
+ "@dative-gpi/foundation-shared-services": "1.0.117"
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": "0ff354e450d124ae789dcca1d4e08d76b927ed22"
38
+ "gitHead": "2ebf4b9959a5da859e4c9086262b0772338a62c0"
39
39
  }