@ouestfrance/sipa-bms-ui 8.49.0 → 8.51.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/table/BmsTable.vue.d.ts +1 -0
- package/dist/composables/search.composable.d.ts +1 -1
- package/dist/sipa-bms-ui.css +22 -22
- package/dist/sipa-bms-ui.es.js +20 -12
- package/dist/sipa-bms-ui.es.js.map +1 -1
- package/dist/sipa-bms-ui.umd.js +19 -11
- package/dist/sipa-bms-ui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button/BmsSwitchIconButton.stories.js +24 -0
- package/src/components/button/BmsSwitchIconButton.vue +9 -5
- package/src/components/table/BmsTable.vue +3 -2
- package/src/composables/search.composable.spec.ts +69 -1
- package/src/composables/search.composable.ts +11 -4
|
@@ -18,6 +18,7 @@ interface UiTableProps {
|
|
|
18
18
|
selectMode?: SelectMode.DEFAULT | SelectMode.SINGLE;
|
|
19
19
|
customSearch?: (item: unknown, searchValue: string) => boolean;
|
|
20
20
|
draggable?: boolean;
|
|
21
|
+
searchDefault?: string;
|
|
21
22
|
}
|
|
22
23
|
type __VLS_Props = UiTableProps;
|
|
23
24
|
declare const __VLS_defaults: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Filter, SavedFilter } from '../models';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
|
-
export declare const useSearch: (persistent?: boolean | Ref<boolean>, defaultFilters?: Filter[] | Ref<Filter[]>, defaultFiltersOpened?: boolean | Ref<boolean>) => {
|
|
3
|
+
export declare const useSearch: (persistent?: boolean | Ref<boolean>, defaultFilters?: Filter[] | Ref<Filter[]>, defaultFiltersOpened?: boolean | Ref<boolean>, defaultSearch?: string | undefined | Ref<string | undefined>) => {
|
|
4
4
|
search: Ref<string, string>;
|
|
5
5
|
reflect: Ref<boolean, boolean>;
|
|
6
6
|
filters: Ref<{
|
package/dist/sipa-bms-ui.css
CHANGED
|
@@ -427,15 +427,15 @@
|
|
|
427
427
|
left: 50%;
|
|
428
428
|
transform: translateX(-50%);
|
|
429
429
|
width: 1em;
|
|
430
|
-
}.bms-switch-icon-button[data-v-
|
|
430
|
+
}.bms-switch-icon-button[data-v-72b8f219] {
|
|
431
431
|
position: relative;
|
|
432
432
|
display: inline-flex;
|
|
433
433
|
border-radius: var(--bms-border-radius, 0.25em);
|
|
434
434
|
}
|
|
435
|
-
.bms-switch-icon-button[data-v-
|
|
435
|
+
.bms-switch-icon-button[data-v-72b8f219]:hover:not(.bms-switch-icon-button--disabled) {
|
|
436
436
|
background-color: light-dark(var(--bms-main-25), var(--bms-grey-140));
|
|
437
437
|
}
|
|
438
|
-
.bms-switch-icon-button__button[data-v-
|
|
438
|
+
.bms-switch-icon-button__button[data-v-72b8f219] {
|
|
439
439
|
display: flex;
|
|
440
440
|
align-items: center;
|
|
441
441
|
gap: 0.25em;
|
|
@@ -446,26 +446,26 @@
|
|
|
446
446
|
border-radius: inherit;
|
|
447
447
|
transition: background-color 0.2s;
|
|
448
448
|
}
|
|
449
|
-
.bms-switch-icon-button__button[data-v-
|
|
449
|
+
.bms-switch-icon-button__button[data-v-72b8f219]:hover:not(.bms-switch-icon-button__button--disabled) {
|
|
450
450
|
background-color: light-dark(var(--bms-main-25), var(--bms-grey-140));
|
|
451
451
|
}
|
|
452
|
-
.bms-switch-icon-button__button--disabled[data-v-
|
|
452
|
+
.bms-switch-icon-button__button--disabled[data-v-72b8f219] {
|
|
453
453
|
cursor: default;
|
|
454
454
|
}
|
|
455
|
-
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__icon-container[data-v-
|
|
455
|
+
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__icon-container[data-v-72b8f219] {
|
|
456
456
|
background-color: var(--bms-field-disabled-background);
|
|
457
457
|
}
|
|
458
|
-
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__icon[data-v-
|
|
459
|
-
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__chevron[data-v-
|
|
458
|
+
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__icon[data-v-72b8f219],
|
|
459
|
+
.bms-switch-icon-button__button--disabled .bms-switch-icon-button__button__chevron[data-v-72b8f219] {
|
|
460
460
|
color: var(--bms-field-disabled-text-color);
|
|
461
461
|
}
|
|
462
|
-
.bms-switch-icon-button__button--outlined .bms-switch-icon-button__button__icon-container[data-v-
|
|
462
|
+
.bms-switch-icon-button__button--outlined .bms-switch-icon-button__button__icon-container[data-v-72b8f219] {
|
|
463
463
|
background-color: inherit;
|
|
464
464
|
}
|
|
465
|
-
.bms-switch-icon-button__button--outlined .bms-switch-icon-button__button__icon[data-v-
|
|
465
|
+
.bms-switch-icon-button__button--outlined .bms-switch-icon-button__button__icon[data-v-72b8f219] {
|
|
466
466
|
color: var(--bms-main-100);
|
|
467
467
|
}
|
|
468
|
-
.bms-switch-icon-button__button__icon-container[data-v-
|
|
468
|
+
.bms-switch-icon-button__button__icon-container[data-v-72b8f219] {
|
|
469
469
|
display: flex;
|
|
470
470
|
align-items: center;
|
|
471
471
|
justify-content: center;
|
|
@@ -475,24 +475,24 @@
|
|
|
475
475
|
transition: background-color 0.2s;
|
|
476
476
|
background-color: var(--bms-main-100);
|
|
477
477
|
}
|
|
478
|
-
.bms-switch-icon-button__button:not(.bms-switch-icon-button__button--small) .bms-switch-icon-button__button__icon-container[data-v-
|
|
478
|
+
.bms-switch-icon-button__button:not(.bms-switch-icon-button__button--small) .bms-switch-icon-button__button__icon-container[data-v-72b8f219] {
|
|
479
479
|
width: 2.25em;
|
|
480
480
|
height: 2.25em;
|
|
481
481
|
}
|
|
482
|
-
.bms-switch-icon-button__button__icon[data-v-
|
|
482
|
+
.bms-switch-icon-button__button__icon[data-v-72b8f219] {
|
|
483
483
|
display: flex;
|
|
484
484
|
align-items: center;
|
|
485
485
|
justify-content: center;
|
|
486
486
|
color: var(--bms-white);
|
|
487
487
|
}
|
|
488
|
-
.bms-switch-icon-button__button__chevron[data-v-
|
|
488
|
+
.bms-switch-icon-button__button__chevron[data-v-72b8f219] {
|
|
489
489
|
display: flex;
|
|
490
490
|
align-items: center;
|
|
491
491
|
color: var(--bms-main-100);
|
|
492
492
|
flex-shrink: 0;
|
|
493
493
|
transition: color 0.2s;
|
|
494
494
|
}
|
|
495
|
-
.bms-switch-icon-button__menu[data-v-
|
|
495
|
+
.bms-switch-icon-button__menu[data-v-72b8f219] {
|
|
496
496
|
position: absolute;
|
|
497
497
|
background-color: var(--bms-white);
|
|
498
498
|
border: 1px solid var(--bms-border-color);
|
|
@@ -506,7 +506,7 @@
|
|
|
506
506
|
box-shadow: var(--bms-box-shadow-elevated);
|
|
507
507
|
width: max-content;
|
|
508
508
|
}
|
|
509
|
-
.bms-switch-icon-button__menu__item[data-v-
|
|
509
|
+
.bms-switch-icon-button__menu__item[data-v-72b8f219] {
|
|
510
510
|
min-height: 2.5em;
|
|
511
511
|
padding: 0.5em 1em;
|
|
512
512
|
display: flex;
|
|
@@ -517,27 +517,27 @@
|
|
|
517
517
|
width: 100%;
|
|
518
518
|
box-sizing: border-box;
|
|
519
519
|
}
|
|
520
|
-
.bms-switch-icon-button__menu__item[data-v-
|
|
520
|
+
.bms-switch-icon-button__menu__item[data-v-72b8f219]:hover {
|
|
521
521
|
background-color: light-dark(var(--bms-grey-10), var(--bms-grey-100));
|
|
522
522
|
}
|
|
523
|
-
.bms-switch-icon-button__menu__item__check[data-v-
|
|
523
|
+
.bms-switch-icon-button__menu__item__check[data-v-72b8f219] {
|
|
524
524
|
flex-shrink: 0;
|
|
525
525
|
color: var(--bms-font-color);
|
|
526
526
|
width: 1em;
|
|
527
527
|
height: 1em;
|
|
528
528
|
}
|
|
529
|
-
.bms-switch-icon-button__menu__item__check-placeholder[data-v-
|
|
529
|
+
.bms-switch-icon-button__menu__item__check-placeholder[data-v-72b8f219] {
|
|
530
530
|
width: 1em;
|
|
531
531
|
height: 1em;
|
|
532
532
|
flex-shrink: 0;
|
|
533
533
|
}
|
|
534
|
-
.bms-switch-icon-button__menu__item__icon[data-v-
|
|
534
|
+
.bms-switch-icon-button__menu__item__icon[data-v-72b8f219] {
|
|
535
535
|
flex-shrink: 0;
|
|
536
536
|
color: var(--bms-font-color);
|
|
537
537
|
width: 1em;
|
|
538
538
|
height: 1em;
|
|
539
539
|
}
|
|
540
|
-
.bms-switch-icon-button__menu__item__label[data-v-
|
|
540
|
+
.bms-switch-icon-button__menu__item__label[data-v-72b8f219] {
|
|
541
541
|
white-space: nowrap;
|
|
542
542
|
font-size: 0.875em;
|
|
543
543
|
color: var(--bms-font-color);
|
|
@@ -3140,7 +3140,7 @@ nav .additional[data-v-43dce565] {
|
|
|
3140
3140
|
padding-right: 32px;
|
|
3141
3141
|
}.table-search[data-v-c674a0d1] {
|
|
3142
3142
|
width: 260px;
|
|
3143
|
-
}.table-search[data-v-
|
|
3143
|
+
}.table-search[data-v-e5a8eec2] {
|
|
3144
3144
|
width: 260px;
|
|
3145
3145
|
}.cocarde[data-v-f48ea977] {
|
|
3146
3146
|
display: flex;
|
package/dist/sipa-bms-ui.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, Teleport, Transition, TransitionGroup, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, hasInjectionContext, inject, isRef, isVNode, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toValue, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelCheckbox, vModelRadio, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
1
|
+
import { Fragment, Teleport, Transition, TransitionGroup, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, h, hasInjectionContext, inject, isRef, isVNode, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toValue, unref, useAttrs, useCssVars, useId, useModel, useSlots, useTemplateRef, vModelCheckbox, vModelRadio, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
2
2
|
import { useRoute, useRouter } from "vue-router";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __create = Object.create;
|
|
@@ -55115,13 +55115,17 @@ var BmsSwitchIconButton_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
55115
55115
|
const props = __props;
|
|
55116
55116
|
const emits = __emit;
|
|
55117
55117
|
const isOpen = ref(false);
|
|
55118
|
+
const openUpward = ref(true);
|
|
55118
55119
|
const anchorElement = useTemplateRef("anchorElement");
|
|
55119
55120
|
const menuElement = useTemplateRef("menuElement");
|
|
55120
|
-
const { height } = useElementBounding(anchorElement);
|
|
55121
|
-
const menuStyle = computed(() =>
|
|
55121
|
+
const { height, top, bottom } = useElementBounding(anchorElement);
|
|
55122
|
+
const menuStyle = computed(() => openUpward.value ? { bottom: `${height.value}px` } : { top: `${height.value}px` });
|
|
55122
55123
|
const selectedOption = computed(() => props.options.find((option) => option.value === props.modelValue));
|
|
55123
55124
|
const toggleMenu = () => {
|
|
55124
|
-
if (!props.disabled)
|
|
55125
|
+
if (!props.disabled) {
|
|
55126
|
+
if (!isOpen.value) openUpward.value = top.value > window.innerHeight - bottom.value;
|
|
55127
|
+
isOpen.value = !isOpen.value;
|
|
55128
|
+
}
|
|
55125
55129
|
};
|
|
55126
55130
|
const selectOption = (value) => {
|
|
55127
55131
|
emits("update:modelValue", value);
|
|
@@ -55151,7 +55155,7 @@ var BmsSwitchIconButton_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
55151
55155
|
key: 0,
|
|
55152
55156
|
size: 16,
|
|
55153
55157
|
class: "bms-switch-icon-button__button__icon"
|
|
55154
|
-
})) : createCommentVNode("", true)]),
|
|
55158
|
+
})) : createCommentVNode("", true)]), openUpward.value !== isOpen.value ? (openBlock(), createBlock(unref(ChevronUp), {
|
|
55155
55159
|
key: 0,
|
|
55156
55160
|
size: 10,
|
|
55157
55161
|
class: "bms-switch-icon-button__button__chevron"
|
|
@@ -55185,7 +55189,7 @@ var BmsSwitchIconButton_default = /*#__PURE__*/ _plugin_vue_export_helper_defaul
|
|
|
55185
55189
|
}), 128))], 4), [[vShow, isOpen.value]])], 2);
|
|
55186
55190
|
};
|
|
55187
55191
|
}
|
|
55188
|
-
}), [["__scopeId", "data-v-
|
|
55192
|
+
}), [["__scopeId", "data-v-72b8f219"]]);
|
|
55189
55193
|
//#endregion
|
|
55190
55194
|
//#region src/components/feedback/BmsAlert.vue?vue&type=script&setup=true&lang.ts
|
|
55191
55195
|
var _hoisted_1$63 = { class: "info-line" };
|
|
@@ -110268,11 +110272,11 @@ var numberIsBetween = (itemValue, filter) => {
|
|
|
110268
110272
|
//#region src/composables/search.composable.ts
|
|
110269
110273
|
var FILTER_KEY = "bms-ui-filter";
|
|
110270
110274
|
var FILTER_SEARCH_KEY = `${FILTER_KEY}-search`;
|
|
110271
|
-
var useSearch = (persistent = true, defaultFilters = [], defaultFiltersOpened = false) => {
|
|
110275
|
+
var useSearch = (persistent = true, defaultFilters = [], defaultFiltersOpened = false, defaultSearch = "") => {
|
|
110272
110276
|
const route = useRoute();
|
|
110273
110277
|
const userPref = useUserPref();
|
|
110274
110278
|
const reflect = ref(unref(persistent));
|
|
110275
|
-
const search = ref("");
|
|
110279
|
+
const search = ref(unref(defaultSearch) ?? "");
|
|
110276
110280
|
const filters = ref(unref(defaultFilters));
|
|
110277
110281
|
const isFilterVisible = ref(unref(defaultFiltersOpened));
|
|
110278
110282
|
const isMounting = ref(true);
|
|
@@ -110348,6 +110352,9 @@ var useSearch = (persistent = true, defaultFilters = [], defaultFiltersOpened =
|
|
|
110348
110352
|
userPref.saveUserPref(savedFilterName, filter.value, route.path);
|
|
110349
110353
|
});
|
|
110350
110354
|
};
|
|
110355
|
+
watch(() => unref(defaultSearch), (newDefault) => {
|
|
110356
|
+
search.value = newDefault ?? "";
|
|
110357
|
+
});
|
|
110351
110358
|
watch(search, () => {
|
|
110352
110359
|
if (reflect.value) {
|
|
110353
110360
|
reflectSearchToPath(search.value, FILTER_SEARCH_KEY);
|
|
@@ -110364,7 +110371,7 @@ var useSearch = (persistent = true, defaultFilters = [], defaultFiltersOpened =
|
|
|
110364
110371
|
if (reflect.value) {
|
|
110365
110372
|
const searchParams = new URLSearchParams(window.location.search);
|
|
110366
110373
|
if (searchParams.get(FILTER_SEARCH_KEY)) search.value = searchParams.get(FILTER_SEARCH_KEY) || "";
|
|
110367
|
-
if (!
|
|
110374
|
+
else if (!hasFiltersInUrl()) search.value = userPref.getUserPref(FILTER_SEARCH_KEY, route.path) || unref(defaultSearch) || "";
|
|
110368
110375
|
}
|
|
110369
110376
|
};
|
|
110370
110377
|
const resetAllFilters = () => {
|
|
@@ -114538,7 +114545,8 @@ var BmsTable_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
114538
114545
|
},
|
|
114539
114546
|
selectMode: { default: SelectMode.DEFAULT },
|
|
114540
114547
|
customSearch: {},
|
|
114541
|
-
draggable: { type: Boolean }
|
|
114548
|
+
draggable: { type: Boolean },
|
|
114549
|
+
searchDefault: {}
|
|
114542
114550
|
}, {
|
|
114543
114551
|
"selectedItems": {
|
|
114544
114552
|
required: false,
|
|
@@ -114559,7 +114567,7 @@ var BmsTable_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
114559
114567
|
const props = __props;
|
|
114560
114568
|
const { items, size, pagination, currentPage, paginationsOptions, currentItems, totalPages, goToPage, isMounting: isPaginationMounting } = usePagination(props.persistent, props.size, props.pagination);
|
|
114561
114569
|
const { sortItems, changeSort, sort, isMounting: isSortMounting } = useSort(props.persistent, props.headers, props.defaultSort);
|
|
114562
|
-
const { search, reflect, filters, isFilterVisible, numberOfActiveFilters, isMounting: isSearchMounting, toggleFilters, filterItems, isSavedFilterActive, resetFilters, selectSavedFilter, resetAllFilters, updateFiltersFromProps } = useSearch(props.persistent, props.filters, props.defaultFiltersOpened);
|
|
114570
|
+
const { search, reflect, filters, isFilterVisible, numberOfActiveFilters, isMounting: isSearchMounting, toggleFilters, filterItems, isSavedFilterActive, resetFilters, selectSavedFilter, resetAllFilters, updateFiltersFromProps } = useSearch(props.persistent, props.filters, props.defaultFiltersOpened, toRef(props, "searchDefault"));
|
|
114563
114571
|
const emits = __emit;
|
|
114564
114572
|
const selectedItems = useModel(__props, "selectedItems");
|
|
114565
114573
|
const emptyText = computed(() => ({
|
|
@@ -114761,7 +114769,7 @@ var BmsTable_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
|
|
|
114761
114769
|
]);
|
|
114762
114770
|
};
|
|
114763
114771
|
}
|
|
114764
|
-
}), [["__scopeId", "data-v-
|
|
114772
|
+
}), [["__scopeId", "data-v-e5a8eec2"]]);
|
|
114765
114773
|
//#endregion
|
|
114766
114774
|
//#region src/components/utils/BmsCocarde.vue
|
|
114767
114775
|
var BmsCocarde_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|