@tekkare/romulus 0.1.335 → 0.1.336
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/module.json
CHANGED
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
hauteur et au rayon de la rangee. Elles tomberont avec ces champs.
|
|
22
22
|
-->
|
|
23
23
|
<script setup lang="ts">
|
|
24
|
-
import { computed, onBeforeUnmount, onMounted, ref, useSlots } from 'vue'
|
|
24
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, useSlots, watch } from 'vue'
|
|
25
25
|
import { useRmFilterBarView } from '../composables/useRmFilterBarView'
|
|
26
|
+
import type { RmFilterSummaryItem } from './FilterSummary.vue'
|
|
26
27
|
|
|
27
28
|
const props = withDefaults(
|
|
28
29
|
defineProps<{
|
|
@@ -50,6 +51,12 @@ const props = withDefaults(
|
|
|
50
51
|
* (le bandeau de page). Sa hauteur est suivie par ResizeObserver.
|
|
51
52
|
*/
|
|
52
53
|
stickyTo?: string | null
|
|
54
|
+
/**
|
|
55
|
+
* Filtres poses, resumes en pills sous la barre quand le panneau est
|
|
56
|
+
* ferme (RmFilterSummary). Un clic ouvre le panneau sur le champ qui
|
|
57
|
+
* porte `data-rm-filter="<key>"`.
|
|
58
|
+
*/
|
|
59
|
+
summary?: RmFilterSummaryItem[] | null
|
|
53
60
|
}>(),
|
|
54
61
|
{
|
|
55
62
|
filtersAmount: 0,
|
|
@@ -62,6 +69,7 @@ const props = withDefaults(
|
|
|
62
69
|
saveScopeMsg: null,
|
|
63
70
|
lang: 'fr',
|
|
64
71
|
stickyTo: 'rm_page_header',
|
|
72
|
+
summary: null,
|
|
65
73
|
},
|
|
66
74
|
)
|
|
67
75
|
|
|
@@ -109,6 +117,75 @@ function toggle(which: RmFilterBarPanel) {
|
|
|
109
117
|
panel.value = panel.value === which ? null : which
|
|
110
118
|
}
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Ouvre le panneau sur un filtre : le champ qui porte `data-rm-filter="<key>"`.
|
|
122
|
+
* Une liste deroulante (`aria-haspopup`) s'ouvre ; tout autre champ (case,
|
|
123
|
+
* nombre) recoit seulement le focus, un clic le changerait.
|
|
124
|
+
*/
|
|
125
|
+
async function openFilter(key: string) {
|
|
126
|
+
panel.value = 'filters'
|
|
127
|
+
await nextTick()
|
|
128
|
+
// Une tache plus tard, pas une micro-tache : le clic sur la pill est encore
|
|
129
|
+
// en train de remonter au document, et la liste qu'on ouvrirait le prendrait
|
|
130
|
+
// pour un clic dehors et se refermerait aussitot.
|
|
131
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
132
|
+
const field = root.value?.querySelector<HTMLElement>(`.rm-fbar__filters [data-rm-filter="${CSS.escape(key)}"]`)
|
|
133
|
+
if (!field) return
|
|
134
|
+
field.scrollIntoView({ block: 'nearest' })
|
|
135
|
+
const trigger = field.matches('[aria-haspopup]') ? field : field.querySelector<HTMLElement>('[aria-haspopup]')
|
|
136
|
+
if (trigger) {
|
|
137
|
+
trigger.focus()
|
|
138
|
+
trigger.click()
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
field.querySelector<HTMLElement>('input, select, textarea, button, [tabindex]:not([tabindex="-1"])')?.focus()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
defineExpose({ openFilter })
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Les pills suivent l'ordre des champs du panneau : la page les decrit dans
|
|
148
|
+
* l'ordre de son etat, qui n'est pas celui qu'on lit en ouvrant les filtres.
|
|
149
|
+
* Relu a chaque changement du resume : un champ peut apparaitre avec les
|
|
150
|
+
* donnees. Un filtre sans champ marque passe en dernier.
|
|
151
|
+
*/
|
|
152
|
+
const fieldOrder = ref<string[]>([])
|
|
153
|
+
|
|
154
|
+
function readFieldOrder() {
|
|
155
|
+
const fields = root.value?.querySelectorAll<HTMLElement>('.rm-fbar__filters [data-rm-filter]') ?? []
|
|
156
|
+
fieldOrder.value = [...fields].map((field) => field.dataset.rmFilter ?? '')
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const orderedSummary = computed(() => {
|
|
160
|
+
const order = fieldOrder.value
|
|
161
|
+
const rank = (key: string) => (order.includes(key) ? order.indexOf(key) : order.length)
|
|
162
|
+
return [...(props.summary ?? [])].sort((a, b) => rank(a.key) - rank(b.key))
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
watch(() => props.summary, () => nextTick(readFieldOrder))
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Les pills flottent sous la barre, par-dessus le contenu quand la page
|
|
169
|
+
* defile. En haut de page, elles ne doivent rien recouvrir : la barre garde
|
|
170
|
+
* en marge basse la hauteur de leur rangee (plusieurs lignes si elles
|
|
171
|
+
* passent a la ligne).
|
|
172
|
+
*/
|
|
173
|
+
const summaryEl = ref<HTMLElement | null>(null)
|
|
174
|
+
const summaryHeight = ref(0)
|
|
175
|
+
let summarySize: ResizeObserver | null = null
|
|
176
|
+
|
|
177
|
+
watch(summaryEl, (el) => {
|
|
178
|
+
summarySize?.disconnect()
|
|
179
|
+
summarySize = null
|
|
180
|
+
summaryHeight.value = 0
|
|
181
|
+
if (!el) return
|
|
182
|
+
summarySize = new ResizeObserver(() => {
|
|
183
|
+
summaryHeight.value = el.offsetHeight
|
|
184
|
+
})
|
|
185
|
+
summarySize.observe(el)
|
|
186
|
+
summaryHeight.value = el.offsetHeight
|
|
187
|
+
})
|
|
188
|
+
|
|
112
189
|
/**
|
|
113
190
|
* Un clic hors de la barre referme le panneau ouvert. Les menus des listes
|
|
114
191
|
* deroulantes, les popovers et les modales sont teleportes sous <body>, hors
|
|
@@ -175,6 +252,7 @@ function watchHeader() {
|
|
|
175
252
|
onMounted(() => {
|
|
176
253
|
watchHeader()
|
|
177
254
|
watchAdvanced()
|
|
255
|
+
readFieldOrder()
|
|
178
256
|
document.addEventListener('pointerdown', onDocPointerDown)
|
|
179
257
|
})
|
|
180
258
|
|
|
@@ -183,6 +261,8 @@ onBeforeUnmount(() => {
|
|
|
183
261
|
headerSize = null
|
|
184
262
|
advancedSize?.disconnect()
|
|
185
263
|
advancedSize = null
|
|
264
|
+
summarySize?.disconnect()
|
|
265
|
+
summarySize = null
|
|
186
266
|
document.removeEventListener('pointerdown', onDocPointerDown)
|
|
187
267
|
})
|
|
188
268
|
</script>
|
|
@@ -193,7 +273,11 @@ onBeforeUnmount(() => {
|
|
|
193
273
|
ref="root"
|
|
194
274
|
class="rm-fbar"
|
|
195
275
|
:class="panel ? 'rm-fbar--open' : 'rm-fbar--closed'"
|
|
196
|
-
:style="{
|
|
276
|
+
:style="{
|
|
277
|
+
top: `${stickyTop}px`,
|
|
278
|
+
'--rm-fbar-advanced-w': `${advancedWidth}px`,
|
|
279
|
+
marginBottom: summaryHeight ? `calc(${summaryHeight}px + 2 * var(--space-8))` : undefined,
|
|
280
|
+
}"
|
|
197
281
|
>
|
|
198
282
|
<!-- La bande traverse le cadre ; la rangee, elle, se cale sur la colonne
|
|
199
283
|
de contenu et ne s'en ecarte que si son contenu ne tient pas : un rail
|
|
@@ -282,6 +366,15 @@ onBeforeUnmount(() => {
|
|
|
282
366
|
</div>
|
|
283
367
|
</div>
|
|
284
368
|
|
|
369
|
+
<!-- Panneau ferme, ce qui est filtre reste lisible : une pill par filtre
|
|
370
|
+
pose, qui flotte sous la barre, hors de sa bande, par-dessus le
|
|
371
|
+
contenu. Panneau ouvert, les champs le disent deja. -->
|
|
372
|
+
<div v-if="$slots.Filters && summary?.length && !panel" ref="summaryEl" class="rm-fbar__summary">
|
|
373
|
+
<div class="rm-fbar__summary-row">
|
|
374
|
+
<RmFilterSummary :items="orderedSummary" :lang="lang" @pick="openFilter" />
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
|
|
285
378
|
<div v-if="$slots.Filters" v-show="open" class="rm-fbar__panel">
|
|
286
379
|
<!-- Le panneau se presente comme une section : son titre, et les
|
|
287
380
|
commandes juste a cote, pres des filtres qu'elles vident. -->
|
|
@@ -340,5 +433,5 @@ onBeforeUnmount(() => {
|
|
|
340
433
|
</template>
|
|
341
434
|
|
|
342
435
|
<style scoped>
|
|
343
|
-
.rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
|
|
436
|
+
.rm-fbar{margin-inline:calc((min(var(--oip-content-max, 100%), 100%) - var(--oip-main-w, 100%))/2);position:sticky;width:var(--oip-main-w,100%);z-index:91;--rm-fbar-field-h:32px;backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);display:flex;flex-direction:column;font-family:var(--font-sans)}.rm-fbar__summary{display:flex;justify-content:center;left:0;padding-inline:32px;pointer-events:none;position:absolute;right:0;top:calc(100% + var(--space-8))}.rm-fbar__summary-row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__summary :deep(.rm-fsum__pill){pointer-events:auto}.rm-fbar__views{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__views:empty{display:none}.rm-fbar__band{display:flex;justify-content:center;padding-inline:32px}.rm-fbar__rail-row,.rm-fbar__row{max-width:100%;min-width:min(100%,var(--oip-content-max,100%));width:-moz-max-content;width:max-content}.rm-fbar__row{align-items:flex-start;display:flex;gap:var(--space-12);padding-block:8px}.rm-fbar--open .rm-fbar__band:not(:has(~.rm-fbar__band--rail)){border-bottom:1px solid var(--border-default)}.rm-fbar__toggle :deep(p),.rm-fbar__toggle :deep(span){font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-fbar__toggle{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);color:var(--text-primary);cursor:pointer;display:flex;flex:0 0 auto;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);gap:var(--space-6);height:var(--rm-fbar-field-h);justify-content:center;padding:0 14px}.rm-fbar__toggle:hover{background:var(--bg-surface-3)}.rm-fbar__toggle.is-active,.rm-fbar__toggle.is-active:hover{background:var(--color-primary);border-color:var(--color-primary);color:var(--color-text-inverse)}.rm-fbar__toggle.is-active .rm-fbar__badge{background:var(--color-text-inverse);color:var(--color-primary)}.rm-fbar__badge{align-items:center;background:var(--color-primary);border-radius:16px;color:var(--color-text-inverse);display:inline-flex;font-size:var(--font-11);font-weight:var(--weight-bold);justify-content:center;min-width:18px;padding:0 5px}.rm-fbar__view{align-items:center;display:flex;flex:0 0 auto}.rm-fbar__advanced{align-items:center;background:none;border:none;border-left:1px solid var(--border-default);color:var(--color-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);font-weight:var(--weight-medium);height:var(--rm-fbar-field-h);padding:0 0 0 var(--space-12);position:absolute;right:14px;text-decoration-line:underline;top:0;white-space:nowrap;z-index:2}.rm-fbar__advanced.is-active,.rm-fbar__advanced:hover{color:var(--color-primary-hover,var(--color-primary));text-decoration-thickness:2px}.rm-fbar__rail-row{display:flex;padding-bottom:var(--space-8)}.rm-fbar--open .rm-fbar__band--rail{border-bottom:1px solid var(--border-default)}.rm-fbar__rail{align-items:center;display:flex;flex:0 1 auto;min-width:0;overflow-x:auto;scrollbar-width:thin}.rm-fbar__rail:empty{display:none}.rm-fbar__search{align-items:center;display:flex;flex:1 1 auto;gap:var(--space-8);min-width:0;position:relative}.rm-fbar__search:empty{display:none}.rm-fbar__search :deep(.rm-search-tags__field){border-radius:var(--radius-pill);box-sizing:border-box;height:var(--rm-fbar-field-h);padding-block:0;padding-right:calc(var(--rm-fbar-advanced-w, 0px) + 14px + var(--space-12))}.rm-fbar__search :deep(.rm-search-tags__field.is-open),.rm-fbar__search :deep(.rm-search-tags__field.is-panel){border-radius:var(--radius-pill)}.rm-fbar__search :deep(.rm-search-tags__list),.rm-fbar__search :deep(.rm-search-tags__panel){border-radius:var(--radius-2xl);border-top:1px solid var(--border-default);box-shadow:var(--shadow-lg);margin-top:var(--space-6);padding:var(--space-6)}.rm-fbar__search :deep(.rm-search-tags__option){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.search-bar-wrapper){flex:1 1 auto;min-width:0}.rm-fbar__search :deep(.search-bar){background:var(--bg-surface);box-sizing:border-box;display:flex;height:var(--rm-fbar-field-h);width:100%}.rm-fbar__search :deep(.filters_input_search){border-radius:var(--radius-pill);box-sizing:border-box;height:auto;min-height:var(--rm-fbar-field-h);padding-right:calc(var(--rm-fbar-advanced-w, 0px) + var(--space-12));width:100%}.rm-fbar__search :deep(.research_tags:not(:has(*))){display:none}.rm-fbar__search :deep(.select_shortcut){box-sizing:border-box;font-size:var(--font-11);height:24px;padding-block:0}.rm-fbar__search :deep(.select_shortcut:hover){background:var(--bg-surface-3)!important;border-color:var(--border-default)!important;color:inherit!important}.rm-fbar__search :deep(.select_shortcut:hover svg){color:inherit!important}.rm-fbar__search :deep(.remove_search_section){border-left:none;border-radius:0 var(--radius-pill) var(--radius-pill) 0}.rm-fbar__search :deep(.remove_search_section:hover){background:transparent!important}.rm-fbar__search :deep(.remove_search_section:hover svg){color:var(--text-primary)!important}.rm-fbar__search :deep(.filters_input_search.no_bottom){border-bottom:1.5px solid var(--color-primary)!important;border-radius:var(--radius-pill)}.rm-fbar__search :deep(.search_suggestions){border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);left:0;padding:var(--space-6);right:0;top:calc(100% + 6px);width:auto}.rm-fbar__search :deep(.sugg_container>*){border-radius:var(--radius-lg)}.rm-fbar__search :deep(.sugg_container>.selected){background:color-mix(in srgb,var(--color-primary) 6%,transparent)!important}.rm-fbar__panel{--rm-filter-col:224px;--rm-fbar-panel-field-h:40px;align-items:end;display:grid;gap:var(--space-8);grid-template-columns:repeat(auto-fit,minmax(0,var(--rm-filter-col)));justify-content:start;padding-block:16px 20px;padding-inline:max(32px,(100% - var(--oip-content-max,100%))/2 + 32px)}.rm-fbar__panel--wide{align-items:stretch;display:flex;flex-direction:column;gap:var(--space-12)}.rm-fbar__filters{display:contents}.rm-fbar__filters :deep(.filter-chip),.rm-fbar__filters :deep(.filter-complex__trigger),.rm-fbar__filters :deep(.rm-csel__field),.rm-fbar__filters :deep(.rm-dsel__field),.rm-fbar__filters :deep(.rm-msel__field),.rm-fbar__filters :deep(.rm-number__box){border-radius:var(--radius-lg);height:var(--rm-fbar-panel-field-h);width:100%}.rm-fbar__filters :deep(.rm-csel),.rm-fbar__filters :deep(.rm-dsel),.rm-fbar__filters :deep(.rm-msel){align-items:stretch;width:100%}.rm-fbar__panel-head{align-items:baseline;display:flex;gap:var(--space-16);grid-column:1/-1;width:100%}.rm-fbar__customize{grid-column:1/-1}.rm-fbar__panel :deep(.filters_row_break){grid-column:1/-1}.rm-fbar__panel-title{font-family:var(--font-serif);font-size:var(--font-18);font-weight:700;margin:0}.rm-fbar__action{background:none;border:none;cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:var(--weight-medium);padding:0;text-decoration-line:underline}.rm-fbar__action--save{color:var(--color-primary)}.rm-fbar__action--clear{color:var(--color-danger)}.rm-fbar__action--clear:hover{opacity:.8;text-decoration-thickness:2px}.rm-fbar__action-sep{align-self:center;background:var(--border-default);height:14px;width:1px}
|
|
344
437
|
</style>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Resume des filtres poses, sous la barre de filtres.
|
|
3
|
+
|
|
4
|
+
Panneau ferme, la barre ne dit que le nombre de filtres actifs : on ne voit
|
|
5
|
+
plus ce qui est selectionne. Une pill par filtre pose, « Libelle : valeurs »,
|
|
6
|
+
tronquee quand elle est longue. Plusieurs valeurs : la liste complete sort au
|
|
7
|
+
survol et au focus (RmTooltip), une par ligne. Un clic emet `pick` avec la
|
|
8
|
+
cle du filtre : RmFilterBar ouvre alors son panneau sur ce filtre.
|
|
9
|
+
|
|
10
|
+
Le composant ne connait pas les filtres de la page : c'est elle qui decrit ce
|
|
11
|
+
qui est pose (libelles traduits, valeurs lisibles, plage d'annees deja
|
|
12
|
+
resumee), parce qu'elle seule sait lire son etat.
|
|
13
|
+
-->
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { computed } from 'vue'
|
|
16
|
+
|
|
17
|
+
export interface RmFilterSummaryItem {
|
|
18
|
+
/** Cle du filtre, la meme que l'attribut `data-rm-filter` pose sur le champ du panneau. */
|
|
19
|
+
key: string
|
|
20
|
+
/** Libelle du filtre, celui du champ. */
|
|
21
|
+
label: string
|
|
22
|
+
/** Valeurs lisibles, une par entree. */
|
|
23
|
+
values: string[]
|
|
24
|
+
/** Resume deja forme (« 2020 - 2026 ») ; a defaut, les valeurs jointes. */
|
|
25
|
+
text?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<{
|
|
29
|
+
items: RmFilterSummaryItem[]
|
|
30
|
+
lang?: 'fr' | 'en'
|
|
31
|
+
}>(), {
|
|
32
|
+
lang: 'fr',
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const emit = defineEmits<{ pick: [key: string] }>()
|
|
36
|
+
|
|
37
|
+
const LABELS = {
|
|
38
|
+
fr: { region: 'Filtres posés', edit: 'Modifier le filtre', sep: ' : ' },
|
|
39
|
+
en: { region: 'Active filters', edit: 'Edit filter', sep: ' : ' },
|
|
40
|
+
} as const
|
|
41
|
+
|
|
42
|
+
const t = computed(() => LABELS[props.lang] ?? LABELS.fr)
|
|
43
|
+
|
|
44
|
+
const pills = computed(() =>
|
|
45
|
+
props.items
|
|
46
|
+
.filter((item) => item.values.length > 0)
|
|
47
|
+
.map((item) => ({ ...item, summary: item.text ?? item.values.join(', ') })),
|
|
48
|
+
)
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<ul v-if="pills.length" class="rm-fsum" :aria-label="t.region">
|
|
53
|
+
<li v-for="pill in pills" :key="pill.key" class="rm-fsum__item">
|
|
54
|
+
<RmTooltip
|
|
55
|
+
dir="bottom"
|
|
56
|
+
full
|
|
57
|
+
max-width="360px"
|
|
58
|
+
:disabled="pill.values.length < 2"
|
|
59
|
+
>
|
|
60
|
+
<button
|
|
61
|
+
type="button"
|
|
62
|
+
class="rm-fsum__pill"
|
|
63
|
+
:aria-label="`${t.edit} ${pill.label}${t.sep}${pill.values.join(', ')}`"
|
|
64
|
+
@click="emit('pick', pill.key)"
|
|
65
|
+
>
|
|
66
|
+
<span class="rm-fsum__label">{{ pill.label }}{{ t.sep }}</span>
|
|
67
|
+
<span class="rm-fsum__value">{{ pill.summary }}</span>
|
|
68
|
+
</button>
|
|
69
|
+
<template #content>
|
|
70
|
+
<ul class="rm-fsum__list">
|
|
71
|
+
<li v-for="value in pill.values" :key="value">{{ value }}</li>
|
|
72
|
+
</ul>
|
|
73
|
+
</template>
|
|
74
|
+
</RmTooltip>
|
|
75
|
+
</li>
|
|
76
|
+
</ul>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<style scoped>
|
|
80
|
+
.rm-fsum{display:flex;flex-wrap:wrap;gap:var(--space-6);list-style:none;margin:0;padding:0}.rm-fsum__item{display:flex;min-width:0}.rm-fsum__pill{--rm-fsum-accent:var(--rm-shell-accent,var(--color-primary));align-items:center;background:color-mix(in srgb,var(--rm-fsum-accent) 16%,var(--rm-shell-surface,var(--bg-surface)));border:1px solid color-mix(in srgb,var(--rm-fsum-accent) 40%,transparent);border-radius:var(--radius-pill);box-shadow:var(--shadow-sm);color:var(--text-primary);cursor:pointer;display:inline-flex;font-family:inherit;font-size:var(--font-13);height:26px;max-width:340px;padding:0 var(--space-12);white-space:nowrap}.rm-fsum__pill:hover{background:color-mix(in srgb,var(--rm-fsum-accent) 26%,var(--rm-shell-surface,var(--bg-surface)));border-color:var(--rm-fsum-accent)}.rm-fsum__pill:focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.rm-fsum__label{color:var(--text-secondary);flex:0 0 auto;white-space:pre}.rm-fsum__value{font-weight:var(--weight-medium);min-width:0;overflow:hidden;text-overflow:ellipsis}.rm-fsum__list{list-style:none;margin:0;padding:0;white-space:normal}.rm-fsum__list li+li{margin-top:var(--space-2,2px)}
|
|
81
|
+
</style>
|