@dative-gpi/foundation-core-components 1.0.27 → 1.0.28-remove-deprecated2
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/components/autocompletes/FSAutocompleteChart.vue +60 -58
- package/components/autocompletes/FSAutocompleteDashboard.vue +59 -56
- package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +30 -39
- package/components/autocompletes/FSAutocompleteDataCategory.vue +52 -38
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +25 -39
- package/components/autocompletes/FSAutocompleteGroup.vue +23 -38
- package/components/autocompletes/FSAutocompleteLocation.vue +23 -38
- package/components/autocompletes/FSAutocompleteManufacturer.vue +65 -2
- package/components/autocompletes/FSAutocompleteModel.vue +66 -3
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +23 -0
- package/components/autocompletes/FSAutocompleteRole.vue +59 -56
- package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +105 -0
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +32 -57
- package/components/customProperties/FSMetaField.vue +31 -35
- package/components/customProperties/FSMetaHistory.vue +4 -4
- package/components/customProperties/FSMetaValue.vue +66 -33
- package/components/customProperties/helpers.ts +2 -1
- package/components/entities/FSBaseEntitiesList.vue +50 -0
- package/components/entities/FSDialogSelectEntities.vue +83 -0
- package/components/entities/FSEntityField.vue +203 -0
- package/components/entities/FSSelectEntitiesList.vue +209 -0
- package/components/entities/FSSimpleEntitiesList.vue +100 -0
- package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
- package/components/explorers/FSBaseFoldersExplorer.vue +265 -0
- package/components/lists/FSDataTable.vue +23 -21
- package/components/lists/alerts/FSBaseAlertsList.vue +337 -0
- package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +204 -0
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +205 -0
- package/components/lists/charts/FSBaseChartsList.vue +268 -0
- package/components/lists/comments/FSBaseCommentsList.vue +143 -0
- package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
- package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +168 -0
- package/components/lists/dashboards/FSBaseDashboardsList.vue +227 -0
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +129 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +327 -0
- package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
- package/components/lists/folders/FSBaseFoldersList.vue +127 -0
- package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
- package/components/lists/groups/FSBaseGroupsList.vue +136 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
- package/components/lists/locations/FSBaseLocationsList.vue +118 -0
- package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
- package/components/lists/models/FSBaseModelsList.vue +155 -0
- package/components/lists/models/FSSimpleModelsList.vue +44 -0
- package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
- package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
- package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
- package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
- package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
- package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +156 -0
- package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +172 -0
- package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
- package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
- package/components/tiles/FSLocationTile.vue +66 -0
- package/components/treeviews/FSTreeViewFolder.vue +15 -3
- package/components/treeviews/FSTreeViewGroup.vue +22 -4
- package/package.json +9 -9
- package/utils/dashboards.ts +33 -5
- package/utils/index.ts +2 -2
- package/utils/permissions.ts +80 -0
- package/utils/roles.ts +4 -4
- package/utils/tables.ts +41 -0
- package/utils/users.ts +7 -4
- package/components/selects/FSAggregationSelector.vue +0 -51
- package/components/selects/FSAxisTypeSelector.vue +0 -48
- package/components/selects/FSDataCategorySelector.vue +0 -62
- package/components/selects/FSDataDefinitionSelector.vue +0 -66
- package/components/selects/FSDisplayAsSelector.vue +0 -52
- package/components/selects/FSFilterTypeSelector.vue +0 -53
- package/components/selects/FSHeatmapRuleSelector.vue +0 -52
- package/components/selects/FSModelSelector.vue +0 -56
- package/components/selects/FSOperationOnSelector.vue +0 -51
- package/components/selects/FSPlanningTypeSelector.vue +0 -51
- package/components/selects/FSPlotPerSelector.vue +0 -51
- package/components/selects/FSSelectSelectedEntities.vue +0 -59
- package/components/selects/FSSerieTypeSelector.vue +0 -51
- package/utils/charts.ts +0 -136
|
@@ -1,49 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSSelectField
|
|
3
3
|
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
4
|
-
class="fs-meta-field"
|
|
5
4
|
:editable="$props.editable"
|
|
5
|
+
:itemTitle="itemTitle"
|
|
6
6
|
:label="$props.label"
|
|
7
|
+
:class="classes"
|
|
7
8
|
:items="items"
|
|
8
9
|
:modelValue="$props.modelValue"
|
|
9
10
|
@update:modelValue="onUpdate"
|
|
10
11
|
>
|
|
11
12
|
<template
|
|
12
|
-
|
|
13
|
+
v-if="$props.customProperty.dataType === PropertyDataType.Icon"
|
|
14
|
+
#item-prepend="{ item }"
|
|
13
15
|
>
|
|
14
16
|
<FSIcon
|
|
15
|
-
v-if="item.
|
|
17
|
+
v-if="item.icon"
|
|
16
18
|
>
|
|
17
|
-
{{ item.
|
|
18
|
-
</FSIcon>
|
|
19
|
-
<FSText
|
|
20
|
-
v-else
|
|
21
|
-
>
|
|
22
|
-
{{ item.raw.label }}
|
|
23
|
-
</FSText>
|
|
24
|
-
</template>
|
|
25
|
-
<template
|
|
26
|
-
#selection-mobile="{ item }"
|
|
27
|
-
>
|
|
28
|
-
<FSIcon
|
|
29
|
-
v-if="item.raw.icon"
|
|
30
|
-
>
|
|
31
|
-
{{ item.raw.icon }}
|
|
32
|
-
</FSIcon>
|
|
33
|
-
</template>
|
|
34
|
-
<template
|
|
35
|
-
#item-label="{ item, font }"
|
|
36
|
-
>
|
|
37
|
-
<FSIcon
|
|
38
|
-
v-if="item.raw.icon"
|
|
39
|
-
>
|
|
40
|
-
{{ item.raw.icon }}
|
|
19
|
+
{{ item.icon }}
|
|
41
20
|
</FSIcon>
|
|
42
21
|
<FSSpan
|
|
43
22
|
v-else
|
|
44
|
-
:font="font"
|
|
45
23
|
>
|
|
46
|
-
{{ item.
|
|
24
|
+
{{ item.label }}
|
|
47
25
|
</FSSpan>
|
|
48
26
|
</template>
|
|
49
27
|
</FSSelectField>
|
|
@@ -91,9 +69,10 @@
|
|
|
91
69
|
<script lang="ts">
|
|
92
70
|
import { computed, defineComponent, type PropType } from "vue";
|
|
93
71
|
|
|
94
|
-
import {
|
|
72
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
95
73
|
|
|
96
|
-
import { type CustomPropertyInfos
|
|
74
|
+
import { type CustomPropertyInfos } from "../../../foundation-core-domain/models";
|
|
75
|
+
import { PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
97
76
|
|
|
98
77
|
import FSDateTimeField from "@dative-gpi/foundation-shared-components/components/fields/FSDateTimeField.vue";
|
|
99
78
|
import FSNumberField from "@dative-gpi/foundation-shared-components/components/fields/FSNumberField.vue";
|
|
@@ -102,7 +81,6 @@ import FSIconField from "@dative-gpi/foundation-shared-components/components/fie
|
|
|
102
81
|
import FSSwitch from "@dative-gpi/foundation-shared-components/components/FSSwitch.vue";
|
|
103
82
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
104
83
|
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
105
|
-
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
106
84
|
|
|
107
85
|
export default defineComponent({
|
|
108
86
|
name: "FSMetaField",
|
|
@@ -113,8 +91,7 @@ export default defineComponent({
|
|
|
113
91
|
FSIconField,
|
|
114
92
|
FSSwitch,
|
|
115
93
|
FSIcon,
|
|
116
|
-
FSSpan
|
|
117
|
-
FSText
|
|
94
|
+
FSSpan
|
|
118
95
|
},
|
|
119
96
|
props: {
|
|
120
97
|
label: {
|
|
@@ -139,7 +116,7 @@ export default defineComponent({
|
|
|
139
116
|
},
|
|
140
117
|
emits: ["update:modelValue"],
|
|
141
118
|
setup(props, { emit }) {
|
|
142
|
-
const { epochToLongTimeFormat } =
|
|
119
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
143
120
|
|
|
144
121
|
const items = computed((): { id: string, label: string, icon: string | null }[] => {
|
|
145
122
|
return Object.keys(props.customProperty.allowedValues).map((key: string) => {
|
|
@@ -179,6 +156,23 @@ export default defineComponent({
|
|
|
179
156
|
});
|
|
180
157
|
});
|
|
181
158
|
|
|
159
|
+
const itemTitle = computed((): string => {
|
|
160
|
+
switch (props.customProperty.dataType) {
|
|
161
|
+
case PropertyDataType.Icon: return "";
|
|
162
|
+
default : return "label";
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const classes = computed((): string[] => {
|
|
167
|
+
const classNames = ["fs-meta-field"];
|
|
168
|
+
switch(props.customProperty.dataType) {
|
|
169
|
+
case PropertyDataType.Icon:
|
|
170
|
+
classNames.push("fs-meta-icon-field");
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
return classNames;
|
|
174
|
+
});
|
|
175
|
+
|
|
182
176
|
const asNumber = (): number | null => {
|
|
183
177
|
if (!props.modelValue) {
|
|
184
178
|
return null;
|
|
@@ -215,6 +209,8 @@ export default defineComponent({
|
|
|
215
209
|
|
|
216
210
|
return {
|
|
217
211
|
PropertyDataType,
|
|
212
|
+
itemTitle,
|
|
213
|
+
classes,
|
|
218
214
|
items,
|
|
219
215
|
asBoolean,
|
|
220
216
|
asNumber,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSButton
|
|
3
3
|
prependIcon="mdi-history"
|
|
4
|
-
:label="$tr('
|
|
4
|
+
:label="$tr('ui.common.history', 'History')"
|
|
5
5
|
@click="dialog = !dialog"
|
|
6
6
|
/>
|
|
7
7
|
<FSDialog
|
|
8
8
|
width="500px"
|
|
9
|
-
:label="$tr('
|
|
9
|
+
:label="$tr('ui.common.history', 'History')"
|
|
10
10
|
v-model="dialog"
|
|
11
11
|
>
|
|
12
12
|
<template
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
import { defineComponent, type PropType, ref, watch } from "vue";
|
|
39
39
|
import _ from "lodash";
|
|
40
40
|
|
|
41
|
-
import {
|
|
41
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
42
42
|
|
|
43
43
|
import { type CustomPropertyInfos, type PropertyEntity } from "../../../foundation-core-domain/models";
|
|
44
44
|
import { useCustomPropertyValues } from "../../../foundation-core-services/composables";
|
|
@@ -70,7 +70,7 @@ export default defineComponent({
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
setup(props) {
|
|
73
|
-
const { epochToLongTimeFormat } =
|
|
73
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
74
74
|
const { fetch, entity: customPropertyValues } = useCustomPropertyValues();
|
|
75
75
|
|
|
76
76
|
const dialog = ref(false);
|
|
@@ -1,52 +1,84 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="
|
|
4
|
-
/>
|
|
5
|
-
<FSText
|
|
6
|
-
v-else-if="$props.customProperty.useOnlyAllowedValues && $props.customProperty.allowedValues[meta[$props.customProperty.code]] != null"
|
|
7
|
-
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
2
|
+
<template
|
|
3
|
+
v-if="$props.variant === 'standard'"
|
|
8
4
|
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
<FSText
|
|
6
|
+
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
7
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
8
|
+
>
|
|
9
|
+
{{ value }}
|
|
10
|
+
</FSText>
|
|
11
|
+
<FSText
|
|
12
|
+
v-else-if="[PropertyDataType.Number, PropertyDataType.String, PropertyDataType.DateTime].includes($props.customProperty.dataType)"
|
|
13
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
14
|
+
>
|
|
15
|
+
{{ value }}
|
|
16
|
+
</FSText>
|
|
17
|
+
<FSIcon
|
|
18
|
+
v-else-if="[PropertyDataType.Icon].includes($props.customProperty.dataType)"
|
|
19
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
20
|
+
>
|
|
21
|
+
{{ value }}
|
|
22
|
+
</FSIcon>
|
|
23
|
+
<FSIconCheck
|
|
24
|
+
v-else-if="[PropertyDataType.Boolean].includes($props.customProperty.dataType) && value"
|
|
25
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
26
|
+
:value="value.toLowerCase() === 'true'"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
<template
|
|
30
|
+
v-else-if="$props.variant === 'colorless'"
|
|
14
31
|
>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
<FSSpan
|
|
33
|
+
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
34
|
+
>
|
|
35
|
+
{{ value }}
|
|
36
|
+
</FSSpan>
|
|
37
|
+
<FSSpan
|
|
38
|
+
v-else-if="[PropertyDataType.Number, PropertyDataType.String, PropertyDataType.DateTime].includes($props.customProperty.dataType)"
|
|
39
|
+
>
|
|
40
|
+
{{ value }}
|
|
41
|
+
</FSSpan>
|
|
42
|
+
<FSIcon
|
|
43
|
+
v-else-if="[PropertyDataType.Icon].includes($props.customProperty.dataType)"
|
|
44
|
+
>
|
|
45
|
+
{{ value }}
|
|
46
|
+
</FSIcon>
|
|
47
|
+
<FSIconCheck
|
|
48
|
+
v-else-if="[PropertyDataType.Boolean].includes($props.customProperty.dataType) && value"
|
|
49
|
+
:value="value.toLowerCase() === 'true'"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
28
52
|
</template>
|
|
29
53
|
|
|
30
54
|
<script lang="ts">
|
|
31
55
|
import { computed, defineComponent, type PropType } from "vue";
|
|
32
56
|
|
|
33
|
-
import {
|
|
57
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
58
|
+
import { PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
34
59
|
|
|
35
|
-
import { type CustomPropertyInfos
|
|
60
|
+
import { type CustomPropertyInfos } from "../../../foundation-core-domain/models";
|
|
36
61
|
import { getColor } from "./helpers";
|
|
37
62
|
|
|
38
63
|
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
39
|
-
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
40
64
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
65
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
66
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
41
67
|
|
|
42
68
|
export default defineComponent({
|
|
43
69
|
name: "FSMetaValue",
|
|
44
70
|
components: {
|
|
45
71
|
FSIconCheck,
|
|
46
|
-
|
|
47
|
-
|
|
72
|
+
FSIcon,
|
|
73
|
+
FSSpan,
|
|
74
|
+
FSText
|
|
48
75
|
},
|
|
49
76
|
props: {
|
|
77
|
+
variant: {
|
|
78
|
+
type: String as PropType<"standard" | "colorless">,
|
|
79
|
+
required: false,
|
|
80
|
+
default: "standard"
|
|
81
|
+
},
|
|
50
82
|
customProperty: {
|
|
51
83
|
type: Object as PropType<CustomPropertyInfos>,
|
|
52
84
|
required: true
|
|
@@ -57,18 +89,19 @@ export default defineComponent({
|
|
|
57
89
|
}
|
|
58
90
|
},
|
|
59
91
|
setup(props) {
|
|
60
|
-
const { epochToLongTimeFormat } =
|
|
92
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
61
93
|
|
|
62
94
|
const value = computed((): string => {
|
|
63
95
|
if (props.customProperty.useOnlyAllowedValues) {
|
|
64
|
-
|
|
65
|
-
return props.customProperty.allowedValues[props.meta[props.customProperty.code]];
|
|
66
|
-
}
|
|
96
|
+
return props.customProperty.allowedValues[props.meta[props.customProperty.code]] ?? "";
|
|
67
97
|
}
|
|
68
98
|
switch (props.customProperty.dataType) {
|
|
69
99
|
case PropertyDataType.DateTime: {
|
|
70
100
|
return epochToLongTimeFormat(parseInt(props.meta[props.customProperty.code]));
|
|
71
101
|
}
|
|
102
|
+
case PropertyDataType.Boolean: {
|
|
103
|
+
return props.meta[props.customProperty.code];
|
|
104
|
+
}
|
|
72
105
|
default: {
|
|
73
106
|
return props.meta[props.customProperty.code];
|
|
74
107
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
2
|
+
import { FilterType, PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
2
3
|
|
|
3
|
-
import { type CustomPropertyInfos,
|
|
4
|
+
import { type CustomPropertyInfos, } from "../../../foundation-core-domain/models";
|
|
4
5
|
|
|
5
6
|
const { getOffsetDifference } = useAppTimeZone();
|
|
6
7
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { defineComponent, defineAsyncComponent, type PropType, computed } from "vue";
|
|
10
|
+
|
|
11
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: "FSBaseEntitiesList",
|
|
15
|
+
components: {
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
entityType: {
|
|
19
|
+
type: Number as PropType<EntityType>,
|
|
20
|
+
required: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(props) {
|
|
24
|
+
const component = computed(() => {
|
|
25
|
+
switch(props.entityType) {
|
|
26
|
+
case EntityType.Device:
|
|
27
|
+
return defineAsyncComponent(() => import("../lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue"));
|
|
28
|
+
case EntityType.Dashboard:
|
|
29
|
+
return defineAsyncComponent(() => import("../lists/dashboards/FSBaseDashboardsList.vue"));
|
|
30
|
+
case EntityType.Folder:
|
|
31
|
+
return defineAsyncComponent(() => import("../lists/folders/FSBaseFoldersList.vue"));
|
|
32
|
+
case EntityType.User:
|
|
33
|
+
return defineAsyncComponent(() => import("../lists/userOrganisations/FSBaseUserOrganisationsList.vue"));
|
|
34
|
+
case EntityType.Group:
|
|
35
|
+
return defineAsyncComponent(() => import("../lists/groups/FSBaseGroupsList.vue"));
|
|
36
|
+
case EntityType.Location:
|
|
37
|
+
return defineAsyncComponent(() => import("../lists/locations/FSBaseLocationsList.vue"));
|
|
38
|
+
case EntityType.Model:
|
|
39
|
+
return defineAsyncComponent(() => import("../lists/models/FSBaseModelsList.vue"));
|
|
40
|
+
default:
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
component,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDialogSubmit
|
|
3
|
+
:title="$tr('ui.common.select-entities', 'Select entities')"
|
|
4
|
+
width="1130px"
|
|
5
|
+
:model-value="$props.modelValue"
|
|
6
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
7
|
+
@click:submit-button="onSubmit"
|
|
8
|
+
>
|
|
9
|
+
<template
|
|
10
|
+
#body
|
|
11
|
+
>
|
|
12
|
+
<FSSelectEntitiesList
|
|
13
|
+
:singleSelect="$props.singleSelect"
|
|
14
|
+
:entityType="$props.entityType"
|
|
15
|
+
:modelValue="actualSelecteds"
|
|
16
|
+
:filters="$props.filters"
|
|
17
|
+
@update:modelValue="actualSelecteds = $event"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</FSDialogSubmit>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { defineComponent, type PropType, ref, watch } from "vue";
|
|
25
|
+
|
|
26
|
+
import type { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
27
|
+
|
|
28
|
+
import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
|
|
29
|
+
import FSSelectEntitiesList from "./FSSelectEntitiesList.vue";
|
|
30
|
+
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
name: "FSDialogSelectEntities",
|
|
33
|
+
components: {
|
|
34
|
+
FSSelectEntitiesList,
|
|
35
|
+
FSDialogSubmit,
|
|
36
|
+
},
|
|
37
|
+
emits: ["update", "update:modelValue", "update:selecteds"],
|
|
38
|
+
props: {
|
|
39
|
+
entityType: {
|
|
40
|
+
type: Number as PropType<EntityType>,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
selecteds: {
|
|
44
|
+
type: Array as PropType<string[]>,
|
|
45
|
+
required: false,
|
|
46
|
+
default: () => []
|
|
47
|
+
},
|
|
48
|
+
singleSelect: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
filters: {
|
|
54
|
+
type: Object,
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
modelValue: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: false,
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup(props, { emit }){
|
|
65
|
+
const actualSelecteds = ref<string[]>([]);
|
|
66
|
+
|
|
67
|
+
const onSubmit = () => {
|
|
68
|
+
emit("update:selecteds", actualSelecteds.value);
|
|
69
|
+
emit("update:modelValue", false);
|
|
70
|
+
emit("update", { selecteds: actualSelecteds.value, modelValue: false });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
watch(() => props.selecteds, (value) => {
|
|
74
|
+
actualSelecteds.value = value;
|
|
75
|
+
}, { immediate: true });
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
onSubmit,
|
|
79
|
+
actualSelecteds
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSEntityFieldUI
|
|
3
|
+
:description="$props.description"
|
|
4
|
+
:hideHeader="$props.hideHeader"
|
|
5
|
+
:required="$props.required"
|
|
6
|
+
:editable="$props.editable"
|
|
7
|
+
:label="$props.label"
|
|
8
|
+
:messages="$props.messages"
|
|
9
|
+
:entityType="$props.entityType"
|
|
10
|
+
:allowedEntityTypes="$props.allowedEntityTypes || []"
|
|
11
|
+
:itemsCount="($props.modelValue || []).length"
|
|
12
|
+
@update:entityType="onEntityTypeChanged"
|
|
13
|
+
:showEntities="$props.showEntities"
|
|
14
|
+
:showCount="$props.showCount"
|
|
15
|
+
@click:select="dialog = true"
|
|
16
|
+
>
|
|
17
|
+
<template
|
|
18
|
+
#items
|
|
19
|
+
>
|
|
20
|
+
<FSSimpleEntitiesList
|
|
21
|
+
:entity-type="$props.entityType"
|
|
22
|
+
:filters="simpleListFilters"
|
|
23
|
+
:showEdit="false"
|
|
24
|
+
@click:remove="onRemove"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
</FSEntityFieldUI>
|
|
28
|
+
<FSDialogSelectEntities
|
|
29
|
+
:singleSelect="$props.singleSelect"
|
|
30
|
+
:entity-type="$props.entityType"
|
|
31
|
+
:filters="$props.filters"
|
|
32
|
+
v-model="dialog"
|
|
33
|
+
:selecteds="$props.modelValue || []"
|
|
34
|
+
@update:selecteds="onModelValueChanged"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import { defineComponent, ref, type PropType, computed } from "vue";
|
|
41
|
+
|
|
42
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
43
|
+
|
|
44
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
45
|
+
|
|
46
|
+
import FSEntityFieldUI from "@dative-gpi/foundation-shared-components/components/fields/FSEntityFieldUI.vue";
|
|
47
|
+
|
|
48
|
+
import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
|
|
49
|
+
import FSDialogSelectEntities from "./FSDialogSelectEntities.vue";
|
|
50
|
+
|
|
51
|
+
export default defineComponent({
|
|
52
|
+
name: "FSEntityField",
|
|
53
|
+
components: {
|
|
54
|
+
FSEntityFieldUI,
|
|
55
|
+
FSSimpleEntitiesList,
|
|
56
|
+
FSDialogSelectEntities
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
label: {
|
|
60
|
+
type: String as PropType<string | null>,
|
|
61
|
+
required: false,
|
|
62
|
+
default: null
|
|
63
|
+
},
|
|
64
|
+
description: {
|
|
65
|
+
type: String as PropType<string | null>,
|
|
66
|
+
required: false,
|
|
67
|
+
default: null
|
|
68
|
+
},
|
|
69
|
+
modelValue: {
|
|
70
|
+
type: Array as PropType<string[]>,
|
|
71
|
+
required: true,
|
|
72
|
+
default: () => []
|
|
73
|
+
},
|
|
74
|
+
hideHeader: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: false,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
required: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
required: false,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
filters: {
|
|
85
|
+
type: Object,
|
|
86
|
+
required: false,
|
|
87
|
+
default: () => null
|
|
88
|
+
},
|
|
89
|
+
rules: {
|
|
90
|
+
type: Array as PropType<any[]>,
|
|
91
|
+
required: false,
|
|
92
|
+
default: () => []
|
|
93
|
+
},
|
|
94
|
+
messages: {
|
|
95
|
+
type: Array as PropType<string[]>,
|
|
96
|
+
required: false,
|
|
97
|
+
default: null
|
|
98
|
+
},
|
|
99
|
+
editable: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
required: false,
|
|
102
|
+
default: true
|
|
103
|
+
},
|
|
104
|
+
entityType: {
|
|
105
|
+
type: Number as PropType<EntityType>,
|
|
106
|
+
required: true
|
|
107
|
+
},
|
|
108
|
+
allowedEntityTypes: {
|
|
109
|
+
type: Array as PropType<EntityType[]>,
|
|
110
|
+
required: false,
|
|
111
|
+
default: () => []
|
|
112
|
+
},
|
|
113
|
+
showEntities: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false,
|
|
116
|
+
default: true
|
|
117
|
+
},
|
|
118
|
+
singleSelect: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
required: false,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
123
|
+
showCount: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
required: false,
|
|
126
|
+
default: true
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
emits: ["update","update:modelValue", "update:entityType"],
|
|
130
|
+
setup(props, { emit }) {
|
|
131
|
+
const dialog = ref(false);
|
|
132
|
+
|
|
133
|
+
const simpleListFilters = computed(() => {
|
|
134
|
+
switch(props.entityType) {
|
|
135
|
+
case EntityType.Device:
|
|
136
|
+
return {
|
|
137
|
+
deviceOrganisationsIds: props.modelValue
|
|
138
|
+
} satisfies DeviceOrganisationFilters;
|
|
139
|
+
case EntityType.Dashboard:
|
|
140
|
+
return {
|
|
141
|
+
dashboardOrganisationsIds: props.modelValue,
|
|
142
|
+
dashboardOrganisationTypesIds: props.modelValue
|
|
143
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
144
|
+
case EntityType.Group:
|
|
145
|
+
return {
|
|
146
|
+
groupsIds: props.modelValue
|
|
147
|
+
} satisfies GroupFilters;
|
|
148
|
+
case EntityType.Folder:
|
|
149
|
+
return {
|
|
150
|
+
foldersIds: props.modelValue
|
|
151
|
+
} satisfies FolderFilters;
|
|
152
|
+
case EntityType.Location:
|
|
153
|
+
return {
|
|
154
|
+
locationsIds: props.modelValue
|
|
155
|
+
} satisfies LocationFilters;
|
|
156
|
+
case EntityType.User:
|
|
157
|
+
return {
|
|
158
|
+
userOrganisationsIds: props.modelValue
|
|
159
|
+
} satisfies UserOrganisationFilters;
|
|
160
|
+
case EntityType.Model:
|
|
161
|
+
return {
|
|
162
|
+
modelsIds: props.modelValue
|
|
163
|
+
} satisfies ModelFilters;
|
|
164
|
+
default:
|
|
165
|
+
return undefined;
|
|
166
|
+
};
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
const onRemove = (id: string) => {
|
|
170
|
+
emit("update:modelValue", props.modelValue.filter((i) => i !== id));
|
|
171
|
+
emit("update", {
|
|
172
|
+
entityType: props.entityType,
|
|
173
|
+
modelValue: props.modelValue.filter((i) => i !== id)
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const onEntityTypeChanged = (entityType: EntityType) => {
|
|
178
|
+
emit('update:entityType', entityType);
|
|
179
|
+
emit('update:modelValue', []);
|
|
180
|
+
emit("update", {
|
|
181
|
+
entityType,
|
|
182
|
+
modelValue: []
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const onModelValueChanged = (modelValue: string[]) => {
|
|
187
|
+
emit('update:modelValue', modelValue);
|
|
188
|
+
emit("update", {
|
|
189
|
+
entityType: props.entityType,
|
|
190
|
+
modelValue
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
dialog,
|
|
196
|
+
simpleListFilters,
|
|
197
|
+
onRemove,
|
|
198
|
+
onEntityTypeChanged,
|
|
199
|
+
onModelValueChanged
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
</script>
|