@dative-gpi/foundation-shared-components 0.1.120 → 1.0.1
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.
- package/assets/images/map/imagery.png +0 -0
- package/assets/images/map/map.png +0 -0
- package/components/FSAccordion.vue +2 -1
- package/components/FSAccordionPanel.vue +20 -1
- package/components/FSBadge.vue +7 -3
- package/components/FSBreadcrumbs.vue +4 -2
- package/components/FSButton.vue +15 -8
- package/components/FSCalendar.vue +5 -2
- package/components/FSCalendarTwin.vue +6 -3
- package/components/FSCard.vue +4 -2
- package/components/FSCardPlaceholder.vue +80 -0
- package/components/FSCheckbox.vue +10 -7
- package/components/FSChip.vue +4 -2
- package/components/FSClickable.vue +5 -3
- package/components/FSClock.vue +18 -4
- package/components/FSCol.vue +12 -5
- package/components/FSColor.vue +4 -2
- package/components/FSColorIcon.vue +5 -3
- package/components/FSDialog.vue +28 -87
- package/components/FSDialogContent.vue +133 -0
- package/components/FSDialogForm.vue +25 -236
- package/components/FSDialogFormBody.vue +273 -0
- package/components/FSDialogMenu.vue +5 -2
- package/components/FSDialogMultiForm.vue +21 -197
- package/components/FSDialogMultiFormBody.vue +231 -0
- package/components/FSDialogSubmit.vue +4 -2
- package/components/FSDivider.vue +6 -4
- package/components/FSEditImage.vue +16 -9
- package/components/FSErrorToast.vue +2 -1
- package/components/FSFadeOut.vue +1 -1
- package/components/FSForm.vue +7 -7
- package/components/FSGrid.vue +4 -2
- package/components/FSGridMosaic.vue +3 -2
- package/components/FSIcon.vue +3 -2
- package/components/FSIconCard.vue +10 -3
- package/components/FSIconCheck.vue +2 -1
- package/components/FSIconFlag.vue +2 -1
- package/components/FSImage.vue +2 -1
- package/components/FSImageCard.vue +72 -0
- package/components/FSLabel.vue +4 -2
- package/components/FSLink.vue +5 -3
- package/components/FSLoader.vue +2 -1
- package/components/FSOptionGroup.vue +28 -20
- package/components/FSOptionItem.vue +8 -18
- package/components/FSPagination.vue +4 -2
- package/components/FSRadio.vue +23 -11
- package/components/FSRadioGroup.vue +23 -10
- package/components/FSRow.vue +8 -1
- package/components/FSSlideGroup.vue +27 -6
- package/components/FSSlider.vue +4 -2
- package/components/FSSpan.vue +2 -1
- package/components/FSSwitch.vue +13 -10
- package/components/FSTab.vue +4 -2
- package/components/FSTabs.vue +5 -14
- package/components/FSTag.vue +11 -4
- package/components/FSTagGroup.vue +4 -2
- package/components/FSText.vue +4 -2
- package/components/FSToggleSet.vue +30 -17
- package/components/FSTooltip.vue +15 -4
- package/components/FSWindow.vue +2 -2
- package/components/FSWrapGroup.vue +2 -1
- package/components/autocompletes/FSAutoCompleteAddress.vue +104 -0
- package/components/autocompletes/FSAutocompleteLanguage.vue +18 -26
- package/components/autocompletes/FSAutocompleteTag.vue +138 -0
- package/components/autocompletes/FSAutocompleteTimeZone.vue +19 -30
- package/components/buttons/FSButtonAdd.vue +28 -0
- package/components/buttons/FSButtonAddIcon.vue +28 -0
- package/components/buttons/FSButtonAddLabel.vue +27 -0
- package/components/buttons/FSButtonAddMini.vue +27 -0
- package/components/buttons/FSButtonFile.vue +4 -4
- package/components/buttons/FSButtonFileIcon.vue +4 -4
- package/components/buttons/FSButtonFileLabel.vue +4 -4
- package/components/buttons/FSButtonFileMini.vue +4 -4
- package/components/deviceOrganisations/FSConnectivity.vue +3 -2
- package/components/deviceOrganisations/FSConnectivityCard.vue +3 -2
- package/components/deviceOrganisations/FSStatus.vue +3 -2
- package/components/deviceOrganisations/FSStatusCard.vue +3 -2
- package/components/deviceOrganisations/FSStatusesCarousel.vue +3 -2
- package/components/deviceOrganisations/FSStatusesRow.vue +3 -2
- package/components/deviceOrganisations/FSWorstAlert.vue +5 -4
- package/components/deviceOrganisations/FSWorstAlertCard.vue +4 -2
- package/components/fields/FSAutocompleteField.vue +219 -97
- package/components/fields/FSBaseField.vue +2 -1
- package/components/fields/FSColorField.vue +65 -94
- package/components/fields/FSDateField.vue +12 -25
- package/components/fields/FSDateRangeField.vue +15 -27
- package/components/fields/FSDateTimeField.vue +22 -32
- package/components/fields/FSDateTimeRangeField.vue +43 -51
- package/components/fields/FSGradientField.vue +143 -0
- package/components/fields/FSIconField.vue +9 -6
- package/components/fields/FSMagicConfigField.vue +154 -0
- package/components/fields/FSMagicField.vue +185 -0
- package/components/fields/FSNumberField.vue +3 -1
- package/components/fields/FSPasswordField.vue +10 -10
- package/components/fields/FSRichTextField.vue +136 -50
- package/components/fields/FSSearchField.vue +41 -62
- package/components/fields/FSSelectField.vue +148 -53
- package/components/fields/FSTagField.vue +19 -16
- package/components/fields/FSTermField.vue +192 -186
- package/components/fields/FSTextArea.vue +4 -4
- package/components/fields/FSTextField.vue +29 -6
- package/components/fields/FSTimeField.vue +55 -20
- package/components/fields/FSTimeSlotField.vue +6 -5
- package/components/fields/FSTranslateField.vue +234 -0
- package/components/fields/FSTranslateRichTextField.vue +185 -0
- package/components/fields/FSTreeViewField.vue +520 -0
- package/components/lists/FSDataIteratorItem.vue +18 -3
- package/components/lists/FSDataTableUI.vue +138 -51
- package/components/lists/FSFilterButton.vue +4 -2
- package/components/lists/FSHiddenButton.vue +4 -2
- package/components/map/FSMap.vue +598 -0
- package/components/map/FSMapEditPointAddressOverlay.vue +164 -0
- package/components/map/FSMapLayerButton.vue +77 -0
- package/components/map/FSMapOverlay.vue +150 -0
- package/components/selects/FSSelectAutoRefresh.vue +62 -0
- package/components/selects/FSSelectDashboardVariableType.vue +47 -0
- package/components/selects/FSSelectDateSetting.vue +39 -37
- package/components/selects/FSSelectDays.vue +62 -0
- package/components/tiles/FSDashboardOrganisationTileUI.vue +8 -8
- package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +8 -8
- package/components/tiles/FSDashboardShallowTileUI.vue +8 -8
- package/components/tiles/FSDeviceOrganisationTileUI.vue +20 -15
- package/components/tiles/FSFolderTileUI.vue +7 -7
- package/components/tiles/FSGroupTileUI.vue +34 -27
- package/components/tiles/FSServiceAccountOrganisationTileUI.vue +142 -0
- package/components/tiles/{FSSimpleIconTileUI.vue → FSSimpleTileUI.vue} +48 -25
- package/components/tiles/FSTile.vue +51 -13
- package/components/tiles/FSUserOrganisationTileUI.vue +25 -34
- package/components/toggleSets/FSToggleSetPosition.vue +61 -0
- package/composables/index.ts +5 -1
- package/composables/useAddress.ts +158 -0
- package/composables/useAutocomplete.ts +4 -3
- package/composables/useColors.ts +8 -25
- package/composables/useDebounce.ts +2 -1
- package/composables/useMagicFieldProvider.ts +22 -0
- package/composables/useRules.ts +4 -12
- package/composables/useSlots.ts +65 -27
- package/composables/useTables.ts +29 -0
- package/composables/useTreeView.ts +48 -0
- package/elements/FSFormElement.ts +2 -1
- package/icons/flags/France.vue +21 -5
- package/icons/flags/Germany.vue +16 -4
- package/icons/flags/GreatBritain.vue +25 -6
- package/icons/flags/Italy.vue +21 -5
- package/icons/flags/Portugal.vue +225 -51
- package/icons/flags/Spain.vue +2781 -543
- package/icons/flags/UnitedStates.vue +31 -7
- package/icons/widgetTemplates/DevicesWidget.vue +189 -189
- package/icons/widgetTemplates/ProfileWidget.vue +9 -9
- package/icons/widgetTemplates/TextWidget.vue +6 -6
- package/models/breadcrumbs.ts +1 -1
- package/models/deviceAlerts.ts +1 -1
- package/models/deviceConnectivities.ts +1 -1
- package/models/index.ts +2 -0
- package/models/magicFields.ts +9 -0
- package/models/map.ts +18 -0
- package/models/richTextVariable.ts +5 -0
- package/models/rules.ts +11 -2
- package/models/tables.ts +30 -21
- package/models/variableNode.ts +104 -0
- package/package.json +21 -18
- package/plugins/colorPlugin.ts +2 -2
- package/plugins/index.ts +2 -1
- package/plugins/mapsPlugin.ts +37 -0
- package/shims-plugin.d.ts +2 -2
- package/shims-window.d.ts +3 -0
- package/styles/components/fs_button.scss +5 -0
- package/styles/components/fs_card.scss +0 -1
- package/styles/components/fs_col.scss +1 -0
- package/styles/components/fs_color_field.scss +12 -2
- package/styles/components/fs_data_iterator_item.scss +19 -6
- package/styles/components/fs_dialog.scss +12 -22
- package/styles/components/fs_gradient_field.scss +16 -0
- package/styles/components/fs_image_card.scss +18 -0
- package/styles/components/fs_magic_config_field.scss +13 -0
- package/styles/components/fs_map.scss +129 -0
- package/styles/components/fs_map_overlay.scss +38 -0
- package/styles/components/fs_meta_field.scss +6 -0
- package/styles/components/fs_option_group.scss +1 -0
- package/styles/components/fs_radio.scss +1 -1
- package/styles/components/fs_rich_text_field.scss +17 -5
- package/styles/components/fs_row.scss +1 -1
- package/styles/components/fs_select_field.scss +9 -14
- package/styles/components/fs_text.scss +1 -1
- package/styles/components/fs_time_field.scss +0 -4
- package/styles/components/fs_translate_field.scss +3 -0
- package/styles/components/fs_tree_view_field.scss +53 -0
- package/styles/components/index.scss +8 -1
- package/styles/globals/overrides.scss +54 -8
- package/styles/globals/scrollbars.scss +2 -2
- package/themes/default.ts +1 -1
- package/utils/gradient.ts +1601 -0
- package/utils/index.ts +3 -1
- package/utils/leafletMarkers.ts +23 -0
- package/utils/lexical.ts +3 -1
- package/components/selects/FSSelectTimeZone.vue +0 -67
- package/styles/components/fs_date_field.scss +0 -8
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTile
|
|
3
|
+
:activeColor="$props.activeColor"
|
|
3
4
|
:bottomColor="$props.bottomColor"
|
|
4
5
|
:editable="$props.editable"
|
|
6
|
+
:width="$props.width"
|
|
5
7
|
:modelValue="$props.modelValue"
|
|
6
8
|
v-bind="$attrs"
|
|
7
9
|
>
|
|
@@ -17,21 +19,29 @@
|
|
|
17
19
|
>
|
|
18
20
|
<FSCol
|
|
19
21
|
gap="6px"
|
|
22
|
+
:width="infoWidth"
|
|
20
23
|
>
|
|
21
|
-
<
|
|
24
|
+
<FSSpan
|
|
22
25
|
font="text-button"
|
|
23
26
|
:lineClamp="2"
|
|
24
27
|
>
|
|
25
28
|
{{ $props.label }}
|
|
26
|
-
</
|
|
27
|
-
<
|
|
29
|
+
</FSSpan>
|
|
30
|
+
<FSSpan
|
|
28
31
|
font="text-overline"
|
|
29
32
|
variant="soft"
|
|
30
33
|
>
|
|
31
34
|
{{ $props.code }}
|
|
32
|
-
</
|
|
35
|
+
</FSSpan>
|
|
33
36
|
</FSCol>
|
|
37
|
+
<FSImage
|
|
38
|
+
v-if="$props.imageId"
|
|
39
|
+
:height="imageSize"
|
|
40
|
+
:width="imageSize"
|
|
41
|
+
:imageId="$props.imageId"
|
|
42
|
+
/>
|
|
34
43
|
<FSIconCard
|
|
44
|
+
v-else
|
|
35
45
|
:backgroundColor="iconBackgroundColor"
|
|
36
46
|
:icon="$props.icon"
|
|
37
47
|
:size="imageSize"
|
|
@@ -42,47 +52,44 @@
|
|
|
42
52
|
</template>
|
|
43
53
|
|
|
44
54
|
<script lang="ts">
|
|
45
|
-
import { computed, defineComponent, PropType } from "vue";
|
|
55
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
46
56
|
|
|
57
|
+
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
47
58
|
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
48
|
-
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
49
59
|
|
|
50
60
|
import FSIconCard from "../FSIconCard.vue";
|
|
51
|
-
import
|
|
61
|
+
import FSImage from "../FSImage.vue";
|
|
62
|
+
import FSSpan from "../FSSpan.vue";
|
|
52
63
|
import FSTile from "./FSTile.vue";
|
|
53
64
|
import FSCol from "../FSCol.vue";
|
|
54
65
|
import FSRow from "../FSRow.vue";
|
|
55
66
|
|
|
56
67
|
export default defineComponent({
|
|
57
|
-
name: "
|
|
68
|
+
name: "FSSimpleTileUI",
|
|
58
69
|
components: {
|
|
59
70
|
FSIconCard,
|
|
60
|
-
|
|
71
|
+
FSImage,
|
|
72
|
+
FSSpan,
|
|
61
73
|
FSTile,
|
|
62
74
|
FSCol,
|
|
63
75
|
FSRow
|
|
64
76
|
},
|
|
65
77
|
props: {
|
|
66
|
-
|
|
67
|
-
type: String as PropType<string
|
|
78
|
+
imageId: {
|
|
79
|
+
type: String as PropType<string>,
|
|
68
80
|
required: false,
|
|
69
81
|
default: null
|
|
70
82
|
},
|
|
71
|
-
|
|
72
|
-
type:
|
|
83
|
+
label: {
|
|
84
|
+
type: String as PropType<string | null>,
|
|
73
85
|
required: false,
|
|
74
|
-
default:
|
|
86
|
+
default: null
|
|
75
87
|
},
|
|
76
88
|
code: {
|
|
77
89
|
type: String as PropType<string | null>,
|
|
78
90
|
required: false,
|
|
79
91
|
default: null
|
|
80
92
|
},
|
|
81
|
-
bottomColor: {
|
|
82
|
-
type: [Array, String] as PropType<ColorBase | ColorBase[]>,
|
|
83
|
-
required: false,
|
|
84
|
-
default: ColorEnum.Light
|
|
85
|
-
},
|
|
86
93
|
iconBackgroundColor: {
|
|
87
94
|
type: Boolean,
|
|
88
95
|
required: false,
|
|
@@ -93,6 +100,26 @@ export default defineComponent({
|
|
|
93
100
|
required: false,
|
|
94
101
|
default: "mdi-ab-testing"
|
|
95
102
|
},
|
|
103
|
+
activeColor: {
|
|
104
|
+
type: String as PropType<ColorBase>,
|
|
105
|
+
required: false,
|
|
106
|
+
default: ColorEnum.Primary
|
|
107
|
+
},
|
|
108
|
+
bottomColor: {
|
|
109
|
+
type: [Array, String] as PropType<ColorBase | ColorBase[]>,
|
|
110
|
+
required: false,
|
|
111
|
+
default: ColorEnum.Light
|
|
112
|
+
},
|
|
113
|
+
width: {
|
|
114
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
115
|
+
required: false,
|
|
116
|
+
default: () => [352, 336]
|
|
117
|
+
},
|
|
118
|
+
modelValue: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
required: false,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
96
123
|
editable: {
|
|
97
124
|
type: Boolean,
|
|
98
125
|
required: false,
|
|
@@ -110,12 +137,8 @@ export default defineComponent({
|
|
|
110
137
|
return isMobileSized.value ? 90 : 100;
|
|
111
138
|
});
|
|
112
139
|
|
|
113
|
-
const infoWidth = computed(():
|
|
114
|
-
|
|
115
|
-
if (props.icon) {
|
|
116
|
-
width -= imageSize.value;
|
|
117
|
-
}
|
|
118
|
-
return width;
|
|
140
|
+
const infoWidth = computed((): string => {
|
|
141
|
+
return `calc(100% - ${imageSize.value}px - 24px)`;
|
|
119
142
|
});
|
|
120
143
|
|
|
121
144
|
return {
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSClickable
|
|
3
|
-
v-if="$props.
|
|
4
|
-
variant="background"
|
|
3
|
+
v-if="$props.singleSelect"
|
|
5
4
|
class="fs-tile"
|
|
6
5
|
padding="12px"
|
|
6
|
+
:variant="variant"
|
|
7
7
|
:height="height"
|
|
8
|
-
:
|
|
8
|
+
:color="color"
|
|
9
9
|
:style="style"
|
|
10
|
+
@click="() => $emit('update:modelValue', !$props.modelValue)"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
<div
|
|
15
|
+
v-if="$props.bottomColor"
|
|
16
|
+
class="fs-tile-bottom"
|
|
17
|
+
:style="style"
|
|
18
|
+
/>
|
|
19
|
+
</FSClickable>
|
|
20
|
+
<FSClickable
|
|
21
|
+
v-else-if="$props.href || $props.to || $attrs.onClick"
|
|
22
|
+
variant="background"
|
|
23
|
+
class="fs-tile"
|
|
24
|
+
padding="12px"
|
|
25
|
+
:color="ColorEnum.Background"
|
|
10
26
|
:href="$props.href"
|
|
27
|
+
:height="height"
|
|
11
28
|
:to="$props.to"
|
|
29
|
+
:style="style"
|
|
12
30
|
v-bind="$attrs"
|
|
13
31
|
>
|
|
14
32
|
<slot />
|
|
15
33
|
<FSCard
|
|
16
34
|
v-if="$props.editable"
|
|
17
35
|
class="fs-tile-checkbox"
|
|
36
|
+
variant="background"
|
|
37
|
+
:color="ColorEnum.Background"
|
|
18
38
|
:border="false"
|
|
19
39
|
v-bind="$attrs"
|
|
20
40
|
>
|
|
@@ -30,10 +50,11 @@
|
|
|
30
50
|
</FSClickable>
|
|
31
51
|
<FSCard
|
|
32
52
|
v-else
|
|
53
|
+
variant="background"
|
|
33
54
|
class="fs-tile"
|
|
34
55
|
padding="12px"
|
|
56
|
+
:color="color"
|
|
35
57
|
:style="style"
|
|
36
|
-
:width="width"
|
|
37
58
|
:height="height"
|
|
38
59
|
v-bind="$attrs"
|
|
39
60
|
>
|
|
@@ -41,6 +62,7 @@
|
|
|
41
62
|
<FSCard
|
|
42
63
|
v-if="$props.editable"
|
|
43
64
|
class="fs-tile-checkbox"
|
|
65
|
+
variant="background"
|
|
44
66
|
:border="false"
|
|
45
67
|
v-bind="$attrs"
|
|
46
68
|
>
|
|
@@ -58,11 +80,11 @@
|
|
|
58
80
|
</template>
|
|
59
81
|
|
|
60
82
|
<script lang="ts">
|
|
61
|
-
import { computed, defineComponent, PropType } from "vue";
|
|
62
|
-
import { RouteLocation } from "vue-router";
|
|
83
|
+
import { computed, defineComponent, type PropType, type StyleValue } from "vue";
|
|
84
|
+
import { type RouteLocation } from "vue-router";
|
|
63
85
|
|
|
64
86
|
import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
65
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/models";
|
|
87
|
+
import { ColorEnum, type ColorBase } from "@dative-gpi/foundation-shared-components/models";
|
|
66
88
|
|
|
67
89
|
import FSClickable from "../FSClickable.vue";
|
|
68
90
|
import FSCheckbox from "../FSCheckbox.vue";
|
|
@@ -91,6 +113,11 @@ export default defineComponent({
|
|
|
91
113
|
required: false,
|
|
92
114
|
default: false
|
|
93
115
|
},
|
|
116
|
+
activeColor: {
|
|
117
|
+
type: [Array, String] as PropType<ColorBase>,
|
|
118
|
+
required: false,
|
|
119
|
+
default: ColorEnum.Primary
|
|
120
|
+
},
|
|
94
121
|
bottomColor: {
|
|
95
122
|
type: [Array, String] as PropType<ColorBase[] | ColorBase | null>,
|
|
96
123
|
required: false,
|
|
@@ -100,6 +127,11 @@ export default defineComponent({
|
|
|
100
127
|
type: Boolean,
|
|
101
128
|
required: false,
|
|
102
129
|
default: false
|
|
130
|
+
},
|
|
131
|
+
singleSelect: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
required: false,
|
|
134
|
+
default: false
|
|
103
135
|
}
|
|
104
136
|
},
|
|
105
137
|
emits: ["update:modelValue"],
|
|
@@ -107,7 +139,7 @@ export default defineComponent({
|
|
|
107
139
|
const { isMobileSized } = useBreakpoints();
|
|
108
140
|
const { getGradients } = useColors();
|
|
109
141
|
|
|
110
|
-
const style = computed(():
|
|
142
|
+
const style = computed((): StyleValue => {
|
|
111
143
|
if (props.bottomColor) {
|
|
112
144
|
const bottomColors = getGradients(props.bottomColor);
|
|
113
145
|
return {
|
|
@@ -117,17 +149,23 @@ export default defineComponent({
|
|
|
117
149
|
return {};
|
|
118
150
|
});
|
|
119
151
|
|
|
120
|
-
const
|
|
121
|
-
return isMobileSized.value ?
|
|
152
|
+
const height = computed((): number => {
|
|
153
|
+
return isMobileSized.value ? 156 : 170;
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const variant = computed((): "standard" | "background" => {
|
|
157
|
+
return (props.singleSelect && props.modelValue) ? "standard" : "background";
|
|
122
158
|
});
|
|
123
159
|
|
|
124
|
-
const
|
|
125
|
-
return
|
|
160
|
+
const color = computed((): ColorBase => {
|
|
161
|
+
return (props.singleSelect && props.modelValue) ? props.activeColor : ColorEnum.Background;
|
|
126
162
|
});
|
|
127
163
|
|
|
128
164
|
return {
|
|
165
|
+
ColorEnum,
|
|
166
|
+
variant,
|
|
129
167
|
height,
|
|
130
|
-
|
|
168
|
+
color,
|
|
131
169
|
style
|
|
132
170
|
};
|
|
133
171
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTile
|
|
3
|
+
:activeColor="ColorEnum.Primary"
|
|
3
4
|
:editable="$props.editable"
|
|
5
|
+
:width="$props.width"
|
|
4
6
|
:modelValue="$props.modelValue"
|
|
5
7
|
v-bind="$attrs"
|
|
6
8
|
>
|
|
@@ -18,16 +20,17 @@
|
|
|
18
20
|
gap="4px"
|
|
19
21
|
:width="infoWidth"
|
|
20
22
|
>
|
|
21
|
-
<
|
|
23
|
+
<FSSpan
|
|
22
24
|
font="text-button"
|
|
23
25
|
:lineClamp="2"
|
|
24
26
|
>
|
|
25
|
-
{{
|
|
26
|
-
</
|
|
27
|
+
{{ $props.name }}
|
|
28
|
+
</FSSpan>
|
|
27
29
|
<FSRow
|
|
28
30
|
v-if="roleLabel"
|
|
29
31
|
align="center-left"
|
|
30
32
|
gap="4px"
|
|
33
|
+
:wrap="false"
|
|
31
34
|
>
|
|
32
35
|
<FSIcon
|
|
33
36
|
v-if="roleIcon"
|
|
@@ -36,12 +39,12 @@
|
|
|
36
39
|
>
|
|
37
40
|
{{ roleIcon }}
|
|
38
41
|
</FSIcon>
|
|
39
|
-
<
|
|
42
|
+
<FSSpan
|
|
40
43
|
font="text-overline"
|
|
41
44
|
variant="soft"
|
|
42
45
|
>
|
|
43
46
|
{{ roleLabel }}
|
|
44
|
-
</
|
|
47
|
+
</FSSpan>
|
|
45
48
|
</FSRow>
|
|
46
49
|
</FSCol>
|
|
47
50
|
<FSImage
|
|
@@ -55,15 +58,14 @@
|
|
|
55
58
|
</template>
|
|
56
59
|
|
|
57
60
|
<script lang="ts">
|
|
58
|
-
import { computed, defineComponent, PropType } from "vue";
|
|
61
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
59
62
|
|
|
60
63
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
61
64
|
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
65
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
63
|
-
import { UserType } from "@dative-gpi/foundation-core-domain/models";
|
|
64
66
|
|
|
65
67
|
import FSImage from "../FSImage.vue";
|
|
66
|
-
import
|
|
68
|
+
import FSSpan from "../FSSpan.vue";
|
|
67
69
|
import FSTile from "./FSTile.vue";
|
|
68
70
|
import FSCol from "../FSCol.vue";
|
|
69
71
|
import FSRow from "../FSRow.vue";
|
|
@@ -72,7 +74,7 @@ export default defineComponent({
|
|
|
72
74
|
name: "FSUserOrganisationTileUI",
|
|
73
75
|
components: {
|
|
74
76
|
FSImage,
|
|
75
|
-
|
|
77
|
+
FSSpan,
|
|
76
78
|
FSTile,
|
|
77
79
|
FSCol,
|
|
78
80
|
FSRow
|
|
@@ -88,16 +90,6 @@ export default defineComponent({
|
|
|
88
90
|
required: false,
|
|
89
91
|
default: null
|
|
90
92
|
},
|
|
91
|
-
label: {
|
|
92
|
-
type: String as PropType<string | null>,
|
|
93
|
-
required: false,
|
|
94
|
-
default: null
|
|
95
|
-
},
|
|
96
|
-
userType: {
|
|
97
|
-
type: Number as PropType<UserType>,
|
|
98
|
-
required: false,
|
|
99
|
-
default: UserType.User
|
|
100
|
-
},
|
|
101
93
|
roleIcon: {
|
|
102
94
|
type: String as PropType<string | null>,
|
|
103
95
|
required: false,
|
|
@@ -113,6 +105,11 @@ export default defineComponent({
|
|
|
113
105
|
required: false,
|
|
114
106
|
default: false
|
|
115
107
|
},
|
|
108
|
+
width: {
|
|
109
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
110
|
+
required: false,
|
|
111
|
+
default: () => [352, 336]
|
|
112
|
+
},
|
|
116
113
|
modelValue: {
|
|
117
114
|
type: Boolean,
|
|
118
115
|
required: false,
|
|
@@ -128,13 +125,6 @@ export default defineComponent({
|
|
|
128
125
|
const { isMobileSized } = useBreakpoints();
|
|
129
126
|
const { $tr } = useTranslationsProvider();
|
|
130
127
|
|
|
131
|
-
const title = computed((): string | null => {
|
|
132
|
-
switch (props.userType) {
|
|
133
|
-
case UserType.ServiceAccount: return props.label;
|
|
134
|
-
default: return props.name;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
128
|
const roleIcon = computed((): string | null => {
|
|
139
129
|
if (props.admin) {
|
|
140
130
|
return "mdi-crown-outline";
|
|
@@ -150,24 +140,25 @@ export default defineComponent({
|
|
|
150
140
|
});
|
|
151
141
|
|
|
152
142
|
const imageSize = computed((): number => {
|
|
143
|
+
if (!props.imageId) {
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
153
146
|
return isMobileSized.value ? 90 : 100;
|
|
154
147
|
});
|
|
155
148
|
|
|
156
|
-
const infoWidth = computed(():
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
width -= imageSize.value;
|
|
149
|
+
const infoWidth = computed((): string => {
|
|
150
|
+
if (!props.imageId) {
|
|
151
|
+
return "100%";
|
|
160
152
|
}
|
|
161
|
-
return
|
|
153
|
+
return `calc(100% - ${imageSize.value}px - 24px)`;
|
|
162
154
|
});
|
|
163
155
|
|
|
164
156
|
return {
|
|
157
|
+
ColorEnum,
|
|
165
158
|
imageSize,
|
|
166
159
|
infoWidth,
|
|
167
|
-
ColorEnum,
|
|
168
160
|
roleLabel,
|
|
169
|
-
roleIcon
|
|
170
|
-
title
|
|
161
|
+
roleIcon
|
|
171
162
|
};
|
|
172
163
|
}
|
|
173
164
|
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSToggleSet
|
|
3
|
+
:values="positions"
|
|
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
|
+
</FSToggleSet>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { computed, defineComponent } from "vue";
|
|
22
|
+
import type { PropType } from "vue";
|
|
23
|
+
|
|
24
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
25
|
+
import { Position } from "@dative-gpi/foundation-shared-domain/models";
|
|
26
|
+
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
name: "FSToggleSetPosition",
|
|
29
|
+
props: {
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: Number as PropType<Position>,
|
|
32
|
+
required: false,
|
|
33
|
+
default: Position.Abscissa
|
|
34
|
+
},
|
|
35
|
+
useNone: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
required: false,
|
|
38
|
+
default: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue"],
|
|
42
|
+
setup(props) {
|
|
43
|
+
const { $tr } = useTranslationsProvider();
|
|
44
|
+
|
|
45
|
+
const positions = computed((): { id: Position; label: string }[] => {
|
|
46
|
+
const items = [
|
|
47
|
+
{ id: Position.Abscissa, label: $tr("ui.position.abscissa", "Right") },
|
|
48
|
+
{ id: Position.Ordinate, label: $tr("ui.position.ordinate", "Bottom") }
|
|
49
|
+
];
|
|
50
|
+
if (props.useNone) {
|
|
51
|
+
items.unshift({ id: Position.None, label: $tr("ui.position.none", "None") });
|
|
52
|
+
}
|
|
53
|
+
return items;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
positions
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
</script>
|
package/composables/index.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export * from "./useAddress";
|
|
1
2
|
export * from "./useAutocomplete";
|
|
2
3
|
export * from "./useBreakpoints";
|
|
3
4
|
export * from "./useColors";
|
|
4
5
|
export * from "./useDebounce";
|
|
6
|
+
export * from "./useMagicFieldProvider";
|
|
5
7
|
export * from "./useRules";
|
|
6
|
-
export * from "./useSlots";
|
|
8
|
+
export * from "./useSlots";
|
|
9
|
+
export * from "./useTables";
|
|
10
|
+
export * from "./useTreeView";
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Place } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
+
import { Address } from "@dative-gpi/foundation-shared-domain/models";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
|
|
5
|
+
export const useAddress = () => {
|
|
6
|
+
const enabled = true;
|
|
7
|
+
let initialized = false;
|
|
8
|
+
let searchService: google.maps.places.AutocompleteService;
|
|
9
|
+
let placeService: google.maps.places.PlacesService;
|
|
10
|
+
let sessionId: google.maps.places.AutocompleteSessionToken;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const init = async () => {
|
|
14
|
+
await window.initMap;
|
|
15
|
+
searchService = new google.maps.places.AutocompleteService();
|
|
16
|
+
placeService = new google.maps.places.PlacesService(
|
|
17
|
+
document.getElementById("places") as HTMLDivElement
|
|
18
|
+
);
|
|
19
|
+
sessionId = new google.maps.places.AutocompleteSessionToken();
|
|
20
|
+
initialized = true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const search = async (search: string): Promise<Place[]> => {
|
|
24
|
+
if(!initialized){
|
|
25
|
+
await init();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return _search(search).then(result => {
|
|
29
|
+
return _.map(result, r => ({ id: r.place_id, label: r.description }));
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
return [];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const get = async (place: Place): Promise<Address> => {
|
|
36
|
+
if(!initialized){
|
|
37
|
+
await init();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const response = await _get(place.id);
|
|
41
|
+
sessionId = new google.maps.places.AutocompleteSessionToken();
|
|
42
|
+
if (response.address_components && response.formatted_address && response.geometry) {
|
|
43
|
+
return new Address({
|
|
44
|
+
formattedAddress: response.formatted_address,
|
|
45
|
+
locality: _find(response.address_components, "locality"),
|
|
46
|
+
country: _find(response.address_components, "country"),
|
|
47
|
+
latitude: response.geometry.location?.lat() ?? 0,
|
|
48
|
+
longitude: response.geometry.location?.lng() ?? 0,
|
|
49
|
+
|
|
50
|
+
placeId: place.id,
|
|
51
|
+
placeLabel: place.label,
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
throw new Error("missing informations");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const reverseSearch = async (lat: number, lon: number): Promise<Address> => {
|
|
58
|
+
if(!initialized){
|
|
59
|
+
await init();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return _reverseSearch(lat, lon).then(result => {
|
|
63
|
+
if (result.length > 0) {
|
|
64
|
+
const response = result[0];
|
|
65
|
+
if (response.address_components && response.formatted_address && response.geometry) {
|
|
66
|
+
return new Address({
|
|
67
|
+
formattedAddress: response.formatted_address,
|
|
68
|
+
locality: _find(response.address_components, "locality"),
|
|
69
|
+
country: _find(response.address_components, "country"),
|
|
70
|
+
latitude: response.geometry.location?.lat() ?? 0,
|
|
71
|
+
longitude: response.geometry.location?.lng() ?? 0,
|
|
72
|
+
placeId: response.place_id,
|
|
73
|
+
placeLabel: response.formatted_address
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
throw new Error("missing informations");
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const _search = (search: string) => {
|
|
82
|
+
if (!enabled) {
|
|
83
|
+
throw new Error("offline mode, do not call this method");
|
|
84
|
+
}
|
|
85
|
+
return new Promise<google.maps.places.AutocompletePrediction[]>(
|
|
86
|
+
(resolve, reject) => {
|
|
87
|
+
searchService!.getPlacePredictions(
|
|
88
|
+
{
|
|
89
|
+
input: search,
|
|
90
|
+
sessionToken: sessionId!
|
|
91
|
+
},
|
|
92
|
+
function (result, status) {
|
|
93
|
+
if (status != google.maps.places.PlacesServiceStatus.OK || !result) {
|
|
94
|
+
reject(status);
|
|
95
|
+
} else {
|
|
96
|
+
resolve(result);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const _reverseSearch = (lat: number, lon: number) => {
|
|
105
|
+
if (!enabled) {
|
|
106
|
+
throw new Error("offline mode, do not call this method");
|
|
107
|
+
}
|
|
108
|
+
return new Promise<google.maps.GeocoderResult[]>((resolve, reject) => {
|
|
109
|
+
new google.maps.Geocoder().geocode(
|
|
110
|
+
{
|
|
111
|
+
location: { lat: lat, lng: lon }
|
|
112
|
+
},
|
|
113
|
+
(result, status) => {
|
|
114
|
+
if (status != google.maps.GeocoderStatus.OK || !result) {
|
|
115
|
+
reject(status);
|
|
116
|
+
} else {
|
|
117
|
+
resolve(result);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const _get = (id: string) => {
|
|
125
|
+
if (!enabled) {
|
|
126
|
+
throw new Error("offline mode, do not call this method");
|
|
127
|
+
}
|
|
128
|
+
return new Promise<google.maps.places.PlaceResult>((resolve, reject) => {
|
|
129
|
+
placeService!.getDetails(
|
|
130
|
+
{
|
|
131
|
+
placeId: id,
|
|
132
|
+
sessionToken: sessionId!,
|
|
133
|
+
fields: ["formatted_address", "geometry", "address_components", "name"]
|
|
134
|
+
},
|
|
135
|
+
(result, status) => {
|
|
136
|
+
if (status != google.maps.places.PlacesServiceStatus.OK || !result) {
|
|
137
|
+
reject(status);
|
|
138
|
+
} else {
|
|
139
|
+
resolve(result);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const _find = (components: google.maps.GeocoderAddressComponent[], type: string): string => {
|
|
147
|
+
const found = _.find(components, c =>
|
|
148
|
+
_.some(c.types, t => t === type)
|
|
149
|
+
);
|
|
150
|
+
return found?.long_name ?? "";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
search,
|
|
155
|
+
get,
|
|
156
|
+
reverseSearch
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Ref} from "vue";
|
|
2
|
+
import { computed, onMounted, ref, watch } from "vue";
|
|
2
3
|
import _ from "lodash";
|
|
3
4
|
|
|
4
5
|
import { useDebounce } from "./useDebounce";
|
|
@@ -60,11 +61,11 @@ export const useAutocomplete = <TInfos>(
|
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
watch(entities, () => {
|
|
64
|
+
watch(() => entities.value, () => {
|
|
64
65
|
if (init.value) {
|
|
65
66
|
init.value = false;
|
|
66
|
-
entitiesLength.value = entities.value.length;
|
|
67
67
|
}
|
|
68
|
+
entitiesLength.value = entities.value.length;
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
onMounted((): void => {
|