@dative-gpi/foundation-core-components 1.0.61 → 1.0.63

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.
@@ -9,84 +9,29 @@
9
9
  <template
10
10
  #body
11
11
  >
12
- <FSCol
13
- gap="24px"
14
- >
15
- <FSCol>
16
- <FSText
17
- font="text-button"
18
- >
19
- {{ $tr("ui.common.selection-reminder", "Selection reminder") }}
20
- </FSText>
21
- <FSRow
22
- align="center-left"
23
- height="50px"
24
- >
25
- <FSSlideGroup
26
- v-if="actualSelecteds.length > 0"
27
- >
28
- <FSSimpleEntitiesList
29
- :entity-type="$props.entityType"
30
- :filters="simpleListFilters"
31
- :showEdit="false"
32
- :showRemove="false"
33
- direction="row"
34
- />
35
- </FSSlideGroup>
36
- <FSText
37
- v-else
38
- >
39
- {{ $tr("ui.common.no-selection", "No selection") }}
40
- </FSText>
41
- </FSRow>
42
- </FSCol>
43
-
44
- <FSCol>
45
- <FSText
46
- font="text-button"
47
- >
48
- {{ $tr("ui.common.entities-list", "Entities list") }}
49
- </FSText>
50
- <FSBaseEntitiesList
51
- :entity-type="$props.entityType"
52
- :tableCode="tableCode"
53
- v-model="actualSelecteds"
54
- v-bind="baseTableAttrs"
55
- />
56
- </FSCol>
57
- </FSCol>
12
+ <FSSelectEntitiesList
13
+ :entityType="$props.entityType"
14
+ :modelValue="actualSelecteds"
15
+ :filters="$props.filters"
16
+ @update:modelValue="actualSelecteds = $event"
17
+ />
58
18
  </template>
59
19
  </FSDialogSubmit>
60
20
  </template>
61
21
 
62
22
  <script lang="ts">
63
- import { defineComponent, type PropType, computed, ref, watch } from "vue";
64
-
65
- import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
66
- import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
23
+ import { defineComponent, type PropType, ref, watch } from "vue";
67
24
 
68
- import { TABLES as T } from "../../utils";
25
+ import type { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
69
26
 
70
- import FSSlideGroup from "@dative-gpi/foundation-shared-components/components/FSSlideGroup.vue";
71
27
  import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
72
- import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
73
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
74
- import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
75
-
76
-
77
- import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
78
- import FSBaseEntitiesList from "./FSBaseEntitiesList.vue";
28
+ import FSSelectEntitiesList from "./FSSelectEntitiesList.vue";
79
29
 
80
30
  export default defineComponent({
81
31
  name: "FSDialogSelectEntities",
82
32
  components: {
83
- FSSimpleEntitiesList,
84
- FSBaseEntitiesList,
85
- FSSlideGroup,
33
+ FSSelectEntitiesList,
86
34
  FSDialogSubmit,
87
- FSCol,
88
- FSRow,
89
- FSText
90
35
  },
91
36
  emits: ["update:modelValue", "update:selecteds"],
92
37
  props: {
@@ -110,98 +55,9 @@ export default defineComponent({
110
55
  default: false
111
56
  }
112
57
  },
113
- setup(props, { attrs, emit }){
58
+ setup(props, { emit }){
114
59
  const actualSelecteds = ref<string[]>([]);
115
60
 
116
- const simpleListFilters = computed(() => {
117
- switch(props.entityType) {
118
- case EntityType.Device:
119
- return {
120
- deviceOrganisationsIds: actualSelecteds.value
121
- } satisfies DeviceOrganisationFilters;
122
- case EntityType.Dashboard:
123
- return {
124
- dashboardOrganisationsIds: actualSelecteds.value,
125
- dashboardOrganisationTypesIds: actualSelecteds.value
126
- } satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
127
- case EntityType.Group:
128
- return {
129
- groupsIds: actualSelecteds.value
130
- } satisfies GroupFilters;
131
- case EntityType.Folder:
132
- return {
133
- foldersIds: actualSelecteds.value
134
- } satisfies FolderFilters;
135
- case EntityType.Location:
136
- return {
137
- locationsIds: actualSelecteds.value
138
- } satisfies LocationFilters;
139
- case EntityType.User:
140
- return {
141
- userOrganisationsIds: actualSelecteds.value
142
- } satisfies UserOrganisationFilters;
143
- case EntityType.Model:
144
- return {
145
- modelsIds: actualSelecteds.value
146
- } satisfies ModelFilters;
147
- default:
148
- return undefined;
149
- };
150
- })
151
-
152
- const tableCode = computed(() => {
153
- switch(props.entityType) {
154
- case EntityType.Device:
155
- return T.DEVICES_SELECT;
156
- default:
157
- return null;
158
- };
159
- })
160
-
161
- const baseTableAttrs = computed(() => {
162
- switch(props.entityType) {
163
- case EntityType.Device:
164
- return {
165
- deviceOrganisationFilters: props.filters,
166
- ...attrs
167
- };
168
- case EntityType.Dashboard:
169
- return {
170
- dashboardShallowsFilters: props.filters,
171
- dashboardOrganisationsFilters: props.filters,
172
- dashboardOrganisationTypeFetchFilter: props.filters,
173
- ...attrs
174
- };
175
- case EntityType.Group:
176
- return {
177
- groupsFilters: props.filters,
178
- ...attrs
179
- };
180
- case EntityType.Folder:
181
- return {
182
- foldersFilters: props.filters,
183
- ...attrs
184
- };
185
- case EntityType.Location:
186
- return {
187
- locationsFilters: props.filters,
188
- ...attrs
189
- };
190
- case EntityType.User:
191
- return {
192
- userOrganisationsFilters: props.filters,
193
- ...attrs
194
- };
195
- case EntityType.Model:
196
- return {
197
- modelsFilters: props.filters,
198
- ...attrs
199
- };
200
- default:
201
- return null;
202
- };
203
- });
204
-
205
61
  const onSubmit = () => {
206
62
  emit("update:selecteds", actualSelecteds.value);
207
63
  emit("update:modelValue", false);
@@ -213,10 +69,7 @@ export default defineComponent({
213
69
 
214
70
  return {
215
71
  onSubmit,
216
- actualSelecteds,
217
- simpleListFilters,
218
- baseTableAttrs,
219
- tableCode
72
+ actualSelecteds
220
73
  }
221
74
  }
222
75
  });
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <FSCol
3
+ gap="24px"
4
+ >
5
+ <FSCol>
6
+ <FSText
7
+ font="text-button"
8
+ >
9
+ {{ $tr("ui.common.selection-reminder", "Selection reminder") }}
10
+ </FSText>
11
+ <FSRow
12
+ align="center-left"
13
+ height="50px"
14
+ >
15
+ <FSSlideGroup
16
+ v-if="$props.modelValue && $props.modelValue.length > 0"
17
+ >
18
+ <FSSimpleEntitiesList
19
+ :entity-type="$props.entityType"
20
+ :filters="simpleListFilters"
21
+ :showEdit="false"
22
+ :showRemove="false"
23
+ direction="row"
24
+ />
25
+ </FSSlideGroup>
26
+ <FSText
27
+ v-else
28
+ >
29
+ {{ $tr("ui.common.no-selection", "No selection") }}
30
+ </FSText>
31
+ </FSRow>
32
+ </FSCol>
33
+
34
+ <FSCol>
35
+ <FSText
36
+ font="text-button"
37
+ >
38
+ {{ $tr("ui.common.entities-list", "Entities list") }}
39
+ </FSText>
40
+ <FSBaseEntitiesList
41
+ :entity-type="$props.entityType"
42
+ :tableCode="tableCode"
43
+ :modelValue="$props.modelValue"
44
+ @update:modelValue="$emit('update:modelValue', $event)"
45
+ v-bind="baseTableAttrs"
46
+ />
47
+ </FSCol>
48
+ </FSCol>
49
+ </template>
50
+
51
+ <script lang="ts">
52
+ import { defineComponent, type PropType, computed } from "vue";
53
+
54
+ import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
55
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
56
+
57
+ import { TABLES as T } from "../../utils";
58
+
59
+ import FSSlideGroup from "@dative-gpi/foundation-shared-components/components/FSSlideGroup.vue";
60
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
61
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
62
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
63
+
64
+
65
+ import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
66
+ import FSBaseEntitiesList from "./FSBaseEntitiesList.vue";
67
+
68
+ export default defineComponent({
69
+ name: "FSSelectEntitiesList",
70
+ components: {
71
+ FSSimpleEntitiesList,
72
+ FSBaseEntitiesList,
73
+ FSSlideGroup,
74
+ FSCol,
75
+ FSRow,
76
+ FSText
77
+ },
78
+ emits: ["update:modelValue"],
79
+ props: {
80
+ entityType: {
81
+ type: Number as PropType<EntityType>,
82
+ required: true
83
+ },
84
+ modelValue: {
85
+ type: Array as PropType<string[]>,
86
+ required: false,
87
+ default: () => []
88
+ },
89
+ filters: {
90
+ type: Object,
91
+ required: false,
92
+ default: null
93
+ }
94
+ },
95
+ setup(props, { attrs }){
96
+ const simpleListFilters = computed(() => {
97
+ switch(props.entityType) {
98
+ case EntityType.Device:
99
+ return {
100
+ deviceOrganisationsIds: props.modelValue
101
+ } satisfies DeviceOrganisationFilters;
102
+ case EntityType.Dashboard:
103
+ return {
104
+ dashboardOrganisationsIds: props.modelValue,
105
+ dashboardOrganisationTypesIds: props.modelValue
106
+ } satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
107
+ case EntityType.Group:
108
+ return {
109
+ groupsIds: props.modelValue
110
+ } satisfies GroupFilters;
111
+ case EntityType.Folder:
112
+ return {
113
+ foldersIds: props.modelValue
114
+ } satisfies FolderFilters;
115
+ case EntityType.Location:
116
+ return {
117
+ locationsIds: props.modelValue
118
+ } satisfies LocationFilters;
119
+ case EntityType.User:
120
+ return {
121
+ userOrganisationsIds: props.modelValue
122
+ } satisfies UserOrganisationFilters;
123
+ case EntityType.Model:
124
+ return {
125
+ modelsIds: props.modelValue
126
+ } satisfies ModelFilters;
127
+ default:
128
+ return undefined;
129
+ };
130
+ })
131
+
132
+ const tableCode = computed(() => {
133
+ switch(props.entityType) {
134
+ case EntityType.Device:
135
+ return T.DEVICES_SELECT;
136
+ default:
137
+ return null;
138
+ };
139
+ })
140
+
141
+ const baseTableAttrs = computed(() => {
142
+ switch(props.entityType) {
143
+ case EntityType.Device:
144
+ return {
145
+ deviceOrganisationFilters: props.filters,
146
+ ...attrs
147
+ };
148
+ case EntityType.Dashboard:
149
+ return {
150
+ dashboardShallowsFilters: props.filters,
151
+ dashboardOrganisationsFilters: props.filters,
152
+ dashboardOrganisationTypeFetchFilter: props.filters,
153
+ ...attrs
154
+ };
155
+ case EntityType.Group:
156
+ return {
157
+ groupsFilters: props.filters,
158
+ ...attrs
159
+ };
160
+ case EntityType.Folder:
161
+ return {
162
+ foldersFilters: props.filters,
163
+ ...attrs
164
+ };
165
+ case EntityType.Location:
166
+ return {
167
+ locationsFilters: props.filters,
168
+ ...attrs
169
+ };
170
+ case EntityType.User:
171
+ return {
172
+ userOrganisationsFilters: props.filters,
173
+ ...attrs
174
+ };
175
+ case EntityType.Model:
176
+ return {
177
+ modelsFilters: props.filters,
178
+ ...attrs
179
+ };
180
+ default:
181
+ return null;
182
+ };
183
+ });
184
+
185
+ return {
186
+ simpleListFilters,
187
+ baseTableAttrs,
188
+ tableCode
189
+ }
190
+ }
191
+ });
192
+ </script>
@@ -69,8 +69,6 @@ export default defineComponent({
69
69
 
70
70
  const computedTable = computed(() => computeTable(props.customSorts, props.customSortRaws));
71
71
 
72
- console.log(JSON.stringify(computedTable.value));
73
-
74
72
  onUnmounted(() => {
75
73
  cancel();
76
74
  update();
@@ -90,7 +88,6 @@ export default defineComponent({
90
88
  getTable,
91
89
  props.tableCode
92
90
  );
93
- console.log(JSON.stringify(computedTable.value));
94
91
  }, { immediate: true });
95
92
 
96
93
  watch(() => table.value, () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.61",
4
+ "version": "1.0.63",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,11 +10,11 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.61",
14
- "@dative-gpi/foundation-core-services": "1.0.61",
15
- "@dative-gpi/foundation-shared-components": "1.0.61",
16
- "@dative-gpi/foundation-shared-domain": "1.0.61",
17
- "@dative-gpi/foundation-shared-services": "1.0.61"
13
+ "@dative-gpi/foundation-core-domain": "1.0.63",
14
+ "@dative-gpi/foundation-core-services": "1.0.63",
15
+ "@dative-gpi/foundation-shared-components": "1.0.63",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.63",
17
+ "@dative-gpi/foundation-shared-services": "1.0.63"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -26,5 +26,5 @@
26
26
  "sass": "1.71.1",
27
27
  "sass-loader": "13.3.2"
28
28
  },
29
- "gitHead": "764e769b8eeb942d5028c00c479333be5907f4de"
29
+ "gitHead": "b2fbfec30ab5c2f3edeaddbc7eed0d3c98fe71c4"
30
30
  }