@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
|
@@ -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 => {
|
package/composables/useColors.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { useTheme } from "vuetify";
|
|
|
2
2
|
|
|
3
3
|
import Color from "color";
|
|
4
4
|
|
|
5
|
-
import { ColorBase,
|
|
5
|
+
import type { ColorBase, ColorVariations } from "@dative-gpi/foundation-shared-components/models";
|
|
6
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
6
7
|
|
|
7
8
|
export const useColors = () => {
|
|
8
9
|
const theme = useTheme().current.value;
|
|
@@ -34,10 +35,6 @@ export const useColors = () => {
|
|
|
34
35
|
return base.value(Math.min(base.value() + 10, 100));
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
const getBase = (base: Color): Color => {
|
|
38
|
-
return base;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
38
|
const getDark = (base: Color): Color => {
|
|
42
39
|
return base.value(Math.max(base.value() - 15, 0));
|
|
43
40
|
};
|
|
@@ -54,7 +51,7 @@ export const useColors = () => {
|
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
if(color.darken(0.15).isLight()){
|
|
57
|
-
return color.darken(0.
|
|
54
|
+
return color.darken(0.8);
|
|
58
55
|
}
|
|
59
56
|
return color.lighten(color.value() / 50);
|
|
60
57
|
}
|
|
@@ -62,33 +59,19 @@ export const useColors = () => {
|
|
|
62
59
|
const getColors = (color: ColorBase): ColorVariations => {
|
|
63
60
|
const themed = (Object as any).values(ColorEnum).includes(color);
|
|
64
61
|
|
|
65
|
-
const
|
|
62
|
+
const base = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
66
63
|
|
|
67
|
-
const base = getBase(seed);
|
|
68
64
|
const light = getLight(base);
|
|
69
65
|
const soft = getSoft(base);
|
|
70
66
|
const dark = getDark(base);
|
|
71
67
|
|
|
72
|
-
if (color === ColorEnum.Background) {
|
|
73
|
-
return {
|
|
74
|
-
get light(): string { throw new Error("Don't use it !") },
|
|
75
|
-
get lightContrast(): string { throw new Error("Don't use it !") },
|
|
76
|
-
get soft(): string { throw new Error("Don't use it !") },
|
|
77
|
-
get softContrast(): string { throw new Error("Don't use it !") },
|
|
78
|
-
base: base.hex(),
|
|
79
|
-
get baseContrast(): string { throw new Error("Don't use it !") },
|
|
80
|
-
get dark(): string { throw new Error("Don't use it !") },
|
|
81
|
-
get darkContrast(): string { throw new Error("Don't use it !") }
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
68
|
return {
|
|
86
69
|
light: light.hex(),
|
|
87
70
|
lightContrast: getContrast(light).hex(),
|
|
88
71
|
soft: soft.hex(),
|
|
89
72
|
softContrast: getContrast(soft).hex(),
|
|
90
|
-
base:
|
|
91
|
-
baseContrast: getContrast(
|
|
73
|
+
base: base.hex(),
|
|
74
|
+
baseContrast: getContrast(base).hex(),
|
|
92
75
|
dark: dark.hex(),
|
|
93
76
|
darkContrast: getContrast(dark).hex()
|
|
94
77
|
};
|
|
@@ -112,7 +95,7 @@ export const useColors = () => {
|
|
|
112
95
|
const columnCount = 8
|
|
113
96
|
const colors: string[][] = [];
|
|
114
97
|
for (let saturation = baseMinSaturation; saturation <= 100; saturation += (100 - baseMinSaturation) / (columnCount - 1)) {
|
|
115
|
-
|
|
98
|
+
const colorsRow = [];
|
|
116
99
|
for (let hue = 0; hue < 360; hue += 15) {
|
|
117
100
|
const color = new Color({ h: hue, s: saturation, v: baseFixedBrightness });
|
|
118
101
|
colorsRow.push(color.hex());
|
|
@@ -134,4 +117,4 @@ export const useColors = () => {
|
|
|
134
117
|
getGradients,
|
|
135
118
|
getBasePaletteColors
|
|
136
119
|
};
|
|
137
|
-
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineAsyncComponent } from "vue";
|
|
2
|
+
|
|
3
|
+
import { MagicFieldType } from "../models/magicFields";
|
|
4
|
+
|
|
5
|
+
const FIELDS = {
|
|
6
|
+
[MagicFieldType.NumberField] : defineAsyncComponent(() => import("../components/fields/FSNumberField.vue")),
|
|
7
|
+
[MagicFieldType.TextField] : defineAsyncComponent(() => import("../components/fields/FSTextField.vue")),
|
|
8
|
+
[MagicFieldType.Switch] : defineAsyncComponent(() => import("../components/FSSwitch.vue")),
|
|
9
|
+
[MagicFieldType.DateTimeField]: defineAsyncComponent(() => import("../components/fields/FSDateTimeField.vue")),
|
|
10
|
+
[MagicFieldType.IconField] : defineAsyncComponent(() => import("../components/fields/FSIconField.vue")),
|
|
11
|
+
[MagicFieldType.TimeField] : defineAsyncComponent(() => import("../components/fields/FSTimeField.vue")),
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const useMagicFieldProvider = () => {
|
|
15
|
+
const get = (code: keyof typeof FIELDS) => {
|
|
16
|
+
return FIELDS[code];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
get
|
|
21
|
+
};
|
|
22
|
+
};
|
package/composables/useRules.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { Ref
|
|
1
|
+
import type { Ref} from "vue";
|
|
2
|
+
import { computed, inject, ref } from "vue";
|
|
2
3
|
|
|
3
4
|
export const useRules = () => {
|
|
4
|
-
const innerValidateOn = inject<Ref<"submit" | "
|
|
5
|
+
const innerValidateOn = inject<Ref<"submit" | "input">>("validateOn", ref('input'));
|
|
5
6
|
const submitted = inject<Ref<boolean>>("submitted", ref(false));
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const validateOn = computed((): "input" | "submit" | "blur" => {
|
|
8
|
+
const validateOn = computed((): "input" | "submit" => {
|
|
10
9
|
switch (innerValidateOn.value) {
|
|
11
10
|
case "submit": return submitted.value ? "input" : "submit";
|
|
12
|
-
case "blur": return blurred.value ? "input" : "blur";
|
|
13
11
|
case "input": return "input";
|
|
14
12
|
}
|
|
15
13
|
});
|
|
@@ -24,11 +22,6 @@ export const useRules = () => {
|
|
|
24
22
|
return [];
|
|
25
23
|
}
|
|
26
24
|
break;
|
|
27
|
-
case "blur":
|
|
28
|
-
if (!blurred.value) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
break;
|
|
32
25
|
case "input":
|
|
33
26
|
break;
|
|
34
27
|
}
|
|
@@ -69,7 +62,6 @@ export const useRules = () => {
|
|
|
69
62
|
|
|
70
63
|
return {
|
|
71
64
|
validateOn,
|
|
72
|
-
blurred,
|
|
73
65
|
getMessages
|
|
74
66
|
};
|
|
75
67
|
}
|
package/composables/useSlots.ts
CHANGED
|
@@ -1,31 +1,51 @@
|
|
|
1
|
-
import { Slot, useSlots as useVueSlots } from "vue"
|
|
1
|
+
import { type Slot, useSlots as useVueSlots } from "vue"
|
|
2
2
|
|
|
3
3
|
export const useSlots = () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
const getChildren = (name: string | undefined = undefined): any => {
|
|
5
|
+
const innerSlots = { ...useVueSlots() };
|
|
6
|
+
const innerName = name ?? "default";
|
|
7
|
+
if (innerSlots[innerName] != null) {
|
|
8
|
+
const slot = innerSlots[innerName]!;
|
|
9
|
+
switch (typeof(slot()[0].type)) {
|
|
10
|
+
// Directive wrapper (v-for, v-if)
|
|
11
|
+
case "symbol":
|
|
12
|
+
switch (slot()[0].type) {
|
|
13
|
+
case Symbol.for("v-fgt"): return recursiveGetChildren(slot()[0].children);
|
|
14
|
+
case Symbol.for("v-cmt"): return slot();
|
|
15
|
+
default: return slot();
|
|
16
|
+
}
|
|
17
|
+
// Custom component
|
|
18
|
+
case "object": return slot();
|
|
19
|
+
// Pre-existing component
|
|
20
|
+
case "string": return slot();
|
|
21
|
+
}
|
|
22
|
+
return slot();
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const recursiveGetChildren = (element: any): any => {
|
|
28
|
+
if (element == null) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
switch (typeof(element[0].type)) {
|
|
32
|
+
// Directive wrapper (v-for, v-if)
|
|
33
|
+
case "symbol":
|
|
34
|
+
switch (element[0].type) {
|
|
35
|
+
case Symbol.for("v-fgt"): return recursiveGetChildren(element[0].children);
|
|
36
|
+
case Symbol.for("v-cmt"): return element;
|
|
37
|
+
default: return element;
|
|
23
38
|
}
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
// Custom component
|
|
40
|
+
case "object": return element;
|
|
41
|
+
// Pre-existing component
|
|
42
|
+
case "string": return element;
|
|
43
|
+
}
|
|
44
|
+
return element;
|
|
45
|
+
};
|
|
26
46
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
47
|
+
return {
|
|
48
|
+
slots: { ...useVueSlots() } as { [label: string]: Slot<any> },
|
|
49
|
+
getChildren
|
|
50
|
+
};
|
|
31
51
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { Single } from "@dative-gpi/foundation-shared-domain/tools/single";
|
|
4
|
+
|
|
5
|
+
import type { FSDataTable } from "../models";
|
|
6
|
+
|
|
7
|
+
const tables = ref<{ [key: string]: FSDataTable }>({});
|
|
8
|
+
|
|
9
|
+
const single = new Single();
|
|
10
|
+
|
|
11
|
+
export const useTables = () => {
|
|
12
|
+
return single.call(() => {
|
|
13
|
+
const getTable = (tableCode: string): FSDataTable | null => {
|
|
14
|
+
if (tables.value[tableCode] != null) {
|
|
15
|
+
return tables.value[tableCode];
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const setTable = (tableCode: string, value: FSDataTable) => {
|
|
21
|
+
tables.value[tableCode] = { ...value };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
getTable,
|
|
26
|
+
setTable
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Ref} from "vue";
|
|
2
|
+
import { onMounted, watch } from "vue";
|
|
3
|
+
import _ from "lodash";
|
|
4
|
+
|
|
5
|
+
import { useDebounce } from "./useDebounce";
|
|
6
|
+
|
|
7
|
+
export const useTreeView = <TInfos>(
|
|
8
|
+
entities: Ref<TInfos[]>,
|
|
9
|
+
filters: (() => any)[],
|
|
10
|
+
emit: (event: "update:modelValue", value: string[] | string | null) => void,
|
|
11
|
+
customFetch: () => Promise<any>,
|
|
12
|
+
customUpdate: ((item: TInfos[] | TInfos | null) => void) | null = null,
|
|
13
|
+
toId: (item: TInfos) => string | null = (item: TInfos) => (item as any).id,
|
|
14
|
+
debounceInterval: number = 1000
|
|
15
|
+
) => {
|
|
16
|
+
const { debounce } = useDebounce();
|
|
17
|
+
|
|
18
|
+
const debouncedFetch = () => debounce(customFetch, debounceInterval);
|
|
19
|
+
|
|
20
|
+
const onUpdate = (value: string[] | string | null) => {
|
|
21
|
+
if (customUpdate) {
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
const items = value.map(v => entities.value.find(e => toId(e) === v) || null).filter(e => e !== null) as TInfos[];
|
|
24
|
+
customUpdate(items);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
customUpdate((value && entities.value.find(e => toId(e) === value)) || null);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
emit("update:modelValue", value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
watch(filters, (newValue, oldValue) => {
|
|
36
|
+
if (!_.isEqual(newValue, oldValue)) {
|
|
37
|
+
debouncedFetch();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
onMounted((): void => {
|
|
42
|
+
customFetch();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
onUpdate
|
|
47
|
+
};
|
|
48
|
+
}
|
package/icons/flags/France.vue
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<svg
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
id="flag-icons-fr"
|
|
5
|
+
viewBox="0 0 640 480"
|
|
6
|
+
>
|
|
7
|
+
<g
|
|
8
|
+
fill-rule="evenodd"
|
|
9
|
+
stroke-width="1pt"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="#fff"
|
|
13
|
+
d="M0 0h640v480H0z"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fill="#00267f"
|
|
17
|
+
d="M0 0h213.3v480H0z"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
fill="#f31830"
|
|
21
|
+
d="M426.7 0H640v480H426.7z"
|
|
22
|
+
/>
|
|
7
23
|
</g>
|
|
8
24
|
</svg>
|
|
9
25
|
</template>
|
package/icons/flags/Germany.vue
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<svg
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
id="flag-icons-de"
|
|
5
|
+
viewBox="0 0 640 480"
|
|
6
|
+
>
|
|
7
|
+
<path
|
|
8
|
+
fill="#ffce00"
|
|
9
|
+
d="M0 320h640v160H0z"
|
|
10
|
+
/>
|
|
11
|
+
<path
|
|
12
|
+
d="M0 0h640v160H0z"
|
|
13
|
+
/>
|
|
14
|
+
<path
|
|
15
|
+
fill="#d00"
|
|
16
|
+
d="M0 160h640v160H0z"
|
|
17
|
+
/>
|
|
6
18
|
</svg>
|
|
7
19
|
</template>
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<svg
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<path
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
id="flag-icons-gb"
|
|
5
|
+
viewBox="0 0 640 480"
|
|
6
|
+
>
|
|
7
|
+
<path
|
|
8
|
+
fill="#012169"
|
|
9
|
+
d="M0 0h640v480H0z"
|
|
10
|
+
/>
|
|
11
|
+
<path
|
|
12
|
+
fill="#FFF"
|
|
13
|
+
d="m75 0 244 181L562 0h78v62L400 241l240 178v61h-80L320 301 81 480H0v-60l239-178L0 64V0h75z"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fill="#C8102E"
|
|
17
|
+
d="m424 281 216 159v40L369 281h55zm-184 20 6 35L54 480H0l240-179zM640 0v3L391 191l2-44L590 0h50zM0 0l239 176h-60L0 42V0z"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
fill="#FFF"
|
|
21
|
+
d="M241 0v480h160V0H241zM0 160v160h640V160H0z"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
fill="#C8102E"
|
|
25
|
+
d="M0 193v96h640v-96H0zM273 0v480h96V0h-96z"
|
|
26
|
+
/>
|
|
8
27
|
</svg>
|
|
9
28
|
</template>
|
package/icons/flags/Italy.vue
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<svg
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
id="flag-icons-it"
|
|
5
|
+
viewBox="0 0 640 480"
|
|
6
|
+
>
|
|
7
|
+
<g
|
|
8
|
+
fill-rule="evenodd"
|
|
9
|
+
stroke-width="1pt"
|
|
10
|
+
>
|
|
11
|
+
<path
|
|
12
|
+
fill="#fff"
|
|
13
|
+
d="M0 0h640v480H0z"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
fill="#009246"
|
|
17
|
+
d="M0 0h213.3v480H0z"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
fill="#ce2b37"
|
|
21
|
+
d="M426.7 0H640v480H426.7z"
|
|
22
|
+
/>
|
|
7
23
|
</g>
|
|
8
24
|
</svg>
|
|
9
25
|
</template>
|