@ouestfrance/sipa-bms-ui 8.5.4 → 8.7.0
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/BmsAutocomplete.vue.d.ts +2 -0
- package/dist/components/form/BmsInputBooleanCheckbox.vue.d.ts +1 -1
- package/dist/components/form/BmsInputCheckboxGroup.vue.d.ts +2 -2
- package/dist/components/form/BmsInputCode.vue.d.ts +2 -2
- package/dist/components/form/BmsInputNumber.vue.d.ts +2 -2
- package/dist/components/form/BmsInputRadio.vue.d.ts +2 -2
- package/dist/components/form/BmsInputText.vue.d.ts +24 -22
- package/dist/components/form/BmsMultiSelect.vue.d.ts +3 -4
- package/dist/components/form/BmsSearch.vue.d.ts +28 -24
- package/dist/components/form/BmsSelect.vue.d.ts +7 -17
- package/dist/components/form/RawAutocomplete.vue.d.ts +17 -21
- package/dist/components/form/RawInputText.vue.d.ts +9 -9
- package/dist/components/form/RawSelect.vue.d.ts +30 -0
- package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +28 -24
- package/dist/components/table/BmsServerTable.vue.d.ts +18 -0
- package/dist/components/table/BmsTable.vue.d.ts +18 -1
- package/dist/components/table/BmsTableFilters.vue.d.ts +47 -25
- package/dist/components/table/UiBmsTableCell.vue.d.ts +7 -0
- package/dist/composables/search.composable.d.ts +1 -0
- package/dist/models/table.model.d.ts +6 -0
- package/dist/plugins/field/FieldDatalist.vue.d.ts +2 -0
- package/dist/plugins/field/field-component.model.d.ts +2 -2
- package/dist/sipa-bms-ui.css +173 -126
- package/dist/sipa-bms-ui.es.js +4875 -4484
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +4882 -4490
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +11 -11
- package/src/components/form/BmsAutocomplete.vue +3 -0
- package/src/components/form/BmsInputNumber.spec.ts +26 -0
- package/src/components/form/BmsInputNumber.stories.js +20 -3
- package/src/components/form/BmsInputNumber.vue +36 -4
- package/src/components/form/BmsInputRadio.vue +1 -1
- package/src/components/form/BmsInputText.spec.ts +25 -0
- package/src/components/form/BmsInputText.stories.js +28 -3
- package/src/components/form/BmsInputText.vue +73 -12
- package/src/components/form/BmsMultiSelect.vue +67 -30
- package/src/components/form/BmsSelect.vue +60 -57
- package/src/components/form/RawAutocomplete.spec.ts +0 -8
- package/src/components/form/RawAutocomplete.vue +42 -24
- package/src/components/form/RawInputText.vue +14 -21
- package/src/components/form/RawSelect.vue +111 -0
- package/src/components/table/BmsServerTable.vue +18 -3
- package/src/components/table/BmsTable.vue +15 -2
- package/src/components/table/BmsTableFilters.vue +19 -7
- package/src/components/table/UiBmsTable.stories.js +37 -0
- package/src/components/table/UiBmsTableCell.vue +25 -0
- package/src/components/table/UiBmsTableRow.stories.js +30 -0
- package/src/components/table/UiBmsTableRow.vue +3 -2
- package/src/components/utils/BmsRelativeTime.vue +1 -1
- package/src/composables/search.composable.spec.ts +75 -0
- package/src/composables/search.composable.ts +54 -11
- package/src/models/table.model.ts +7 -0
- package/src/plugins/field/FieldComponent.vue +6 -4
- package/src/plugins/field/FieldDatalist.stories.js +0 -9
- package/src/plugins/field/FieldDatalist.vue +16 -13
- package/src/plugins/field/field-component.model.ts +2 -2
- package/src/showroom/pages/autocomplete.vue +22 -1
- package/src/showroom/pages/server-table.vue +53 -22
- package/src/showroom/pages/table.vue +46 -21
- package/dist/plugins/field/FieldDatalist.spec.d.ts +0 -1
- package/src/plugins/field/FieldDatalist.spec.ts +0 -35
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
:can-add-new-option="true"
|
|
12
12
|
@add-new-option="onAddNewOption"
|
|
13
13
|
/>
|
|
14
|
-
|
|
15
14
|
Valeur: {{ inputValueIcon }}
|
|
16
15
|
<BmsAutocomplete
|
|
17
16
|
label="Autocomplete avec icones"
|
|
@@ -26,6 +25,20 @@
|
|
|
26
25
|
:options="optionsText"
|
|
27
26
|
v-model="inputText"
|
|
28
27
|
/>
|
|
28
|
+
|
|
29
|
+
<BmsSelect
|
|
30
|
+
label="Select"
|
|
31
|
+
@blur="console.log('blur')"
|
|
32
|
+
v-model="select"
|
|
33
|
+
:options="optionsLabelValue"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<BmsMultiSelect
|
|
37
|
+
label="Multi-select"
|
|
38
|
+
v-model="multiSelect"
|
|
39
|
+
:options="optionsLabelValue"
|
|
40
|
+
/>
|
|
41
|
+
<br />
|
|
29
42
|
</template>
|
|
30
43
|
|
|
31
44
|
<script setup lang="ts">
|
|
@@ -34,6 +47,14 @@ import { Heart, Cat } from 'lucide-vue-next';
|
|
|
34
47
|
import { range } from 'lodash';
|
|
35
48
|
import { ref } from 'vue';
|
|
36
49
|
import BmsButton from '@/components/button/BmsButton.vue';
|
|
50
|
+
import BmsSelect from '@/components/form/BmsSelect.vue';
|
|
51
|
+
import BmsMultiSelect from '@/components/form/BmsMultiSelect.vue';
|
|
52
|
+
import FieldDatalist from '@/plugins/field/FieldDatalist.vue';
|
|
53
|
+
import RawAutocomplete from '@/components/form/RawAutocomplete.vue';
|
|
54
|
+
import BmsInputText from '@/components/form/BmsInputText.vue';
|
|
55
|
+
|
|
56
|
+
const select = ref('');
|
|
57
|
+
const multiSelect = ref([]);
|
|
37
58
|
|
|
38
59
|
const optionsLabelValue = ref(
|
|
39
60
|
range(0, 30).map((i) =>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
{{ filters }}
|
|
2
3
|
<bms-server-table
|
|
3
4
|
v-model:selectedItems="selectedItems"
|
|
4
5
|
v-model:selectMode="selectMode"
|
|
@@ -13,6 +14,8 @@
|
|
|
13
14
|
:total="totalItems"
|
|
14
15
|
@saveFilter="onSaveFilter"
|
|
15
16
|
@deleteSavedFilter="onDeleteSavedFilter"
|
|
17
|
+
@filterInput="onFilterInput"
|
|
18
|
+
@filterChange="onFilterChange"
|
|
16
19
|
>
|
|
17
20
|
<template #default="{ row }: { row: any }">
|
|
18
21
|
<td>
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
<script lang="ts" setup>
|
|
41
44
|
import { Filter, SavedFilter, SelectMode } from '@/models';
|
|
42
45
|
import axios from 'axios';
|
|
43
|
-
import { Ref, ref } from 'vue';
|
|
46
|
+
import { computed, Ref, ref } from 'vue';
|
|
44
47
|
import { isEmptyStringOrNotDefined } from '@/helpers';
|
|
45
48
|
|
|
46
49
|
const serverHeaders = [
|
|
@@ -49,7 +52,27 @@ const serverHeaders = [
|
|
|
49
52
|
{ label: 'Type', key: 'type' },
|
|
50
53
|
];
|
|
51
54
|
|
|
52
|
-
const
|
|
55
|
+
const typeOptions = ref([
|
|
56
|
+
'Grass',
|
|
57
|
+
'Poison',
|
|
58
|
+
'Fire',
|
|
59
|
+
'Flying',
|
|
60
|
+
'Water',
|
|
61
|
+
'Bug',
|
|
62
|
+
'Normal',
|
|
63
|
+
'Electric',
|
|
64
|
+
'Ground',
|
|
65
|
+
'Fairy',
|
|
66
|
+
'Fighting',
|
|
67
|
+
'Psychic',
|
|
68
|
+
'Rock',
|
|
69
|
+
'Steel',
|
|
70
|
+
'Ice',
|
|
71
|
+
'Ghost',
|
|
72
|
+
'Dragon',
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
const filters = computed(() => [
|
|
53
76
|
{
|
|
54
77
|
label: 'Name',
|
|
55
78
|
key: 'name',
|
|
@@ -65,27 +88,9 @@ const filters = [
|
|
|
65
88
|
label: 'Type',
|
|
66
89
|
key: 'type',
|
|
67
90
|
type: 'autocomplete',
|
|
68
|
-
autocompleteOptions:
|
|
69
|
-
'Grass',
|
|
70
|
-
'Poison',
|
|
71
|
-
'Fire',
|
|
72
|
-
'Flying',
|
|
73
|
-
'Water',
|
|
74
|
-
'Bug',
|
|
75
|
-
'Normal',
|
|
76
|
-
'Electric',
|
|
77
|
-
'Ground',
|
|
78
|
-
'Fairy',
|
|
79
|
-
'Fighting',
|
|
80
|
-
'Psychic',
|
|
81
|
-
'Rock',
|
|
82
|
-
'Steel',
|
|
83
|
-
'Ice',
|
|
84
|
-
'Ghost',
|
|
85
|
-
'Dragon',
|
|
86
|
-
],
|
|
91
|
+
autocompleteOptions: typeOptions.value,
|
|
87
92
|
},
|
|
88
|
-
];
|
|
93
|
+
]);
|
|
89
94
|
|
|
90
95
|
const savedFilters: Ref<SavedFilter[]> = ref<SavedFilter[]>([]);
|
|
91
96
|
const selectedItems = ref<any[]>([]);
|
|
@@ -102,6 +107,32 @@ const onDeleteSavedFilter = (savedFilter: SavedFilter) => {
|
|
|
102
107
|
);
|
|
103
108
|
};
|
|
104
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
|
+
|
|
105
136
|
const customFetchData = async (
|
|
106
137
|
params: any,
|
|
107
138
|
abortController: AbortController,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<BmsBackButton :fallback="{ path: '/' }" />
|
|
3
|
+
<br />
|
|
4
|
+
<BmsButton @click="changeChoice">Change choice</BmsButton>
|
|
3
5
|
<bms-table
|
|
4
6
|
:headers="headers"
|
|
5
7
|
:filters="filters"
|
|
@@ -13,22 +15,9 @@
|
|
|
13
15
|
v-model:selectedItems="selectedItems"
|
|
14
16
|
@saveFilter="onSaveFilter"
|
|
15
17
|
@deleteSavedFilter="onDeleteSavedFilter"
|
|
18
|
+
@filterInput="onFilterInput"
|
|
19
|
+
@filterChange="onFilterChange"
|
|
16
20
|
>
|
|
17
|
-
<template #date="{ row }">
|
|
18
|
-
<bms-tooltip :tooltip-text="row.date.toUTCString()">
|
|
19
|
-
{{ row.date.toLocaleDateString() }}
|
|
20
|
-
</bms-tooltip>
|
|
21
|
-
</template>
|
|
22
|
-
<template #dateUpdate="{ row }">
|
|
23
|
-
<bms-tooltip :tooltip-text="row.dateUpdate.toUTCString()">
|
|
24
|
-
{{ row.dateUpdate.toLocaleDateString() }}
|
|
25
|
-
</bms-tooltip>
|
|
26
|
-
</template>
|
|
27
|
-
<template #dateDelete="{ row }">
|
|
28
|
-
<bms-tooltip :tooltip-text="row.dateDelete.toUTCString()">
|
|
29
|
-
{{ row.dateDelete.toLocaleDateString() }}
|
|
30
|
-
</bms-tooltip>
|
|
31
|
-
</template>
|
|
32
21
|
<template #choice2="{ row }">
|
|
33
22
|
<BmsTooltip tooltipText="tooltip">
|
|
34
23
|
{{ row.choice2 }}
|
|
@@ -65,6 +54,7 @@
|
|
|
65
54
|
<script lang="ts" setup>
|
|
66
55
|
import { BmsBackButton, BmsButton, useNotifications } from '@/index';
|
|
67
56
|
import {
|
|
57
|
+
ColumnType,
|
|
68
58
|
Filter,
|
|
69
59
|
InputType,
|
|
70
60
|
SavedFilter,
|
|
@@ -86,9 +76,9 @@ const headers = [
|
|
|
86
76
|
{ label: 'Colonne 1', key: 'column1', sortable: true },
|
|
87
77
|
{ label: 'actions', key: 'action', action: true },
|
|
88
78
|
{ label: 'Colonne 2', key: 'column2' },
|
|
89
|
-
{ label: 'Date', key: 'date' },
|
|
90
|
-
{ label: 'DateUpdate', key: 'dateUpdate' },
|
|
91
|
-
{ label: 'DateDelete', key: 'dateDelete' },
|
|
79
|
+
{ label: 'Date', key: 'date', columnType: ColumnType.Date },
|
|
80
|
+
{ label: 'DateUpdate', key: 'dateUpdate', columnType: ColumnType.Date },
|
|
81
|
+
{ label: 'DateDelete', key: 'dateDelete', columnType: ColumnType.Date },
|
|
92
82
|
{ label: 'choice1', key: 'choice1' },
|
|
93
83
|
{ label: 'choice2', key: 'choice2' },
|
|
94
84
|
{
|
|
@@ -154,7 +144,6 @@ const items = Array(100)
|
|
|
154
144
|
|
|
155
145
|
const savedFilters: Ref<SavedFilter[]> = ref<SavedFilter[]>([]);
|
|
156
146
|
const selectedItems: Ref<any[]> = ref([]);
|
|
157
|
-
|
|
158
147
|
const onSaveFilter = (savedFilter: SavedFilter) => {
|
|
159
148
|
savedFilters.value.push(savedFilter);
|
|
160
149
|
};
|
|
@@ -165,7 +154,28 @@ const onDeleteSavedFilter = (savedFilter: SavedFilter) => {
|
|
|
165
154
|
);
|
|
166
155
|
};
|
|
167
156
|
|
|
168
|
-
const
|
|
157
|
+
const onFilterInput = ({
|
|
158
|
+
filterKey,
|
|
159
|
+
e,
|
|
160
|
+
value,
|
|
161
|
+
}: {
|
|
162
|
+
filterKey: string;
|
|
163
|
+
e: InputEvent;
|
|
164
|
+
value: any;
|
|
165
|
+
}) => {
|
|
166
|
+
console.log(`Input in filter ${filterKey} with val ${value}`);
|
|
167
|
+
};
|
|
168
|
+
const onFilterChange = ({
|
|
169
|
+
filterKey,
|
|
170
|
+
value,
|
|
171
|
+
}: {
|
|
172
|
+
filterKey: string;
|
|
173
|
+
value: any;
|
|
174
|
+
}) => {
|
|
175
|
+
console.log(`Change in filter ${filterKey} with val`, value);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const filters = ref<Filter[]>([
|
|
169
179
|
{
|
|
170
180
|
label: 'inputText Colonne 1',
|
|
171
181
|
key: 'column1',
|
|
@@ -213,5 +223,20 @@ const filters: Filter[] = [
|
|
|
213
223
|
customFilter: (item: any, value: any, target: string) =>
|
|
214
224
|
item[target] > 0.5 === value,
|
|
215
225
|
},
|
|
216
|
-
];
|
|
226
|
+
]);
|
|
227
|
+
const changeChoice = () => {
|
|
228
|
+
filters.value = filters.value.map((f) =>
|
|
229
|
+
f.key === 'choice2'
|
|
230
|
+
? {
|
|
231
|
+
...f,
|
|
232
|
+
selectOptions: [
|
|
233
|
+
{ label: 'huey', value: 'huey' },
|
|
234
|
+
{ label: 'riri', value: 'riri' },
|
|
235
|
+
{ label: 'fifi', value: 'fifi' },
|
|
236
|
+
{ label: 'loulou', value: 'loulou' },
|
|
237
|
+
],
|
|
238
|
+
}
|
|
239
|
+
: f,
|
|
240
|
+
);
|
|
241
|
+
};
|
|
217
242
|
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import FieldDatalist, { type Props } from '@/plugins/field/FieldDatalist.vue';
|
|
2
|
-
import { mount } from '@vue/test-utils';
|
|
3
|
-
import { field } from '@/plugins/field';
|
|
4
|
-
|
|
5
|
-
const factory = (props?: Props) => {
|
|
6
|
-
const wrapper = mount(FieldDatalist, {
|
|
7
|
-
global: {
|
|
8
|
-
plugins: [field],
|
|
9
|
-
},
|
|
10
|
-
props: {
|
|
11
|
-
isInputFocused: false,
|
|
12
|
-
options: [
|
|
13
|
-
{ label: 'titi', value: 'i' },
|
|
14
|
-
{ label: 'toto', value: 'o' },
|
|
15
|
-
{ label: 'tutu', value: 'u' },
|
|
16
|
-
],
|
|
17
|
-
modelValue: '',
|
|
18
|
-
...props,
|
|
19
|
-
},
|
|
20
|
-
attachTo: document.body,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return { wrapper };
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe('FieldDatalist', () => {
|
|
27
|
-
it('should be able to select with keyboard', async () => {
|
|
28
|
-
const { wrapper } = factory();
|
|
29
|
-
const titi = wrapper.get('[data-testid="i"]');
|
|
30
|
-
|
|
31
|
-
expect(titi.classes()).toStrictEqual([]);
|
|
32
|
-
await wrapper.trigger('keydown.down');
|
|
33
|
-
expect(titi.classes()).toStrictEqual(['selected']);
|
|
34
|
-
});
|
|
35
|
-
});
|