@ouestfrance/sipa-bms-ui 8.8.1 → 8.9.1
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/dist/components/form/BmsMultiSelect.vue.d.ts +4 -4
- package/dist/components/form/BmsServerAutocomplete.vue.d.ts +30 -0
- package/dist/components/form/RawAutocomplete.vue.d.ts +1 -0
- package/dist/components/table/BmsServerTable.vue.d.ts +5 -5
- package/dist/components/table/BmsTable.vue.d.ts +1 -1
- package/dist/composables/search.composable.d.ts +6 -0
- package/dist/models/table.model.d.ts +5 -2
- package/dist/sipa-bms-ui.css +42 -29
- package/dist/sipa-bms-ui.es.js +526 -384
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +532 -390
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/BmsMultiSelect.stories.js +6 -6
- package/src/components/form/BmsMultiSelect.vue +48 -23
- package/src/components/form/BmsSelect.vue +3 -3
- package/src/components/form/BmsServerAutocomplete.stories.js +74 -0
- package/src/components/form/BmsServerAutocomplete.vue +143 -0
- package/src/components/form/RawAutocomplete.vue +3 -2
- package/src/components/table/BmsTableFilters.vue +4 -0
- package/src/models/table.model.ts +6 -1
- package/src/showroom/pages/autocomplete.vue +27 -4
- package/src/showroom/pages/server-table.vue +17 -73
- package/src/showroom/server.js +24 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
{{ filters }}
|
|
3
2
|
<bms-server-table
|
|
4
3
|
v-model:selectedItems="selectedItems"
|
|
5
4
|
v-model:selectMode="selectMode"
|
|
@@ -14,8 +13,6 @@
|
|
|
14
13
|
:total="totalItems"
|
|
15
14
|
@saveFilter="onSaveFilter"
|
|
16
15
|
@deleteSavedFilter="onDeleteSavedFilter"
|
|
17
|
-
@filterInput="onFilterInput"
|
|
18
|
-
@filterChange="onFilterChange"
|
|
19
16
|
>
|
|
20
17
|
<template #default="{ row }: { row: any }">
|
|
21
18
|
<td>
|
|
@@ -41,7 +38,7 @@
|
|
|
41
38
|
</template>
|
|
42
39
|
|
|
43
40
|
<script lang="ts" setup>
|
|
44
|
-
import { Filter, SavedFilter, SelectMode } from '@/models';
|
|
41
|
+
import { Filter, InputType, SavedFilter, SelectMode } from '@/models';
|
|
45
42
|
import axios from 'axios';
|
|
46
43
|
import { computed, Ref, ref } from 'vue';
|
|
47
44
|
import { isEmptyStringOrNotDefined } from '@/helpers';
|
|
@@ -52,27 +49,19 @@ const serverHeaders = [
|
|
|
52
49
|
{ label: 'Type', key: 'type' },
|
|
53
50
|
];
|
|
54
51
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'Fighting',
|
|
67
|
-
'Psychic',
|
|
68
|
-
'Rock',
|
|
69
|
-
'Steel',
|
|
70
|
-
'Ice',
|
|
71
|
-
'Ghost',
|
|
72
|
-
'Dragon',
|
|
73
|
-
]);
|
|
52
|
+
const pokemonTypeAutocompleteRequest = async (
|
|
53
|
+
abortController: AbortController,
|
|
54
|
+
) => {
|
|
55
|
+
const { data } = await axios.get('http://localhost:3000/pokemon-types', {
|
|
56
|
+
signal: abortController.signal,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
data,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
74
63
|
|
|
75
|
-
const filters =
|
|
64
|
+
const filters: Filter[] = [
|
|
76
65
|
{
|
|
77
66
|
label: 'Name',
|
|
78
67
|
key: 'name',
|
|
@@ -82,15 +71,15 @@ const filters = computed(() => [
|
|
|
82
71
|
label: 'Number',
|
|
83
72
|
key: 'idBetween',
|
|
84
73
|
type: 'betweenNumber',
|
|
85
|
-
inputType:
|
|
74
|
+
inputType: InputType.NUMBER,
|
|
86
75
|
},
|
|
87
76
|
{
|
|
88
77
|
label: 'Type',
|
|
89
78
|
key: 'type',
|
|
90
|
-
type: '
|
|
91
|
-
|
|
79
|
+
type: 'autocompleteServer',
|
|
80
|
+
autocompleteRequest: pokemonTypeAutocompleteRequest,
|
|
92
81
|
},
|
|
93
|
-
]
|
|
82
|
+
];
|
|
94
83
|
|
|
95
84
|
const savedFilters: Ref<SavedFilter[]> = ref<SavedFilter[]>([]);
|
|
96
85
|
const selectedItems = ref<any[]>([]);
|
|
@@ -106,33 +95,6 @@ const onDeleteSavedFilter = (savedFilter: SavedFilter) => {
|
|
|
106
95
|
(filter) => filter.id !== savedFilter.id,
|
|
107
96
|
);
|
|
108
97
|
};
|
|
109
|
-
|
|
110
|
-
const onFilterInput = ({
|
|
111
|
-
filterKey,
|
|
112
|
-
e,
|
|
113
|
-
}: {
|
|
114
|
-
filterKey: string;
|
|
115
|
-
e: InputEvent;
|
|
116
|
-
}) => {
|
|
117
|
-
typeOptions.value = [];
|
|
118
|
-
console.log(
|
|
119
|
-
`user filtered key ${filterKey} with val ${(e.target as HTMLInputElement)?.value}`,
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const onFilterChange = ({
|
|
124
|
-
filterKey,
|
|
125
|
-
e,
|
|
126
|
-
}: {
|
|
127
|
-
filterKey: string;
|
|
128
|
-
e: InputEvent;
|
|
129
|
-
}) => {
|
|
130
|
-
typeOptions.value = [];
|
|
131
|
-
console.log(
|
|
132
|
-
`user filtered key ${filterKey} changed with val ${(e.target as HTMLInputElement)?.value}`,
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
98
|
const customFetchData = async (
|
|
137
99
|
params: any,
|
|
138
100
|
abortController: AbortController,
|
|
@@ -170,22 +132,4 @@ const customFetchData = async (
|
|
|
170
132
|
data,
|
|
171
133
|
};
|
|
172
134
|
};
|
|
173
|
-
|
|
174
|
-
const customQueryBuilder = (
|
|
175
|
-
size: number,
|
|
176
|
-
_: number,
|
|
177
|
-
page: number,
|
|
178
|
-
search: string,
|
|
179
|
-
) => {
|
|
180
|
-
const params: any = {
|
|
181
|
-
size: '' + size,
|
|
182
|
-
page: '' + (page + 1),
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
if (search) {
|
|
186
|
-
params['beer_name'] = search;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return params;
|
|
190
|
-
};
|
|
191
135
|
</script>
|
package/src/showroom/server.js
CHANGED
|
@@ -8,6 +8,30 @@ app.use(cors());
|
|
|
8
8
|
|
|
9
9
|
const port = 3000;
|
|
10
10
|
|
|
11
|
+
app.get('/pokemon-types', (req, res) => {
|
|
12
|
+
res.send({
|
|
13
|
+
data: [
|
|
14
|
+
{ label: 'Grass', value: 'Grass' },
|
|
15
|
+
{ label: 'Poison', value: 'Poison' },
|
|
16
|
+
{ label: 'Fire', value: 'Fire' },
|
|
17
|
+
{ label: 'Flying', value: 'Flying' },
|
|
18
|
+
{ label: 'Water', value: 'Water' },
|
|
19
|
+
{ label: 'Bug', value: 'Bug' },
|
|
20
|
+
{ label: 'Normal', value: 'Normal' },
|
|
21
|
+
{ label: 'Electric', value: 'Electric' },
|
|
22
|
+
{ label: 'Ground', value: 'Ground' },
|
|
23
|
+
{ label: 'Fairy', value: 'Fairy' },
|
|
24
|
+
{ label: 'Fighting', value: 'Fighting' },
|
|
25
|
+
{ label: 'Psychic', value: 'Psychic' },
|
|
26
|
+
{ label: 'Rock', value: 'Rock' },
|
|
27
|
+
{ label: 'Steel', value: 'Steel' },
|
|
28
|
+
{ label: 'Ice', value: 'Ice' },
|
|
29
|
+
{ label: 'Ghost', value: 'Ghost' },
|
|
30
|
+
{ label: 'Dragon', value: 'Dragon' },
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
11
35
|
app.get('/pokemons', (req, res) => {
|
|
12
36
|
let data = pokemons;
|
|
13
37
|
let total = 0;
|