@dative-gpi/foundation-shared-components 1.0.186 → 1.0.188
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.
|
@@ -493,7 +493,7 @@
|
|
|
493
493
|
:headers="innerHeaders.filter(h => !$props.sneakyHeaders.includes(h.value))"
|
|
494
494
|
:selectable="$props.selectable"
|
|
495
495
|
:singleSelect="$props.singleSelect"
|
|
496
|
-
:to="$props.itemTo"
|
|
496
|
+
:to="$props.itemTo && $props.itemTo(item.raw)"
|
|
497
497
|
:bottomColor="$props.color"
|
|
498
498
|
:item="item.raw"
|
|
499
499
|
:key="index"
|
|
@@ -666,7 +666,7 @@
|
|
|
666
666
|
:headers="innerHeaders.filter(h => !$props.sneakyHeaders.includes(h.value))"
|
|
667
667
|
:selectable="$props.selectable"
|
|
668
668
|
:singleSelect="$props.singleSelect"
|
|
669
|
-
:to="$props.itemTo"
|
|
669
|
+
:to="$props.itemTo && $props.itemTo(item.raw)"
|
|
670
670
|
:bottomColor="$props.color"
|
|
671
671
|
:item="item.raw"
|
|
672
672
|
:key="index"
|
|
@@ -724,7 +724,7 @@
|
|
|
724
724
|
|
|
725
725
|
<script lang="ts">
|
|
726
726
|
import { computed, defineComponent, nextTick, onMounted, onUnmounted, type PropType, type Ref, ref, type Slot, type StyleValue, watch } from "vue";
|
|
727
|
-
import { useRouter } from "vue-router";
|
|
727
|
+
import { useRouter, type RouteLocation } from "vue-router";
|
|
728
728
|
|
|
729
729
|
import { ColorEnum, type FSDataTableColumn, type FSDataTableFilter, type FSDataTableOrder, type FSToggle } from "@dative-gpi/foundation-shared-components/models";
|
|
730
730
|
import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
@@ -805,7 +805,7 @@ export default defineComponent({
|
|
|
805
805
|
default: "id"
|
|
806
806
|
},
|
|
807
807
|
itemTo: {
|
|
808
|
-
type: Function
|
|
808
|
+
type: Function as PropType<(item: any) => Partial<RouteLocation>>,
|
|
809
809
|
required: false,
|
|
810
810
|
default: null
|
|
811
811
|
},
|
|
@@ -1141,7 +1141,6 @@ export default defineComponent({
|
|
|
1141
1141
|
});
|
|
1142
1142
|
|
|
1143
1143
|
const onClickLibrary = computed((): { [key: string]: Function | boolean } => {
|
|
1144
|
-
console.log(props["onClick:row"]);
|
|
1145
1144
|
if (props["onClick:row"] || props.itemTo) {
|
|
1146
1145
|
return {
|
|
1147
1146
|
clickable: true,
|
|
@@ -1154,10 +1153,7 @@ export default defineComponent({
|
|
|
1154
1153
|
}
|
|
1155
1154
|
},
|
|
1156
1155
|
mobile: (event: any, item: any) => {
|
|
1157
|
-
if (props.itemTo
|
|
1158
|
-
router.push(props.itemTo(item.raw));
|
|
1159
|
-
}
|
|
1160
|
-
else {
|
|
1156
|
+
if (!props.itemTo) {
|
|
1161
1157
|
emit("click:row", item.raw);
|
|
1162
1158
|
}
|
|
1163
1159
|
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol
|
|
3
|
+
gap="12px"
|
|
4
|
+
>
|
|
5
|
+
<FSSearchField
|
|
6
|
+
v-if="$props.searchable"
|
|
7
|
+
:hideHeader="true"
|
|
8
|
+
:modelValue="actualSearch"
|
|
9
|
+
@update:modelValue="onSearch"
|
|
10
|
+
/>
|
|
11
|
+
<FSFadeOut
|
|
12
|
+
v-if="$props.direction == ListDirections.Column"
|
|
13
|
+
:maxHeight="$props.maxHeight"
|
|
14
|
+
:maskHeight="0"
|
|
15
|
+
>
|
|
16
|
+
<FSCol>
|
|
17
|
+
<template
|
|
18
|
+
v-if="$props.loading"
|
|
19
|
+
>
|
|
20
|
+
<FSLoader
|
|
21
|
+
v-for="i in 4"
|
|
22
|
+
:key="i"
|
|
23
|
+
width="100%"
|
|
24
|
+
height="50px"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
<template
|
|
28
|
+
v-else
|
|
29
|
+
>
|
|
30
|
+
<template
|
|
31
|
+
v-for="(item, index) in filteredItems"
|
|
32
|
+
:key="index"
|
|
33
|
+
>
|
|
34
|
+
<slot
|
|
35
|
+
name="item.tile"
|
|
36
|
+
v-bind="{ index, item, direction: $props.direction, toggleSelect }"
|
|
37
|
+
>
|
|
38
|
+
<FSSimpleTileUI
|
|
39
|
+
:key="index"
|
|
40
|
+
:id="item.id"
|
|
41
|
+
:label="item.label"
|
|
42
|
+
:code="item.code"
|
|
43
|
+
:icon="item.icon"
|
|
44
|
+
:imageId="item.imageId"
|
|
45
|
+
:selectable="$props.selectable"
|
|
46
|
+
width="fill"
|
|
47
|
+
v-bind="$props.tileProps ? $props.tileProps(item) : undefined"
|
|
48
|
+
:modelValue="isSelected(item.id)"
|
|
49
|
+
@update:modelValue="toggleSelect(item)"
|
|
50
|
+
/>
|
|
51
|
+
</slot>
|
|
52
|
+
</template>
|
|
53
|
+
</template>
|
|
54
|
+
</FSCol>
|
|
55
|
+
</FSFadeOut>
|
|
56
|
+
<FSSlideGroup
|
|
57
|
+
v-else
|
|
58
|
+
>
|
|
59
|
+
<template
|
|
60
|
+
v-if="$props.loading"
|
|
61
|
+
>
|
|
62
|
+
<FSLoader
|
|
63
|
+
v-for="i in 4"
|
|
64
|
+
:key="i"
|
|
65
|
+
width="100%"
|
|
66
|
+
height="50px"
|
|
67
|
+
/>
|
|
68
|
+
</template>
|
|
69
|
+
<template
|
|
70
|
+
v-else
|
|
71
|
+
>
|
|
72
|
+
<template
|
|
73
|
+
v-for="(item, index) in filteredItems"
|
|
74
|
+
:key="index"
|
|
75
|
+
>
|
|
76
|
+
<slot
|
|
77
|
+
name="item.tile"
|
|
78
|
+
v-bind="{ index, item, direction: $props.direction, toggleSelect }"
|
|
79
|
+
>
|
|
80
|
+
<FSSimpleTileUI
|
|
81
|
+
:key="index"
|
|
82
|
+
:id="item.id"
|
|
83
|
+
:label="item.label"
|
|
84
|
+
:code="item.code"
|
|
85
|
+
:icon="item.icon"
|
|
86
|
+
:imageId="item.imageId"
|
|
87
|
+
:selectable="$props.selectable"
|
|
88
|
+
v-bind="$props.tileProps ? $props.tileProps(item) : undefined"
|
|
89
|
+
:modelValue="isSelected(item.id)"
|
|
90
|
+
@update:modelValue="toggleSelect(item)"
|
|
91
|
+
/>
|
|
92
|
+
</slot>
|
|
93
|
+
</template>
|
|
94
|
+
</template>
|
|
95
|
+
</FSSlideGroup>
|
|
96
|
+
</FSCol>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script lang="ts">
|
|
100
|
+
import { computed } from "vue";
|
|
101
|
+
import { defineComponent, type PropType, ref, watch } from "vue";
|
|
102
|
+
import { ListDirections } from "@dative-gpi/foundation-shared-domain/enums";
|
|
103
|
+
|
|
104
|
+
import { filterItems } from "../../utils";
|
|
105
|
+
|
|
106
|
+
import FSCol from "../FSCol.vue";
|
|
107
|
+
import FSLoader from '../FSLoader.vue';
|
|
108
|
+
import FSFadeOut from "../FSFadeOut.vue";
|
|
109
|
+
import FSSlideGroup from "../FSSlideGroup.vue"
|
|
110
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
111
|
+
import FSSimpleTileUI from "../tiles/FSSimpleTileUI.vue";
|
|
112
|
+
|
|
113
|
+
export default defineComponent({
|
|
114
|
+
name: "FSTileList",
|
|
115
|
+
components: {
|
|
116
|
+
FSCol,
|
|
117
|
+
FSFadeOut,
|
|
118
|
+
FSLoader,
|
|
119
|
+
FSSlideGroup,
|
|
120
|
+
FSSearchField,
|
|
121
|
+
FSSimpleTileUI
|
|
122
|
+
},
|
|
123
|
+
props: {
|
|
124
|
+
items: {
|
|
125
|
+
type: Array as PropType<{id: string, label?: string, icon?: string, imageId?: string | null, [index: string]: any}[]>,
|
|
126
|
+
required: true
|
|
127
|
+
},
|
|
128
|
+
tileProps: {
|
|
129
|
+
type: Function as PropType<(item: any) => Record<string, any>>,
|
|
130
|
+
required: false
|
|
131
|
+
},
|
|
132
|
+
searchable: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
required: false,
|
|
135
|
+
default: false
|
|
136
|
+
},
|
|
137
|
+
search: {
|
|
138
|
+
type: String,
|
|
139
|
+
required: false,
|
|
140
|
+
default: ""
|
|
141
|
+
},
|
|
142
|
+
disableFilter: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
required: false,
|
|
145
|
+
default: false
|
|
146
|
+
},
|
|
147
|
+
maxHeight: {
|
|
148
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null | undefined>,
|
|
149
|
+
required: false,
|
|
150
|
+
default: undefined
|
|
151
|
+
},
|
|
152
|
+
direction: {
|
|
153
|
+
type: String as PropType<ListDirections | undefined>,
|
|
154
|
+
required: false,
|
|
155
|
+
default: ListDirections.Column
|
|
156
|
+
},
|
|
157
|
+
loading: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
required: false,
|
|
160
|
+
default: false
|
|
161
|
+
},
|
|
162
|
+
selectable: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
required: false,
|
|
165
|
+
default: false
|
|
166
|
+
},
|
|
167
|
+
singleSelect: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
required: false,
|
|
170
|
+
default: false
|
|
171
|
+
},
|
|
172
|
+
itemValue: {
|
|
173
|
+
type: String,
|
|
174
|
+
required: false,
|
|
175
|
+
default: "id"
|
|
176
|
+
},
|
|
177
|
+
modelValue: {
|
|
178
|
+
type: Array as PropType<string[]>,
|
|
179
|
+
default: () => [],
|
|
180
|
+
required: false
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
emits: ["update:search","update:modelValue"],
|
|
184
|
+
setup(props, { emit }) {
|
|
185
|
+
const actualSearch = ref<string | null>(props.search);
|
|
186
|
+
const filteredItems = computed(() => {
|
|
187
|
+
if(!actualSearch.value) {
|
|
188
|
+
return props.items;
|
|
189
|
+
}
|
|
190
|
+
return filterItems(props.items, actualSearch.value);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const onSearch = (value: string) => {
|
|
194
|
+
if(props.disableFilter) {
|
|
195
|
+
emit("update:search", value);
|
|
196
|
+
} else {
|
|
197
|
+
actualSearch.value = value;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const isSelected = (id: string): boolean => {
|
|
202
|
+
return props.modelValue.includes(id);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const toggleSelect = (item: any): void => {
|
|
206
|
+
let values = props.modelValue.slice();
|
|
207
|
+
const index = values.indexOf(item[props.itemValue]);
|
|
208
|
+
if (index > -1) {
|
|
209
|
+
values.splice(index, 1);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
if (props.singleSelect) {
|
|
213
|
+
values = [item[props.itemValue]];
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
values.push(item[props.itemValue]);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
emit("update:modelValue", values);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
watch(() => props.search, (value) => {
|
|
223
|
+
actualSearch.value = value;
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
actualSearch,
|
|
228
|
+
filteredItems,
|
|
229
|
+
ListDirections,
|
|
230
|
+
onSearch,
|
|
231
|
+
isSelected,
|
|
232
|
+
toggleSelect
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
</script>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:bottomColor="$props.bottomColor"
|
|
5
5
|
:width="$props.width"
|
|
6
6
|
:modelValue="$props.modelValue"
|
|
7
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
7
8
|
v-bind="$attrs"
|
|
8
9
|
>
|
|
9
10
|
<FSCol
|
|
@@ -143,6 +144,7 @@ export default defineComponent({
|
|
|
143
144
|
default: false
|
|
144
145
|
}
|
|
145
146
|
},
|
|
147
|
+
emits: ['update:modelValue'],
|
|
146
148
|
setup(props) {
|
|
147
149
|
const { isMobileSized } = useBreakpoints();
|
|
148
150
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
|
+
"repository": {
|
|
4
|
+
"url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
|
|
5
|
+
},
|
|
3
6
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.188",
|
|
5
8
|
"description": "",
|
|
6
9
|
"publishConfig": {
|
|
7
10
|
"access": "public"
|
|
@@ -10,8 +13,8 @@
|
|
|
10
13
|
"author": "",
|
|
11
14
|
"license": "ISC",
|
|
12
15
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "1.0.188",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "1.0.188"
|
|
15
18
|
},
|
|
16
19
|
"peerDependencies": {
|
|
17
20
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -35,5 +38,5 @@
|
|
|
35
38
|
"sass": "1.71.1",
|
|
36
39
|
"sass-loader": "13.3.2"
|
|
37
40
|
},
|
|
38
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "5d77493228261fb2a57c5a2e233152715b9322e3"
|
|
39
42
|
}
|