@ouestfrance/sipa-bms-ui 8.22.2 → 8.23.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/button/BmsButton.vue.d.ts +1 -1
- package/dist/components/button/BmsIconButton.vue.d.ts +1 -1
- package/dist/components/button/BmsToggleIcon.vue.d.ts +24 -0
- package/dist/components/button/UiButton.vue.d.ts +1 -1
- package/dist/components/form/BmsInputText.vue.d.ts +1 -1
- package/dist/components/form/BmsSearch.vue.d.ts +3 -3
- package/dist/components/form/BmsSelect.vue.d.ts +1 -1
- package/dist/components/form/RawSelect.vue.d.ts +1 -1
- package/dist/components/layout/BmsHeaderTitle.vue.d.ts +1 -1
- package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +1 -1
- package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +2 -2
- package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +3 -3
- package/dist/components/table/BmsPagination.vue.d.ts +4 -2
- package/dist/components/table/BmsServerTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTable.vue.d.ts +3 -3
- package/dist/components/table/BmsTableFilters.vue.d.ts +5 -3
- package/dist/components/table/UiBmsTable.vue.d.ts +3 -3
- package/dist/components/table/UiFilterButton.vue.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/models/table.model.d.ts +5 -0
- package/dist/plugins/field/FieldComponent.vue.d.ts +1 -1
- package/dist/plugins/router-history/router-history.composable.d.ts +1 -1
- package/dist/showroom/pages/table.vue.d.ts +2 -0
- package/dist/sipa-bms-ui.css +167 -103
- package/dist/sipa-bms-ui.es.js +3838 -3301
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +3842 -3303
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +19 -19
- package/src/components/button/BmsButton.stories.js +142 -3
- package/src/components/button/BmsToggleIcon.stories.js +145 -0
- package/src/components/button/BmsToggleIcon.vue +108 -0
- package/src/components/form/BmsChip.stories.js +104 -2
- package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +157 -2
- package/src/components/form/BmsInputCheckboxGroup.stories.js +119 -2
- package/src/components/form/BmsInputCode.stories.js +109 -2
- package/src/components/form/BmsInputFile.stories.js +110 -2
- package/src/components/form/BmsInputNumber.stories.js +12 -2
- package/src/components/form/BmsInputNumber.vue +2 -1
- package/src/components/form/BmsInputRadioCaptionGroup.stories.js +138 -2
- package/src/components/form/BmsInputRadioGroup.stories.js +120 -2
- package/src/components/form/BmsInputText.stories.js +278 -1
- package/src/components/form/BmsInputText.vue +2 -0
- package/src/components/form/BmsMultiSelect.vue +3 -1
- package/src/components/form/BmsSearch.stories.js +89 -2
- package/src/components/form/BmsSelect.stories.js +220 -2
- package/src/components/form/BmsSelect.vue +5 -3
- package/src/components/form/BmsTag.stories.js +119 -3
- package/src/components/form/BmsTextArea.stories.js +146 -2
- package/src/components/form/RawAutocomplete.vue +3 -1
- package/src/components/layout/BmsFloatingWindow.vue +12 -1
- package/src/components/layout/BmsForm.stories.js +216 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +136 -1
- package/src/components/layout/BmsSplitWindow.vue +1 -1
- package/src/components/table/BmsPagination.vue +3 -0
- package/src/components/table/BmsServerTable.stories.js +59 -3
- package/src/components/table/BmsServerTable.vue +9 -2
- package/src/components/table/BmsTable.stories.js +312 -2
- package/src/components/table/BmsTable.vue +14 -3
- package/src/components/table/BmsTableFilters.vue +15 -5
- package/src/components/table/UiBmsTable.stories.js +3 -0
- package/src/components/table/UiBmsTable.vue +14 -5
- package/src/components/table/UiFilterButton.vue +6 -1
- package/src/documentation/button/secondaryButton.mdx +114 -3
- package/src/documentation/checkboxCaptionGroup.mdx +99 -0
- package/src/documentation/checkboxGroup.mdx +99 -0
- package/src/documentation/chip.mdx +85 -11
- package/src/documentation/inputCode.mdx +97 -0
- package/src/documentation/inputFile.mdx +90 -13
- package/src/documentation/inputText.mdx +183 -0
- package/src/documentation/layout/form.mdx +74 -0
- package/src/documentation/layout/headerTitle.mdx +124 -0
- package/src/documentation/layout/table.mdx +111 -0
- package/src/documentation/radioCaptionGroup.mdx +86 -19
- package/src/documentation/radioGroup.mdx +85 -18
- package/src/documentation/search.mdx +85 -13
- package/src/documentation/select.mdx +137 -16
- package/src/documentation/tag.mdx +91 -11
- package/src/documentation/textArea.mdx +126 -13
- package/src/index.ts +3 -0
- package/src/models/table.model.ts +6 -0
- package/src/showroom/pages/floating-window.vue +36 -0
- package/src/documentation/fields_text.mdx +0 -31
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
import { Maximize2, Minimize2, X } from 'lucide-vue-next';
|
|
48
48
|
import BmsIconButton from '../button/BmsIconButton.vue';
|
|
49
49
|
import { ref, computed, onMounted, watch, type CSSProperties } from 'vue';
|
|
50
|
+
import { useDebounceFn } from '@vueuse/core';
|
|
50
51
|
|
|
51
52
|
export type Placement =
|
|
52
53
|
| 'top-left'
|
|
@@ -128,10 +129,21 @@ function initPosition() {
|
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
const resizeCallack = useDebounceFn(() => {
|
|
133
|
+
expandedStyle.value = computeExpandedStyle();
|
|
134
|
+
}, 100);
|
|
135
|
+
|
|
131
136
|
onMounted(() => {
|
|
132
137
|
if (open.value) {
|
|
133
138
|
initPosition();
|
|
134
139
|
}
|
|
140
|
+
if (props.expandTarget) {
|
|
141
|
+
const targetEl = document.querySelector(props.expandTarget);
|
|
142
|
+
if (targetEl) {
|
|
143
|
+
const resizeObserver = new ResizeObserver(resizeCallack);
|
|
144
|
+
resizeObserver.observe(targetEl);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
135
147
|
});
|
|
136
148
|
|
|
137
149
|
watch(open, (newVal) => {
|
|
@@ -350,7 +362,6 @@ function onDragEnd() {
|
|
|
350
362
|
|
|
351
363
|
@container floating-window (min-width:900px) {
|
|
352
364
|
.floating-window {
|
|
353
|
-
max-height: 300px;
|
|
354
365
|
max-width: 80%;
|
|
355
366
|
}
|
|
356
367
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import BmsForm from '@/components/layout/BmsForm.vue';
|
|
2
|
+
import BmsInputText from '@/components/form/BmsInputText.vue';
|
|
3
|
+
import BmsSelect from '@/components/form/BmsSelect.vue';
|
|
4
|
+
import BmsTextArea from '@/components/form/BmsTextArea.vue';
|
|
5
|
+
import BmsInputNumber from '@/components/form/BmsInputNumber.vue';
|
|
6
|
+
import BmsButton from '@/components/button/BmsButton.vue';
|
|
7
|
+
import { ref } from 'vue';
|
|
2
8
|
|
|
3
9
|
export default {
|
|
4
10
|
title: 'Composants/layout/Form',
|
|
@@ -28,3 +34,213 @@ const Template = (args) => ({
|
|
|
28
34
|
});
|
|
29
35
|
|
|
30
36
|
export const Default = Template.bind({});
|
|
37
|
+
|
|
38
|
+
// Simple template for documentation
|
|
39
|
+
const SimpleTemplate = (args) => ({
|
|
40
|
+
components: {
|
|
41
|
+
BmsForm,
|
|
42
|
+
BmsInputText,
|
|
43
|
+
BmsSelect,
|
|
44
|
+
BmsTextArea,
|
|
45
|
+
BmsInputNumber,
|
|
46
|
+
BmsButton,
|
|
47
|
+
},
|
|
48
|
+
setup() {
|
|
49
|
+
const name = ref(args.name || '');
|
|
50
|
+
const email = ref(args.email || '');
|
|
51
|
+
const phone = ref(args.phone || '');
|
|
52
|
+
const country = ref(args.country || '');
|
|
53
|
+
const description = ref(args.description || '');
|
|
54
|
+
const age = ref(args.age || null);
|
|
55
|
+
return { args, name, email, phone, country, description, age };
|
|
56
|
+
},
|
|
57
|
+
template: `
|
|
58
|
+
<BmsForm>
|
|
59
|
+
<template #form_1>
|
|
60
|
+
<h2>Personal Information</h2>
|
|
61
|
+
<BmsInputText label="Name" v-model="name" placeholder="Enter your name" required />
|
|
62
|
+
<BmsInputText label="Email" v-model="email" placeholder="Enter your email" required />
|
|
63
|
+
<BmsInputText label="Phone" v-model="phone" placeholder="Enter your phone number" />
|
|
64
|
+
<BmsSelect
|
|
65
|
+
label="Country"
|
|
66
|
+
v-model="country"
|
|
67
|
+
placeholder="Select a country"
|
|
68
|
+
:options="[
|
|
69
|
+
{ label: 'France', value: 'fr' },
|
|
70
|
+
{ label: 'United States', value: 'us' },
|
|
71
|
+
{ label: 'United Kingdom', value: 'uk' },
|
|
72
|
+
{ label: 'Germany', value: 'de' }
|
|
73
|
+
]"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
<template #form_2>
|
|
77
|
+
<h2>Additional Details</h2>
|
|
78
|
+
<BmsTextArea label="Description" v-model="description" placeholder="Enter a description" />
|
|
79
|
+
<BmsInputNumber label="Age" v-model="age" :min="0" :max="120" />
|
|
80
|
+
</template>
|
|
81
|
+
<template #actions>
|
|
82
|
+
<BmsButton type="secondary">Cancel</BmsButton>
|
|
83
|
+
<BmsButton type="primary">Submit</BmsButton>
|
|
84
|
+
</template>
|
|
85
|
+
</BmsForm>
|
|
86
|
+
`,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Playground with default values for documentation
|
|
90
|
+
export const PlaygroundForm = SimpleTemplate.bind({});
|
|
91
|
+
PlaygroundForm.parameters = { chromatic: { disable: true } };
|
|
92
|
+
PlaygroundForm.args = {
|
|
93
|
+
name: '',
|
|
94
|
+
email: '',
|
|
95
|
+
phone: '',
|
|
96
|
+
country: '',
|
|
97
|
+
description: '',
|
|
98
|
+
age: null,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Do: Form with organized sections
|
|
102
|
+
export const DoWithOrganizedSections = SimpleTemplate.bind({});
|
|
103
|
+
DoWithOrganizedSections.parameters = { chromatic: { disable: true } };
|
|
104
|
+
DoWithOrganizedSections.args = {
|
|
105
|
+
name: '',
|
|
106
|
+
email: '',
|
|
107
|
+
phone: '',
|
|
108
|
+
country: '',
|
|
109
|
+
description: '',
|
|
110
|
+
age: null,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Do: Form with actions
|
|
114
|
+
export const DoWithActions = SimpleTemplate.bind({});
|
|
115
|
+
DoWithActions.parameters = { chromatic: { disable: true } };
|
|
116
|
+
DoWithActions.args = {
|
|
117
|
+
name: '',
|
|
118
|
+
email: '',
|
|
119
|
+
phone: '',
|
|
120
|
+
country: '',
|
|
121
|
+
description: '',
|
|
122
|
+
age: null,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Don't: Form without actions
|
|
126
|
+
export const DontNoActions = (args) => ({
|
|
127
|
+
components: {
|
|
128
|
+
BmsForm,
|
|
129
|
+
BmsInputText,
|
|
130
|
+
BmsSelect,
|
|
131
|
+
BmsTextArea,
|
|
132
|
+
},
|
|
133
|
+
setup() {
|
|
134
|
+
const name = ref(args.name || '');
|
|
135
|
+
const email = ref(args.email || '');
|
|
136
|
+
const country = ref(args.country || '');
|
|
137
|
+
const description = ref(args.description || '');
|
|
138
|
+
return { args, name, email, country, description };
|
|
139
|
+
},
|
|
140
|
+
template: `
|
|
141
|
+
<BmsForm>
|
|
142
|
+
<template #form_1>
|
|
143
|
+
<h2>Personal Information</h2>
|
|
144
|
+
<BmsInputText label="Name" v-model="name" required />
|
|
145
|
+
<BmsInputText label="Email" v-model="email" required />
|
|
146
|
+
<BmsSelect
|
|
147
|
+
label="Country"
|
|
148
|
+
v-model="country"
|
|
149
|
+
:options="[
|
|
150
|
+
{ label: 'France', value: 'fr' },
|
|
151
|
+
{ label: 'United States', value: 'us' }
|
|
152
|
+
]"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
<template #form_2>
|
|
156
|
+
<h2>Additional Details</h2>
|
|
157
|
+
<BmsTextArea label="Description" v-model="description" />
|
|
158
|
+
</template>
|
|
159
|
+
</BmsForm>
|
|
160
|
+
`,
|
|
161
|
+
});
|
|
162
|
+
DontNoActions.parameters = { chromatic: { disable: true } };
|
|
163
|
+
DontNoActions.args = {
|
|
164
|
+
name: '',
|
|
165
|
+
email: '',
|
|
166
|
+
country: '',
|
|
167
|
+
description: '',
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const DoWithActionsButton = SimpleTemplate.bind({});
|
|
171
|
+
DoWithActionsButton.parameters = { chromatic: { disable: true } };
|
|
172
|
+
DoWithActionsButton.args = {
|
|
173
|
+
name: '',
|
|
174
|
+
email: '',
|
|
175
|
+
phone: '',
|
|
176
|
+
country: '',
|
|
177
|
+
description: '',
|
|
178
|
+
age: null,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: Form without section titles
|
|
182
|
+
export const DontNoSectionTitles = (args) => ({
|
|
183
|
+
components: {
|
|
184
|
+
BmsForm,
|
|
185
|
+
BmsInputText,
|
|
186
|
+
BmsSelect,
|
|
187
|
+
BmsTextArea,
|
|
188
|
+
BmsInputNumber,
|
|
189
|
+
BmsButton,
|
|
190
|
+
},
|
|
191
|
+
setup() {
|
|
192
|
+
const name = ref(args.name || '');
|
|
193
|
+
const email = ref(args.email || '');
|
|
194
|
+
const phone = ref(args.phone || '');
|
|
195
|
+
const country = ref(args.country || '');
|
|
196
|
+
const description = ref(args.description || '');
|
|
197
|
+
const age = ref(args.age || null);
|
|
198
|
+
return { args, name, email, phone, country, description, age };
|
|
199
|
+
},
|
|
200
|
+
template: `
|
|
201
|
+
<BmsForm>
|
|
202
|
+
<template #form_1>
|
|
203
|
+
<BmsInputText label="Name" v-model="name" placeholder="Enter your name" required />
|
|
204
|
+
<BmsInputText label="Email" v-model="email" placeholder="Enter your email" required />
|
|
205
|
+
<BmsInputText label="Phone" v-model="phone" placeholder="Enter your phone number" />
|
|
206
|
+
<BmsSelect
|
|
207
|
+
label="Country"
|
|
208
|
+
v-model="country"
|
|
209
|
+
placeholder="Select a country"
|
|
210
|
+
:options="[
|
|
211
|
+
{ label: 'France', value: 'fr' },
|
|
212
|
+
{ label: 'United States', value: 'us' }
|
|
213
|
+
]"
|
|
214
|
+
/>
|
|
215
|
+
</template>
|
|
216
|
+
<template #form_2>
|
|
217
|
+
<BmsTextArea label="Description" v-model="description" placeholder="Enter a description" />
|
|
218
|
+
<BmsInputNumber label="Age" v-model="age" :min="0" :max="120" />
|
|
219
|
+
</template>
|
|
220
|
+
<template #actions>
|
|
221
|
+
<BmsButton type="secondary">Cancel</BmsButton>
|
|
222
|
+
<BmsButton type="primary">Submit</BmsButton>
|
|
223
|
+
</template>
|
|
224
|
+
</BmsForm>
|
|
225
|
+
`,
|
|
226
|
+
});
|
|
227
|
+
DontNoSectionTitles.parameters = { chromatic: { disable: true } };
|
|
228
|
+
DontNoSectionTitles.args = {
|
|
229
|
+
name: '',
|
|
230
|
+
email: '',
|
|
231
|
+
phone: '',
|
|
232
|
+
country: '',
|
|
233
|
+
description: '',
|
|
234
|
+
age: null,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export const DoWithSectionTitles = SimpleTemplate.bind({});
|
|
238
|
+
DoWithSectionTitles.parameters = { chromatic: { disable: true } };
|
|
239
|
+
DoWithSectionTitles.args = {
|
|
240
|
+
name: '',
|
|
241
|
+
email: '',
|
|
242
|
+
phone: '',
|
|
243
|
+
country: '',
|
|
244
|
+
description: '',
|
|
245
|
+
age: null,
|
|
246
|
+
};
|
|
@@ -3,7 +3,6 @@ import BmsButton from '@/components/button/BmsButton.vue';
|
|
|
3
3
|
import { Flower } from 'lucide-vue-next';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
components: { BmsHeaderTitle },
|
|
7
6
|
title: 'Composants/layout/HeaderTitle',
|
|
8
7
|
component: BmsHeaderTitle,
|
|
9
8
|
};
|
|
@@ -66,3 +65,139 @@ WithAll.args = {
|
|
|
66
65
|
documentationUrl: '/docs',
|
|
67
66
|
activityUrl: '/docs',
|
|
68
67
|
};
|
|
68
|
+
|
|
69
|
+
// Simple template for documentation
|
|
70
|
+
const SimpleTemplate = (args) => ({
|
|
71
|
+
components: { BmsHeaderTitle, BmsButton, Flower },
|
|
72
|
+
setup() {
|
|
73
|
+
return { args };
|
|
74
|
+
},
|
|
75
|
+
template: `
|
|
76
|
+
<BmsHeaderTitle v-bind="args">
|
|
77
|
+
<template v-if="args.logo" #logo>
|
|
78
|
+
<Flower/>
|
|
79
|
+
</template>
|
|
80
|
+
<template v-if="args.afterTitle" #afterTitle>
|
|
81
|
+
<BmsButton type="tertiary">Secondary action</BmsButton>
|
|
82
|
+
</template>
|
|
83
|
+
<template v-if="args.actions" #actions>
|
|
84
|
+
<span style="display: flex; gap: 8px;">
|
|
85
|
+
<BmsButton v-if="args.secondaryAction && !args.twoPrimary" type="secondary">{{ args.secondaryLabel || 'Secondary' }}</BmsButton>
|
|
86
|
+
<BmsButton :type="args.primaryType || 'primary'">{{ args.primaryLabel || 'Primary action' }}</BmsButton>
|
|
87
|
+
<BmsButton v-if="args.secondaryActionRight" type="secondary">{{ args.secondaryLabel || 'Secondary' }}</BmsButton>
|
|
88
|
+
<BmsButton v-if="args.twoPrimary && args.secondaryAction" :type="args.primaryType || 'primary'">{{ args.secondaryLabel || 'Delete' }}</BmsButton>
|
|
89
|
+
</span>
|
|
90
|
+
</template>
|
|
91
|
+
<template v-if="args.subtitle" #subtitle>
|
|
92
|
+
{{ args.subtitle }}
|
|
93
|
+
</template>
|
|
94
|
+
</BmsHeaderTitle>
|
|
95
|
+
`,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Playground with default values for documentation
|
|
99
|
+
export const PlaygroundHeaderTitle = SimpleTemplate.bind({});
|
|
100
|
+
PlaygroundHeaderTitle.parameters = { chromatic: { disable: true } };
|
|
101
|
+
PlaygroundHeaderTitle.args = {
|
|
102
|
+
title: 'Page Title',
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// Do: Header title with clear title
|
|
106
|
+
export const DoWithClearTitle = SimpleTemplate.bind({});
|
|
107
|
+
DoWithClearTitle.parameters = { chromatic: { disable: true } };
|
|
108
|
+
DoWithClearTitle.args = {
|
|
109
|
+
title: 'User Settings',
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Do: Header title with label
|
|
113
|
+
export const DoWithLabel = SimpleTemplate.bind({});
|
|
114
|
+
DoWithLabel.parameters = { chromatic: { disable: true } };
|
|
115
|
+
DoWithLabel.args = {
|
|
116
|
+
title: 'Edit Profile',
|
|
117
|
+
label: 'User Profile',
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// Do: Header title with actions
|
|
121
|
+
export const DoWithActions = SimpleTemplate.bind({});
|
|
122
|
+
DoWithActions.parameters = { chromatic: { disable: true } };
|
|
123
|
+
DoWithActions.args = {
|
|
124
|
+
title: 'Dashboard',
|
|
125
|
+
actions: true,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Do: Header title with secondary action
|
|
129
|
+
export const DoWithSecondaryAction = SimpleTemplate.bind({});
|
|
130
|
+
DoWithSecondaryAction.parameters = { chromatic: { disable: true } };
|
|
131
|
+
DoWithSecondaryAction.args = {
|
|
132
|
+
title: 'Edit Document',
|
|
133
|
+
actions: true,
|
|
134
|
+
secondaryAction: true,
|
|
135
|
+
secondaryLabel: 'Import',
|
|
136
|
+
primaryLabel: 'Add',
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Do: Header title with subtitle
|
|
140
|
+
export const DoWithSubtitle = SimpleTemplate.bind({});
|
|
141
|
+
DoWithSubtitle.parameters = { chromatic: { disable: true } };
|
|
142
|
+
DoWithSubtitle.args = {
|
|
143
|
+
title: 'Project Overview',
|
|
144
|
+
subtitle: 'Manage your project settings and team members',
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Do: Header title with helper links
|
|
148
|
+
export const DoWithHelperLinks = SimpleTemplate.bind({});
|
|
149
|
+
DoWithHelperLinks.parameters = { chromatic: { disable: true } };
|
|
150
|
+
DoWithHelperLinks.args = {
|
|
151
|
+
title: 'Configuration',
|
|
152
|
+
documentationUrl: '/docs/configuration',
|
|
153
|
+
activityUrl: '/activity',
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Don't: Missing title
|
|
157
|
+
export const DontNoTitle = SimpleTemplate.bind({});
|
|
158
|
+
DontNoTitle.parameters = { chromatic: { disable: true } };
|
|
159
|
+
DontNoTitle.args = {};
|
|
160
|
+
|
|
161
|
+
export const DoWithTitle = SimpleTemplate.bind({});
|
|
162
|
+
DoWithTitle.parameters = { chromatic: { disable: true } };
|
|
163
|
+
DoWithTitle.args = {
|
|
164
|
+
title: 'Page Title',
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Don't: Too long title
|
|
168
|
+
export const DontLongTitle = SimpleTemplate.bind({});
|
|
169
|
+
DontLongTitle.parameters = { chromatic: { disable: true } };
|
|
170
|
+
DontLongTitle.args = {
|
|
171
|
+
title:
|
|
172
|
+
'This is a very long page title that should not be used because it makes the header difficult to read and breaks the layout',
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const DoShortTitle = SimpleTemplate.bind({});
|
|
176
|
+
DoShortTitle.parameters = { chromatic: { disable: true } };
|
|
177
|
+
DoShortTitle.args = {
|
|
178
|
+
title: 'Settings',
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Don't: Two primary buttons
|
|
182
|
+
export const DontTwoPrimaryButtons = SimpleTemplate.bind({});
|
|
183
|
+
DontTwoPrimaryButtons.parameters = { chromatic: { disable: true } };
|
|
184
|
+
DontTwoPrimaryButtons.args = {
|
|
185
|
+
title: 'Edit Document',
|
|
186
|
+
actions: true,
|
|
187
|
+
twoPrimary: true,
|
|
188
|
+
primaryType: 'primary',
|
|
189
|
+
primaryLabel: 'Add',
|
|
190
|
+
secondaryAction: true,
|
|
191
|
+
secondaryLabel: 'Delete',
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Don't: Inverted button order
|
|
195
|
+
export const DontInvertedButtonOrder = SimpleTemplate.bind({});
|
|
196
|
+
DontInvertedButtonOrder.parameters = { chromatic: { disable: true } };
|
|
197
|
+
DontInvertedButtonOrder.args = {
|
|
198
|
+
title: 'Edit Document',
|
|
199
|
+
actions: true,
|
|
200
|
+
secondaryActionRight: true,
|
|
201
|
+
secondaryLabel: 'Import',
|
|
202
|
+
primaryLabel: 'Add',
|
|
203
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
{{ selectLabel }}
|
|
5
5
|
<BmsSelect
|
|
6
6
|
v-model="size"
|
|
7
|
+
:small="small"
|
|
7
8
|
:options="
|
|
8
9
|
sizes.map((size: number) => ({ label: size.toString(), value: size }))
|
|
9
10
|
"
|
|
@@ -70,9 +71,11 @@ interface BmsPaginationProps {
|
|
|
70
71
|
currentPage: number;
|
|
71
72
|
pages: number;
|
|
72
73
|
selectLabel?: string;
|
|
74
|
+
small?: boolean;
|
|
73
75
|
}
|
|
74
76
|
const props = withDefaults(defineProps<BmsPaginationProps>(), {
|
|
75
77
|
selectLabel: 'Éléments par page :',
|
|
78
|
+
small: false,
|
|
76
79
|
});
|
|
77
80
|
|
|
78
81
|
const emit = defineEmits<{
|
|
@@ -73,13 +73,13 @@ Default.args = {
|
|
|
73
73
|
url: 'https://fakeapi.com/items',
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
export const
|
|
77
|
-
|
|
76
|
+
export const WithFilters = Template.bind({});
|
|
77
|
+
WithFilters.parameters = {
|
|
78
78
|
msw: {
|
|
79
79
|
handlers: [mswRequestHandler()],
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
WithFilters.args = {
|
|
83
83
|
headers: [
|
|
84
84
|
{
|
|
85
85
|
label: 'Column 1',
|
|
@@ -129,6 +129,62 @@ withFilters.args = {
|
|
|
129
129
|
defaultFiltersOpened: true,
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
export const Small = Template.bind({});
|
|
133
|
+
Small.parameters = {
|
|
134
|
+
msw: {
|
|
135
|
+
handlers: [mswRequestHandler()],
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
Small.args = {
|
|
139
|
+
mode: 'small',
|
|
140
|
+
headers: [
|
|
141
|
+
{
|
|
142
|
+
label: 'Column 1',
|
|
143
|
+
key: 'col1',
|
|
144
|
+
align: 'start',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: 'Column 2',
|
|
148
|
+
key: 'col2',
|
|
149
|
+
align: 'center',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: 'Column 3',
|
|
153
|
+
key: 'col3',
|
|
154
|
+
align: 'end',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
filters: [
|
|
158
|
+
{
|
|
159
|
+
label: 'Input',
|
|
160
|
+
key: 'col1',
|
|
161
|
+
type: 'input',
|
|
162
|
+
value: 'Val',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: 'Select',
|
|
166
|
+
key: 'col2',
|
|
167
|
+
type: 'select',
|
|
168
|
+
selectOptions: [
|
|
169
|
+
{
|
|
170
|
+
label: 'option1',
|
|
171
|
+
value: 'option1',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 'option2',
|
|
175
|
+
value: 'option2',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: 'Boolean',
|
|
181
|
+
key: 'col3',
|
|
182
|
+
type: 'boolean',
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
url: 'https://fakeapi.com/items',
|
|
186
|
+
defaultFiltersOpened: true,
|
|
187
|
+
};
|
|
132
188
|
export const WithSavedFilters = Template.bind({});
|
|
133
189
|
WithSavedFilters.parameters = {
|
|
134
190
|
msw: {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
Sort,
|
|
18
18
|
SortValue,
|
|
19
19
|
TableHeader,
|
|
20
|
+
TableMode,
|
|
20
21
|
} from '@/models';
|
|
21
22
|
import _debounce from 'lodash/debounce';
|
|
22
23
|
import { computed, type Ref, ref, type Slots, watch, watchEffect } from 'vue';
|
|
@@ -31,7 +32,7 @@ interface UiTableProps {
|
|
|
31
32
|
headers: TableHeader[];
|
|
32
33
|
filters?: Filter[];
|
|
33
34
|
url?: string;
|
|
34
|
-
mode?:
|
|
35
|
+
mode?: TableMode;
|
|
35
36
|
persistent?: boolean;
|
|
36
37
|
pagination?: number[];
|
|
37
38
|
size?: number;
|
|
@@ -54,7 +55,7 @@ interface UiTableProps {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
const props = withDefaults(defineProps<UiTableProps>(), {
|
|
57
|
-
mode:
|
|
58
|
+
mode: TableMode.NORMAL,
|
|
58
59
|
persistent: true,
|
|
59
60
|
pagination: () => [25, 50, 100],
|
|
60
61
|
size: 25,
|
|
@@ -307,6 +308,8 @@ const onClearSelection = () => {
|
|
|
307
308
|
};
|
|
308
309
|
|
|
309
310
|
const onSelectAll = () => emits('update:selectMode', SelectMode.ALL);
|
|
311
|
+
|
|
312
|
+
const isTableSmall = computed(() => props.mode === TableMode.SMALL);
|
|
310
313
|
</script>
|
|
311
314
|
|
|
312
315
|
<template>
|
|
@@ -341,6 +344,7 @@ const onSelectAll = () => emits('update:selectMode', SelectMode.ALL);
|
|
|
341
344
|
<BmsTableFilters
|
|
342
345
|
v-model="filters"
|
|
343
346
|
:canSaveFilters="canSaveFilters"
|
|
347
|
+
:small="mode == 'small'"
|
|
344
348
|
@saveFilter="onSaveFilter"
|
|
345
349
|
@resetFilters="resetFilters"
|
|
346
350
|
@filterInput="(filterEvent) => emits('filterInput', filterEvent)"
|
|
@@ -371,6 +375,7 @@ const onSelectAll = () => emits('update:selectMode', SelectMode.ALL);
|
|
|
371
375
|
<template #search>
|
|
372
376
|
<UiFilterButton
|
|
373
377
|
v-if="filters.length > 0"
|
|
378
|
+
:small="isTableSmall"
|
|
374
379
|
:activeFiltersNb="numberOfActiveFilters"
|
|
375
380
|
:isFilterVisible="isFilterVisible"
|
|
376
381
|
@toggleFilters="toggleFilters"
|
|
@@ -380,6 +385,7 @@ const onSelectAll = () => emits('update:selectMode', SelectMode.ALL);
|
|
|
380
385
|
<BmsSearch
|
|
381
386
|
:modelValue="search"
|
|
382
387
|
class="table-search"
|
|
388
|
+
:small="isTableSmall"
|
|
383
389
|
@update:modelValue="search = $event"
|
|
384
390
|
/>
|
|
385
391
|
</slot>
|
|
@@ -407,6 +413,7 @@ const onSelectAll = () => emits('update:selectMode', SelectMode.ALL);
|
|
|
407
413
|
:currentPage="props.initialPage === 1 ? currentPage - 1 : currentPage"
|
|
408
414
|
:sizes="paginationsOptions"
|
|
409
415
|
:pages="totalPages"
|
|
416
|
+
:small="isTableSmall"
|
|
410
417
|
@prev="onPrevClick"
|
|
411
418
|
@next="onNextClick"
|
|
412
419
|
@go="go($event)"
|