@dative-gpi/foundation-core-components 1.0.66 → 1.0.67-map-edit
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 +15 -8
- package/components/autocompletes/FSAutocompleteDashboard.vue +14 -6
- package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
- package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
- package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
- package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
- package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
- package/components/autocompletes/FSAutocompleteModel.vue +9 -1
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
- package/components/autocompletes/FSAutocompleteRole.vue +14 -6
- package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
- package/components/customProperties/FSMetaField.vue +35 -40
- package/components/customProperties/FSMetaFormContent.vue +4 -3
- package/components/customProperties/FSMetaHistory.vue +2 -2
- package/components/customProperties/helpers.ts +57 -165
- package/components/entities/FSBaseEntitiesList.vue +12 -2
- package/components/entities/FSDialogSelectEntities.vue +19 -2
- package/components/entities/FSEntityField.vue +68 -13
- package/components/entities/FSSelectEntitiesList.vue +40 -7
- package/components/explorers/FSBaseDevicesExplorer.vue +322 -0
- package/components/explorers/FSBaseFoldersExplorer.vue +126 -24
- package/components/lists/FSDataTable.vue +22 -16
- package/components/lists/alerts/FSBaseAlertsList.vue +96 -106
- package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +97 -34
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +98 -34
- package/components/lists/charts/FSBaseChartsList.vue +153 -64
- package/components/lists/comments/FSBaseCommentsList.vue +39 -23
- package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
- package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +41 -8
- package/components/lists/dashboards/FSBaseDashboardsList.vue +76 -16
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -6
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +8 -5
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +70 -44
- package/components/lists/folders/FSBaseFoldersList.vue +27 -15
- package/components/lists/groups/FSBaseGroupsList.vue +13 -9
- package/components/lists/locations/FSBaseLocationsList.vue +17 -13
- package/components/lists/models/FSBaseModelsList.vue +31 -13
- package/components/lists/playlists/FSSimplePlaylistsList.vue +44 -0
- package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +6 -5
- package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +17 -16
- package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +45 -8
- package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +45 -7
- package/components/lists/scenarios/FSBaseScenariosList.vue +121 -86
- package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +10 -7
- package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +10 -7
- package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
- package/components/tiles/FSChartTile.vue +71 -0
- package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
- package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
- package/components/tiles/FSDashboardShallowTile.vue +3 -3
- package/components/tiles/FSDeviceOrganisationTile.vue +3 -3
- package/components/tiles/FSFolderTile.vue +7 -5
- package/components/tiles/FSGroupTile.vue +3 -3
- package/components/tiles/FSLocationTile.vue +5 -3
- package/components/tiles/FSModelTile.vue +64 -0
- package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
- package/components/tiles/FSUserOrganisationTile.vue +3 -3
- package/components/treeviews/FSTreeViewGroup.vue +7 -1
- package/package.json +9 -9
- package/utils/dashboards.ts +4 -4
- package/utils/index.ts +0 -1
- package/utils/roles.ts +3 -3
- package/utils/users.ts +3 -3
- package/components/selects/FSAggregationSelector.vue +0 -51
- package/components/selects/FSAxisTypeSelector.vue +0 -48
- package/components/selects/FSDisplayAsSelector.vue +0 -52
- package/components/selects/FSFilterTypeSelector.vue +0 -53
- package/components/selects/FSHeatmapRuleSelector.vue +0 -52
- package/components/selects/FSOperationOnSelector.vue +0 -51
- package/components/selects/FSPlanningTypeSelector.vue +0 -51
- package/components/selects/FSPlotPerSelector.vue +0 -51
- package/components/selects/FSSelectEntityType.vue +0 -59
- package/components/selects/FSSerieTypeSelector.vue +0 -51
- package/utils/charts.ts +0 -137
|
@@ -1,49 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSSelectField
|
|
3
3
|
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
4
|
-
|
|
5
|
-
:
|
|
4
|
+
:disabled="$props.disabled"
|
|
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>
|
|
@@ -52,35 +30,35 @@
|
|
|
52
30
|
>
|
|
53
31
|
<FSNumberField
|
|
54
32
|
v-if="$props.customProperty.dataType === PropertyDataType.Number"
|
|
55
|
-
:
|
|
33
|
+
:disabled="$props.disabled"
|
|
56
34
|
:label="$props.label"
|
|
57
35
|
:modelValue="asNumber()"
|
|
58
36
|
@update:modelValue="onUpdate"
|
|
59
37
|
/>
|
|
60
38
|
<FSSwitch
|
|
61
39
|
v-else-if="$props.customProperty.dataType === PropertyDataType.Boolean"
|
|
62
|
-
:
|
|
40
|
+
:disabled="$props.disabled"
|
|
63
41
|
:label="$props.label"
|
|
64
42
|
:modelValue="asBoolean()"
|
|
65
43
|
@update:modelValue="onUpdate"
|
|
66
44
|
/>
|
|
67
45
|
<FSTextField
|
|
68
46
|
v-else-if="$props.customProperty.dataType === PropertyDataType.String"
|
|
69
|
-
:
|
|
47
|
+
:disabled="$props.disabled"
|
|
70
48
|
:label="$props.label"
|
|
71
49
|
:modelValue="$props.modelValue"
|
|
72
50
|
@update:modelValue="onUpdate"
|
|
73
51
|
/>
|
|
74
52
|
<FSDateTimeField
|
|
75
53
|
v-else-if="$props.customProperty.dataType === PropertyDataType.DateTime"
|
|
76
|
-
:
|
|
54
|
+
:disabled="$props.disabled"
|
|
77
55
|
:label="$props.label"
|
|
78
56
|
:modelValue="asNumber()"
|
|
79
57
|
@update:modelValue="onUpdate"
|
|
80
58
|
/>
|
|
81
59
|
<FSIconField
|
|
82
60
|
v-else-if="$props.customProperty.dataType === PropertyDataType.Icon"
|
|
83
|
-
:
|
|
61
|
+
:disabled="$props.disabled"
|
|
84
62
|
:label="$props.label"
|
|
85
63
|
:modelValue="modelValue"
|
|
86
64
|
@update:modelValue="onUpdate"
|
|
@@ -103,7 +81,6 @@ import FSIconField from "@dative-gpi/foundation-shared-components/components/fie
|
|
|
103
81
|
import FSSwitch from "@dative-gpi/foundation-shared-components/components/FSSwitch.vue";
|
|
104
82
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
105
83
|
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
106
|
-
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
107
84
|
|
|
108
85
|
export default defineComponent({
|
|
109
86
|
name: "FSMetaField",
|
|
@@ -114,8 +91,7 @@ export default defineComponent({
|
|
|
114
91
|
FSIconField,
|
|
115
92
|
FSSwitch,
|
|
116
93
|
FSIcon,
|
|
117
|
-
FSSpan
|
|
118
|
-
FSText
|
|
94
|
+
FSSpan
|
|
119
95
|
},
|
|
120
96
|
props: {
|
|
121
97
|
label: {
|
|
@@ -132,10 +108,10 @@ export default defineComponent({
|
|
|
132
108
|
required: false,
|
|
133
109
|
default: null
|
|
134
110
|
},
|
|
135
|
-
|
|
111
|
+
disabled: {
|
|
136
112
|
type: Boolean,
|
|
137
113
|
required: false,
|
|
138
|
-
default:
|
|
114
|
+
default: false
|
|
139
115
|
}
|
|
140
116
|
},
|
|
141
117
|
emits: ["update:modelValue"],
|
|
@@ -180,6 +156,23 @@ export default defineComponent({
|
|
|
180
156
|
});
|
|
181
157
|
});
|
|
182
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
|
+
|
|
183
176
|
const asNumber = (): number | null => {
|
|
184
177
|
if (!props.modelValue) {
|
|
185
178
|
return null;
|
|
@@ -216,6 +209,8 @@ export default defineComponent({
|
|
|
216
209
|
|
|
217
210
|
return {
|
|
218
211
|
PropertyDataType,
|
|
212
|
+
itemTitle,
|
|
213
|
+
classes,
|
|
219
214
|
items,
|
|
220
215
|
asBoolean,
|
|
221
216
|
asNumber,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<FSMetaField
|
|
18
18
|
v-for="(property, index) in properties"
|
|
19
19
|
:customProperty="property"
|
|
20
|
-
:
|
|
20
|
+
:disabled="disabled"
|
|
21
21
|
:key="index"
|
|
22
22
|
:modelValue="modelValue[property.code]"
|
|
23
23
|
@update:modelValue="(event) => $emit('update:modelValue', { ...modelValue, [property.code]: event})"
|
|
@@ -50,12 +50,13 @@ export default defineComponent({
|
|
|
50
50
|
type: Object as PropType<{ [key: string]: string }>,
|
|
51
51
|
required: true
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
disabled: {
|
|
54
54
|
type: Boolean,
|
|
55
55
|
required: false,
|
|
56
|
-
default:
|
|
56
|
+
default: false
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
+
emits: ["update:modelValue"],
|
|
59
60
|
setup(props) {
|
|
60
61
|
const categories = props.customProperties.reduce((acc, curr) => {
|
|
61
62
|
if (acc[curr.categoryLabel] === undefined) {
|
|
@@ -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
|
|
@@ -1,192 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDateExpression } from "@dative-gpi/foundation-shared-services/composables";
|
|
2
2
|
import { FilterType, PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
3
3
|
|
|
4
|
-
import { type CustomPropertyInfos
|
|
4
|
+
import { type CustomPropertyInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { convert: convertExpressionToEpoch } = useDateExpression();
|
|
7
7
|
|
|
8
8
|
export const getColor = (property: CustomPropertyInfos, value: string): string | undefined => {
|
|
9
|
-
if (property.colorful) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case FilterType.More: {
|
|
24
|
-
if (!isNaN(parseFloat(value))) {
|
|
25
|
-
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) < parseFloat(value))) {
|
|
26
|
-
return color.color;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
case FilterType.Less: {
|
|
32
|
-
if (!isNaN(parseFloat(value))) {
|
|
33
|
-
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) > parseFloat(value))) {
|
|
34
|
-
return color.color;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case FilterType.MoreOrEqual: {
|
|
40
|
-
if (!isNaN(parseFloat(value))) {
|
|
41
|
-
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) <= parseFloat(value))) {
|
|
42
|
-
return color.color;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case FilterType.LessOrEqual: {
|
|
48
|
-
if (!isNaN(parseFloat(value))) {
|
|
49
|
-
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) >= parseFloat(value))) {
|
|
50
|
-
return color.color;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
9
|
+
if (!property.colorful) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
for (const color of [...property.colorMap].sort((a, b) => b.priority - a.priority)) {
|
|
14
|
+
let filterValues = [...color.filterValues];
|
|
15
|
+
if ([PropertyDataType.DateTime].includes(property.dataType)) {
|
|
16
|
+
filterValues = filterValues.map(fv => convertExpressionToEpoch(fv).toString());
|
|
17
|
+
}
|
|
18
|
+
switch (color.filterType) {
|
|
19
|
+
case FilterType.None: return color.color;
|
|
20
|
+
case FilterType.Equal: {
|
|
21
|
+
if (filterValues.includes(value)) {
|
|
22
|
+
return color.color;
|
|
54
23
|
}
|
|
55
|
-
|
|
56
|
-
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case FilterType.More: {
|
|
27
|
+
if (!isNaN(parseFloat(value))) {
|
|
28
|
+
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) < parseFloat(value))) {
|
|
57
29
|
return color.color;
|
|
58
30
|
}
|
|
59
|
-
break;
|
|
60
31
|
}
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case FilterType.Less: {
|
|
35
|
+
if (!isNaN(parseFloat(value))) {
|
|
36
|
+
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) > parseFloat(value))) {
|
|
63
37
|
return color.color;
|
|
64
38
|
}
|
|
65
|
-
break;
|
|
66
39
|
}
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case FilterType.MoreOrEqual: {
|
|
43
|
+
if (!isNaN(parseFloat(value))) {
|
|
44
|
+
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) <= parseFloat(value))) {
|
|
69
45
|
return color.color;
|
|
70
46
|
}
|
|
71
|
-
break;
|
|
72
47
|
}
|
|
73
|
-
|
|
74
|
-
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case FilterType.LessOrEqual: {
|
|
51
|
+
if (!isNaN(parseFloat(value))) {
|
|
52
|
+
if (filterValues.some(fv => !isNaN(parseFloat(fv)) && parseFloat(fv) >= parseFloat(value))) {
|
|
75
53
|
return color.color;
|
|
76
54
|
}
|
|
77
|
-
break;
|
|
78
55
|
}
|
|
56
|
+
break;
|
|
79
57
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const getEpoch = (expression: string): string => {
|
|
85
|
-
if (!isNaN(parseInt(expression))) {
|
|
86
|
-
return expression;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const date = new Date();
|
|
90
|
-
if (expression.startsWith("now")) {
|
|
91
|
-
expression = expression.substring(3).replace(/\s/g, "");
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
return (date.getTime()).toString();
|
|
95
|
-
}
|
|
96
|
-
let match = /^(?:(?:([-+])(\d*))?(\w+))?(?:\/(\w))?/g.exec(expression);
|
|
97
|
-
while (match != null && (match[0] != null && match[0].length > 0)) {
|
|
98
|
-
if (match[1] != null && match[3] != null) {
|
|
99
|
-
if (!["-", "+"].includes(match[1]) || isNaN(parseInt(match[2])) || !["s", "m", "h", "d", "w", "M", "y"].includes(match[3])) {
|
|
100
|
-
return (date.getTime()).toString();
|
|
101
|
-
}
|
|
102
|
-
const offset = match[1] == "-" ? -1 * parseInt(match[2]): 1* parseInt(match[2]);
|
|
103
|
-
switch (match[3]) {
|
|
104
|
-
case "s": {
|
|
105
|
-
date.setSeconds(date.getSeconds() + offset);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
case "m": {
|
|
109
|
-
date.setMinutes(date.getMinutes() + offset);
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
case "h": {
|
|
113
|
-
date.setHours(date.getHours() + offset);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case "d": {
|
|
117
|
-
date.setDate(date.getDate() + offset);
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
case "w": {
|
|
121
|
-
date.setDate(date.getDate() + offset * 7);
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
case "M": {
|
|
125
|
-
date.setMonth(date.getMonth() + offset);
|
|
126
|
-
break;
|
|
58
|
+
case FilterType.Different: {
|
|
59
|
+
if (!filterValues.includes(value)) {
|
|
60
|
+
return color.color;
|
|
127
61
|
}
|
|
128
|
-
|
|
129
|
-
date.setFullYear(date.getFullYear() + offset);
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (match[4] != null) {
|
|
135
|
-
if (!["s", "m", "h", "d", "w", "M", "y"].includes(match[4])) {
|
|
136
|
-
return (date.getTime()).toString();
|
|
62
|
+
break;
|
|
137
63
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
case "m": {
|
|
144
|
-
date.setMilliseconds(0);
|
|
145
|
-
date.setSeconds(0);
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
case "h": {
|
|
149
|
-
date.setMilliseconds(0);
|
|
150
|
-
date.setSeconds(0);
|
|
151
|
-
date.setMinutes(0);
|
|
152
|
-
break;
|
|
64
|
+
case FilterType.Contains: {
|
|
65
|
+
if (filterValues.some(fv => value.includes(fv))) {
|
|
66
|
+
return color.color;
|
|
153
67
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
case "w": {
|
|
162
|
-
date.setMilliseconds(0);
|
|
163
|
-
date.setSeconds(0);
|
|
164
|
-
date.setMinutes(0);
|
|
165
|
-
date.setHours(0);
|
|
166
|
-
date.setDate(date.getDate() - date.getDay() + (date.getDay() === 0 ? -6 : 1));
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
case "M": {
|
|
170
|
-
date.setMilliseconds(0);
|
|
171
|
-
date.setSeconds(0);
|
|
172
|
-
date.setMinutes(0);
|
|
173
|
-
date.setHours(0);
|
|
174
|
-
date.setDate(1);
|
|
175
|
-
break;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case FilterType.StartsWith: {
|
|
71
|
+
if (filterValues.some(fv => value.startsWith(fv))) {
|
|
72
|
+
return color.color;
|
|
176
73
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
date.setDate(1);
|
|
183
|
-
date.setMonth(0);
|
|
184
|
-
break;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case FilterType.EndsWith: {
|
|
77
|
+
if (filterValues.some(fv => value.endsWith(fv))) {
|
|
78
|
+
return color.color;
|
|
185
79
|
}
|
|
80
|
+
break;
|
|
186
81
|
}
|
|
187
82
|
}
|
|
188
|
-
expression = expression.substring(match[0].length);
|
|
189
|
-
match = /(?:(?:([-+])(\d*))?(\w+))?(?:\/(\w))?/g.exec(expression);
|
|
190
83
|
}
|
|
191
|
-
|
|
192
|
-
}
|
|
84
|
+
}
|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
<component
|
|
3
3
|
:is="component"
|
|
4
4
|
v-bind="$attrs"
|
|
5
|
-
|
|
5
|
+
>
|
|
6
|
+
<template
|
|
7
|
+
v-for="(_, name) in $slots"
|
|
8
|
+
v-slot:[name]="slotData"
|
|
9
|
+
>
|
|
10
|
+
<slot
|
|
11
|
+
:name="name"
|
|
12
|
+
v-bind="slotData"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
</component>
|
|
6
16
|
</template>
|
|
7
17
|
|
|
8
18
|
<script lang="ts">
|
|
@@ -43,7 +53,7 @@ export default defineComponent({
|
|
|
43
53
|
});
|
|
44
54
|
|
|
45
55
|
return {
|
|
46
|
-
component
|
|
56
|
+
component
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
});
|
|
@@ -10,11 +10,22 @@
|
|
|
10
10
|
#body
|
|
11
11
|
>
|
|
12
12
|
<FSSelectEntitiesList
|
|
13
|
+
:singleSelect="$props.singleSelect"
|
|
13
14
|
:entityType="$props.entityType"
|
|
14
15
|
:modelValue="actualSelecteds"
|
|
15
16
|
:filters="$props.filters"
|
|
16
17
|
@update:modelValue="actualSelecteds = $event"
|
|
17
|
-
|
|
18
|
+
>
|
|
19
|
+
<template
|
|
20
|
+
v-for="(_, name) in $slots"
|
|
21
|
+
v-slot:[name]="slotData"
|
|
22
|
+
>
|
|
23
|
+
<slot
|
|
24
|
+
:name="name"
|
|
25
|
+
v-bind="slotData"
|
|
26
|
+
/>
|
|
27
|
+
</template>
|
|
28
|
+
</FSSelectEntitiesList>
|
|
18
29
|
</template>
|
|
19
30
|
</FSDialogSubmit>
|
|
20
31
|
</template>
|
|
@@ -33,7 +44,7 @@ export default defineComponent({
|
|
|
33
44
|
FSSelectEntitiesList,
|
|
34
45
|
FSDialogSubmit,
|
|
35
46
|
},
|
|
36
|
-
emits: ["update:modelValue", "update:selecteds"],
|
|
47
|
+
emits: ["update", "update:modelValue", "update:selecteds"],
|
|
37
48
|
props: {
|
|
38
49
|
entityType: {
|
|
39
50
|
type: Number as PropType<EntityType>,
|
|
@@ -44,6 +55,11 @@ export default defineComponent({
|
|
|
44
55
|
required: false,
|
|
45
56
|
default: () => []
|
|
46
57
|
},
|
|
58
|
+
singleSelect: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: false,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
47
63
|
filters: {
|
|
48
64
|
type: Object,
|
|
49
65
|
required: false,
|
|
@@ -61,6 +77,7 @@ export default defineComponent({
|
|
|
61
77
|
const onSubmit = () => {
|
|
62
78
|
emit("update:selecteds", actualSelecteds.value);
|
|
63
79
|
emit("update:modelValue", false);
|
|
80
|
+
emit("update", { selecteds: actualSelecteds.value, modelValue: false });
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
watch(() => props.selecteds, (value) => {
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
:description="$props.description"
|
|
4
4
|
:hideHeader="$props.hideHeader"
|
|
5
5
|
:required="$props.required"
|
|
6
|
-
:
|
|
6
|
+
:disabled="$props.disabled"
|
|
7
7
|
:label="$props.label"
|
|
8
8
|
:messages="$props.messages"
|
|
9
9
|
:entityType="$props.entityType"
|
|
10
10
|
:allowedEntityTypes="$props.allowedEntityTypes || []"
|
|
11
11
|
:itemsCount="($props.modelValue || []).length"
|
|
12
|
-
@update:entityType="
|
|
12
|
+
@update:entityType="onEntityTypeChanged"
|
|
13
13
|
:showEntities="$props.showEntities"
|
|
14
14
|
:showCount="$props.showCount"
|
|
15
15
|
@click:select="dialog = true"
|
|
@@ -19,18 +19,19 @@
|
|
|
19
19
|
>
|
|
20
20
|
<FSSimpleEntitiesList
|
|
21
21
|
:entity-type="$props.entityType"
|
|
22
|
-
:filters="
|
|
22
|
+
:filters="simpleListFilters"
|
|
23
23
|
:showEdit="false"
|
|
24
24
|
@click:remove="onRemove"
|
|
25
25
|
/>
|
|
26
26
|
</template>
|
|
27
27
|
</FSEntityFieldUI>
|
|
28
28
|
<FSDialogSelectEntities
|
|
29
|
+
:singleSelect="$props.singleSelect"
|
|
29
30
|
:entity-type="$props.entityType"
|
|
30
31
|
:filters="$props.filters"
|
|
31
32
|
v-model="dialog"
|
|
32
33
|
:selecteds="$props.modelValue || []"
|
|
33
|
-
@update:selecteds="
|
|
34
|
+
@update:selecteds="onModelValueChanged"
|
|
34
35
|
/>
|
|
35
36
|
</template>
|
|
36
37
|
|
|
@@ -40,7 +41,7 @@ import { defineComponent, ref, type PropType, computed } from "vue";
|
|
|
40
41
|
|
|
41
42
|
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
42
43
|
|
|
43
|
-
import type { DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
44
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
44
45
|
|
|
45
46
|
import FSEntityFieldUI from "@dative-gpi/foundation-shared-components/components/fields/FSEntityFieldUI.vue";
|
|
46
47
|
|
|
@@ -95,10 +96,10 @@ export default defineComponent({
|
|
|
95
96
|
required: false,
|
|
96
97
|
default: null
|
|
97
98
|
},
|
|
98
|
-
|
|
99
|
+
disabled: {
|
|
99
100
|
type: Boolean,
|
|
100
101
|
required: false,
|
|
101
|
-
default:
|
|
102
|
+
default: false
|
|
102
103
|
},
|
|
103
104
|
entityType: {
|
|
104
105
|
type: Number as PropType<EntityType>,
|
|
@@ -114,35 +115,89 @@ export default defineComponent({
|
|
|
114
115
|
required: false,
|
|
115
116
|
default: true
|
|
116
117
|
},
|
|
118
|
+
singleSelect: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
required: false,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
117
123
|
showCount: {
|
|
118
124
|
type: Boolean,
|
|
119
125
|
required: false,
|
|
120
126
|
default: true
|
|
121
127
|
}
|
|
122
128
|
},
|
|
123
|
-
emits: ["update:modelValue", "update:entityType"],
|
|
129
|
+
emits: ["update","update:modelValue", "update:entityType"],
|
|
124
130
|
setup(props, { emit }) {
|
|
125
131
|
const dialog = ref(false);
|
|
126
132
|
|
|
127
|
-
const
|
|
133
|
+
const simpleListFilters = computed(() => {
|
|
128
134
|
switch(props.entityType) {
|
|
129
135
|
case EntityType.Device:
|
|
130
136
|
return {
|
|
131
137
|
deviceOrganisationsIds: props.modelValue
|
|
132
138
|
} satisfies DeviceOrganisationFilters;
|
|
139
|
+
case EntityType.Dashboard:
|
|
140
|
+
return {
|
|
141
|
+
dashboardOrganisationsIds: props.modelValue,
|
|
142
|
+
dashboardOrganisationTypesIds: props.modelValue,
|
|
143
|
+
dashboardShallowsIds: props.modelValue
|
|
144
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
145
|
+
case EntityType.Group:
|
|
146
|
+
return {
|
|
147
|
+
groupsIds: props.modelValue
|
|
148
|
+
} satisfies GroupFilters;
|
|
149
|
+
case EntityType.Folder:
|
|
150
|
+
return {
|
|
151
|
+
foldersIds: props.modelValue
|
|
152
|
+
} satisfies FolderFilters;
|
|
153
|
+
case EntityType.Location:
|
|
154
|
+
return {
|
|
155
|
+
locationsIds: props.modelValue
|
|
156
|
+
} satisfies LocationFilters;
|
|
157
|
+
case EntityType.User:
|
|
158
|
+
return {
|
|
159
|
+
userOrganisationsIds: props.modelValue
|
|
160
|
+
} satisfies UserOrganisationFilters;
|
|
161
|
+
case EntityType.Model:
|
|
162
|
+
return {
|
|
163
|
+
modelsIds: props.modelValue
|
|
164
|
+
} satisfies ModelFilters;
|
|
133
165
|
default:
|
|
134
|
-
return
|
|
166
|
+
return undefined;
|
|
135
167
|
};
|
|
136
|
-
})
|
|
168
|
+
})
|
|
137
169
|
|
|
138
170
|
const onRemove = (id: string) => {
|
|
139
171
|
emit("update:modelValue", props.modelValue.filter((i) => i !== id));
|
|
172
|
+
emit("update", {
|
|
173
|
+
entityType: props.entityType,
|
|
174
|
+
modelValue: props.modelValue.filter((i) => i !== id)
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const onEntityTypeChanged = (entityType: EntityType) => {
|
|
179
|
+
emit('update:entityType', entityType);
|
|
180
|
+
emit('update:modelValue', []);
|
|
181
|
+
emit("update", {
|
|
182
|
+
entityType,
|
|
183
|
+
modelValue: []
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const onModelValueChanged = (modelValue: string[]) => {
|
|
188
|
+
emit('update:modelValue', modelValue);
|
|
189
|
+
emit("update", {
|
|
190
|
+
entityType: props.entityType,
|
|
191
|
+
modelValue
|
|
192
|
+
})
|
|
140
193
|
}
|
|
141
194
|
|
|
142
195
|
return {
|
|
143
196
|
dialog,
|
|
144
|
-
|
|
145
|
-
onRemove
|
|
197
|
+
simpleListFilters,
|
|
198
|
+
onRemove,
|
|
199
|
+
onEntityTypeChanged,
|
|
200
|
+
onModelValueChanged
|
|
146
201
|
}
|
|
147
202
|
}
|
|
148
203
|
});
|