@dative-gpi/foundation-shared-components 1.0.185 → 1.0.186-tile-list-5
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.
|
@@ -0,0 +1,237 @@
|
|
|
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 == '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, 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, 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
|
+
width="348px"
|
|
90
|
+
:modelValue="isSelected(item.id)"
|
|
91
|
+
@update:modelValue="toggleSelect(item)"
|
|
92
|
+
/>
|
|
93
|
+
</slot>
|
|
94
|
+
</template>
|
|
95
|
+
</template>
|
|
96
|
+
</FSSlideGroup>
|
|
97
|
+
</FSCol>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script lang="ts">
|
|
101
|
+
import { computed } from "vue";
|
|
102
|
+
import { defineComponent, type PropType, ref, watch } from "vue";
|
|
103
|
+
|
|
104
|
+
import { ColorEnum } from "../../models"
|
|
105
|
+
import { filterItems } from "../../utils";
|
|
106
|
+
|
|
107
|
+
import FSCol from "../FSCol.vue";
|
|
108
|
+
import FSLoader from '../FSLoader.vue';
|
|
109
|
+
import FSFadeOut from "../FSFadeOut.vue";
|
|
110
|
+
import FSSlideGroup from "../FSSlideGroup.vue"
|
|
111
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
112
|
+
import FSSimpleTileUI from "../tiles/FSSimpleTileUI.vue";
|
|
113
|
+
|
|
114
|
+
export default defineComponent({
|
|
115
|
+
name: "FSTileList",
|
|
116
|
+
components: {
|
|
117
|
+
FSCol,
|
|
118
|
+
FSFadeOut,
|
|
119
|
+
FSLoader,
|
|
120
|
+
FSSlideGroup,
|
|
121
|
+
FSSearchField,
|
|
122
|
+
FSSimpleTileUI
|
|
123
|
+
},
|
|
124
|
+
props: {
|
|
125
|
+
items: {
|
|
126
|
+
type: Array as PropType<{id: string, label?: string, icon?: string, imageId?: string | null, [index: string]: any}[]>,
|
|
127
|
+
required: true
|
|
128
|
+
},
|
|
129
|
+
tileProps: {
|
|
130
|
+
type: Function as PropType<(item: any) => Record<string, any>>,
|
|
131
|
+
required: false
|
|
132
|
+
},
|
|
133
|
+
searchable: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
required: false,
|
|
136
|
+
default: false
|
|
137
|
+
},
|
|
138
|
+
search: {
|
|
139
|
+
type: String,
|
|
140
|
+
required: false,
|
|
141
|
+
default: ""
|
|
142
|
+
},
|
|
143
|
+
noFilter: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
required: false,
|
|
146
|
+
default: false
|
|
147
|
+
},
|
|
148
|
+
maxHeight: {
|
|
149
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null | undefined>,
|
|
150
|
+
required: false,
|
|
151
|
+
default: undefined
|
|
152
|
+
},
|
|
153
|
+
direction: {
|
|
154
|
+
type: String as PropType<"column" | "slided">,
|
|
155
|
+
required: false,
|
|
156
|
+
default: "column"
|
|
157
|
+
},
|
|
158
|
+
loading: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
required: false,
|
|
161
|
+
default: false
|
|
162
|
+
},
|
|
163
|
+
selectable: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
required: false,
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
168
|
+
singleSelect: {
|
|
169
|
+
type: Boolean,
|
|
170
|
+
required: false,
|
|
171
|
+
default: false
|
|
172
|
+
},
|
|
173
|
+
itemValue: {
|
|
174
|
+
type: String,
|
|
175
|
+
required: false,
|
|
176
|
+
default: "id"
|
|
177
|
+
},
|
|
178
|
+
modelValue: {
|
|
179
|
+
type: Array as PropType<string[]>,
|
|
180
|
+
default: () => [],
|
|
181
|
+
required: false
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
emits: ["update:search","update:modelValue"],
|
|
185
|
+
setup(props, { emit }) {
|
|
186
|
+
const actualSearch = ref<string | null>(props.search);
|
|
187
|
+
const filteredItems = computed(() => {
|
|
188
|
+
if(!actualSearch.value) {
|
|
189
|
+
return props.items;
|
|
190
|
+
}
|
|
191
|
+
return filterItems(props.items, actualSearch.value);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const onSearch = (value: string) => {
|
|
195
|
+
if(props.noFilter) {
|
|
196
|
+
emit("update:search", value);
|
|
197
|
+
} else {
|
|
198
|
+
actualSearch.value = value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const isSelected = (id: string): boolean => {
|
|
203
|
+
return props.modelValue.includes(id);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const toggleSelect = (item: any): void => {
|
|
207
|
+
let values = props.modelValue.slice();
|
|
208
|
+
const index = values.indexOf(item[props.itemValue]);
|
|
209
|
+
if (index > -1) {
|
|
210
|
+
values.splice(index, 1);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
if (props.singleSelect) {
|
|
214
|
+
values = [item[props.itemValue]];
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
values.push(item[props.itemValue]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
emit("update:modelValue", values);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
watch(() => props.search, (value) => {
|
|
224
|
+
actualSearch.value = value;
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
actualSearch,
|
|
229
|
+
filteredItems,
|
|
230
|
+
ColorEnum,
|
|
231
|
+
onSearch,
|
|
232
|
+
isSelected,
|
|
233
|
+
toggleSelect
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
</script>
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
:bottomColor="$props.bottomColor"
|
|
5
5
|
:width="$props.width"
|
|
6
6
|
:modelValue="$props.modelValue"
|
|
7
|
+
:selectable="$props.selectable"
|
|
8
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
7
9
|
v-bind="$attrs"
|
|
8
10
|
>
|
|
9
11
|
<FSCol
|
|
@@ -141,8 +143,14 @@ export default defineComponent({
|
|
|
141
143
|
type: Boolean,
|
|
142
144
|
required: false,
|
|
143
145
|
default: false
|
|
146
|
+
},
|
|
147
|
+
selectable: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
required: false,
|
|
150
|
+
default: false
|
|
144
151
|
}
|
|
145
152
|
},
|
|
153
|
+
emits: ['update:modelValue'],
|
|
146
154
|
setup(props) {
|
|
147
155
|
const { isMobileSized } = useBreakpoints();
|
|
148
156
|
|
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.186-tile-list-5",
|
|
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.186-tile-list-5",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "1.0.186-tile-list-5"
|
|
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": "8ddd95344bae8a58eab6a9dc7c73bf13ed517fbb"
|
|
39
42
|
}
|
package/tools/chartsTools.ts
CHANGED
|
@@ -374,16 +374,10 @@ export const yAxisTypeFromSerieType = (serieType: SerieType): AxisType[] => {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
export const
|
|
378
|
-
return chartType == ChartType.XY;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export const hasXAxis = (chartType: ChartType) => {
|
|
377
|
+
export const hasAxis = (chartType: ChartType) => {
|
|
382
378
|
switch (chartType) {
|
|
383
379
|
case ChartType.XY:
|
|
384
380
|
case ChartType.Heatmap:
|
|
385
|
-
case ChartType.Gauge:
|
|
386
|
-
case ChartType.Slider:
|
|
387
381
|
return true;
|
|
388
382
|
default:
|
|
389
383
|
return false;
|