@dative-gpi/foundation-shared-components 0.1.120 → 1.0.0
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 +210 -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 +7 -5
- package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +7 -5
- package/components/tiles/FSDashboardShallowTileUI.vue +7 -5
- package/components/tiles/FSDeviceOrganisationTileUI.vue +11 -12
- package/components/tiles/FSFolderTileUI.vue +8 -6
- package/components/tiles/FSGroupTileUI.vue +13 -15
- package/components/tiles/{FSSimpleIconTileUI.vue → FSSimpleTileUI.vue} +29 -15
- package/components/tiles/FSTile.vue +5 -11
- package/components/tiles/FSUserOrganisationTileUI.vue +2 -1
- 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 +46 -26
- 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
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:style="style"
|
|
14
14
|
:class="classes"
|
|
15
15
|
:rows="$props.rows"
|
|
16
|
+
:persistentClear="true"
|
|
16
17
|
:hideDetails="true"
|
|
17
18
|
:noResize="true"
|
|
18
19
|
:autoGrow="$props.autoGrow"
|
|
@@ -22,7 +23,6 @@
|
|
|
22
23
|
:validateOn="validateOn"
|
|
23
24
|
:modelValue="$props.modelValue"
|
|
24
25
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
25
|
-
@blur="blurred = true"
|
|
26
26
|
v-bind="$attrs"
|
|
27
27
|
>
|
|
28
28
|
<template
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
</template>
|
|
55
55
|
|
|
56
56
|
<script lang="ts">
|
|
57
|
-
import {
|
|
57
|
+
import type { PropType } from "vue";
|
|
58
|
+
import { computed, defineComponent } from "vue";
|
|
58
59
|
|
|
59
60
|
import { useColors, useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
60
61
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
@@ -127,7 +128,7 @@ export default defineComponent({
|
|
|
127
128
|
},
|
|
128
129
|
emits: ["update:modelValue"],
|
|
129
130
|
setup(props) {
|
|
130
|
-
const { validateOn,
|
|
131
|
+
const { validateOn, getMessages } = useRules();
|
|
131
132
|
const { isMobileSized } = useBreakpoints();
|
|
132
133
|
const { getColors } = useColors();
|
|
133
134
|
|
|
@@ -184,7 +185,6 @@ export default defineComponent({
|
|
|
184
185
|
validateOn,
|
|
185
186
|
ColorEnum,
|
|
186
187
|
messages,
|
|
187
|
-
blurred,
|
|
188
188
|
classes,
|
|
189
189
|
style
|
|
190
190
|
};
|
|
@@ -7,11 +7,30 @@
|
|
|
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>
|
|
19
|
+
<template
|
|
20
|
+
v-if="$slots.description"
|
|
21
|
+
v-slot:label="slotData"
|
|
22
|
+
>
|
|
23
|
+
<slot
|
|
24
|
+
name="description"
|
|
25
|
+
v-bind="slotData"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
10
28
|
<v-text-field
|
|
11
29
|
class="fs-text-field"
|
|
12
30
|
variant="outlined"
|
|
13
31
|
:style="style"
|
|
14
32
|
:type="$props.type"
|
|
33
|
+
:persistentClear="true"
|
|
15
34
|
:hideDetails="true"
|
|
16
35
|
:readonly="!$props.editable"
|
|
17
36
|
:clearable="$props.clearable && $props.editable && !!$props.modelValue"
|
|
@@ -19,11 +38,10 @@
|
|
|
19
38
|
:validateOn="validateOn"
|
|
20
39
|
:modelValue="$props.modelValue"
|
|
21
40
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
22
|
-
@blur="blurred = true"
|
|
23
41
|
v-bind="$attrs"
|
|
24
42
|
>
|
|
25
43
|
<template
|
|
26
|
-
v-for="(_, name) in
|
|
44
|
+
v-for="(_, name) in slots"
|
|
27
45
|
v-slot:[name]="slotData"
|
|
28
46
|
>
|
|
29
47
|
<slot
|
|
@@ -47,9 +65,10 @@
|
|
|
47
65
|
</template>
|
|
48
66
|
|
|
49
67
|
<script lang="ts">
|
|
50
|
-
import {
|
|
68
|
+
import type { PropType } from "vue";
|
|
69
|
+
import { computed, defineComponent } from "vue";
|
|
51
70
|
|
|
52
|
-
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
71
|
+
import { useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
53
72
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
54
73
|
|
|
55
74
|
import FSBaseField from "./FSBaseField.vue";
|
|
@@ -115,8 +134,12 @@ export default defineComponent({
|
|
|
115
134
|
},
|
|
116
135
|
emits: ["update:modelValue"],
|
|
117
136
|
setup(props) {
|
|
118
|
-
const { validateOn,
|
|
137
|
+
const { validateOn, getMessages } = useRules();
|
|
119
138
|
const { getColors } = useColors();
|
|
139
|
+
const { slots } = useSlots();
|
|
140
|
+
|
|
141
|
+
delete slots.label;
|
|
142
|
+
delete slots.description;
|
|
120
143
|
|
|
121
144
|
const errors = getColors(ColorEnum.Error);
|
|
122
145
|
const lights = getColors(ColorEnum.Light);
|
|
@@ -146,7 +169,7 @@ export default defineComponent({
|
|
|
146
169
|
validateOn,
|
|
147
170
|
ColorEnum,
|
|
148
171
|
messages,
|
|
149
|
-
|
|
172
|
+
slots,
|
|
150
173
|
style
|
|
151
174
|
};
|
|
152
175
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSBaseField
|
|
3
|
-
:label="$props.label"
|
|
4
3
|
:description="$props.description"
|
|
5
4
|
:hideHeader="$props.hideHeader"
|
|
6
5
|
:required="$props.required"
|
|
7
6
|
:editable="$props.editable"
|
|
7
|
+
:label="$props.label"
|
|
8
8
|
:messages="messages"
|
|
9
9
|
>
|
|
10
10
|
<FSRow>
|
|
11
11
|
<FSNumberField
|
|
12
|
+
:validationValue="$props.modelValue"
|
|
12
13
|
:editable="$props.editable"
|
|
13
|
-
:
|
|
14
|
+
:validateOn="validateOn"
|
|
14
15
|
:rules="$props.rules"
|
|
16
|
+
:hideHeader="true"
|
|
15
17
|
:messages="messages"
|
|
16
|
-
:validateOn="validateOn"
|
|
17
|
-
:validationValue="$props.modelValue"
|
|
18
18
|
:modelValue="innerTime"
|
|
19
19
|
@update:modelValue="onSubmitValue"
|
|
20
20
|
v-bind="$attrs"
|
|
21
21
|
>
|
|
22
22
|
<template
|
|
23
|
-
v-for="(_, name) in
|
|
23
|
+
v-for="(_, name) in numberSlots"
|
|
24
24
|
v-slot:[name]="slotData"
|
|
25
25
|
>
|
|
26
26
|
<slot
|
|
@@ -37,16 +37,26 @@
|
|
|
37
37
|
:items="timeScale"
|
|
38
38
|
:modelValue="selectedUnit.id"
|
|
39
39
|
@update:modelValue="onSubmitTimeScale"
|
|
40
|
-
|
|
40
|
+
>
|
|
41
|
+
<template
|
|
42
|
+
v-for="(_, name) in selectSlots"
|
|
43
|
+
v-slot:[name]="slotData"
|
|
44
|
+
>
|
|
45
|
+
<slot
|
|
46
|
+
:name="name"
|
|
47
|
+
v-bind="slotData"
|
|
48
|
+
/>
|
|
49
|
+
</template>
|
|
50
|
+
</FSSelectField>
|
|
41
51
|
</FSRow>
|
|
42
52
|
</FSBaseField>
|
|
43
53
|
</template>
|
|
44
54
|
|
|
45
55
|
<script lang="ts">
|
|
46
|
-
import { computed, defineComponent, PropType, ref } from "vue";
|
|
56
|
+
import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
47
57
|
|
|
58
|
+
import { useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
48
59
|
import { getTimeScaleIndex, timeScale } from "@dative-gpi/foundation-shared-components/utils";
|
|
49
|
-
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
50
60
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
51
61
|
|
|
52
62
|
import FSNumberField from "./FSNumberField.vue";
|
|
@@ -106,8 +116,12 @@ export default defineComponent({
|
|
|
106
116
|
},
|
|
107
117
|
emits: ["update:modelValue"],
|
|
108
118
|
setup(props, { emit }) {
|
|
109
|
-
const { validateOn,
|
|
119
|
+
const { validateOn, getMessages } = useRules();
|
|
110
120
|
const { getColors } = useColors();
|
|
121
|
+
const { slots } = useSlots();
|
|
122
|
+
|
|
123
|
+
delete slots.label;
|
|
124
|
+
delete slots.description;
|
|
111
125
|
|
|
112
126
|
const errors = getColors(ColorEnum.Error);
|
|
113
127
|
const lights = getColors(ColorEnum.Light);
|
|
@@ -116,16 +130,6 @@ export default defineComponent({
|
|
|
116
130
|
const innerTime = ref(0);
|
|
117
131
|
const selectedUnit = ref(timeScale[0]);
|
|
118
132
|
|
|
119
|
-
if (props.modelValue) {
|
|
120
|
-
if (getTimeScaleIndex(props.modelValue) !== 0) {
|
|
121
|
-
selectedUnit.value = timeScale[getTimeScaleIndex(props.modelValue)];
|
|
122
|
-
innerTime.value = props.modelValue / selectedUnit.value.id;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
innerTime.value = props.modelValue;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
133
|
const style = computed((): { [key: string] : string | null | undefined } => {
|
|
130
134
|
if (!props.editable) {
|
|
131
135
|
return {
|
|
@@ -145,6 +149,20 @@ export default defineComponent({
|
|
|
145
149
|
};
|
|
146
150
|
});
|
|
147
151
|
|
|
152
|
+
const numberSlots = computed((): any => {
|
|
153
|
+
return Object.keys(slots).filter(k => k.startsWith("number-")).reduce((acc, key) => {
|
|
154
|
+
acc[key.substring("number-".length)] = slots[key];
|
|
155
|
+
return acc;
|
|
156
|
+
}, {});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const selectSlots = computed((): any => {
|
|
160
|
+
return Object.keys(slots).filter(k => k.startsWith("select-")).reduce((acc, key) => {
|
|
161
|
+
acc[key.substring("select-".length)] = slots[key];
|
|
162
|
+
return acc;
|
|
163
|
+
}, {});
|
|
164
|
+
});
|
|
165
|
+
|
|
148
166
|
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
149
167
|
|
|
150
168
|
const onSubmitValue = (value: number): void => {
|
|
@@ -157,13 +175,30 @@ export default defineComponent({
|
|
|
157
175
|
emit("update:modelValue", innerTime.value * selectedUnit.value.id);
|
|
158
176
|
};
|
|
159
177
|
|
|
178
|
+
const reset = (): void => {
|
|
179
|
+
if (props.modelValue) {
|
|
180
|
+
if (getTimeScaleIndex(props.modelValue) !== 0) {
|
|
181
|
+
selectedUnit.value = timeScale[getTimeScaleIndex(props.modelValue)];
|
|
182
|
+
innerTime.value = props.modelValue / selectedUnit.value.id;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
innerTime.value = props.modelValue;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
watch(() => props.modelValue, () => {
|
|
191
|
+
reset();
|
|
192
|
+
}, { immediate: true });
|
|
193
|
+
|
|
160
194
|
return {
|
|
161
195
|
selectedUnit,
|
|
196
|
+
numberSlots,
|
|
197
|
+
selectSlots,
|
|
162
198
|
validateOn,
|
|
163
199
|
innerTime,
|
|
164
200
|
timeScale,
|
|
165
201
|
messages,
|
|
166
|
-
blurred,
|
|
167
202
|
style,
|
|
168
203
|
onSubmitTimeScale,
|
|
169
204
|
onSubmitValue
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSBaseField
|
|
3
|
-
:label="$props.label"
|
|
4
3
|
:description="$props.description"
|
|
5
4
|
:hideHeader="$props.hideHeader"
|
|
6
5
|
:required="$props.required"
|
|
7
6
|
:editable="$props.editable"
|
|
7
|
+
:label="$props.label"
|
|
8
8
|
:messages="messages"
|
|
9
9
|
>
|
|
10
10
|
<FSRow>
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
:wrap="false"
|
|
13
13
|
>
|
|
14
14
|
<FSSelectField
|
|
15
|
+
:validationValue="$props.modelValue"
|
|
15
16
|
:editable="$props.editable"
|
|
17
|
+
:validateOn="validateOn"
|
|
18
|
+
:rules="$props.rules"
|
|
16
19
|
:items="daysObject"
|
|
17
20
|
:hideHeader="true"
|
|
18
21
|
:clearable="false"
|
|
19
22
|
:style="style"
|
|
20
|
-
:rules="$props.rules"
|
|
21
|
-
:validateOn="validateOn"
|
|
22
|
-
:validationValue="$props.modelValue"
|
|
23
23
|
:modelValue="dayStart"
|
|
24
24
|
@update:modelValue="onChangeDayStart"
|
|
25
25
|
/>
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
</template>
|
|
62
62
|
|
|
63
63
|
<script lang="ts">
|
|
64
|
-
import {
|
|
64
|
+
import type { PropType } from "vue";
|
|
65
|
+
import { computed, defineComponent } from "vue";
|
|
65
66
|
|
|
66
67
|
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
68
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSTextField
|
|
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
|
+
:prependIcon="$props.buttonPrependIcon"
|
|
22
|
+
:appendIcon="$props.buttonAppendIcon"
|
|
23
|
+
:variant="$props.buttonVariant"
|
|
24
|
+
:color="$props.buttonColor"
|
|
25
|
+
:label="$props.buttonLabel"
|
|
26
|
+
@click="dialog = true"
|
|
27
|
+
/>
|
|
28
|
+
<slot
|
|
29
|
+
name="append"
|
|
30
|
+
/>
|
|
31
|
+
</template>
|
|
32
|
+
</FSTextField>
|
|
33
|
+
<FSDialogSubmit
|
|
34
|
+
:title="$tr('ui.translate-field.title', 'Handle translations')"
|
|
35
|
+
:submitButtonColor="$props.buttonColor"
|
|
36
|
+
@click:submitButton="onSubmit"
|
|
37
|
+
v-model="dialog"
|
|
38
|
+
>
|
|
39
|
+
<template
|
|
40
|
+
#body
|
|
41
|
+
>
|
|
42
|
+
<FSCol
|
|
43
|
+
gap="32px"
|
|
44
|
+
>
|
|
45
|
+
<FSTextField
|
|
46
|
+
:label="$tr('ui.translate-field.default-value', 'Default value')"
|
|
47
|
+
:editable="false"
|
|
48
|
+
:modelValue="$props.modelValue"
|
|
49
|
+
/>
|
|
50
|
+
<FSCol
|
|
51
|
+
gap="16px"
|
|
52
|
+
>
|
|
53
|
+
<FSTextField
|
|
54
|
+
v-for="(language, index) in languages"
|
|
55
|
+
:editable="$props.editable"
|
|
56
|
+
:key="index"
|
|
57
|
+
:modelValue="getTranslation(language.code)"
|
|
58
|
+
@update:modelValue="setTranslation(language.code, $event)"
|
|
59
|
+
>
|
|
60
|
+
<template
|
|
61
|
+
#label
|
|
62
|
+
>
|
|
63
|
+
<FSRow
|
|
64
|
+
:wrap="false"
|
|
65
|
+
>
|
|
66
|
+
<FSSpan
|
|
67
|
+
class="fs-translate-field-label"
|
|
68
|
+
font="text-overline"
|
|
69
|
+
:style="style"
|
|
70
|
+
>
|
|
71
|
+
{{ $tr("ui.translate-field.translate-in", "Translate in {0}", language.label) }}
|
|
72
|
+
</FSSpan>
|
|
73
|
+
<FSIcon>
|
|
74
|
+
{{ language.icon }}
|
|
75
|
+
</FSIcon>
|
|
76
|
+
</FSRow>
|
|
77
|
+
</template>
|
|
78
|
+
</FSTextField>
|
|
79
|
+
</FSCol>
|
|
80
|
+
</FSCol>
|
|
81
|
+
</template>
|
|
82
|
+
</FSDialogSubmit>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script lang="ts">
|
|
86
|
+
import { computed, defineComponent, type PropType, ref } from "vue";
|
|
87
|
+
|
|
88
|
+
import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
89
|
+
import { useAppLanguages } from "@dative-gpi/foundation-shared-services/composables";
|
|
90
|
+
|
|
91
|
+
import { useColors, useSlots } from "../../composables";
|
|
92
|
+
|
|
93
|
+
import FSDialogSubmit from "../FSDialogSubmit.vue";
|
|
94
|
+
import FSTextField from "./FSTextField.vue";
|
|
95
|
+
import FSButton from "../FSButton.vue";
|
|
96
|
+
import FSIcon from "../FSIcon.vue";
|
|
97
|
+
import FSSpan from "../FSSpan.vue";
|
|
98
|
+
import FSRow from "../FSRow.vue";
|
|
99
|
+
|
|
100
|
+
export default defineComponent({
|
|
101
|
+
name: "FSTranslateField",
|
|
102
|
+
components: {
|
|
103
|
+
FSDialogSubmit,
|
|
104
|
+
FSTextField,
|
|
105
|
+
FSButton,
|
|
106
|
+
FSIcon,
|
|
107
|
+
FSSpan,
|
|
108
|
+
FSRow
|
|
109
|
+
},
|
|
110
|
+
props: {
|
|
111
|
+
buttonPrependIcon: {
|
|
112
|
+
type: String as PropType<string | null>,
|
|
113
|
+
required: false,
|
|
114
|
+
default: "mdi-translate"
|
|
115
|
+
},
|
|
116
|
+
buttonLabel: {
|
|
117
|
+
type: String as PropType<string | null>,
|
|
118
|
+
required: false,
|
|
119
|
+
default: null
|
|
120
|
+
},
|
|
121
|
+
buttonAppendIcon: {
|
|
122
|
+
type: String as PropType<string | null>,
|
|
123
|
+
required: false,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
buttonVariant: {
|
|
127
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
128
|
+
required: false,
|
|
129
|
+
default: "standard"
|
|
130
|
+
},
|
|
131
|
+
modelValue: {
|
|
132
|
+
type: String as PropType<string | null>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: null
|
|
135
|
+
},
|
|
136
|
+
property: {
|
|
137
|
+
type: String as PropType<string>,
|
|
138
|
+
required: false,
|
|
139
|
+
default: "label"
|
|
140
|
+
},
|
|
141
|
+
translations: {
|
|
142
|
+
type: Array as PropType<{ languageCode: string; [key: string]: string }[]>,
|
|
143
|
+
required: false,
|
|
144
|
+
default: () => []
|
|
145
|
+
},
|
|
146
|
+
buttonColor: {
|
|
147
|
+
type: String as PropType<ColorBase>,
|
|
148
|
+
required: false,
|
|
149
|
+
default: ColorEnum.Primary
|
|
150
|
+
},
|
|
151
|
+
editable: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
required: false,
|
|
154
|
+
default: true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
emits: ["update:modelValue", "update:translations"],
|
|
158
|
+
setup(props, { emit }) {
|
|
159
|
+
const { languages } = useAppLanguages();
|
|
160
|
+
const { getColors } = useColors();
|
|
161
|
+
const { slots } = useSlots();
|
|
162
|
+
|
|
163
|
+
delete slots.append;
|
|
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((): { [key: string] : string | null | undefined } => {
|
|
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
|
+
slots,
|
|
227
|
+
style,
|
|
228
|
+
getTranslation,
|
|
229
|
+
setTranslation,
|
|
230
|
+
onSubmit
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
</script>
|