@dative-gpi/foundation-shared-components 1.0.43 → 1.0.45

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.
@@ -472,7 +472,7 @@
472
472
  </template>
473
473
 
474
474
  <script lang="ts">
475
- import { computed, defineComponent, type PropType, ref, type Slot, type StyleValue } from "vue";
475
+ import { computed, defineComponent, type PropType, ref, type Slot, type StyleValue, watch } from "vue";
476
476
 
477
477
  import { useBreakpoints, useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
478
478
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -768,6 +768,10 @@ export default defineComponent({
768
768
  showExtra.value = true;
769
769
  };
770
770
 
771
+ watch(search, () => {
772
+ emit("update:search", search.value);
773
+ });
774
+
771
775
  return {
772
776
  autocompleteSlots,
773
777
  toggleSetSlots,
@@ -7,6 +7,15 @@
7
7
  :editable="$props.editable"
8
8
  :messages="messages"
9
9
  >
10
+ <template
11
+ v-if="$slots.label"
12
+ v-slot:label="slotData"
13
+ >
14
+ <slot
15
+ name="label"
16
+ v-bind="slotData"
17
+ />
18
+ </template>
10
19
  <v-textarea
11
20
  class="fs-text-area"
12
21
  variant="outlined"
@@ -26,7 +35,7 @@
26
35
  v-bind="$attrs"
27
36
  >
28
37
  <template
29
- v-for="(_, name) in $slots"
38
+ v-for="(_, name) in slots"
30
39
  v-slot:[name]="slotData"
31
40
  >
32
41
  <slot
@@ -56,7 +65,7 @@
56
65
  <script lang="ts">
57
66
  import { computed, defineComponent, type PropType, type StyleValue } from "vue";
58
67
 
59
- import { useColors, useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
68
+ import { useColors, useBreakpoints, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
60
69
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
61
70
 
62
71
  import FSBaseField from "./FSBaseField.vue";
@@ -130,6 +139,9 @@ export default defineComponent({
130
139
  const { validateOn, getMessages } = useRules();
131
140
  const { isMobileSized } = useBreakpoints();
132
141
  const { getColors } = useColors();
142
+ const { slots } = useSlots();
143
+
144
+ delete slots.label;
133
145
 
134
146
  const errors = getColors(ColorEnum.Error);
135
147
  const lights = getColors(ColorEnum.Light);
@@ -185,7 +197,8 @@ export default defineComponent({
185
197
  ColorEnum,
186
198
  messages,
187
199
  classes,
188
- style
200
+ style,
201
+ slots
189
202
  };
190
203
  }
191
204
  });
@@ -62,6 +62,7 @@
62
62
  >
63
63
  <FSRow
64
64
  :wrap="false"
65
+ align="center-left"
65
66
  >
66
67
  <FSSpan
67
68
  class="fs-translate-field-label"
@@ -24,6 +24,7 @@
24
24
  >
25
25
  <FSRow
26
26
  :wrap="false"
27
+ align="center-left"
27
28
  >
28
29
  <FSSpan
29
30
  class="fs-translate-field-label"
@@ -0,0 +1,233 @@
1
+ <template>
2
+ <FSTextArea
3
+ :editable="$props.editable"
4
+ :modelValue="$props.modelValue"
5
+ @update:modelValue="$emit('update:modelValue', $event)"
6
+ v-bind="$attrs"
7
+ >
8
+ <template
9
+ v-for="(_, name) in $slots"
10
+ v-slot:[name]="slotData"
11
+ >
12
+ <slot
13
+ :name="name"
14
+ v-bind="slotData"
15
+ />
16
+ </template>
17
+ <template
18
+ #append
19
+ >
20
+ <FSButton
21
+ height="100%"
22
+ style=""
23
+ :prependIcon="$props.buttonPrependIcon"
24
+ :appendIcon="$props.buttonAppendIcon"
25
+ :variant="$props.buttonVariant"
26
+ :color="$props.buttonColor"
27
+ @click="dialog = true"
28
+ />
29
+ <slot
30
+ name="append"
31
+ />
32
+ </template>
33
+ </FSTextArea>
34
+ <FSDialogSubmit
35
+ :title="$tr('ui.translate-text-area.title', 'Handle translations')"
36
+ :submitButtonColor="$props.buttonColor"
37
+ @click:submitButton="onSubmit"
38
+ v-model="dialog"
39
+ >
40
+ <template
41
+ #body
42
+ >
43
+ <FSCol
44
+ gap="32px"
45
+ >
46
+ <FSTextArea
47
+ :label="$tr('ui.translate-text-area.default-value', 'Default value')"
48
+ :editable="false"
49
+ :rows="($attrs.rows as number)"
50
+ :modelValue="$props.modelValue"
51
+ />
52
+ <FSCol
53
+ gap="20px"
54
+ >
55
+ <FSTextArea
56
+ v-for="(language, index) in languages"
57
+ :editable="$props.editable"
58
+ :key="index"
59
+ :modelValue="getTranslation(language.code)"
60
+ :rows="($attrs.rows as number)"
61
+ @update:modelValue="setTranslation(language.code, $event)"
62
+ >
63
+ <template
64
+ #label
65
+ >
66
+ <FSRow
67
+ :wrap="false"
68
+ align="center-left"
69
+ >
70
+ <FSSpan
71
+ font="text-overline"
72
+ :style="style"
73
+ >
74
+ {{ $tr("ui.translate-field.translate-in", "Translate in {0}", language.label) }}
75
+ </FSSpan>
76
+ <FSIcon>
77
+ {{ language.icon }}
78
+ </FSIcon>
79
+ </FSRow>
80
+ </template>
81
+ </FSTextArea>
82
+ </FSCol>
83
+ </FSCol>
84
+ </template>
85
+ </FSDialogSubmit>
86
+ </template>
87
+
88
+ <script lang="ts">
89
+ import { computed, defineComponent, type PropType, ref, type StyleValue } from "vue";
90
+
91
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
92
+ import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
93
+
94
+ import { useColors } from "../../composables";
95
+
96
+ import FSDialogSubmit from "../FSDialogSubmit.vue";
97
+ import FSTextArea from "./FSTextArea.vue";
98
+ import FSButton from "../FSButton.vue";
99
+ import FSIcon from "../FSIcon.vue";
100
+ import FSSpan from "../FSSpan.vue";
101
+ import FSRow from "../FSRow.vue";
102
+
103
+ export default defineComponent({
104
+ name: "FSTranslateTextArea",
105
+ components: {
106
+ FSDialogSubmit,
107
+ FSTextArea,
108
+ FSButton,
109
+ FSIcon,
110
+ FSSpan,
111
+ FSRow
112
+ },
113
+ props: {
114
+ buttonPrependIcon: {
115
+ type: String as PropType<string | null>,
116
+ required: false,
117
+ default: "mdi-translate"
118
+ },
119
+ buttonLabel: {
120
+ type: String as PropType<string | null>,
121
+ required: false,
122
+ default: null
123
+ },
124
+ buttonAppendIcon: {
125
+ type: String as PropType<string | null>,
126
+ required: false,
127
+ default: null
128
+ },
129
+ buttonVariant: {
130
+ type: String as PropType<"standard" | "full" | "icon">,
131
+ required: false,
132
+ default: "standard"
133
+ },
134
+ modelValue: {
135
+ type: String as PropType<string | null>,
136
+ required: false,
137
+ default: null
138
+ },
139
+ property: {
140
+ type: String as PropType<string>,
141
+ required: false,
142
+ default: "label"
143
+ },
144
+ translations: {
145
+ type: Array as PropType<{ languageCode: string; [key: string]: string }[]>,
146
+ required: false,
147
+ default: () => []
148
+ },
149
+ buttonColor: {
150
+ type: String as PropType<ColorBase>,
151
+ required: false,
152
+ default: ColorEnum.Primary
153
+ },
154
+ editable: {
155
+ type: Boolean,
156
+ required: false,
157
+ default: true
158
+ }
159
+ },
160
+ emits: ["update:modelValue", "update:translations"],
161
+ setup(props, { emit }) {
162
+ const { languages } = useAppLanguages();
163
+ const { getColors } = useColors();
164
+
165
+ const dialog = ref(false);
166
+
167
+ const innerTranslations = ref(props.translations);
168
+
169
+ const lights = getColors(ColorEnum.Light);
170
+ const darks = getColors(ColorEnum.Dark);
171
+
172
+ const style = computed((): StyleValue => {
173
+ if (!props.editable) {
174
+ return {
175
+ "--fs-translate-field-color": lights.dark
176
+ };
177
+ }
178
+ return {
179
+ "--fs-translate-field-color": darks.base
180
+ };
181
+ });
182
+
183
+ const getTranslation = (languageCode: string): string => {
184
+ if (!innerTranslations.value) {
185
+ return "";
186
+ }
187
+ const translation = innerTranslations.value.find((t) => t.languageCode === languageCode);
188
+ if (!translation || !translation[props.property]) {
189
+ return "";
190
+ }
191
+ return translation[props.property];
192
+ };
193
+
194
+ const setTranslation = (languageCode: string, value: string): void => {
195
+ if (!innerTranslations.value) {
196
+ innerTranslations.value = [{
197
+ languageCode,
198
+ [props.property]: value
199
+ }]
200
+ return;
201
+ }
202
+ const translation = innerTranslations.value.find((t) => t.languageCode === languageCode);
203
+ if (translation) {
204
+ translation[props.property] = value;
205
+ }
206
+ else {
207
+ innerTranslations.value.push({
208
+ languageCode,
209
+ [props.property]: value
210
+ });
211
+ }
212
+ };
213
+
214
+ const onSubmit = (): void => {
215
+ dialog.value = false;
216
+ if (props.editable) {
217
+ emit("update:translations", innerTranslations.value);
218
+ }
219
+ };
220
+
221
+ return {
222
+ innerTranslations,
223
+ ColorEnum,
224
+ languages,
225
+ dialog,
226
+ style,
227
+ getTranslation,
228
+ setTranslation,
229
+ onSubmit
230
+ };
231
+ }
232
+ });
233
+ </script>
@@ -22,7 +22,6 @@
22
22
  <FSButton
23
23
  v-if="filterableHeaders.length > 0"
24
24
  prependIcon="mdi-filter-variant"
25
- padding="0 7px"
26
25
  :variant="showFilters ? 'full' : 'standard'"
27
26
  @click="showFilters = !showFilters"
28
27
  />
@@ -906,8 +905,8 @@ export default defineComponent({
906
905
  const elementId = `id${uuidv4()}`;
907
906
 
908
907
  const modeOptions: FSToggle[] = [
909
- { id: "table", prependIcon: "mdi-table" },
910
- { id: "iterator", prependIcon: "mdi-apps" }
908
+ { id: "iterator", prependIcon: "mdi-view-grid-outline" },
909
+ { id: "table", prependIcon: "mdi-format-list-bulleted" }
911
910
  ];
912
911
 
913
912
  const rowsPerPageOptions: { id: number, label: string }[] = [
@@ -117,7 +117,7 @@
117
117
  </template>
118
118
 
119
119
  <script lang="ts">
120
- import { computed, defineComponent, onMounted, type Ref, provide, type PropType, ref, type StyleValue, watch, onUnmounted } from "vue";
120
+ import { computed, defineComponent, onMounted, type Ref, provide, type PropType, ref, type StyleValue, watch, onUnmounted, markRaw } from "vue";
121
121
 
122
122
  import type {} from "leaflet.markercluster";
123
123
  import { map as createMap, control, tileLayer, latLngBounds, latLng, type LatLng, LatLngBounds, type FitBoundsOptions } from "leaflet";
@@ -361,7 +361,7 @@ export default defineComponent({
361
361
  maxBoundsViscosity: 1.0
362
362
  };
363
363
 
364
- map.value = createMap(leafletContainer.value, mapOptions);
364
+ map.value = markRaw(createMap(leafletContainer.value, mapOptions));
365
365
  setView(props.center[0], props.center[1], defaultZoom);
366
366
 
367
367
  map.value.on('click', (e: L.LeafletMouseEvent) => {
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <FSSelectField
3
+ :clearable="false"
4
+ :items="items"
5
+ :modelValue="$props.modelValue"
6
+ @update:modelValue="$emit('update:modelValue', $event)"
7
+ v-bind="$attrs"
8
+ >
9
+ <template
10
+ #item-prepend="{ item }"
11
+ >
12
+ <v-icon>{{ item.icon }}</v-icon>
13
+ </template>
14
+ </FSSelectField>
15
+ </template>
16
+
17
+ <script lang="ts">
18
+ import type { PropType} from "vue";
19
+ import { defineComponent } from "vue";
20
+
21
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
22
+ import { ListModes } from "@dative-gpi/foundation-shared-domain/models";
23
+
24
+ import FSSelectField from "../fields/FSSelectField.vue";
25
+
26
+ export default defineComponent({
27
+ name: "FSSelectViewMode",
28
+ components: {
29
+ FSSelectField
30
+ },
31
+ props: {
32
+ modelValue: {
33
+ type: String as PropType<ListModes>,
34
+ required: true
35
+ },
36
+ },
37
+ emits: ["update:modelValue"],
38
+ setup() {
39
+ const { $tr } = useTranslationsProvider();
40
+
41
+ const items = [
42
+ { id: ListModes.Table, label: $tr("ui.common.table-mode", "Table"), icon: "mdi-format-list-bulleted" },
43
+ { id: ListModes.Iterator, label: $tr("ui.common.tile-mode", "Tuile"), icon: "mdi-view-grid-outline" },
44
+ ];
45
+
46
+ return {
47
+ items
48
+ };
49
+ }
50
+ });
51
+ </script>
@@ -53,7 +53,8 @@ export const useColors = () => {
53
53
  if(color.darken(0.15).isLight()){
54
54
  return color.darken(0.8);
55
55
  }
56
- return color.lighten(color.value() / 50);
56
+
57
+ return color.lightness(color.lightness() < 30 ? 100 : Math.min(color.lightness() + 60, 100));
57
58
  }
58
59
 
59
60
  const parseColor = (color: ColorBase): Color => {
@@ -105,7 +106,7 @@ export const useColors = () => {
105
106
  const colors: string[][] = [];
106
107
  for (let saturation = baseMinSaturation; saturation <= 100; saturation += (100 - baseMinSaturation) / (columnCount - 1)) {
107
108
  const colorsRow = [];
108
- for (let hue = 0; hue < 360; hue += 15) {
109
+ for (let hue = 0; hue < 360; hue += 5) {
109
110
  const color = new Color({ h: hue, s: saturation, v: baseFixedBrightness });
110
111
  colorsRow.push(color.hex());
111
112
  }
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.43",
4
+ "version": "1.0.45",
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.43",
14
- "@dative-gpi/foundation-shared-services": "1.0.43"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.45",
14
+ "@dative-gpi/foundation-shared-services": "1.0.45"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "30a450a1f1843ffd8d38d5ff3f86c4349480ed74"
38
+ "gitHead": "8e1ac12c45e7a7a18f010d4f616af04008e815d6"
39
39
  }
@@ -1,5 +1,5 @@
1
1
  .fs-span {
2
- padding-inline-end: 2px;
2
+ // padding-inline-end: 2px;
3
3
  max-width: 100%;
4
4
  }
5
5
 
@@ -1,7 +1,6 @@
1
1
  .fs-text-area:not(.fs-text-area-auto-grow) {
2
2
  & > .v-input__control > .v-field {
3
3
  border: 1px solid var(--fs-text-area-border-color) !important;
4
- height: var(--fs-text-area-height);
5
4
 
6
5
  &--error {
7
6
  border-color: var(--fs-text-area-error-border-color) !important;
@@ -25,6 +24,10 @@
25
24
  color: var(--fs-text-area-color);
26
25
  padding: 0;
27
26
  }
27
+
28
+ & > .v-field__clearable {
29
+ align-items: flex-start;
30
+ }
28
31
 
29
32
  @include web {
30
33
  padding: 11px 16px !important;
@@ -33,6 +36,10 @@
33
36
  @include mobile {
34
37
  padding: 10px 16px !important;
35
38
  }
39
+ }
40
+
41
+ & > .v-input__append {
42
+ padding-top: 0px;
36
43
  }
37
44
  }
38
45
 
@@ -61,6 +68,10 @@
61
68
  color: var(--fs-text-area-color);
62
69
  padding: 0;
63
70
  }
71
+
72
+ & > .v-field__clearable {
73
+ align-items: flex-start;
74
+ }
64
75
 
65
76
  @include web {
66
77
  padding: 11px 16px !important;
@@ -70,4 +81,8 @@
70
81
  padding: 10px 16px !important;
71
82
  }
72
83
  }
84
+
85
+ & > .v-input__append {
86
+ padding-top: 0px;
87
+ }
73
88
  }