@dative-gpi/foundation-shared-components 0.0.113 → 0.0.115

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.
@@ -55,6 +55,16 @@ export default defineComponent({
55
55
  emit("update:modelValue", !!((formRef.value as any).isValid ?? true));
56
56
  };
57
57
 
58
+ const reset = () => {
59
+ submitted.value = false;
60
+ (formRef.value as any).reset();
61
+ };
62
+
63
+ const resetValidation = () => {
64
+ submitted.value = false;
65
+ (formRef.value as any).resetValidation();
66
+ };
67
+
58
68
  provide("validateOn", validateOn);
59
69
  provide("submitted", submitted);
60
70
 
@@ -62,8 +72,10 @@ export default defineComponent({
62
72
  validateOn,
63
73
  submitted,
64
74
  formRef,
75
+ reset,
76
+ validate,
65
77
  onSubmit,
66
- validate
78
+ resetValidation
67
79
  };
68
80
  }
69
81
  });
@@ -17,6 +17,7 @@
17
17
  />
18
18
  <FSButtonPreviousIcon
19
19
  :color="ColorEnum.Dark"
20
+ :disabled="false"
20
21
  @click="goToPrev"
21
22
  />
22
23
  </template>
@@ -37,6 +38,7 @@
37
38
  >
38
39
  <FSButtonNextIcon
39
40
  :color="ColorEnum.Dark"
41
+ :disabled="false"
40
42
  @click="goToNext"
41
43
  />
42
44
  <FSButton
@@ -50,7 +52,7 @@
50
52
  </template>
51
53
 
52
54
  <script lang="ts">
53
- import { computed, defineComponent, PropType, ref } from "vue";
55
+ import { computed, defineComponent, onMounted, onUnmounted, PropType, ref } from "vue";
54
56
 
55
57
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
56
58
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -96,6 +98,7 @@ export default defineComponent({
96
98
  const darks = getColors(ColorEnum.Dark);
97
99
 
98
100
  const slideGroupRef = ref<HTMLElement | null>(null);
101
+ const resizeObserver = ref<ResizeObserver | null>(null);
99
102
 
100
103
  const style = computed((): { [key: string] : string | null | undefined } => ({
101
104
  "--fs-group-arrows-width": props.dash ? "52px" : "32px",
@@ -131,6 +134,23 @@ export default defineComponent({
131
134
  }
132
135
  };
133
136
 
137
+ onMounted((): void => {
138
+ resizeObserver.value = new ResizeObserver(entries => {
139
+ entries.forEach(() => {
140
+ (slideGroupRef.value as any).scrollTo("prev");
141
+ });
142
+ });
143
+ if (document.querySelector(".fs-slide-group")) {
144
+ resizeObserver.value.observe(document.querySelector(".fs-slide-group")!);
145
+ }
146
+ });
147
+
148
+ onUnmounted((): void => {
149
+ if (resizeObserver.value) {
150
+ resizeObserver.value.disconnect();
151
+ }
152
+ });
153
+
134
154
  return {
135
155
  slideGroupRef,
136
156
  ColorEnum,
@@ -17,7 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
- import { computed, defineComponent, PropType, ref } from "vue";
20
+ import { computed, defineComponent, onMounted, onUnmounted, PropType, ref } from "vue";
21
21
 
22
22
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
23
23
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -43,7 +43,8 @@ export default defineComponent({
43
43
 
44
44
  const darks = getColors(ColorEnum.Dark);
45
45
 
46
- const wrapGroupRef = ref(null);
46
+ const wrapGroupRef = ref<HTMLElement | null>(null);
47
+ const resizeObserver = ref<ResizeObserver | null>(null);
47
48
 
48
49
  const style = computed((): { [key: string] : string | null | undefined } => ({
49
50
  "--fs-group-padding" : sizeToVar(props.padding),
@@ -52,6 +53,23 @@ export default defineComponent({
52
53
  "--fs-group-hover-color": darks.dark
53
54
  }));
54
55
 
56
+ onMounted((): void => {
57
+ resizeObserver.value = new ResizeObserver(entries => {
58
+ entries.forEach(() => {
59
+ (wrapGroupRef.value as any).scrollTo("prev");
60
+ });
61
+ });
62
+ if (document.querySelector(".fs-wrap-group")) {
63
+ resizeObserver.value.observe(document.querySelector(".fs-wrap-group")!);
64
+ }
65
+ });
66
+
67
+ onUnmounted((): void => {
68
+ if (resizeObserver.value) {
69
+ resizeObserver.value.disconnect();
70
+ }
71
+ });
72
+
55
73
  return {
56
74
  wrapGroupRef,
57
75
  style,
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
3
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
+ :customFilter="customFilter"
4
5
  :multiple="$props.multiple"
5
6
  :loading="loading"
6
7
  :items="timeZones"
@@ -127,6 +128,10 @@ export default defineComponent({
127
128
  return getManyTimeZones({ ...props.timeZoneFilters, search: search ?? undefined });
128
129
  };
129
130
 
131
+ const customFilter = (_: any, search: string, item: any): boolean => {
132
+ return item.raw.id.toLowerCase().includes(search.toLowerCase());
133
+ };
134
+
130
135
  const { toggleSet, search, init, onUpdate } = useAutocomplete(
131
136
  timeZones,
132
137
  [() => props.timeZoneFilters],
@@ -142,6 +147,7 @@ export default defineComponent({
142
147
  toggleSet,
143
148
  loading,
144
149
  search,
150
+ customFilter,
145
151
  onUpdate
146
152
  };
147
153
  }
@@ -14,7 +14,7 @@
14
14
  :class="classes"
15
15
  :rows="$props.rows"
16
16
  :hideDetails="true"
17
- :noResize="!$props.resize"
17
+ :noResize="true"
18
18
  :autoGrow="$props.autoGrow"
19
19
  :readonly="!$props.editable"
20
20
  :clearable="$props.clearable && $props.editable && !!$props.modelValue"
@@ -37,13 +37,17 @@
37
37
  <template
38
38
  #clear
39
39
  >
40
- <FSButton
41
- v-if="$props.clearable && $props.editable && !!$props.modelValue"
42
- icon="mdi-close"
43
- variant="icon"
44
- :color="ColorEnum.Dark"
45
- @click="$emit('update:modelValue', null)"
46
- />
40
+ <FSCol
41
+ align="center-center"
42
+ >
43
+ <FSButton
44
+ v-if="$props.clearable && $props.editable && !!$props.modelValue"
45
+ icon="mdi-close"
46
+ variant="icon"
47
+ :color="ColorEnum.Dark"
48
+ @click="$emit('update:modelValue', null)"
49
+ />
50
+ </FSCol>
47
51
  </template>
48
52
  </v-textarea>
49
53
  </FSBaseField>
@@ -56,11 +60,13 @@ import { useColors, useBreakpoints, useRules } from "@dative-gpi/foundation-shar
56
60
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
57
61
 
58
62
  import FSBaseField from "./FSBaseField.vue";
63
+ import FSCol from "../FSCol.vue";
59
64
 
60
65
  export default defineComponent({
61
66
  name: "FSTextArea",
62
67
  components: {
63
- FSBaseField
68
+ FSBaseField,
69
+ FSCol
64
70
  },
65
71
  props: {
66
72
  label: {
@@ -83,11 +89,6 @@ export default defineComponent({
83
89
  required: false,
84
90
  default: 1
85
91
  },
86
- resize: {
87
- type: Boolean,
88
- required: false,
89
- default: false
90
- },
91
92
  autoGrow: {
92
93
  type: Boolean,
93
94
  required: false,
@@ -136,17 +137,17 @@ export default defineComponent({
136
137
 
137
138
  const style = computed((): { [key: string] : string | null | undefined } => {
138
139
  let height: string | undefined = undefined;
139
- let minHeight: string | undefined = undefined;
140
+ let fieldHeight: string | undefined = undefined;
140
141
  if (!props.autoGrow) {
141
- const base = isMobileSized.value ? 30 : 34;
142
- const row = isMobileSized.value ? 16 : 20;
143
- minHeight = `${base}px`;
142
+ const base = isMobileSized.value ? 34 : 38;
143
+ const row = isMobileSized.value ? 14 : 16;
144
144
  if (props.rows > 1) {
145
145
  height = `${base + (props.rows - 1) * row}px`;
146
146
  }
147
147
  else {
148
148
  height = `${base}px`;
149
149
  }
150
+ fieldHeight = `${props.rows * row}px`;
150
151
  }
151
152
  if (!props.editable) {
152
153
  return {
@@ -154,8 +155,8 @@ export default defineComponent({
154
155
  "--fs-text-area-border-color" : lights.base,
155
156
  "--fs-text-area-color" : lights.dark,
156
157
  "--fs-text-area-active-border-color": lights.base,
157
- "--fs-text-area-min-height" : minHeight,
158
- "--fs-text-area-height" : height
158
+ "--fs-text-area-height" : height,
159
+ "--fs-text-area-field-height" : fieldHeight
159
160
  };
160
161
  }
161
162
  return {
@@ -164,8 +165,8 @@ export default defineComponent({
164
165
  "--fs-text-area-color" : darks.base,
165
166
  "--fs-text-area-active-border-color": darks.dark,
166
167
  "--fs-text-area-error-border-color" : errors.base,
167
- "--fs-text-area-min-height" : minHeight,
168
- "--fs-text-area-height" : height
168
+ "--fs-text-area-height" : height,
169
+ "--fs-text-area-field-height" : fieldHeight
169
170
  };
170
171
  });
171
172
 
@@ -185,7 +186,7 @@ export default defineComponent({
185
186
  messages,
186
187
  blurred,
187
188
  classes,
188
- style,
189
+ style
189
190
  };
190
191
  }
191
192
  });
@@ -124,7 +124,7 @@
124
124
  :class="classes"
125
125
  :page="innerPage"
126
126
  :itemsPerPage="innerRowsPerPage"
127
- :modelValue="innerValue"
127
+ :modelValue="$props.modelValue"
128
128
  @auxclick:row="onClickRow"
129
129
  @click:row="onClickRow"
130
130
  @update:sortBy="innerSortBy = $event ? $event[0] : null"
@@ -167,7 +167,7 @@
167
167
  width="hug"
168
168
  >
169
169
  <FSCheckbox
170
- :modelValue="innerValue.includes(props.item[$props.itemValue])"
170
+ :modelValue="$props.modelValue.includes(props.item[$props.itemValue])"
171
171
  @update:modelValue="toggleSelect(props.item)"
172
172
  />
173
173
  </FSRow>
@@ -237,8 +237,8 @@
237
237
  >
238
238
  <FSCheckbox
239
239
  v-if="$props.showSelect"
240
- :modelValue="props.item.items.every((item) => innerValue.includes(item.key))"
241
- :indeterminate="innerValue.some((id) => props.item.items.some((item) => item.key === id)) && !props.item.items.every((item) => innerValue.includes(item.key))"
240
+ :modelValue="props.item.items.every((item) => $props.modelValue.includes(item.key))"
241
+ :indeterminate="$props.modelValue.some((id) => props.item.items.some((item) => item.key === id)) && !props.item.items.every((item) => $props.modelValue.includes(item.key))"
242
242
  @update:modelValue="toggleSelectGroup(props.item)"
243
243
  />
244
244
  <FSText>
@@ -441,7 +441,7 @@
441
441
  :color="$props.color"
442
442
  :item="item.raw"
443
443
  :key="index"
444
- :modelValue="innerValue.includes(item.raw[$props.itemValue])"
444
+ :modelValue="$props.modelValue.includes(item.raw[$props.itemValue])"
445
445
  @update:modelValue="toggleSelect"
446
446
  >
447
447
  <template
@@ -591,7 +591,7 @@
591
591
  :color="$props.color"
592
592
  :item="item.raw"
593
593
  :key="index"
594
- :modelValue="innerValue.includes(item.raw[$props.itemValue])"
594
+ :modelValue="$props.modelValue.includes(item.raw[$props.itemValue])"
595
595
  @update:modelValue="toggleSelect"
596
596
  >
597
597
  <template
@@ -645,7 +645,8 @@ import { useRouter } from "vue-router";
645
645
  import { ColorEnum, FSDataTableColumn, FSDataTableFilter, FSDataTableOrder, FSToggle } from "@dative-gpi/foundation-shared-components/models";
646
646
  import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
647
647
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
648
- import { sizeToVar } from "../../utils";
648
+
649
+ import { alphanumericSort, sizeToVar } from "../../utils";
649
650
 
650
651
  import FSDataIteratorItem from "./FSDataIteratorItem.vue";
651
652
  import FSSearchField from "../fields/FSSearchField.vue";
@@ -831,7 +832,6 @@ export default defineComponent({
831
832
  const filters = ref<{ [key: string]: FSDataTableFilter[] }>({});
832
833
  const innerSearch: Ref<string | null> = ref(null);
833
834
  const innerRowsPerPage = ref(props.rowsPerPage);
834
- const innerValue = ref(props.modelValue);
835
835
  const innerSortBy = ref(props.sortBy);
836
836
  const innerMode = ref(props.mode);
837
837
  const innerPage = ref(props.page);
@@ -945,19 +945,7 @@ export default defineComponent({
945
945
  }
946
946
  return {
947
947
  ...c,
948
- sort: (a: any, b: any): number =>{
949
- if (a === undefined && b === undefined) {
950
- return 0;
951
- }
952
- if (a === undefined) {
953
- return -1;
954
- }
955
- if (b === undefined) {
956
- return 1;
957
- }
958
- return JSON.stringify(a)
959
- .localeCompare(JSON.stringify(b), undefined, { numeric: true })
960
- }
948
+ sort: alphanumericSort
961
949
  };
962
950
  })
963
951
  });
@@ -976,7 +964,7 @@ export default defineComponent({
976
964
  }, [] as { key: string, filter: FSDataTableFilter }[]);
977
965
  if (props.items && props.items.length) {
978
966
  return props.items.filter((item) => {
979
- if (props.selectedOnly && !innerValue.value.includes(item[props.itemValue])) {
967
+ if (props.selectedOnly && !props.modelValue.includes(item[props.itemValue])) {
980
968
  return false;
981
969
  }
982
970
  if (innerSearch.value) {
@@ -1002,9 +990,9 @@ export default defineComponent({
1002
990
  });
1003
991
 
1004
992
  const groups = computed((): { [key: string]: any[] } => {
1005
- if (props.groupBy) {
993
+ if (props.groupBy && props.groupBy.key) {
1006
994
  return innerItems.value.reduce((acc, item) => {
1007
- const key = item[props.groupBy.key];
995
+ const key = item[props.groupBy.key!];
1008
996
  if (!acc[key]) {
1009
997
  acc[key] = [];
1010
998
  }
@@ -1055,38 +1043,37 @@ export default defineComponent({
1055
1043
 
1056
1044
  const toggleSelectAll = (allSelected: boolean): void => {
1057
1045
  if (allSelected) {
1058
- innerValue.value = [];
1046
+ emit("update:modelValue", []);
1059
1047
  }
1060
1048
  else {
1061
- innerValue.value = innerItems.value.map((item) => item[props.itemValue]);
1049
+ emit("update:modelValue", innerItems.value.map((item) => item[props.itemValue]));
1062
1050
  }
1063
- emit("update:modelValue", innerValue.value);
1064
1051
  };
1065
1052
 
1066
1053
  const toggleSelectGroup = (group: any): void => {
1067
- if (group.items.every((item: any) => innerValue.value.includes(item.key))) {
1068
- innerValue.value = innerValue.value.filter((id) => !group.items.some((item: any) => item.key === id));
1054
+ if (group.items.every((item: any) => props.modelValue.includes(item.key))) {
1055
+ emit("update:modelValue", props.modelValue.filter((id) => !group.items.some((item: any) => item.key === id)));
1069
1056
  }
1070
1057
  else {
1071
- innerValue.value = [...new Set(innerValue.value.concat(group.items.map((item: any) => item.key)))];
1058
+ emit("update:modelValue", [...new Set(props.modelValue.concat(group.items.map((item: any) => item.key)))]);
1072
1059
  }
1073
- emit("update:modelValue", innerValue.value);
1074
1060
  };
1075
1061
 
1076
1062
  const toggleSelect = (item: any): void => {
1077
- const index = innerValue.value.indexOf(item[props.itemValue]);
1063
+ let values = props.modelValue.slice();
1064
+ const index = values.indexOf(item[props.itemValue]);
1078
1065
  if (index > -1) {
1079
- innerValue.value.splice(index, 1);
1066
+ values.splice(index, 1);
1080
1067
  }
1081
1068
  else {
1082
1069
  if (props.singleSelect) {
1083
- innerValue.value = [item[props.itemValue]];
1070
+ values = [item[props.itemValue]];
1084
1071
  }
1085
1072
  else {
1086
- innerValue.value.push(item[props.itemValue]);
1073
+ values.push(item[props.itemValue]);
1087
1074
  }
1088
1075
  }
1089
- emit("update:modelValue", innerValue.value);
1076
+ emit("update:modelValue", values);
1090
1077
  };
1091
1078
 
1092
1079
  const toggleFilter = (header: string, value: FSDataTableFilter[]): void => {
@@ -1461,7 +1448,6 @@ export default defineComponent({
1461
1448
  innerItems,
1462
1449
  headersSlots,
1463
1450
  itemsSlots,
1464
- innerValue,
1465
1451
  classes,
1466
1452
  style,
1467
1453
  size,
@@ -23,7 +23,7 @@ export const useAutocomplete = <TInfos>(
23
23
  const init = ref(true);
24
24
 
25
25
  const toggleSet = computed((): boolean => {
26
- return allowToggleSet && entitiesLength.value <= breakpointToggleSet;
26
+ return allowToggleSet && entitiesLength.value > 0 && entitiesLength.value <= breakpointToggleSet;
27
27
  });
28
28
 
29
29
  const debouncedFetch = () => debounce(() => customFetch(search.value), debounceInterval);
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.113",
4
+ "version": "0.0.115",
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.113",
14
- "@dative-gpi/foundation-shared-services": "0.0.113",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.115",
14
+ "@dative-gpi/foundation-shared-services": "0.0.115",
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": "f5968ac788b2bf889a786aab099086c24c46179b"
35
+ "gitHead": "19b102691d3d6846375b6c94e3e35f9e6e83dc42"
36
36
  }
@@ -18,19 +18,21 @@
18
18
  mask-image: none !important;
19
19
  -webkit-mask-image: none !important;
20
20
 
21
- margin: 2px 2px 2px 0 !important;
21
+ min-height: var(--fs-text-area-field-height) !important;
22
+ max-height: var(--fs-text-area-field-height) !important;
22
23
  cursor: var(--fs-text-area-cursor) !important;
23
- min-height: var(--fs-text-area-min-height);
24
- height: var(--fs-text-area-height);
25
24
  color: var(--fs-text-area-color);
25
+ padding: 0;
26
+ }
27
+
28
+ height: var(--fs-text-area-height);
26
29
 
27
- @include web {
28
- padding: 12px 0 12px 16px !important;
29
- }
30
-
31
- @include mobile {
32
- padding: 7px 0 7px 16px !important;
33
- }
30
+ @include web {
31
+ padding: 11px 16px !important;
32
+ }
33
+
34
+ @include mobile {
35
+ padding: 10px 16px !important;
34
36
  }
35
37
  }
36
38
  }
@@ -56,19 +58,17 @@
56
58
  mask-image: none !important;
57
59
  -webkit-mask-image: none !important;
58
60
 
59
- padding-inline: 0 !important;
60
- margin: 2px 2px 2px 0 !important;
61
61
  cursor: var(--fs-text-area-cursor) !important;
62
- height: var(--fs-text-area-height);
63
62
  color: var(--fs-text-area-color);
63
+ padding: 0;
64
+ }
64
65
 
65
- @include web {
66
- padding: 12px 0 12px 16px !important;
67
- }
68
-
69
- @include mobile {
70
- padding: 7px 0 7px 16px !important;
71
- }
66
+ @include web {
67
+ padding: 11px 16px !important;
68
+ }
69
+
70
+ @include mobile {
71
+ padding: 10px 16px !important;
72
72
  }
73
73
  }
74
74
  }
@@ -56,7 +56,6 @@
56
56
  @import "fs_tile.scss";
57
57
  @import "fs_time_field.scss";
58
58
  @import "fs_timeslot_field.scss";
59
- @import "fs_toggle_set.scss";
60
59
  @import "fs_tooltip.scss";
61
60
  @import "fs_window.scss";
62
61
  @import "fs_wrap_group.scss";
@@ -30,6 +30,10 @@
30
30
  .v-input {
31
31
  padding: 0px !important;
32
32
 
33
+ &.fs-small-input {
34
+ flex: 0 0 auto;
35
+ }
36
+
33
37
  &:not(.v-checkbox):not(.v-slider):not(.fs-small-input) {
34
38
  min-width: 200px;
35
39
  width: 100%;
@@ -121,6 +125,13 @@ $nthOverlay: 25;
121
125
  }
122
126
 
123
127
  /***** Applies to all slide groups (FSTabs, FSSlideGroup, FSWrapGroup) *****/
128
+ .fs-slide-group {
129
+ max-width: 100%;
130
+
131
+ & > .v-slide-group__container > .v-slide-group__content {
132
+ margin: 0 2px 0.2px 0 !important;
133
+ }
134
+ }
124
135
 
125
136
  // On touchscreen, hide arrows
126
137
  // Otherwise show small ones with base text color
package/utils/sort.ts CHANGED
@@ -1,9 +1,18 @@
1
1
  export const alphanumericSort = (a: any, b: any) => {
2
- if (typeof(a) !== 'string') {
3
- a = JSON.stringify(a);
4
- }
5
- if (typeof(b) !== 'string') {
6
- b = JSON.stringify(b);
7
- }
8
- return a.localeCompare(b, undefined, { numeric: true });
2
+ if (a == null && b == null) {
3
+ return 0;
4
+ }
5
+ if (a == null) {
6
+ return -1;
7
+ }
8
+ if (b == null) {
9
+ return 1;
10
+ }
11
+ if (typeof(a) !== 'string') {
12
+ a = JSON.stringify(a);
13
+ }
14
+ if (typeof(b) !== 'string') {
15
+ b = JSON.stringify(b);
16
+ }
17
+ return a.localeCompare(b, undefined, { numeric: true });
9
18
  }
@@ -1,4 +0,0 @@
1
- .fs-toggle-set > .v-input__control > .v-slide-group {
2
- height: calc(100% + 0.4px);
3
- width: calc(100% + 0.4px);
4
- }